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