Unprefix -webkit-text-orientation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2020 20:12:54 +0000 (20:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2020 20:12:54 +0000 (20:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196139

Source/WebCore:

Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25
Reviewed by Myles C. Maxfield

In order to unprefix -webkit-text-orientation to be text-orientation,
a new property, "text-orientation" is added to CSSProperties.json.
I didn't use alias because the prefixed version still supports non-standard values,
and we want the unprefixed version to strictly follow the specs.
However only adding a new property is not enough because -webkit-text-orientation
is a high-priority property, and without extra logic, the CSS property
"last-one-wins" ordering rule cannot be enforced because high-priority properties
are applied to elements in the order they appear in the generated CSSPropertyNames.cpp file.
Therefore a codegen flag, "related-property" is added to both
-webkit-text-orientation and text-orientation to point to each other,
so that when applying high priorities, the algorithm will know that the
two properties are modifying the same style of the element (in our case, text orientation)
and thus the CSS property "last-one-wins" ordering rule will take effect.

This code change also helps future developments when we want to unprefix other high-priority properties.

Tests: fast/text/orientation-inheritance.html
       fast/text/orientation-mixed-unprefix.html
       fast/text/orientation-sideways-prefix-unprefix.html
       fast/text/orientation-sideways-unprefix.html
       fast/text/orientation-upright-unprefix.html
       fast/text/test-orientation-parsing-001.html
       fast/text/text-orientation-parse-competition.html
       fast/text/text-orientation-parse.html
       imported/w3c/web-platform-tests/css/css-writing-modes/text-orientation-parsing-001.html

* css/CSSComputedStyleDeclaration.cpp:
    - added support for parsing "text-orientation"
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
    - added a new RenderStyle, CSSPropertyTextOrientation
* css/CSSProperties.json:
    - added a new codegen property, "related-property"
* css/makeprop.pl:
    - added new rules for generating code to parse related properties
(addProperty):
    - inserts new rule in the generated code to parse related properties
* css/parser/CSSParserFastPaths.cpp:
    - Specified the CSS property values that the unprefixed "text-orientation" can take
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
    - Only supports the standard values for text-orientation
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
    - Added switch case value CSSPropertyTextOrientation
* css/parser/CSSParserImpl.cpp:
    - Added rules to treat related properties differently
(WebCore::filterProperties):
    - For related rules that are also high priority,
      if we saw one in the property list, we will mark all the related property
      as seen, in order to enforce the "last-one-wins" ordering rule
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueTextOrientation):
    - added functionality to parse the newly added "text-orientation" property

Tools:

Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25
Reviewed by Myles C. Maxfield.

This change is made to add the extra flag "related-property" in CSSProperty.json
in the jsonchecker so that the jsonchecker would not complain about unrecognized key

* Scripts/webkitpy/style/checkers/jsonchecker.py: added check for related-property
(JSONCSSPropertiesChecker.check_codegen_properties):

LayoutTests:

Added test cases to check that Webkit can now parse text-orientation correctly,
as well as that the precedence rule for CSS property still applies when both
-webkit-text-orientation and text-orientation property are present, the second
one takes precedence.

Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25
Reviewed by Myles C. Maxfield

* fast/text/orientation-inheritance-expected.html: Added.
* fast/text/orientation-inheritance.html: Added.
* fast/text/orientation-mixed-unprefix-expected.html: Added.
* fast/text/orientation-mixed-unprefix.html: Added.
* fast/text/orientation-sideways-prefix-unprefix-expected.html: Added.
* fast/text/orientation-sideways-prefix-unprefix.html: Added.
* fast/text/orientation-sideways-unprefix-expected.html: Added.
* fast/text/orientation-sideways-unprefix.html: Added.
* fast/text/orientation-upright-unprefix-expected.html: Added.
* fast/text/orientation-upright-unprefix.html: Added.
* fast/text/test-orientation-parsing-001-expected.txt: Added.
* fast/text/test-orientation-parsing-001.html: Added.
* fast/text/text-orientation-parse-competition-expected.txt: Added.
* fast/text/text-orientation-parse-competition.html: Added.
* fast/text/text-orientation-parse-expected.txt: Added.
* fast/text/text-orientation-parse.html: Added.
* fast/text/text-orientation-parse-stylesheet-expected.txt: Added.
* fast/text/text-orientation-parse-stylesheet.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/orientation-inheritance-expected.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-inheritance.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-mixed-unprefix-expected.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-mixed-unprefix.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-sideways-prefix-unprefix-expected.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-sideways-prefix-unprefix.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-sideways-unprefix-expected.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-sideways-unprefix.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-upright-unprefix-expected.html [new file with mode: 0644]
LayoutTests/fast/text/orientation-upright-unprefix.html [new file with mode: 0644]
LayoutTests/fast/text/test-orientation-parsing-001-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/test-orientation-parsing-001.html [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse-competition-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse-competition.html [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse-stylesheet.html [new file with mode: 0644]
LayoutTests/fast/text/text-orientation-parse.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/parsing/text-orientation-valid-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/text-orientation-parsing-001-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/text-orientation-parsing-sideways-right-001-expected.txt
LayoutTests/imported/w3c/web-platform-tests/svg/styling/required-properties-expected.txt
LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSProperties.json
Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
Source/WebCore/css/makeprop.pl
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSParserImpl.cpp
Source/WebCore/style/StyleBuilderCustom.h
Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/jsonchecker.py

index 26e098e..f83a62f 100644 (file)
@@ -1,3 +1,34 @@
+2020-03-25  Frank Yang  <guowei_yang@apple.com>
+
+        Unprefix -webkit-text-orientation
+        https://bugs.webkit.org/show_bug.cgi?id=196139
+
+        Added test cases to check that Webkit can now parse text-orientation correctly, 
+        as well as that the precedence rule for CSS property still applies when both 
+        -webkit-text-orientation and text-orientation property are present, the second 
+        one takes precedence. 
+
+        Reviewed by Myles C. Maxfield
+
+        * fast/text/orientation-inheritance-expected.html: Added.
+        * fast/text/orientation-inheritance.html: Added.
+        * fast/text/orientation-mixed-unprefix-expected.html: Added.
+        * fast/text/orientation-mixed-unprefix.html: Added.
+        * fast/text/orientation-sideways-prefix-unprefix-expected.html: Added.
+        * fast/text/orientation-sideways-prefix-unprefix.html: Added.
+        * fast/text/orientation-sideways-unprefix-expected.html: Added.
+        * fast/text/orientation-sideways-unprefix.html: Added.
+        * fast/text/orientation-upright-unprefix-expected.html: Added.
+        * fast/text/orientation-upright-unprefix.html: Added.
+        * fast/text/test-orientation-parsing-001-expected.txt: Added.
+        * fast/text/test-orientation-parsing-001.html: Added.
+        * fast/text/text-orientation-parse-competition-expected.txt: Added.
+        * fast/text/text-orientation-parse-competition.html: Added.
+        * fast/text/text-orientation-parse-expected.txt: Added.
+        * fast/text/text-orientation-parse.html: Added.
+        * fast/text/text-orientation-parse-stylesheet-expected.txt: Added.
+        * fast/text/text-orientation-parse-stylesheet.html: Added.
+
 2020-03-25  Nikos Mouchtaris  <nmouchtaris@apple.com>
 
         Add ref test for apple pay button corner radius change
diff --git a/LayoutTests/fast/text/orientation-inheritance-expected.html b/LayoutTests/fast/text/orientation-inheritance-expected.html
new file mode 100644 (file)
index 0000000..1b52770
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       </head>
+       <body>
+               This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+               <div id="placeholder"></div>
+               <div style="text-orientation: upright;">
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!   
+                               </div>  
+                       </div>
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: mixed;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!   
+                               </div>  
+                       </div>
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: upright;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!
+                               </div>  
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-inheritance.html b/LayoutTests/fast/text/orientation-inheritance.html
new file mode 100644 (file)
index 0000000..0aa8ce9
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       </head>
+       <body>
+               This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+               <div id="placeholder"></div>
+               <div style="text-orientation: upright;">
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!   
+                               </div>  
+                       </div>
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: mixed;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!   
+                               </div>  
+                       </div>
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: upright;">苹果公司 abcd  
+                               <div>
+                                       你好 Hello World!
+                               </div>  
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-mixed-unprefix-expected.html b/LayoutTests/fast/text/orientation-mixed-unprefix-expected.html
new file mode 100644 (file)
index 0000000..f07a1eb
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: mixed;">苹果公司abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-mixed-unprefix.html b/LayoutTests/fast/text/orientation-mixed-unprefix.html
new file mode 100644 (file)
index 0000000..5f24b91
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: mixed;">苹果公司abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-sideways-prefix-unprefix-expected.html b/LayoutTests/fast/text/orientation-sideways-prefix-unprefix-expected.html
new file mode 100644 (file)
index 0000000..1cff1b0
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+       </head>
+       <body>
+               This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+               <div id="placeholder"></div>
+               <div style="text-orientation: upright;">
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways;">苹果公司 abcd</div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-sideways-prefix-unprefix.html b/LayoutTests/fast/text/orientation-sideways-prefix-unprefix.html
new file mode 100644 (file)
index 0000000..5e1693e
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+       </head>
+       <body>
+               This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+               <div id="placeholder"></div>
+               <div style="text-orientation: upright;">
+                       <div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: upright; text-orientation: sideways;">苹果公司 abcd</div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-sideways-unprefix-expected.html b/LayoutTests/fast/text/orientation-sideways-unprefix-expected.html
new file mode 100644 (file)
index 0000000..d0a268b
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways;">苹果公司 abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-sideways-unprefix.html b/LayoutTests/fast/text/orientation-sideways-unprefix.html
new file mode 100644 (file)
index 0000000..7eeacba
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;">苹果公司 abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-upright-unprefix-expected.html b/LayoutTests/fast/text/orientation-upright-unprefix-expected.html
new file mode 100644 (file)
index 0000000..82bcd04
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: upright;">abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/orientation-upright-unprefix.html b/LayoutTests/fast/text/orientation-upright-unprefix.html
new file mode 100644 (file)
index 0000000..c59a9c2
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+</head>
+<body>
+This test makes sure that text-orientation: sideways is treated the same as text-orientation: sideways-right.
+<div id="placeholder"></div>
+<div style="text-orientation: upright;">
+<div id="t" style="-webkit-writing-mode: vertical-rl; text-orientation: upright;">abcd</div>
+</div>
+<script>
+var t = document.getElementById("t");
+var receiver = document.getElementById("placeholder");
+receiver.textContent = window.getComputedStyle(t).getPropertyValue("-webkit-text-orientation");
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/test-orientation-parsing-001-expected.txt b/LayoutTests/fast/text/test-orientation-parsing-001-expected.txt
new file mode 100644 (file)
index 0000000..aeaf4d8
--- /dev/null
@@ -0,0 +1,11 @@
+PASS window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test7')).webkitTextOrientation is "upright"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/test-orientation-parsing-001.html b/LayoutTests/fast/text/test-orientation-parsing-001.html
new file mode 100644 (file)
index 0000000..aba1f65
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       <script src="../../resources/js-test-pre.js"></script>
+       </head>
+       <body>
+               <div
+                 data-expected="mixed" title="text-orientation initial value"></div>
+
+               <div id="test1" style="text-orientation: upright"
+                 data-expected="upright"></div>
+               <div id="test2" style="text-orientation: sideways"
+                 data-expected="sideways"></div>
+
+               <div id="test3" style="text-orientation: upright">
+                 <div
+                   data-expected="upright" title="text-orientation should inherit"></div>
+
+                 <div id="test4" style="text-orientation: mixed"
+                   data-expected="mixed"></div>
+
+                 <div id="test5" style="text-orientation: initial"
+                   data-expected="mixed"></div>
+                 <div id="test6" style="text-orientation: inherit"
+                   data-expected="upright"></div>
+
+                 <div id="test7" style="text-orientation: foo"
+                   data-expected="upright"></div>
+               </div>
+
+
+
+
+               <script>
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).webkitTextOrientation", "upright");
+               </script>
+
+               <script src="../../resources/js-test-post.js"></script>
+       </body>
+</html>
diff --git a/LayoutTests/fast/text/text-orientation-parse-competition-expected.txt b/LayoutTests/fast/text/text-orientation-parse-competition-expected.txt
new file mode 100644 (file)
index 0000000..6a6ab1d
--- /dev/null
@@ -0,0 +1,9 @@
+PASS window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test1')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test2')).textOrientation is "upright"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+你好ABC
+你好ABC
diff --git a/LayoutTests/fast/text/text-orientation-parse-competition.html b/LayoutTests/fast/text/text-orientation-parse-competition.html
new file mode 100644 (file)
index 0000000..1080b72
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       <meta charset="utf-8">
+       <script src="../../resources/js-test-pre.js"></script>
+       </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>
+               <script>
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).textOrientation", "upright");
+               </script>
+               <script src="../../resources/js-test-post.js"></script>
+       </body>
+</html>
diff --git a/LayoutTests/fast/text/text-orientation-parse-expected.txt b/LayoutTests/fast/text/text-orientation-parse-expected.txt
new file mode 100644 (file)
index 0000000..a07e1b9
--- /dev/null
@@ -0,0 +1,58 @@
+PASS window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test7')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test8')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test9')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test10')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test11')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test12')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test13')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test14')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test15')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test16')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test17')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test18')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test19')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test20')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test21')).webkitTextOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test22')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test23')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test24')).webkitTextOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test25')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test26')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test27')).webkitTextOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test1')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test2')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test3')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test4')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test5')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test6')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test7')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test8')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test9')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test10')).textOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test11')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test12')).textOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test13')).textOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test14')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test15')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test16')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test17')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test18')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test19')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test20')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test21')).textOrientation is "mixed"
+PASS window.getComputedStyle(document.getElementById('test22')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test23')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test24')).textOrientation is "upright"
+PASS window.getComputedStyle(document.getElementById('test25')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test26')).textOrientation is "sideways"
+PASS window.getComputedStyle(document.getElementById('test27')).textOrientation is "sideways"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt b/LayoutTests/fast/text/text-orientation-parse-stylesheet-expected.txt
new file mode 100644 (file)
index 0000000..a525241
--- /dev/null
@@ -0,0 +1,16 @@
+PASS document.getElementById('test1').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "upright"
+PASS document.getElementById('test2').sheet.cssRules[0].style.getPropertyValue('text-orientation') is "upright"
+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('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"
+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 successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/text-orientation-parse-stylesheet.html b/LayoutTests/fast/text/text-orientation-parse-stylesheet.html
new file mode 100644 (file)
index 0000000..5c52423
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       <script src="../../resources/js-test-pre.js"></script>
+       </head>
+       <body>
+
+               <style id="test1"> dummy { text-orientation: upright; -webkit-text-orientation: sideways; text-orientation: upright;} </style>
+               <style id="test2"> dummy { text-orientation: upright;} </style>
+               <style id="test3"> dummy { -webkit-text-orientation: upright;} </style>
+               <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>
+
+               <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");
+                       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('test1').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "upright");
+                       shouldBeEqualToString("document.getElementById('test2').sheet.cssRules[0].style.getPropertyValue('-webkit-text-orientation')", "upright");
+                       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");
+
+
+               </script>
+
+               <script src="../../resources/js-test-post.js"></script>
+       </body>
+</html>
diff --git a/LayoutTests/fast/text/text-orientation-parse.html b/LayoutTests/fast/text/text-orientation-parse.html
new file mode 100644 (file)
index 0000000..bee70de
--- /dev/null
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+<html>
+       <head>
+       <script src="../../resources/js-test-pre.js"></script>
+       </head>
+       <body>
+               <div style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;">
+                       <div id="test1"></div>
+                       <div id="test2" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;"></div>
+                       <div id="test3" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;"></div>
+                       <div id="test4" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;"></div>
+                       <div id="test5" style="-webkit-writing-mode: vertical-rl; text-orientation: upright;">
+                               <div id="test6"></div>
+                               <div id="test7" style="text-orientation: upright;">
+                                       <div id="test8">
+                                               <div id="test9"></div>
+                                       </div>
+                                       <div id="test10" style="text-orientation: mixed;"></div>
+                               </div>
+                       </div>
+                       <div id="test11" style="-webkit-text-orientation: upright; text-orientation: sideways;"></div> 
+               </div>
+
+
+               <div id="test12" style="-webkit-writing-mode: vertical-rl;">
+                       <div id="test13"></div>
+               </div>
+
+
+               <div style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways;">
+                       <div id="test14"></div>
+                       <div id="test15" style="-webkit-writing-mode: vertical-rl; text-orientation: sideways;"></div>
+                       <div id="test16" style="-webkit-writing-mode: vertical-rl; text-orientation: upright;">
+                               <div id="test17"></div>
+                               <div id="test18" style="text-orientation: upright;">
+                                       <div id="test19">
+                                               <div id="test20"></div>
+                                       </div>
+                                       <div id="test21" style="text-orientation: mixed;"></div>
+                               </div>
+                       <div id="test22" style="-webkit-text-orientation: upright; text-orientation: sideways;"></div> 
+                       </div>
+               </div>
+
+
+               <div style="-webkit-writing-mode: vertical-rl; -webkit-text-orientation: sideways; text-orientation: upright">
+                       <div id="test23">
+                               <div id="test24"></div>
+                       </div>
+               </div>
+
+               <div id="test25" style="-webkit-writing-mode: vertical-rl;  text-orientation: upright; -webkit-text-orientation: sideways;">
+                       <div id="test26">
+                               <div id="test27"></div>
+                       </div>
+               </div>
+
+
+
+               <script>
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).webkitTextOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).webkitTextOrientation", "sideways");
+
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).webkitTextOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).webkitTextOrientation", "mixed");
+
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).webkitTextOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).webkitTextOrientation", "sideways");
+
+                       
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).webkitTextOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).webkitTextOrientation", "upright");
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test25')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test26')).webkitTextOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test27')).webkitTextOrientation", "sideways");
+
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).textOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).textOrientation", "sideways");
+
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).textOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).textOrientation", "mixed");
+
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).textOrientation", "mixed");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).textOrientation", "sideways");
+
+                       
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).textOrientation", "upright");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).textOrientation", "upright");
+
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test25')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test26')).textOrientation", "sideways");
+                       shouldBeEqualToString("window.getComputedStyle(document.getElementById('test27')).textOrientation", "sideways");
+
+
+               </script>
+
+               <script src="../../resources/js-test-post.js"></script>
+       </body>
+</html>
index a416cd9..1b0b7ac 100644 (file)
@@ -244,6 +244,7 @@ PASS text-decoration-skip
 PASS text-decoration-style 
 PASS text-decoration-thickness 
 PASS text-indent 
+PASS text-orientation 
 PASS text-overflow 
 PASS text-rendering 
 PASS text-shadow 
index 88104d9..5664535 100644 (file)
@@ -1,5 +1,5 @@
 
-FAIL e.style['text-orientation'] = "mixed" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['text-orientation'] = "upright" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['text-orientation'] = "sideways" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['text-orientation'] = "mixed" should set the property value 
+PASS e.style['text-orientation'] = "upright" should set the property value 
+PASS e.style['text-orientation'] = "sideways" should set the property value 
 
index 3d6d83a..aa5fb77 100644 (file)
@@ -1,10 +1,10 @@
 
-FAIL text-orientation initial value assert_equals: expected (string) "mixed" but got (undefined) undefined
-FAIL -webkit-text-orientation: upright assert_equals: expected (string) "upright" but got (undefined) undefined
-FAIL -webkit-text-orientation: sideways assert_equals: expected (string) "sideways" but got (undefined) undefined
-FAIL text-orientation should inherit assert_equals: expected (string) "upright" but got (undefined) undefined
-FAIL -webkit-text-orientation: mixed assert_equals: expected (string) "mixed" but got (undefined) undefined
-FAIL -webkit-text-orientation: initial assert_equals: expected (string) "mixed" but got (undefined) undefined
-FAIL -webkit-text-orientation: inherit assert_equals: expected (string) "upright" but got (undefined) undefined
-FAIL -webkit-text-orientation: foo assert_equals: expected (string) "upright" but got (undefined) undefined
+PASS text-orientation initial value 
+PASS -webkit-text-orientation: upright 
+PASS -webkit-text-orientation: sideways 
+PASS text-orientation should inherit 
+PASS -webkit-text-orientation: mixed 
+PASS -webkit-text-orientation: initial 
+PASS -webkit-text-orientation: inherit 
+PASS -webkit-text-orientation: foo 
 
index b9cb05d..f96623f 100644 (file)
@@ -67,7 +67,7 @@ PASS Property "text-decoration-color" is supported
 PASS Property "text-decoration-line" is supported 
 PASS Property "text-decoration-style" is supported 
 PASS Property "text-indent" is supported 
-FAIL Property "text-orientation" is supported assert_true: expected true got false
+PASS Property "text-orientation" is supported 
 PASS Property "text-overflow" is supported 
 PASS Property "text-rendering" is supported 
 FAIL Property "text-space-collapse" is supported assert_true: expected true got false
index 8107701..f682e57 100644 (file)
@@ -1,3 +1,62 @@
+2020-03-25  Frank Yang  <guowei_yang@apple.com>
+
+        Unprefix -webkit-text-orientation
+        https://bugs.webkit.org/show_bug.cgi?id=196139
+
+        Reviewed by Myles C. Maxfield
+
+        In order to unprefix -webkit-text-orientation to be text-orientation, 
+        a new property, "text-orientation" is added to CSSProperties.json. 
+        I didn't use alias because the prefixed version still supports non-standard values, 
+        and we want the unprefixed version to strictly follow the specs.
+        However only adding a new property is not enough because -webkit-text-orientation
+        is a high-priority property, and without extra logic, the CSS property 
+        "last-one-wins" ordering rule cannot be enforced because high-priority properties 
+        are applied to elements in the order they appear in the generated CSSPropertyNames.cpp file. 
+        Therefore a codegen flag, "related-property" is added to both 
+        -webkit-text-orientation and text-orientation to point to each other, 
+        so that when applying high priorities, the algorithm will know that the 
+        two properties are modifying the same style of the element (in our case, text orientation)
+        and thus the CSS property "last-one-wins" ordering rule will take effect. 
+
+        This code change also helps future developments when we want to unprefix other high-priority properties.
+
+        Tests: fast/text/orientation-inheritance.html
+               fast/text/orientation-mixed-unprefix.html
+               fast/text/orientation-sideways-prefix-unprefix.html
+               fast/text/orientation-sideways-unprefix.html
+               fast/text/orientation-upright-unprefix.html
+               fast/text/test-orientation-parsing-001.html
+               fast/text/text-orientation-parse-competition.html
+               fast/text/text-orientation-parse.html
+               imported/w3c/web-platform-tests/css/css-writing-modes/text-orientation-parsing-001.html
+
+        * css/CSSComputedStyleDeclaration.cpp: 
+            - added support for parsing "text-orientation"
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+            - added a new RenderStyle, CSSPropertyTextOrientation 
+        * css/CSSProperties.json: 
+            - added a new codegen property, "related-property"
+        * css/makeprop.pl: 
+            - added new rules for generating code to parse related properties
+        (addProperty):
+            - inserts new rule in the generated code to parse related properties
+        * css/parser/CSSParserFastPaths.cpp:
+            - Specified the CSS property values that the unprefixed "text-orientation" can take
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+            - Only supports the standard values for text-orientation
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+            - Added switch case value CSSPropertyTextOrientation
+        * css/parser/CSSParserImpl.cpp: 
+            - Added rules to treat related properties differently
+        (WebCore::filterProperties):
+            - For related rules that are also high priority, 
+              if we saw one in the property list, we will mark all the related property 
+              as seen, in order to enforce the "last-one-wins" ordering rule
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyValueTextOrientation):
+            - added functionality to parse the newly added "text-orientation" property
+
 2020-03-25  Simon Fraser  <simon.fraser@apple.com>
 
         Remove CompositingChangeRepaint which was always CompositingChangeRepaintNow
index 180e4dd..af93257 100644 (file)
@@ -3504,6 +3504,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
             return cssValuePool.createValue(style.textCombine());
         case CSSPropertyWebkitTextOrientation:
             return CSSPrimitiveValue::create(style.textOrientation());
+        case CSSPropertyTextOrientation:
+            return CSSPrimitiveValue::create(style.textOrientation());
         case CSSPropertyWebkitLineBoxContain:
             return createLineBoxContainValue(style.lineBoxContain());
         case CSSPropertyAlt:
index ac4146a..258e021 100644 (file)
         "Whether the property needs to be applied before non-high-priority properties",
         "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",
+        "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.",
+        "",
         "* aliases:",
         "An array of the alternative names for this property.",
         "",
             },
             "status": "non-standard"
         },
+        "text-orientation": {
+            "inherited": true,
+            "values": [
+                "sideways",
+                "mixed",
+                "upright"
+            ],
+            "codegen-properties": {
+                "custom": "Value",
+                "related-property": "-webkit-text-orientation",
+                "high-priority": true
+            },
+            "specification": {
+                "category": "css-writing-modes",
+                "url": "https://www.w3.org/TR/css-writing-modes-3/#text-orientation"
+            }
+        },
         "-webkit-text-orientation": {
             "inherited": true,
             "values": [
                 "aliases": [
                     "-epub-text-orientation"
                 ],
+                "related-property": "text-orientation",
                 "custom": "Value",
                 "high-priority": true
             },
index 914bbc9..a5e99fc 100644 (file)
@@ -300,9 +300,14 @@ RefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSS
 String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
 {
     String value = m_propertySet->getPropertyValue(propertyID);
+    CSSPropertyID relatedPropertyID = getRelatedPropertyId(propertyID);
+    String relatedValue = m_propertySet->getPropertyValue(relatedPropertyID);
+        
     if (!value.isEmpty())
         return value;
-
+    if (!relatedValue.isEmpty())
+        return relatedValue;
+    
     return String();
 }
 
index 4ec9ad0..690249d 100755 (executable)
@@ -85,6 +85,7 @@ my %styleBuilderOptions = (
 );
 my %nameToId;
 my %nameToAliases;
+my %relatedProperty;
 
 for my $name (@allNames) {
     my $value = $propertiesHashRef->{$name};
@@ -193,6 +194,8 @@ sub addProperty($$)
                     next;
                 } elsif ($codegenOptionName eq "high-priority") {
                     $nameIsHighPriority{$name} = 1;
+                } elsif ($codegenOptionName eq "related-property") {
+                    $relatedProperty{$name} = $codegenProperties->{"related-property"}
                 } elsif ($codegenOptionName eq "aliases") {
                     $nameToAliases{$name} = $codegenProperties->{"aliases"};
                 } elsif ($styleBuilderOptions{$codegenOptionName}) {
@@ -415,6 +418,24 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID id)
     ASSERT(id != CSSPropertyInvalid);
     return isInheritedPropertyTable[id];
 }
+    
+CSSPropertyID getRelatedPropertyId(CSSPropertyID id)
+{
+    switch(id) {
+EOF
+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 << "EOF";
+    default:
+        return CSSPropertyID::CSSPropertyInvalid;
+    }
+}
 
 Vector<String> CSSProperty::aliasesForProperty(CSSPropertyID id)
 {
@@ -531,6 +552,7 @@ const char* getPropertyName(CSSPropertyID);
 const WTF::AtomString& getPropertyNameAtomString(CSSPropertyID id);
 WTF::String getPropertyNameString(CSSPropertyID id);
 WTF::String getJSPropertyName(CSSPropertyID);
+CSSPropertyID getRelatedPropertyId(CSSPropertyID id);
 
 inline CSSPropertyID convertToCSSPropertyID(int value)
 {
index 0a934d4..bb5d306 100644 (file)
@@ -668,6 +668,8 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
 #endif
     case CSSPropertyWebkitTextOrientation: // mixed | upright | sideways | sideways-right
         return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways || valueID == CSSValueSidewaysRight;
+    case CSSPropertyTextOrientation:
+        return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways;
     case CSSPropertyTextOverflow: // clip | ellipsis
         return valueID == CSSValueClip || valueID == CSSValueEllipsis;
     case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision
@@ -869,6 +871,7 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyResize:
     case CSSPropertyTableLayout:
     case CSSPropertyTextAlign:
+    case CSSPropertyTextOrientation:
     case CSSPropertyTextOverflow:
     case CSSPropertyTextRendering:
     case CSSPropertyTextTransform:
@@ -943,7 +946,6 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
     // case CSSPropertyTextCombineUpright:
     // case CSSPropertyTextDecorationStyle:
     // case CSSPropertyTextJustify:
-    // case CSSPropertyTextOrientation:
     // case CSSPropertyUserSelect:
 #if ENABLE(CSS_TRAILING_WORD)
     case CSSPropertyAppleTrailingWord:
index 7fd731d..c7b2f68 100644 (file)
@@ -123,9 +123,16 @@ static inline void filterProperties(bool important, const ParsedPropertyVector&
          // FIXME: Do we need to do anything here?
          } */
         
+
         if (seenProperties.test(propertyIDIndex))
             continue;
-        seenProperties.set(propertyIDIndex);
+        const unsigned relatedPropertyId = getRelatedPropertyId(property.id());
+        if (property.id() != CSSPropertyInvalid && relatedPropertyId != CSSPropertyInvalid) {
+            const unsigned relatedPropertyIDIndex = relatedPropertyId - firstCSSProperty;
+            seenProperties.set(relatedPropertyIDIndex);
+            seenProperties.set(propertyIDIndex);
+        } else
+            seenProperties.set(propertyIDIndex);
 
         output[--unusedEntries] = property;
     }
index c350ee5..e2d65fc 100644 (file)
@@ -133,6 +133,7 @@ public:
     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&);
 #endif
@@ -757,6 +758,11 @@ inline void BuilderCustom::applyValueWebkitTextOrientation(BuilderState& builder
     builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
 }
 
+inline void BuilderCustom::applyValueTextOrientation(BuilderState& builderState, CSSValue& value)
+{
+    builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
+}
+
 #if ENABLE(TEXT_AUTOSIZING)
 inline void BuilderCustom::applyValueWebkitTextSizeAdjust(BuilderState& builderState, CSSValue& value)
 {
index 182564a..b0ad6eb 100644 (file)
@@ -1,3 +1,16 @@
+2020-03-25  Frank Yang  <guowei_yang@apple.com>
+
+        Unprefix -webkit-text-orientation
+        https://bugs.webkit.org/show_bug.cgi?id=196139
+
+        Reviewed by Myles C. Maxfield.
+
+        This change is made to add the extra flag "related-property" in CSSProperty.json
+        in the jsonchecker so that the jsonchecker would not complain about unrecognized key
+
+        * Scripts/webkitpy/style/checkers/jsonchecker.py: added check for related-property
+        (JSONCSSPropertiesChecker.check_codegen_properties): 
+
 2020-03-25  Aakash Jain  <aakash_jain@apple.com>
 
         [ews] commit-queue should comment on bug if it fails to find any modified ChangeLog
index 1977c7f..ba3e628 100644 (file)
@@ -287,6 +287,7 @@ class JSONCSSPropertiesChecker(JSONChecker):
             'longhands': self.validate_array,
             'name-for-methods': self.validate_string,
             'no-default-color': self.validate_boolean,
+            'related-property': self.validate_string,
             'runtime-flag': self.validate_string,
             'setter': self.validate_string,
             'skip-builder': self.validate_boolean,