Coverage Report

Created: 2025-09-05 06:52

/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2020, the SerenityOS developers.
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibWeb/Bindings/HTMLParagraphElementPrototype.h>
8
#include <LibWeb/Bindings/Intrinsics.h>
9
#include <LibWeb/CSS/StyleProperties.h>
10
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
11
#include <LibWeb/HTML/HTMLParagraphElement.h>
12
13
namespace Web::HTML {
14
15
JS_DEFINE_ALLOCATOR(HTMLParagraphElement);
16
17
HTMLParagraphElement::HTMLParagraphElement(DOM::Document& document, DOM::QualifiedName qualified_name)
18
0
    : HTMLElement(document, move(qualified_name))
19
0
{
20
0
}
21
22
0
HTMLParagraphElement::~HTMLParagraphElement() = default;
23
24
void HTMLParagraphElement::initialize(JS::Realm& realm)
25
0
{
26
0
    Base::initialize(realm);
27
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLParagraphElement);
28
0
}
29
30
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2
31
void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& style) const
32
0
{
33
0
    HTMLElement::apply_presentational_hints(style);
34
0
    for_each_attribute([&](auto& name, auto& value) {
35
0
        if (name.equals_ignoring_ascii_case("align"sv)) {
36
0
            if (value == "left"sv)
37
0
                style.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Left));
38
0
            else if (value == "right"sv)
39
0
                style.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Right));
40
0
            else if (value == "center"sv)
41
0
                style.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Center));
42
0
            else if (value == "justify"sv)
43
0
                style.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Justify));
44
0
        }
45
0
    });
46
0
}
47
48
}