/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLPreElement.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/HTMLPreElementPrototype.h> |
8 | | #include <LibWeb/Bindings/Intrinsics.h> |
9 | | #include <LibWeb/CSS/StyleProperties.h> |
10 | | #include <LibWeb/CSS/StyleValues/CSSKeywordValue.h> |
11 | | #include <LibWeb/HTML/HTMLPreElement.h> |
12 | | #include <LibWeb/HTML/Numbers.h> |
13 | | |
14 | | namespace Web::HTML { |
15 | | |
16 | | JS_DEFINE_ALLOCATOR(HTMLPreElement); |
17 | | |
18 | | HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName qualified_name) |
19 | 0 | : HTMLElement(document, move(qualified_name)) |
20 | 0 | { |
21 | 0 | } |
22 | | |
23 | 0 | HTMLPreElement::~HTMLPreElement() = default; |
24 | | |
25 | | void HTMLPreElement::initialize(JS::Realm& realm) |
26 | 0 | { |
27 | 0 | Base::initialize(realm); |
28 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLPreElement); |
29 | 0 | } |
30 | | |
31 | | void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const |
32 | 0 | { |
33 | 0 | HTMLElement::apply_presentational_hints(style); |
34 | |
|
35 | 0 | for_each_attribute([&](auto const& name, auto const&) { |
36 | 0 | if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap)) |
37 | 0 | style.set_property(CSS::PropertyID::WhiteSpace, CSS::CSSKeywordValue::create(CSS::Keyword::PreWrap)); |
38 | 0 | }); |
39 | 0 | } |
40 | | |
41 | | } |