2020-08-01 02:05:43 +00:00
|
|
|
/*
|
2021-04-28 20:46:44 +00:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2020-08-01 02:05:43 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 02:05:43 +00:00
|
|
|
*/
|
|
|
|
|
2024-04-27 00:09:58 +00:00
|
|
|
#include <LibWeb/Bindings/HTMLPreElementPrototype.h>
|
2022-09-30 23:16:16 +00:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2023-05-08 05:51:03 +00:00
|
|
|
#include <LibWeb/CSS/StyleProperties.h>
|
2024-08-14 10:46:56 +00:00
|
|
|
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
2020-08-01 02:05:43 +00:00
|
|
|
#include <LibWeb/HTML/HTMLPreElement.h>
|
2024-02-20 16:06:36 +00:00
|
|
|
#include <LibWeb/HTML/Numbers.h>
|
2020-08-01 02:05:43 +00:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DEFINE_ALLOCATOR(HTMLPreElement);
|
2023-11-19 18:47:52 +00:00
|
|
|
|
2022-02-18 20:00:52 +00:00
|
|
|
HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2021-02-07 10:20:15 +00:00
|
|
|
: HTMLElement(document, move(qualified_name))
|
2020-08-01 02:05:43 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-03-14 19:21:51 +00:00
|
|
|
HTMLPreElement::~HTMLPreElement() = default;
|
2020-08-01 02:05:43 +00:00
|
|
|
|
2023-08-07 06:41:28 +00:00
|
|
|
void HTMLPreElement::initialize(JS::Realm& realm)
|
2023-01-10 11:28:20 +00:00
|
|
|
{
|
2023-08-07 06:41:28 +00:00
|
|
|
Base::initialize(realm);
|
2024-03-16 12:13:08 +00:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLPreElement);
|
2023-01-10 11:28:20 +00:00
|
|
|
}
|
|
|
|
|
2022-04-13 13:50:56 +00:00
|
|
|
void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
|
|
|
{
|
|
|
|
HTMLElement::apply_presentational_hints(style);
|
|
|
|
|
|
|
|
for_each_attribute([&](auto const& name, auto const&) {
|
2023-03-10 07:48:54 +00:00
|
|
|
if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap))
|
2024-08-14 13:06:03 +00:00
|
|
|
style.set_property(CSS::PropertyID::WhiteSpace, CSS::CSSKeywordValue::create(CSS::Keyword::PreWrap));
|
2022-04-13 13:50:56 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-01 02:05:43 +00:00
|
|
|
}
|