HTMLHtmlElement.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include <LibWeb/Layout/Node.h>
  9. namespace Web::HTML {
  10. HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  11. : HTMLElement(document, move(qualified_name))
  12. {
  13. }
  14. HTMLHtmlElement::~HTMLHtmlElement() = default;
  15. void HTMLHtmlElement::initialize(JS::Realm& realm)
  16. {
  17. Base::initialize(realm);
  18. set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHtmlElementPrototype>(realm, "HTMLHtmlElement"));
  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. }