
This was resulting in a whole lot of rebuilding whenever a new IDL interface was added. Instead, just directly include the prototype in every C++ file which needs it. While we only really need a forward declaration in each cpp file; including the full prototype header (which itself only includes LibJS/Object.h, which is already transitively brought in by PlatformObject) - it seems like a small price to pay compared to what feels like a full rebuild of LibWeb whenever a new IDL file is added. Given all of these includes are only needed for the ::initialize method, there is probably a smart way of avoiding this problem altogether. I've considered both using some macro trickery or generating these functions somehow instead.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/CSSRulePrototype.h>
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
CSSRule::CSSRule(JS::Realm& realm)
|
|
: PlatformObject(realm)
|
|
{
|
|
}
|
|
|
|
void CSSRule::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_parent_style_sheet);
|
|
visitor.visit(m_parent_rule);
|
|
}
|
|
|
|
// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
|
|
String CSSRule::css_text() const
|
|
{
|
|
// The cssText attribute must return a serialization of the CSS rule.
|
|
return serialized();
|
|
}
|
|
|
|
// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
|
|
void CSSRule::set_css_text(StringView)
|
|
{
|
|
// On setting the cssText attribute must do nothing.
|
|
}
|
|
|
|
void CSSRule::set_parent_rule(CSSRule* parent_rule)
|
|
{
|
|
m_parent_rule = parent_rule;
|
|
}
|
|
|
|
void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
|
|
{
|
|
m_parent_style_sheet = parent_style_sheet;
|
|
}
|
|
|
|
}
|