HTMLPreElement.cpp 944 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/HTMLPreElementPrototype.h>
  7. #include <LibWeb/HTML/HTMLPreElement.h>
  8. #include <LibWeb/HTML/Window.h>
  9. namespace Web::HTML {
  10. HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  11. : HTMLElement(document, move(qualified_name))
  12. {
  13. set_prototype(&window().ensure_web_prototype<Bindings::HTMLPreElementPrototype>("HTMLPreElement"));
  14. }
  15. HTMLPreElement::~HTMLPreElement() = default;
  16. void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const
  17. {
  18. HTMLElement::apply_presentational_hints(style);
  19. for_each_attribute([&](auto const& name, auto const&) {
  20. if (name.equals_ignoring_case(HTML::AttributeNames::wrap))
  21. style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap));
  22. });
  23. }
  24. }