/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.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/HTMLTableCaptionElementPrototype.h> |
8 | | #include <LibWeb/Bindings/Intrinsics.h> |
9 | | #include <LibWeb/CSS/StyleProperties.h> |
10 | | #include <LibWeb/CSS/StyleValues/CSSKeywordValue.h> |
11 | | #include <LibWeb/HTML/HTMLTableCaptionElement.h> |
12 | | |
13 | | namespace Web::HTML { |
14 | | |
15 | | JS_DEFINE_ALLOCATOR(HTMLTableCaptionElement); |
16 | | |
17 | | HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, DOM::QualifiedName qualified_name) |
18 | 0 | : HTMLElement(document, move(qualified_name)) |
19 | 0 | { |
20 | 0 | } |
21 | | |
22 | 0 | HTMLTableCaptionElement::~HTMLTableCaptionElement() = default; |
23 | | |
24 | | void HTMLTableCaptionElement::initialize(JS::Realm& realm) |
25 | 0 | { |
26 | 0 | Base::initialize(realm); |
27 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableCaptionElement); |
28 | 0 | } |
29 | | |
30 | | // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 |
31 | | void HTMLTableCaptionElement::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 == "bottom"sv) |
37 | 0 | style.set_property(CSS::PropertyID::CaptionSide, CSS::CSSKeywordValue::create(CSS::Keyword::Bottom)); |
38 | 0 | } |
39 | 0 | }); |
40 | 0 | } |
41 | | |
42 | | } |