CustomIdentStyleValue.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/FlyString.h>
  8. #include <LibWeb/CSS/StyleValue.h>
  9. namespace Web::CSS {
  10. // https://www.w3.org/TR/css-values-4/#custom-idents
  11. class CustomIdentStyleValue final : public StyleValueWithDefaultOperators<CustomIdentStyleValue> {
  12. public:
  13. static ValueComparingNonnullRefPtr<CustomIdentStyleValue> create(FlyString custom_ident)
  14. {
  15. return adopt_ref(*new (nothrow) CustomIdentStyleValue(move(custom_ident)));
  16. }
  17. virtual ~CustomIdentStyleValue() override = default;
  18. FlyString const& custom_ident() const { return m_custom_ident; }
  19. virtual String to_string() const override { return m_custom_ident.to_string(); }
  20. bool properties_equal(CustomIdentStyleValue const& other) const { return m_custom_ident == other.m_custom_ident; }
  21. private:
  22. explicit CustomIdentStyleValue(FlyString custom_ident)
  23. : StyleValueWithDefaultOperators(Type::CustomIdent)
  24. , m_custom_ident(move(custom_ident))
  25. {
  26. }
  27. FlyString m_custom_ident;
  28. };
  29. }