Skip to content

Commit dcaee9e

Browse files
committed
counter-* properties computed value serialization depends on HashMap iteration order
https://bugs.webkit.org/show_bug.cgi?id=304808 Reviewed by Darin Adler. Converts the `counter-*` properties off of their HashMap value representation via new strong style types that use `FixedVector` to maintain the computed values. For now, the HashMap is also maintained, but is now named to show that it is the `used` representation. To ensure the HashMap and computed value representations stay in sync, a new CSSProperties.json entry was added, `render-style-setter-requires-did-set` which causes the code generator to include a call to a `didSet{property name}` function after setting the value on `Style::ComputedStyle`. For the `counter-*` properties, these are used and call the new `updateUsedCounter*()` functions. By converting to strong style types, we are able to remove the custom style builder, style extractor and style interpolation code. * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-valid.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-valid.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-valid.html: * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/scripts/process-css-properties.py: * Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleComputedStyleProperties+SettersInlines.h: * Source/WebCore/rendering/RenderCounter.cpp: * Source/WebCore/rendering/RenderElement.cpp: * Source/WebCore/rendering/RenderListItem.cpp: * Source/WebCore/rendering/RenderListItem.h: * Source/WebCore/rendering/style/CounterDirectives.h: * Source/WebCore/rendering/style/RenderStyleBase+GettersInlines.h: * Source/WebCore/rendering/style/RenderStyleBase.h: * Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp: * Source/WebCore/rendering/style/StyleRareNonInheritedData.h: * Source/WebCore/style/StyleBuilderCustom.h: * Source/WebCore/style/StyleDifference.cpp: * Source/WebCore/style/StyleExtractorCustom.h: * Source/WebCore/style/StyleInterpolationWrappers.h: * Source/WebCore/style/computed/StyleComputedStyleBase.cpp: * Source/WebCore/style/computed/StyleComputedStyleBase.h: * Source/WebCore/style/computed/StyleComputedStyleProperties+SettersCustomInlines.h: * Source/WebCore/style/values/lists/StyleCounterIncrement.cpp: Added. * Source/WebCore/style/values/lists/StyleCounterIncrement.h: Added. * Source/WebCore/style/values/lists/StyleCounterReset.cpp: Added. * Source/WebCore/style/values/lists/StyleCounterReset.h: Added. * Source/WebCore/style/values/lists/StyleCounterSet.cpp: Added. * Source/WebCore/style/values/lists/StyleCounterSet.h: Added. * Tools/Scripts/webkitpy/style/checkers/jsonchecker.py: Canonical link: https://commits.webkit.org/305086@main
1 parent 5fb0c86 commit dcaee9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+619
-379
lines changed

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-computed-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ PASS Property counter-increment value 'myCounter otherCounter -8'
77
PASS Property counter-increment value 'myCounter 7 otherCounter'
88
PASS Property counter-increment value 'myCounter calc(10 + (sign(2cqw - 10px) * 5))'
99
PASS Property counter-increment value 'myCounter calc(10 + (sign(2cqw - 10px) * 10)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))'
10+
PASS Property counter-increment value 'a 1 b 2 c 3 d 4 e 5'
11+
PASS Property counter-increment value 'a 1 b 2 c 3 a 4 b 5'
1012

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-computed.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
test_computed_value('counter-increment', 'myCounter 7 otherCounter', 'myCounter 7 otherCounter 1');
2929
test_computed_value('counter-increment', 'myCounter calc(10 + (sign(2cqw - 10px) * 5))', 'myCounter 5');
3030
test_computed_value('counter-increment', 'myCounter calc(10 + (sign(2cqw - 10px) * 10)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))', 'myCounter 0 otherCounter 10');
31+
test_computed_value('counter-increment', 'a 1 b 2 c 3 d 4 e 5');
32+
test_computed_value('counter-increment', 'a 1 b 2 c 3 a 4 b 5');
3133
</script>
3234
</body>
3335
</html>

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-valid-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ PASS e.style['counter-increment'] = "first -1 second third 99" should set the pr
66
PASS e.style['counter-increment'] = "section calc(1)" should set the property value
77
PASS e.style['counter-increment'] = "section calc(-2.5)" should set the property value
88
PASS e.style['counter-increment'] = "section calc(10 + (5 * sign(2cqw - 10px)))" should set the property value
9+
PASS e.style['counter-increment'] = "a 1 b 2 c 3 d 4 e 5" should set the property value
10+
PASS e.style['counter-increment'] = "a 1 b 2 c 3 a 4 b 5" should set the property value
911

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-increment-valid.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
test_valid_value('counter-increment', 'section calc(1)');
1919
test_valid_value('counter-increment', 'section calc(-2.5)');
2020
test_valid_value('counter-increment', 'section calc(10 + (5 * sign(2cqw - 10px)))');
21+
test_valid_value('counter-increment', 'a 1 b 2 c 3 d 4 e 5');
22+
test_valid_value('counter-increment', 'a 1 b 2 c 3 a 4 b 5');
2123
</script>
2224
</body>
2325
</html>

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-computed-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ PASS Property counter-reset value 'myCounter otherCounter -8'
77
PASS Property counter-reset value 'myCounter 7 otherCounter'
88
PASS Property counter-reset value 'myCounter calc(10 + (sign(2cqw - 10px) * 5))'
99
PASS Property counter-reset value 'myCounter calc(10 + (sign(2cqw - 10px) * 5)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))'
10+
PASS Property counter-reset value 'a 1 b 2 c 3 d 4 e 5'
11+
PASS Property counter-reset value 'a 1 b 2 c 3 a 4 b 5'
1012

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-computed.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
test_computed_value('counter-reset', 'myCounter 7 otherCounter', 'myCounter 7 otherCounter 0');
2929
test_computed_value('counter-reset', 'myCounter calc(10 + (sign(2cqw - 10px) * 5))', 'myCounter 5');
3030
test_computed_value('counter-reset', 'myCounter calc(10 + (sign(2cqw - 10px) * 5)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))', 'myCounter 5 otherCounter 10');
31+
test_computed_value('counter-reset', 'a 1 b 2 c 3 d 4 e 5');
32+
test_computed_value('counter-reset', 'a 1 b 2 c 3 a 4 b 5');
3133
</script>
3234
</body>
3335
</html>

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-valid-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ FAIL e.style['counter-reset'] = "reversed(first) -1 reversed(second) third 99" s
1212
PASS e.style['counter-reset'] = "section calc(1)" should set the property value
1313
PASS e.style['counter-reset'] = "section calc(-2.5)" should set the property value
1414
PASS e.style['counter-reset'] = "section calc(10 + (5 * sign(2cqw - 10px)))" should set the property value
15+
PASS e.style['counter-reset'] = "a 1 b 2 c 3 d 4 e 5" should set the property value
16+
PASS e.style['counter-reset'] = "a 1 b 2 c 3 a 4 b 5" should set the property value
1517

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-reset-valid.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
test_valid_value('counter-reset', 'section calc(1)');
2525
test_valid_value('counter-reset', 'section calc(-2.5)');
2626
test_valid_value('counter-reset', 'section calc(10 + (5 * sign(2cqw - 10px)))');
27+
test_valid_value('counter-reset', 'a 1 b 2 c 3 d 4 e 5');
28+
test_valid_value('counter-reset', 'a 1 b 2 c 3 a 4 b 5');
2729
</script>
2830
</body>
2931
</html>

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-computed-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ PASS Property counter-set value 'myCounter otherCounter 8'
77
PASS Property counter-set value 'myCounter 7 otherCounter'
88
PASS Property counter-set value 'myCounter calc(10 + (sign(2cqw - 10px) * 5))'
99
PASS Property counter-set value 'myCounter calc(10 + (sign(2cqw - 10px) * 5)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))'
10+
PASS Property counter-set value 'a 1 b 2 c 3 d 4 e 5'
11+
PASS Property counter-set value 'a 1 b 2 c 3 a 4 b 5'
1012

LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/counter-set-computed.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
test_computed_value('counter-set', 'myCounter 7 otherCounter', 'myCounter 7 otherCounter 0');
2929
test_computed_value('counter-set', 'myCounter calc(10 + (sign(2cqw - 10px) * 5))', 'myCounter 5');
3030
test_computed_value('counter-set', 'myCounter calc(10 + (sign(2cqw - 10px) * 5)) otherCounter calc(15 + (sign(2cqw - 10px) * 5))', 'myCounter 5 otherCounter 10');
31+
test_computed_value('counter-set', 'a 1 b 2 c 3 d 4 e 5');
32+
test_computed_value('counter-set', 'a 1 b 2 c 3 a 4 b 5');
3133
</script>
3234
</body>
3335
</html>

0 commit comments

Comments
 (0)