diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Libraries/LibWeb/HTML/HTMLOListElement.cpp
index 7079afdea11..7f1b706f54f 100644
--- a/Libraries/LibWeb/HTML/HTMLOListElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLOListElement.cpp
@@ -6,6 +6,7 @@
#include
#include
+#include
#include
#include
@@ -36,4 +37,32 @@ WebIDL::Long HTMLOListElement::start()
return 1;
}
+bool HTMLOListElement::is_presentational_hint(FlyString const& name) const
+{
+ if (Base::is_presentational_hint(name))
+ return true;
+
+ return name == HTML::AttributeNames::type;
+}
+
+void HTMLOListElement::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 == "1"sv) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Decimal));
+ } else if (value == "a"sv) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::LowerAlpha));
+ } else if (value == "A"sv) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::UpperAlpha));
+ } else if (value == "i"sv) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::LowerRoman));
+ } else if (value == "I"sv) {
+ cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::UpperRoman));
+ }
+ }
+ });
+}
+
}
diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.h b/Libraries/LibWeb/HTML/HTMLOListElement.h
index 478d91168e1..23264cdfe42 100644
--- a/Libraries/LibWeb/HTML/HTMLOListElement.h
+++ b/Libraries/LibWeb/HTML/HTMLOListElement.h
@@ -32,6 +32,9 @@ private:
HTMLOListElement(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/ol-type-supported-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/ol-type-supported-ref.html
new file mode 100644
index 00000000000..fb61db3261c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/ol-type-supported-ref.html
@@ -0,0 +1,25 @@
+
+
+ol@type: supported types
+
+- 1
- 2
+- a
- b
+- A
- B
+- i
- ii
+- I
- II
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ol-type-supported.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ol-type-supported.html
new file mode 100644
index 00000000000..f64e18028f3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/ol-type-supported.html
@@ -0,0 +1,9 @@
+
+
+ol@type: supported types
+
+- 1
- 2
+- a
- b
+- A
- B
+- i
- ii
+- I
- II