HTMLHtmlElement.cpp 965 B

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