HTMLHtmlElement.cpp 1.0 KB

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