HTMLHtmlElement.cpp 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. JS_DEFINE_ALLOCATOR(HTMLHtmlElement);
  11. HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  12. : HTMLElement(document, move(qualified_name))
  13. {
  14. }
  15. HTMLHtmlElement::~HTMLHtmlElement() = default;
  16. void HTMLHtmlElement::initialize(JS::Realm& realm)
  17. {
  18. Base::initialize(realm);
  19. WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLHtmlElement);
  20. }
  21. bool HTMLHtmlElement::should_use_body_background_properties() const
  22. {
  23. auto background_color = layout_node()->computed_values().background_color();
  24. auto const& background_layers = layout_node()->background_layers();
  25. for (auto& layer : background_layers) {
  26. if (layer.background_image)
  27. return false;
  28. }
  29. return (background_color == Color::Transparent);
  30. }
  31. }