Serenity Operating System
1/*
2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <LibWeb/Bindings/Intrinsics.h>
8#include <LibWeb/HTML/HTMLHtmlElement.h>
9
10namespace Web::HTML {
11
12HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qualified_name)
13 : HTMLElement(document, move(qualified_name))
14{
15}
16
17HTMLHtmlElement::~HTMLHtmlElement() = default;
18
19JS::ThrowCompletionOr<void> HTMLHtmlElement::initialize(JS::Realm& realm)
20{
21 MUST_OR_THROW_OOM(Base::initialize(realm));
22 set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHtmlElementPrototype>(realm, "HTMLHtmlElement"));
23
24 return {};
25}
26
27bool HTMLHtmlElement::should_use_body_background_properties() const
28{
29 auto background_color = layout_node()->computed_values().background_color();
30 auto const& background_layers = layout_node()->background_layers();
31
32 for (auto& layer : background_layers) {
33 if (layer.background_image)
34 return false;
35 }
36
37 return (background_color == Color::Transparent);
38}
39
40}