Coverage Report

Created: 2026-02-14 08:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022-2024, Sam Atkins <sam@ladybird.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibWeb/CSS/Resolution.h>
10
#include <LibWeb/CSS/StyleValues/CSSUnitValue.h>
11
12
namespace Web::CSS {
13
14
class ResolutionStyleValue : public CSSUnitValue {
15
public:
16
    static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution)
17
0
    {
18
0
        return adopt_ref(*new (nothrow) ResolutionStyleValue(move(resolution)));
19
0
    }
20
    virtual ~ResolutionStyleValue() override = default;
21
22
0
    Resolution const& resolution() const { return m_resolution; }
23
0
    virtual double value() const override { return m_resolution.raw_value(); }
24
0
    virtual StringView unit() const override { return m_resolution.unit_name(); }
25
26
0
    virtual String to_string() const override { return m_resolution.to_string(); }
27
28
    bool equals(CSSStyleValue const& other) const override
29
0
    {
30
0
        if (type() != other.type())
31
0
            return false;
32
0
        auto const& other_resolution = other.as_resolution();
33
0
        return m_resolution == other_resolution.m_resolution;
34
0
    }
35
36
private:
37
    explicit ResolutionStyleValue(Resolution resolution)
38
0
        : CSSUnitValue(Type::Resolution)
39
0
        , m_resolution(move(resolution))
40
0
    {
41
0
    }
42
43
    Resolution m_resolution;
44
};
45
46
}