CSSRule.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #include <LibWeb/CSS/CSSRule.h>
  9. #include <LibWeb/CSS/CSSStyleSheet.h>
  10. namespace Web::CSS {
  11. CSSRule::CSSRule(JS::Realm& realm)
  12. : PlatformObject(realm)
  13. {
  14. }
  15. void CSSRule::visit_edges(Cell::Visitor& visitor)
  16. {
  17. Base::visit_edges(visitor);
  18. visitor.visit(m_parent_style_sheet.ptr());
  19. visitor.visit(m_parent_rule.ptr());
  20. }
  21. // https://www.w3.org/TR/cssom/#dom-cssrule-csstext
  22. DeprecatedString CSSRule::css_text() const
  23. {
  24. // The cssText attribute must return a serialization of the CSS rule.
  25. return serialized();
  26. }
  27. // https://www.w3.org/TR/cssom/#dom-cssrule-csstext
  28. void CSSRule::set_css_text(StringView)
  29. {
  30. // On setting the cssText attribute must do nothing.
  31. }
  32. void CSSRule::set_parent_rule(CSSRule* parent_rule)
  33. {
  34. m_parent_rule = parent_rule;
  35. }
  36. void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
  37. {
  38. m_parent_style_sheet = parent_style_sheet;
  39. }
  40. }