diff --git a/Libraries/LibWeb/CSS/Enums.json b/Libraries/LibWeb/CSS/Enums.json index 38748f94332..b347cd0ad2f 100644 --- a/Libraries/LibWeb/CSS/Enums.json +++ b/Libraries/LibWeb/CSS/Enums.json @@ -638,8 +638,7 @@ "auto", "none", "inter-word", - "inter-character", - "distribute=inter-character" + "inter-character" ], "text-overflow": [ "clip", diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 0b824dbe434..017ae22d660 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -724,6 +724,17 @@ Parser::ParseErrorOr> Parser::parse_css_value if (auto parsed_value = parse_text_decoration_line_value(tokens); parsed_value && !tokens.has_next_token()) return parsed_value.release_nonnull(); return ParseError::SyntaxError; + case PropertyID::TextJustify: + if (auto parsed_value = parse_css_value_for_property(property_id, tokens); parsed_value && !tokens.has_next_token()) { + // https://drafts.csswg.org/css-text-3/#valdef-text-justify-distribute + // For legacy reasons, UAs must also support the alternate keyword distribute which must compute to + // inter-character, thus having the exact same meaning and behavior. UAs may treat this as a legacy value alias. + // FIXME: Figure out a generic way of supporting legacy value aliases. + if (parsed_value->to_keyword() == Keyword::Distribute) + return CSSKeywordValue::create(Keyword::InterCharacter); + return parsed_value.release_nonnull(); + } + return ParseError::SyntaxError; case PropertyID::TextShadow: if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::No); parsed_value && !tokens.has_next_token()) return parsed_value.release_nonnull(); diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json index d3e5e5e5904..a7f5bc49f04 100644 --- a/Libraries/LibWeb/CSS/Properties.json +++ b/Libraries/LibWeb/CSS/Properties.json @@ -3158,6 +3158,9 @@ "initial": "auto", "valid-types": [ "text-justify" + ], + "valid-identifiers": [ + "distribute" ] }, "text-overflow": { diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/text-justify/distribute-alias.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/text-justify/distribute-alias.tentative.txt new file mode 100644 index 00000000000..2183b6327f3 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/text-justify/distribute-alias.tentative.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass text-justify: distribute is a parse-time alias of inter-character \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-text/text-justify/distribute-alias.tentative.html b/Tests/LibWeb/Text/input/wpt-import/css/css-text/text-justify/distribute-alias.tentative.html new file mode 100644 index 00000000000..2b157246889 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-text/text-justify/distribute-alias.tentative.html @@ -0,0 +1,14 @@ + + + + +text-justify: distribute is a parse-time alias of inter-character + + +