HTMLHtmlElement.cpp 1012 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. void HTMLHtmlElement::initialize(JS::Realm& realm)
  15. {
  16. Base::initialize(realm);
  17. set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHtmlElementPrototype>(realm, "HTMLHtmlElement"));
  18. }
  19. bool HTMLHtmlElement::should_use_body_background_properties() const
  20. {
  21. auto background_color = layout_node()->computed_values().background_color();
  22. auto const& background_layers = layout_node()->background_layers();
  23. for (auto& layer : background_layers) {
  24. if (layer.background_image)
  25. return false;
  26. }
  27. return (background_color == Color::Transparent);
  28. }
  29. }