diff --git a/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Libraries/LibWeb/HTML/HTMLLIElement.cpp
index c443d9623b2..706e1209d3e 100644
--- a/Libraries/LibWeb/HTML/HTMLLIElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLLIElement.cpp
@@ -5,6 +5,7 @@
*/
#include
+#include
#include
#include
#include
@@ -38,4 +39,40 @@ WebIDL::Long HTMLLIElement::value()
return 0;
}
+bool HTMLLIElement::is_presentational_hint(FlyString const& name) const
+{
+ if (Base::is_presentational_hint(name))
+ return true;
+
+ return name == HTML::AttributeNames::type;
+}
+
+void HTMLLIElement::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));
+ } else 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/HTMLLIElement.h b/Libraries/LibWeb/HTML/HTMLLIElement.h
index 44c026745c6..5a05c14b8ed 100644
--- a/Libraries/LibWeb/HTML/HTMLLIElement.h
+++ b/Libraries/LibWeb/HTML/HTMLLIElement.h
@@ -45,6 +45,9 @@ private:
HTMLLIElement(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/li-type-supported-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/li-type-supported-ref.html
new file mode 100644
index 00000000000..0de7ff329c2
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/lists/li-type-supported-ref.html
@@ -0,0 +1,45 @@
+
+
+li@type: supported types
+
+first item
+second item
+third item
+fourth item
+fifth item
+sixth item
+seventh item
+eighth item
+ninth item
+
+ - first ordered item
+ - second ordered item
+ - third ordered item
+ - fourth ordered item
+ - fifth ordered item
+ - sixth ordered item
+ - seventh ordered item
+ - eighth ordered item
+ - ninth ordered item
+
+
+ - first unordered item
+ - second unordered item
+ - third unordered item
+ - fourth unordered item
+ - fifth unordered item
+ - sixth unordered item
+ - seventh unordered item
+ - eighth unordered item
+ - ninth unordered item
+
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/li-type-supported.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/li-type-supported.html
new file mode 100644
index 00000000000..eb401e4e6c3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/lists/li-type-supported.html
@@ -0,0 +1,35 @@
+
+
+li@type: supported types
+
+first item
+second item
+third item
+fourth item
+fifth item
+sixth item
+seventh item
+eighth item
+ninth item
+
+ - first ordered item
+ - second ordered item
+ - third ordered item
+ - fourth ordered item
+ - fifth ordered item
+ - sixth ordered item
+ - seventh ordered item
+ - eighth ordered item
+ - ninth ordered item
+
+
+ - first unordered item
+ - second unordered item
+ - third unordered item
+ - fourth unordered item
+ - fifth unordered item
+ - sixth unordered item
+ - seventh unordered item
+ - eighth unordered item
+ - ninth unordered item
+
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.txt b/Tests/LibWeb/Text/expected/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.txt
new file mode 100644
index 00000000000..972be46b83f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Pass
+Pass keyword disc
+Pass keyword square
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.html b/Tests/LibWeb/Text/input/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.html
new file mode 100644
index 00000000000..e48429be9b9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/html/rendering/non-replaced-elements/lists/lists-presentational-hints-ascii-case-insensitive.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+