CSSSupportsRule.cpp 736 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/CSS/CSSSupportsRule.h>
  7. #include <LibWeb/CSS/Parser/Parser.h>
  8. namespace Web::CSS {
  9. CSSSupportsRule::CSSSupportsRule(NonnullRefPtr<Supports>&& supports, NonnullRefPtrVector<CSSRule>&& rules)
  10. : CSSConditionRule(move(rules))
  11. , m_supports(move(supports))
  12. {
  13. }
  14. CSSSupportsRule::~CSSSupportsRule()
  15. {
  16. }
  17. String CSSSupportsRule::condition_text() const
  18. {
  19. // FIXME: Serializing supports rules!
  20. return "<supports-condition>";
  21. }
  22. void CSSSupportsRule::set_condition_text(String text)
  23. {
  24. if (auto new_supports = parse_css_supports({}, text))
  25. m_supports = new_supports.release_nonnull();
  26. }
  27. }