HTMLPreElement.cpp 856 B

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