Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/StringStyleValue.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2022-2024, 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
class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> {
15
public:
16
    static ValueComparingNonnullRefPtr<StringStyleValue> create(FlyString const& string)
17
0
    {
18
0
        return adopt_ref(*new (nothrow) StringStyleValue(string));
19
0
    }
20
0
    virtual ~StringStyleValue() override = default;
21
22
0
    FlyString const& string_value() const { return m_string; }
23
0
    String to_string() const override { return serialize_a_string(m_string); }
24
25
0
    bool properties_equal(StringStyleValue const& other) const { return m_string == other.m_string; }
26
27
private:
28
    explicit StringStyleValue(FlyString const& string)
29
0
        : StyleValueWithDefaultOperators(Type::String)
30
0
        , m_string(string)
31
0
    {
32
0
    }
33
34
    FlyString m_string;
35
};
36
37
}