CSSRule.cpp 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2021, the SerenityOS developers.
  3. * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/CSS/CSSRule.h>
  8. #include <LibWeb/CSS/CSSStyleSheet.h>
  9. namespace Web::CSS {
  10. // https://www.w3.org/TR/cssom/#dom-cssrule-csstext
  11. String CSSRule::css_text() const
  12. {
  13. // The cssText attribute must return a serialization of the CSS rule.
  14. return serialized();
  15. }
  16. // https://www.w3.org/TR/cssom/#dom-cssrule-csstext
  17. void CSSRule::set_css_text(StringView)
  18. {
  19. // On setting the cssText attribute must do nothing.
  20. }
  21. void CSSRule::set_parent_rule(CSSRule* parent_rule)
  22. {
  23. if (parent_rule)
  24. m_parent_rule = parent_rule->make_weak_ptr();
  25. else
  26. m_parent_rule = nullptr;
  27. }
  28. void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
  29. {
  30. if (parent_style_sheet)
  31. m_parent_style_sheet = parent_style_sheet->make_weak_ptr();
  32. else
  33. m_parent_style_sheet = nullptr;
  34. }
  35. }