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.cpp
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
#include <LibWeb/Bindings/StyleSheetPrototype.h>
9
#include <LibWeb/CSS/CSSStyleSheet.h>
10
#include <LibWeb/CSS/StyleSheet.h>
11
#include <LibWeb/DOM/Element.h>
12
13
namespace Web::CSS {
14
15
StyleSheet::StyleSheet(JS::Realm& realm, MediaList& media)
16
0
    : PlatformObject(realm)
17
0
    , m_media(media)
18
0
{
19
0
}
20
21
void StyleSheet::visit_edges(Cell::Visitor& visitor)
22
0
{
23
0
    Base::visit_edges(visitor);
24
0
    visitor.visit(m_owner_node);
25
0
    visitor.visit(m_parent_style_sheet);
26
0
    visitor.visit(m_media);
27
0
}
28
29
void StyleSheet::set_owner_node(DOM::Element* element)
30
0
{
31
0
    m_owner_node = element;
32
0
}
33
34
void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
35
0
{
36
0
    m_parent_style_sheet = parent;
37
0
}
38
39
// https://drafts.csswg.org/cssom/#dom-stylesheet-title
40
Optional<String> StyleSheet::title_for_bindings() const
41
0
{
42
    // The title attribute must return the title or null if title is the empty string.
43
0
    if (m_title.is_empty())
44
0
        return {};
45
46
0
    return m_title;
47
0
}
48
49
}