/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.h
Line | Count | Source |
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 | | |
10 | | #pragma once |
11 | | |
12 | | #include <AK/Vector.h> |
13 | | #include <LibWeb/CSS/CSSStyleValue.h> |
14 | | #include <LibWeb/CSS/Parser/ComponentValue.h> |
15 | | |
16 | | namespace Web::CSS { |
17 | | |
18 | | class UnresolvedStyleValue final : public CSSStyleValue { |
19 | | public: |
20 | | static ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr, Optional<String> original_source_text) |
21 | 0 | { |
22 | 0 | return adopt_ref(*new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr, move(original_source_text))); |
23 | 0 | } |
24 | 0 | virtual ~UnresolvedStyleValue() override = default; |
25 | | |
26 | | virtual String to_string() const override; |
27 | | |
28 | 0 | Vector<Parser::ComponentValue> const& values() const { return m_values; } |
29 | 0 | bool contains_var_or_attr() const { return m_contains_var_or_attr; } |
30 | | |
31 | | virtual bool equals(CSSStyleValue const& other) const override; |
32 | | |
33 | | private: |
34 | | UnresolvedStyleValue(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr, Optional<String> original_source_text) |
35 | 0 | : CSSStyleValue(Type::Unresolved) |
36 | 0 | , m_values(move(values)) |
37 | 0 | , m_contains_var_or_attr(contains_var_or_attr) |
38 | 0 | , m_original_source_text(move(original_source_text)) |
39 | 0 | { |
40 | 0 | } |
41 | | |
42 | | Vector<Parser::ComponentValue> m_values; |
43 | | bool m_contains_var_or_attr { false }; |
44 | | Optional<String> m_original_source_text; |
45 | | }; |
46 | | |
47 | | } |