Files
ladybird/Libraries/LibWeb/CSS/StyleSheet.cpp
Shannon Booth fd44da6829 LibWeb/Bindings: Emit one bindings header and cpp per IDL
Previously, the LibWeb bindings generator would output multiple per
interface files like Prototype/Constructor/Namespace/GlobalMixin
depending on the contents of that IDL file.

This complicates the build system as it means that it does not know
what files will be generated without knowledge of the contents of that
IDL file.

Instead, for each IDL file only generate a single Bindings/<IDLFile>.h
and Bindings/<IDLFile>.cpp.
2026-04-21 07:36:13 +02:00

58 lines
1.3 KiB
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/StyleSheet.h>
#include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/CSS/StyleSheet.h>
#include <LibWeb/DOM/Element.h>
namespace Web::CSS {
StyleSheet::StyleSheet(JS::Realm& realm, MediaList& media)
: PlatformObject(realm)
, m_media(media)
{
m_media->set_associated_style_sheet(*this);
}
void StyleSheet::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_owner_node);
visitor.visit(m_parent_style_sheet);
visitor.visit(m_media);
}
Optional<String> StyleSheet::href() const
{
if (m_location.has_value())
return m_location->to_string();
return {};
}
void StyleSheet::set_owner_node(DOM::Element* element)
{
m_owner_node = element;
}
void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
{
m_parent_style_sheet = parent;
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-title
Optional<String> StyleSheet::title_for_bindings() const
{
// The title attribute must return the title or null if title is the empty string.
if (m_title.is_empty())
return {};
return m_title;
}
}