Title: [292463] trunk
Revision
292463
Author
obru...@igalia.com
Date
2022-04-06 07:19:18 -0700 (Wed, 06 Apr 2022)

Log Message

[css] Turn -webkit-text-orientation into a legacy shorthand
https://bugs.webkit.org/show_bug.cgi?id=238356

Reviewed by Antti Koivisto.

Source/WebCore:

`-webkit-text-orientation` and `text-orientation` were both implemented
as longhands, just with a `related-property` flag so that declaration
blocks with both of them would use the one appearing last.

However, the logic for `related-property` wasn't always working well.
In bug 238350 I plan to merge it with shouldApplyPropertyInParseOrder(),
which has the same purpose and works better. But it's not suitable for
high priority properties like `text-orientation`.

So this patch turns `-webkit-text-orientation` into a shorthand that
expands into `text-orientation`.

`-webkit-text-orientation` continues accepting the legacy value
`sideways-right`, which is now mapped into `sideways` at parse time.
Previously this happened at computed-value time, but it implied that
serializing `text-decoration` could yield an invalid value.

Tests: fast/text/text-orientation-parse-competition.html
       fast/text/text-orientation-parse-stylesheet.html

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::operator TextOrientation const):
Remove mapping of `sideways-right` into `sideways`, this is now
done at parse time. Also remove mapping of `vertical-right` into `mixed`
since `vertical-right` is a remnant of the past which has not been
considered valid syntax for years.

* css/CSSProperties.json:
Turn `-webkit-text-orientation` into a shorthand of `text-orientation`.
Remove their `related-property` flags and a remnant of `vertical-right`.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue const):
Add code for serializing the `-webkit-text-orientation` shorthand.

* css/makeprop.pl:
Avoid a compile warning in getRelatedPropertyId() when no property has
the `related-property` flag.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
Remove `-webkit-text-orientation` from code which is only relevant for
longhands.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeLegacyTextOrientation):
(WebCore::CSSPropertyParser::parseShorthand):
Add parsing logic for `-webkit-text-orientation` as a shorthand.

* css/parser/CSSPropertyParser.h:
Add parsing logic for `-webkit-text-orientation` as a shorthand.

* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueWebkitTextOrientation): Deleted.
Remove `-webkit-text-orientation` from code which is only relevant for
longhands.

LayoutTests:

* fast/text/text-orientation-parse-competition-expected.txt:
* fast/text/text-orientation-parse-competition.html:
Check that if a stylesheet specifies both -webkit-text-orientation and
text-orientation for the same element, the last specified one wins.

* fast/text/text-orientation-parse-stylesheet-expected.txt:
* fast/text/text-orientation-parse-stylesheet.html:
Check that only -webkit-text-orientation accepts `sideways-right`, and
that it's mapped to `sideways` at parse time.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292462 => 292463)


--- trunk/LayoutTests/ChangeLog	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/LayoutTests/ChangeLog	2022-04-06 14:19:18 UTC (rev 292463)
@@ -1,3 +1,20 @@
+2022-04-06  Oriol Brufau  <obru...@igalia.com>
+
+        [css] Turn -webkit-text-orientation into a legacy shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=238356
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/text-orientation-parse-competition-expected.txt:
+        * fast/text/text-orientation-parse-competition.html:
+        Check that if a stylesheet specifies both -webkit-text-orientation and
+        text-orientation for the same element, the last specified one wins.
+
+        * fast/text/text-orientation-parse-stylesheet-expected.txt:
+        * fast/text/text-orientation-parse-stylesheet.html:
+        Check that only -webkit-text-orientation accepts `sideways-right`, and
+        that it's mapped to `sideways` at parse time.
+
 2022-04-06  Youenn Fablet  <you...@apple.com>
 
         Implement ServiceWorkerWindowClient.navigate

Modified: trunk/LayoutTests/fast/text/text-orientation-parse-competition-expected.txt (292462 => 292463)


--- trunk/LayoutTests/fast/text/text-orientation-parse-competition-expected.txt	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/LayoutTests/fast/text/text-orientation-parse-competition-expected.txt	2022-04-06 14:19:18 UTC (rev 292463)
@@ -1,9 +1,21 @@
 PASS window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation is "upright"
 PASS window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation is "upright"
 PASS window.getComputedStyle(document.getElementById('test1')).textOrientation is "upright"
 PASS window.getComputedStyle(document.getElementById('test2')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test3')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test4')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test5')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test6')).textOrientation is "upright"
 PASS successfullyParsed is true
 
 TEST COMPLETE
 你好ABC
 你好ABC
+你好ABC
+你好ABC
+你好ABC
+你好ABC

Modified: trunk/LayoutTests/fast/text/text-orientation-parse-competition.html (292462 => 292463)


--- trunk/LayoutTests/fast/text/text-orientation-parse-competition.html	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/LayoutTests/fast/text/text-orientation-parse-competition.html	2022-04-06 14:19:18 UTC (rev 292463)
@@ -2,16 +2,39 @@
 <html>
 	<head>
 	<meta charset="utf-8">
+	<style>
+		#test3 { -webkit-text-orientation: sideways; text-orientation: upright; }
+
+		#test4 { text-orientation: sideways; -webkit-text-orientation: upright; }
+
+		#test5 { -webkit-text-orientation: sideways; }
+		#test5 { text-orientation: upright; }
+
+		#test6 { text-orientation: sideways; }
+		#test6 { -webkit-text-orientation: upright; }
+	</style>
 	<script src=""
 	</head>
 	<body>
 		<div id="test1" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways; text-orientation: upright">你好ABC</div>
 		<div id="test2" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways; -webkit-text-orientation: upright">你好ABC</div>
+		<div id="test3" style="-webkit-writing-mode: vertical-rl">你好ABC</div>
+		<div id="test4" style="-webkit-writing-mode: vertical-rl">你好ABC</div>
+		<div id="test5" style="-webkit-writing-mode: vertical-rl">你好ABC</div>
+		<div id="test6" style="-webkit-writing-mode: vertical-rl">你好ABC</div>
 		<script>
 			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation", "upright");
 			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation", "upright");
 			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).textOrientation", "upright");
 			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).textOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).textOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).textOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).textOrientation", "upright");
+			shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).textOrientation", "upright");
 		</script>
 		<script src=""
 	</body>

Modified: trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt (292462 => 292463)


--- trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt	2022-04-06 14:19:18 UTC (rev 292463)
@@ -3,6 +3,9 @@
 PASS document.getElementById('test3').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "upright"
 PASS document.getElementById('test4').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "mixed"
 PASS document.getElementById('test5').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "mixed"
+PASS document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "sideways"
+PASS document.getElementById('test7').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "sideways"
+PASS document.getElementById('test8').sheet.cssRules[0].style.getPropertyValue('text-orientation') is ""
 PASS document.getElementById('test1').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "upright"
 PASS document.getElementById('test2').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "upright"
 PASS document.getElementById('test3').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "upright"
@@ -9,7 +12,8 @@
 PASS document.getElementById('test4').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "mixed"
 PASS document.getElementById('test5').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "mixed"
 PASS document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "sideways"
-PASS document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "sideways"
+PASS document.getElementById('test7').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is "sideways"
+PASS document.getElementById('test8').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation') is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet.html (292462 => 292463)


--- trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet.html	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/LayoutTests/fast/text/text-orientation-parse-stylesheet.html	2022-04-06 14:19:18 UTC (rev 292463)
@@ -11,7 +11,10 @@
 		<style id="test4"> dummy { text-orientation: upright; -webkit-text-orientation: mixed;} </style>
 		<style id="test5"> dummy { -webkit-text-orientation: upright; text-orientation: mixed;} </style>
 		<style id="test6"> dummy { -webkit-text-orientation: upright; text-orientation: mixed; -webkit-text-orientation: sideways;} </style>
+		<style id="test7"> dummy { -webkit-text-orientation: sideways-right;} </style>
+		<style id="test8"> dummy { text-orientation: sideways-right;} </style>
 
+
 		<script>
 			shouldBeEqualToString("document.getElementById('test1').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "upright");
 			shouldBeEqualToString("document.getElementById('test2').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "upright");
@@ -18,6 +21,9 @@
 			shouldBeEqualToString("document.getElementById('test3').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "upright");
 			shouldBeEqualToString("document.getElementById('test4').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "mixed");
 			shouldBeEqualToString("document.getElementById('test5').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "mixed");
+			shouldBeEqualToString("document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "sideways");
+			shouldBeEqualToString("document.getElementById('test7').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "sideways");
+			shouldBeEqualToString("document.getElementById('test8').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "");
 
 			shouldBeEqualToString("document.getElementById('test1').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "upright");
 			shouldBeEqualToString("document.getElementById('test2').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "upright");
@@ -24,11 +30,9 @@
 			shouldBeEqualToString("document.getElementById('test3').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "upright");
 			shouldBeEqualToString("document.getElementById('test4').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "mixed");
 			shouldBeEqualToString("document.getElementById('test5').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "mixed");
-
 			shouldBeEqualToString("document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "sideways");
-			shouldBeEqualToString("document.getElementById('test6').sheet.cssRules[0].style.getPropertyValue('text-orientation')", "sideways");
-
-
+			shouldBeEqualToString("document.getElementById('test7').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "sideways");
+			shouldBeEqualToString("document.getElementById('test8').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "");
 		</script>
 
 		<script src=""

Modified: trunk/Source/WebCore/ChangeLog (292462 => 292463)


--- trunk/Source/WebCore/ChangeLog	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/ChangeLog	2022-04-06 14:19:18 UTC (rev 292463)
@@ -1,3 +1,68 @@
+2022-04-06  Oriol Brufau  <obru...@igalia.com>
+
+        [css] Turn -webkit-text-orientation into a legacy shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=238356
+
+        Reviewed by Antti Koivisto.
+
+        `-webkit-text-orientation` and `text-orientation` were both implemented
+        as longhands, just with a `related-property` flag so that declaration
+        blocks with both of them would use the one appearing last.
+
+        However, the logic for `related-property` wasn't always working well.
+        In bug 238350 I plan to merge it with shouldApplyPropertyInParseOrder(),
+        which has the same purpose and works better. But it's not suitable for
+        high priority properties like `text-orientation`.
+
+        So this patch turns `-webkit-text-orientation` into a shorthand that
+        expands into `text-orientation`.
+
+        `-webkit-text-orientation` continues accepting the legacy value
+        `sideways-right`, which is now mapped into `sideways` at parse time.
+        Previously this happened at computed-value time, but it implied that
+        serializing `text-decoration` could yield an invalid value.
+
+        Tests: fast/text/text-orientation-parse-competition.html
+               fast/text/text-orientation-parse-stylesheet.html
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::operator TextOrientation const):
+        Remove mapping of `sideways-right` into `sideways`, this is now
+        done at parse time. Also remove mapping of `vertical-right` into `mixed`
+        since `vertical-right` is a remnant of the past which has not been
+        considered valid syntax for years.
+
+        * css/CSSProperties.json:
+        Turn `-webkit-text-orientation` into a shorthand of `text-orientation`.
+        Remove their `related-property` flags and a remnant of `vertical-right`.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::getPropertyValue const):
+        Add code for serializing the `-webkit-text-orientation` shorthand.
+
+        * css/makeprop.pl:
+        Avoid a compile warning in getRelatedPropertyId() when no property has
+        the `related-property` flag.
+
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        Remove `-webkit-text-orientation` from code which is only relevant for
+        longhands.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeLegacyTextOrientation):
+        (WebCore::CSSPropertyParser::parseShorthand):
+        Add parsing logic for `-webkit-text-orientation` as a shorthand.
+
+        * css/parser/CSSPropertyParser.h:
+        Add parsing logic for `-webkit-text-orientation` as a shorthand.
+
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyValueWebkitTextOrientation): Deleted.
+        Remove `-webkit-text-orientation` from code which is only relevant for
+        longhands.
+
 2022-04-06  Zan Dobersek  <zdober...@igalia.com>
 
         [TextureMapper] Clean up the GraphicsContextGLTextureMapperANGLE header

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (292462 => 292463)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2022-04-06 14:19:18 UTC (rev 292463)
@@ -3314,10 +3314,6 @@
     switch (m_value.valueID) {
     case CSSValueSideways:
         return TextOrientation::Sideways;
-    case CSSValueSidewaysRight:
-        return TextOrientation::Sideways;
-    case CSSValueVerticalRight:
-        return TextOrientation::Mixed;
     case CSSValueMixed:
         return TextOrientation::Mixed;
     case CSSValueUpright:

Modified: trunk/Source/WebCore/css/CSSProperties.json (292462 => 292463)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-04-06 14:19:18 UTC (rev 292463)
@@ -142,8 +142,7 @@
         "in CSS cascading order.",
         "",
         "* related-property:",
-        "Indicates the prefixed or unprefixed version of the same property,",
-        "e.g. -webkit-text-orientation has a related property text-orientation",
+        "Indicates the prefixed or unprefixed version of the same property.",
         "When parsing high priority CSS properties with both prefixed and unprefixed",
         "versions, this flig will help the parser to mark all related properties ",
         "as seen when one is seen. This could enforce the 'last-one-wins' rule.",
@@ -690,7 +689,6 @@
             ],
             "codegen-properties": {
                 "custom": "Value",
-                "related-property": "-webkit-text-orientation",
                 "high-priority": true
             },
             "specification": {
@@ -706,10 +704,6 @@
                     "value": "sideways-right",
                     "status": "deprecated"
                 },
-                {
-                    "value": "vertical-right",
-                    "status": "non-standard"
-                },
                 "mixed",
                 "upright"
             ],
@@ -717,9 +711,9 @@
                 "aliases": [
                     "-epub-text-orientation"
                 ],
-                "related-property": "text-orientation",
-                "custom": "Value",
-                "high-priority": true
+                "longhands": [
+                    "text-orientation"
+                ]
             },
             "specification": {
                 "category": "css-writing-modes",

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (292462 => 292463)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-06 14:19:18 UTC (rev 292463)
@@ -351,6 +351,8 @@
         return get2Values(scrollPaddingBlockShorthand());
     case CSSPropertyScrollPaddingInline:
         return get2Values(scrollPaddingInlineShorthand());
+    case CSSPropertyWebkitTextOrientation:
+        return getPropertyValue(CSSPropertyTextOrientation);
     default:
         return String();
     }

Modified: trunk/Source/WebCore/css/makeprop.pl (292462 => 292463)


--- trunk/Source/WebCore/css/makeprop.pl	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/makeprop.pl	2022-04-06 14:19:18 UTC (rev 292463)
@@ -587,25 +587,38 @@
     ASSERT(id != CSSPropertyInvalid);
     return isInheritedPropertyTable[id];
 }
-    
-CSSPropertyID getRelatedPropertyId(CSSPropertyID id)
+
+EOF
+
+if (%relatedProperty) {
+    print GPERF << "EOF";
+CSSPropertyID getRelatedPropertyId(const CSSPropertyID id)
 {
     switch (id) {
 EOF
-for my $name (@names) {
-    if (!$relatedProperty{$name}) {
-        next;
+    for my $name (@names) {
+        if (!$relatedProperty{$name}) {
+            next;
+        }
+        print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
+        print GPERF "        return CSSPropertyID::CSSProperty" . $nameToId{$relatedProperty{$name}} . ";\n";
     }
-    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
-    print GPERF "        return CSSPropertyID::CSSProperty" . $nameToId{$relatedProperty{$name}} . ";\n";
-}
-        
-print GPERF << "EOF";
+    print GPERF << "EOF";
     default:
         return CSSPropertyID::CSSPropertyInvalid;
     }
+EOF
+} else {
+    print GPERF << "EOF";
+CSSPropertyID getRelatedPropertyId(const CSSPropertyID)
+{
+    return CSSPropertyID::CSSPropertyInvalid;
+EOF
 }
 
+print GPERF << "EOF";
+}
+
 Vector<String> CSSProperty::aliasesForProperty(CSSPropertyID id)
 {
     switch (id) {

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (292462 => 292463)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-06 14:19:18 UTC (rev 292463)
@@ -732,9 +732,8 @@
         // auto | none | inter-word | distribute
         return valueID == CSSValueInterWord || valueID == CSSValueDistribute || valueID == CSSValueAuto || valueID == CSSValueNone;
 #endif
-    case CSSPropertyWebkitTextOrientation: // mixed | upright | sideways | sideways-right
-        return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways || valueID == CSSValueSidewaysRight;
     case CSSPropertyTextOrientation:
+        // mixed | upright | sideways
         return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways;
     case CSSPropertyTextOverflow: // clip | ellipsis
         return valueID == CSSValueClip || valueID == CSSValueEllipsis;
@@ -986,7 +985,6 @@
     case CSSPropertyWebkitTextCombine:
     case CSSPropertyTextCombineUpright:
     case CSSPropertyTextDecorationStyle:
-    case CSSPropertyWebkitTextOrientation:
     case CSSPropertyWebkitTextSecurity:
     case CSSPropertyWebkitTextZoom:
     case CSSPropertyWebkitTransformStyle:

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (292462 => 292463)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-06 14:19:18 UTC (rev 292463)
@@ -5649,6 +5649,23 @@
     return true;
 }
 
+bool CSSPropertyParser::consumeLegacyTextOrientation(bool important)
+{
+    // -webkit-text-orientation is a legacy shorthand for text-orientation.
+    // The only difference is that it accepts 'sideways-right', which is mapped into 'sideways'.
+    RefPtr<CSSPrimitiveValue> keyword;
+    auto valueID = m_range.peek().id();
+    if (valueID == CSSValueSidewaysRight) {
+        keyword = CSSValuePool::singleton().createIdentifierValue(CSSValueSideways);
+        consumeIdentRaw(m_range);
+    } else if (CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyTextOrientation, valueID, m_context))
+        keyword = consumeIdent(m_range);
+    if (!keyword || !m_range.atEnd())
+        return false;
+    addProperty(CSSPropertyTextOrientation, CSSPropertyWebkitTextOrientation, keyword.releaseNonNull(), important);
+    return true;
+}
+
 static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParserContext& context, CSSPropertyID property, RefPtr<CSSValue>& resultX, RefPtr<CSSValue>& resultY)
 {
     do {
@@ -6457,6 +6474,8 @@
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
         return consumeLegacyBreakProperty(property, important);
+    case CSSPropertyWebkitTextOrientation:
+        return consumeLegacyTextOrientation(important);
     case CSSPropertyMaskPosition:
     case CSSPropertyWebkitMaskPosition:
     case CSSPropertyBackgroundPosition: {

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (292462 => 292463)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-04-06 14:19:18 UTC (rev 292463)
@@ -117,6 +117,7 @@
     bool consumeFlex(bool important);
 
     bool consumeLegacyBreakProperty(CSSPropertyID, bool important);
+    bool consumeLegacyTextOrientation(bool important);
 
     bool consumeTransformOrigin(bool important);
     bool consumePerspectiveOrigin(bool important);

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (292462 => 292463)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-04-06 13:33:26 UTC (rev 292462)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-04-06 14:19:18 UTC (rev 292463)
@@ -148,7 +148,6 @@
     static void applyInitialTextAlign(BuilderState&);
     static void applyValueTextAlign(BuilderState&, CSSValue&);
     static void applyValueWebkitLocale(BuilderState&, CSSValue&);
-    static void applyValueWebkitTextOrientation(BuilderState&, CSSValue&);
     static void applyValueTextOrientation(BuilderState&, CSSValue&);
 #if ENABLE(TEXT_AUTOSIZING)
     static void applyValueWebkitTextSizeAdjust(BuilderState&, CSSValue&);
@@ -890,11 +889,6 @@
     builderState.style().setHasExplicitlySetWritingMode(true);
 }
 
-inline void BuilderCustom::applyValueWebkitTextOrientation(BuilderState& builderState, CSSValue& value)
-{
-    builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
-}
-
 inline void BuilderCustom::applyValueTextOrientation(BuilderState& builderState, CSSValue& value)
 {
     builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to