2021-02-21 08:45:26 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
2022-04-22 15:56:22 -03:00
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
2022-08-07 10:46:44 -03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2021-02-21 08:45:26 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-21 08:45:26 -03:00
|
|
|
*/
|
|
|
|
|
|
2024-04-26 21:09:58 -03:00
|
|
|
#include <LibWeb/Bindings/CSSRulePrototype.h>
|
2021-02-21 08:45:26 -03:00
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
2022-04-22 15:56:22 -03:00
|
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
2021-02-21 08:45:26 -03:00
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2022-09-24 19:34:04 -03:00
|
|
|
CSSRule::CSSRule(JS::Realm& realm)
|
|
|
|
|
: PlatformObject(realm)
|
2022-08-07 10:46:44 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSSRule::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
2023-11-19 00:18:00 -03:00
|
|
|
visitor.visit(m_parent_style_sheet);
|
|
|
|
|
visitor.visit(m_parent_rule);
|
2022-08-07 10:46:44 -03:00
|
|
|
}
|
|
|
|
|
|
2021-10-15 15:38:39 -03:00
|
|
|
// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
|
2023-11-20 07:16:39 -03:00
|
|
|
String CSSRule::css_text() const
|
2021-10-01 14:57:45 -03:00
|
|
|
{
|
|
|
|
|
// The cssText attribute must return a serialization of the CSS rule.
|
|
|
|
|
return serialized();
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-15 15:38:39 -03:00
|
|
|
// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
|
2021-10-01 14:57:45 -03:00
|
|
|
void CSSRule::set_css_text(StringView)
|
|
|
|
|
{
|
|
|
|
|
// On setting the cssText attribute must do nothing.
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-22 15:56:22 -03:00
|
|
|
void CSSRule::set_parent_rule(CSSRule* parent_rule)
|
|
|
|
|
{
|
2022-07-03 19:42:44 -03:00
|
|
|
m_parent_rule = parent_rule;
|
2022-04-22 15:56:22 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
|
|
|
|
|
{
|
2022-07-03 19:42:44 -03:00
|
|
|
m_parent_style_sheet = parent_style_sheet;
|
2022-04-22 15:56:22 -03:00
|
|
|
}
|
|
|
|
|
|
2021-02-21 08:45:26 -03:00
|
|
|
}
|