diff --git a/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Libraries/LibWeb/HTML/HTMLUListElement.cpp
index 5c6e74ee628..f4cce3450c0 100644
--- a/Libraries/LibWeb/HTML/HTMLUListElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLUListElement.cpp
@@ -6,6 +6,7 @@
#include
#include
+#include
#include
namespace Web::HTML {
@@ -25,4 +26,30 @@ void HTMLUListElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLUListElement);
}
+bool HTMLUListElement::is_presentational_hint(FlyString const& name) const
+{
+ if (Base::is_presentational_hint(name))
+ return true;
+
+ return name == HTML::AttributeNames::type;
+}
+
+void HTMLUListElement::apply_presentational_hints(GC::Ref cascaded_properties) const
+{
+ // https://html.spec.whatwg.org/multipage/rendering.html#lists
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name == HTML::AttributeNames::type) {
+ if (value.equals_ignoring_ascii_case("none"sv)) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::None));
+ } else if (value.equals_ignoring_ascii_case("disc"sv)) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Disc));
+ } else if (value.equals_ignoring_ascii_case("circle"sv)) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Circle));
+ } else if (value.equals_ignoring_ascii_case("square"sv)) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Square));
+ }
+ }
+ });
+}
+
}
diff --git a/Libraries/LibWeb/HTML/HTMLUListElement.h b/Libraries/LibWeb/HTML/HTMLUListElement.h
index 50ab0f5e143..d1b92a1c09a 100644
--- a/Libraries/LibWeb/HTML/HTMLUListElement.h
+++ b/Libraries/LibWeb/HTML/HTMLUListElement.h
@@ -25,6 +25,9 @@ private:
HTMLUListElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
+
+ virtual bool is_presentational_hint(FlyString const&) const override;
+ virtual void apply_presentational_hints(GC::Ref) const override;
};
}
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported-ref.html
new file mode 100644
index 00000000000..59a0400cc80
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported-ref.html
@@ -0,0 +1,21 @@
+
+
+ul@type: supported types
+
+
+- first circle
- second circle
+- first square
- second square
+
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported.html
new file mode 100644
index 00000000000..75b2189b345
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ul-type-supported.html
@@ -0,0 +1,8 @@
+
+
+ul@type: supported types
+
+
+- first circle
- second circle
+- first square
- second square
+