mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb/CSS: Support text-justify: distribute
legacy value alias
...for `text-justify: inter-character`. We previously had this mapped in Enums.json, but the behaviour is different: `a=b` in Enums.json keeps `a` around but makes it behave the same as `b`. A legacy name alias is instead expected to replace `a` with `b`, so we have to do that separately.
This commit is contained in:
parent
db75405881
commit
11e2dbb555
Notes:
github-actions[bot]
2025-07-21 09:05:50 +00:00
Author: https://github.com/AtkinsSJ
Commit: 11e2dbb555
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5484
5 changed files with 35 additions and 2 deletions
|
@ -638,8 +638,7 @@
|
||||||
"auto",
|
"auto",
|
||||||
"none",
|
"none",
|
||||||
"inter-word",
|
"inter-word",
|
||||||
"inter-character",
|
"inter-character"
|
||||||
"distribute=inter-character"
|
|
||||||
],
|
],
|
||||||
"text-overflow": [
|
"text-overflow": [
|
||||||
"clip",
|
"clip",
|
||||||
|
|
|
@ -724,6 +724,17 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_css_value
|
||||||
if (auto parsed_value = parse_text_decoration_line_value(tokens); parsed_value && !tokens.has_next_token())
|
if (auto parsed_value = parse_text_decoration_line_value(tokens); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
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:
|
case PropertyID::TextShadow:
|
||||||
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::No); parsed_value && !tokens.has_next_token())
|
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::No); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
|
|
|
@ -3158,6 +3158,9 @@
|
||||||
"initial": "auto",
|
"initial": "auto",
|
||||||
"valid-types": [
|
"valid-types": [
|
||||||
"text-justify"
|
"text-justify"
|
||||||
|
],
|
||||||
|
"valid-identifiers": [
|
||||||
|
"distribute"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"text-overflow": {
|
"text-overflow": {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
Harness status: OK
|
||||||
|
|
||||||
|
Found 1 tests
|
||||||
|
|
||||||
|
1 Pass
|
||||||
|
Pass text-justify: distribute is a parse-time alias of inter-character
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<link rel=author href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||||
|
<link rel=author href="https://mozilla.org" title="Mozilla">
|
||||||
|
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/6156">
|
||||||
|
<title>text-justify: distribute is a parse-time alias of inter-character</title>
|
||||||
|
<script src="../../../resources/testharness.js"></script>
|
||||||
|
<script src="../../../resources/testharnessreport.js"></script>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
let style = document.createElement("div").style;
|
||||||
|
style.textJustify = "distribute";
|
||||||
|
assert_equals(style.textJustify, "inter-character");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue