UnresolvedStyleValue.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
  4. * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
  5. * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
  6. *
  7. * SPDX-License-Identifier: BSD-2-Clause
  8. */
  9. #pragma once
  10. #include <AK/Vector.h>
  11. #include <LibWeb/CSS/Parser/ComponentValue.h>
  12. #include <LibWeb/CSS/StyleValue.h>
  13. namespace Web::CSS {
  14. class UnresolvedStyleValue final : public StyleValue {
  15. public:
  16. static ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
  17. {
  18. return adopt_ref(*new UnresolvedStyleValue(move(values), contains_var_or_attr));
  19. }
  20. virtual ~UnresolvedStyleValue() override = default;
  21. virtual ErrorOr<String> to_string() const override;
  22. Vector<Parser::ComponentValue> const& values() const { return m_values; }
  23. bool contains_var_or_attr() const { return m_contains_var_or_attr; }
  24. virtual bool equals(StyleValue const& other) const override;
  25. private:
  26. UnresolvedStyleValue(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
  27. : StyleValue(Type::Unresolved)
  28. , m_values(move(values))
  29. , m_contains_var_or_attr(contains_var_or_attr)
  30. {
  31. }
  32. Vector<Parser::ComponentValue> m_values;
  33. bool m_contains_var_or_attr { false };
  34. };
  35. }