Coverage Report

Created: 2025-12-18 07:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/CSS/StyleSheet.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
3
 * Copyright (c) 2021, the SerenityOS developers.
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <LibWeb/Bindings/PlatformObject.h>
11
#include <LibWeb/CSS/MediaList.h>
12
#include <LibWeb/Forward.h>
13
14
namespace Web::CSS {
15
16
class StyleSheet : public Bindings::PlatformObject {
17
    WEB_PLATFORM_OBJECT(StyleSheet, Bindings::PlatformObject);
18
19
public:
20
0
    virtual ~StyleSheet() = default;
21
22
    virtual String type() const = 0;
23
24
0
    DOM::Element* owner_node() { return m_owner_node; }
25
    void set_owner_node(DOM::Element*);
26
27
0
    Optional<String> href() const { return m_location; }
28
29
0
    Optional<String> location() const { return m_location; }
30
0
    void set_location(Optional<String> location) { m_location = move(location); }
31
32
0
    String title() const { return m_title; }
33
    Optional<String> title_for_bindings() const;
34
0
    void set_title(String title) { m_title = move(title); }
35
36
0
    void set_type(String type) { m_type_string = move(type); }
37
38
    MediaList* media() const
39
0
    {
40
0
        return m_media;
41
0
    }
42
43
    void set_media(String media)
44
0
    {
45
0
        m_media->set_media_text(media);
46
0
    }
47
48
0
    bool is_alternate() const { return m_alternate; }
49
0
    void set_alternate(bool alternate) { m_alternate = alternate; }
50
51
0
    void set_origin_clean(bool origin_clean) { m_origin_clean = origin_clean; }
52
53
0
    bool disabled() const { return m_disabled; }
54
0
    void set_disabled(bool disabled) { m_disabled = disabled; }
55
56
0
    CSSStyleSheet* parent_style_sheet() { return m_parent_style_sheet; }
57
    void set_parent_css_style_sheet(CSSStyleSheet*);
58
59
protected:
60
    explicit StyleSheet(JS::Realm&, MediaList& media);
61
    virtual void visit_edges(Cell::Visitor&) override;
62
63
    JS::NonnullGCPtr<MediaList> m_media;
64
65
private:
66
    JS::GCPtr<DOM::Element> m_owner_node;
67
    JS::GCPtr<CSSStyleSheet> m_parent_style_sheet;
68
69
    Optional<String> m_location;
70
    String m_title;
71
    String m_type_string;
72
73
    bool m_disabled { false };
74
    bool m_alternate { false };
75
    bool m_origin_clean { true };
76
};
77
78
}