CSSRule.cpp 1.1 KB

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