HTMLPreElement.cpp 991 B

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