summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-04-13 15:50:56 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-13 16:40:46 +0200
commit5d6c5571c4828e4941719a96bcfa8a309f273801 (patch)
tree37fe134d25b8ec36c20b6168e79edf4e412a1762 /Userland
parentde5de4d99af85f7ce2ec37b1dcdbb6e28a5e96a6 (diff)
downloadserenity-5d6c5571c4828e4941719a96bcfa8a309f273801.zip
LibWeb: Map <pre wrap> presentational hint to CSS white-space:pre-wrap
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPreElement.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
index c21fee9871..b098384bcc 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
@@ -15,4 +15,14 @@ HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName quali
HTMLPreElement::~HTMLPreElement() = default;
+void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ HTMLElement::apply_presentational_hints(style);
+
+ for_each_attribute([&](auto const& name, auto const&) {
+ if (name.equals_ignoring_case(HTML::AttributeNames::wrap))
+ style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap));
+ });
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h
index 9db21317f3..fa8f24887b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h
@@ -16,6 +16,9 @@ public:
HTMLPreElement(DOM::Document&, DOM::QualifiedName);
virtual ~HTMLPreElement() override;
+
+private:
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
};
}