Serenity Operating System
1/*
2 * Copyright (c) 2021, the SerenityOS developers.
3 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
4 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 */
8
9#include <LibWeb/CSS/CSSRule.h>
10#include <LibWeb/CSS/CSSStyleSheet.h>
11
12namespace Web::CSS {
13
14CSSRule::CSSRule(JS::Realm& realm)
15 : PlatformObject(realm)
16{
17}
18
19void CSSRule::visit_edges(Cell::Visitor& visitor)
20{
21 Base::visit_edges(visitor);
22 visitor.visit(m_parent_style_sheet.ptr());
23 visitor.visit(m_parent_rule.ptr());
24}
25
26// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
27DeprecatedString CSSRule::css_text() const
28{
29 // The cssText attribute must return a serialization of the CSS rule.
30 return serialized();
31}
32
33// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
34void CSSRule::set_css_text(StringView)
35{
36 // On setting the cssText attribute must do nothing.
37}
38
39void CSSRule::set_parent_rule(CSSRule* parent_rule)
40{
41 m_parent_rule = parent_rule;
42}
43
44void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
45{
46 m_parent_style_sheet = parent_style_sheet;
47}
48
49}