HTMLHtmlElement.cpp 1.1 KB

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