haikuwebkit/LayoutTests/fast/text/text-orientation-parse-styl...

37 lines
2.4 KiB
HTML
Raw Permalink Normal View History

Unprefix -webkit-text-orientation 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. Canonical link: https://commits.webkit.org/222487@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-25 20:12:54 +00:00
<!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>