From a6812e1005d0153e311ca2fe2ae393196f862ab9 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Sun, 14 Sep 2025 14:16:37 +1200 Subject: [PATCH] LibWeb: Store parsed shorthands in canonical order --- Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp | 2 +- .../expected/wpt-import/css/cssom/shorthand-values.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index fa0bfbbf32f..7c8a5272f21 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -848,7 +848,7 @@ Parser::ParseErrorOr> Parser::parse_css_value(Pr auto stream = TokenStream { component_values }; - HashMap, Vector>> assigned_values; + OrderedHashMap, Vector>> assigned_values; while (stream.has_next_token() && !unassigned_properties.is_empty()) { auto property_and_value = parse_css_value_for_properties(unassigned_properties, stream); diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/shorthand-values.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/shorthand-values.txt index cdccee56f3f..7e6b9b84a2f 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/shorthand-values.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/shorthand-values.txt @@ -2,15 +2,15 @@ Harness status: OK Found 20 tests -15 Pass -5 Fail +17 Pass +3 Fail Pass The serialization of border: 1px; border-top: 1px; should be canonical. Pass The serialization of border: 1px solid red; should be canonical. Pass The serialization of border: 1px red; should be canonical. Pass The serialization of border: red; should be canonical. Pass The serialization of border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px; border-image: none; should be canonical. -Fail The serialization of border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px; should be canonical. -Fail The serialization of border-top: 1px; border-right: 2px; border-bottom: 3px; border-left: 4px; should be canonical. +Pass The serialization of border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px; should be canonical. +Pass The serialization of border-top: 1px; border-right: 2px; border-bottom: 3px; border-left: 4px; should be canonical. Fail The serialization of border: 1px; border-top: 2px; should be canonical. Fail The serialization of border: 1px; border-top: 1px !important; should be canonical. Fail The serialization of border: 1px; border-top-color: red; should be canonical.