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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
2022-04-22 15:56:22 -03:00
|
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
2022-08-28 08:42:07 -03:00
|
|
|
#include <LibWeb/HTML/Window.h>
|
2021-02-21 08:45:26 -03:00
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2022-08-28 08:42:07 -03:00
|
|
|
CSSRule::CSSRule(HTML::Window& window_object)
|
2022-09-03 13:43:24 -03:00
|
|
|
: PlatformObject(window_object.cached_web_prototype("CSSRule"))
|
2022-08-07 10:46:44 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSSRule::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_parent_style_sheet.ptr());
|
|
|
|
|
visitor.visit(m_parent_rule.ptr());
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
String CSSRule::css_text() const
|
|
|
|
|
{
|
|
|
|
|
// 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
|
|
|
}
|