OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <div id="testContainer"> | 4 <div id="testContainer"> |
5 <div id="outer"> | 5 <div id="outer"> |
6 <div id="inner"> | 6 <div id="inner"> |
7 <div id="innermost"></div> | 7 <div id="innermost"></div> |
8 </div> | 8 </div> |
9 </div> | 9 </div> |
10 </div> | 10 </div> |
11 <script> | 11 <script> |
12 | 12 |
13 // TODO(napper): Generate this table from CSSProperties.in. | 13 // TODO(napper): Generate this table from CSSProperties.in. |
14 var independent_properties = [ | 14 var independent_properties = [ |
15 // [Property name, [list of valid keywords]]. Each keyword is tested in cons
ecutive pairs. | 15 // [Property name, [list of valid keywords]]. Each keyword is tested in cons
ecutive pairs. |
16 ["pointerEvents", ["none", "auto", "stroke", "fill", "painted", "visible", "
visibleStroke", "visibleFill", "visiblePainted", "bounding-box", "all"]], | 16 ["pointerEvents", ["none", "auto", "stroke", "fill", "painted", "visible", "
visibleStroke", "visibleFill", "visiblePainted", "bounding-box", "all"]], |
17 ["visibility", ["visible", "hidden", "collapse"]], | 17 ["visibility", ["visible", "hidden", "collapse"]], |
18 ["whiteSpace", ["normal", "pre", "pre-wrap", "pre-line", "nowrap"]], | 18 ["whiteSpace", ["normal", "pre", "pre-wrap", "pre-line", "nowrap"]], |
19 ["borderCollapse", ["separate", "collapse"]], | 19 ["borderCollapse", ["separate", "collapse"]], |
20 ["emptyCells", ["show", "hide"]], | 20 ["emptyCells", ["show", "hide"]], |
21 ["captionSide", ["top", "bottom", "left", "right"]], | 21 ["captionSide", ["top", "bottom", "left", "right"]], |
22 ["listStylePosition", ["outside", "inside"]], | 22 ["listStylePosition", ["outside", "inside"]], |
23 ["webkitBoxDirection", ["normal", "reverse"]], | 23 ["webkitBoxDirection", ["normal", "reverse"]], |
24 ["webkitPrintColorAdjust", ["economy", "exact"]], | 24 ["webkitPrintColorAdjust", ["economy", "exact"]], |
25 ["textTransform", ["capitalize", "uppercase", "lowercase", "none"]], | 25 ["textTransform", ["capitalize", "uppercase", "lowercase", "none"]], |
26 ["webkitRtlOrdering", ["logical", "visual"]], | 26 ["webkitRtlOrdering", ["logical", "visual"]], |
| 27 ["textAlign", ["start", "left"]], |
27 ]; | 28 ]; |
28 | 29 |
29 independent_properties.forEach(function(test_data) | 30 independent_properties.forEach(function(test_data) |
30 { | 31 { |
31 var propertyName = test_data[0]; | 32 var propertyName = test_data[0]; |
32 var keywords = test_data[1]; | 33 var keywords = test_data[1]; |
33 var num_keywords = keywords.length; | 34 var num_keywords = keywords.length; |
34 // Tests style change propagation for each keyword, verifying there is only
a single | 35 // Tests style change propagation for each keyword, verifying there is only
a single |
35 // style recalc. | 36 // style recalc. |
36 for (i = 0; i < num_keywords; i++) { | 37 for (i = 0; i < num_keywords; i++) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 76 |
76 // Changing inner to value1 changes all its children to that value. | 77 // Changing inner to value1 changes all its children to that value. |
77 inner.style[propertyName] = value1; | 78 inner.style[propertyName] = value1; |
78 assert_equals(internals.updateStyleAndReturnAffectedElementCount(),
1, "Only inner should be recalced (2 without fast path)"); | 79 assert_equals(internals.updateStyleAndReturnAffectedElementCount(),
1, "Only inner should be recalced (2 without fast path)"); |
79 | 80 |
80 assert_equals(getComputedStyle(outer)[propertyName], value2); | 81 assert_equals(getComputedStyle(outer)[propertyName], value2); |
81 assert_equals(getComputedStyle(inner)[propertyName], value1); | 82 assert_equals(getComputedStyle(inner)[propertyName], value1); |
82 assert_equals(getComputedStyle(innermost)[propertyName], value1); | 83 assert_equals(getComputedStyle(innermost)[propertyName], value1); |
83 outer.offsetTop; // Force recalc. | 84 outer.offsetTop; // Force recalc. |
84 | 85 |
| 86 // Setting inner to value2 and outer to value1 should not propagate
value1 to inner. |
| 87 inner.style[propertyName] = value2; |
| 88 outer.offsetTop; // Force recalc. |
| 89 outer.style[propertyName] = value1; |
| 90 assert_equals(internals.updateStyleAndReturnAffectedElementCount(),
1, "Only outer should be recalced (2 without fast path)"); |
| 91 |
| 92 assert_equals(getComputedStyle(outer)[propertyName], value1); |
| 93 assert_equals(getComputedStyle(inner)[propertyName], value2); |
| 94 assert_equals(getComputedStyle(innermost)[propertyName], value2); |
| 95 outer.offsetTop; // Force recalc. |
| 96 |
85 // Clear for next test. | 97 // Clear for next test. |
86 outer.remove(); | 98 outer.remove(); |
87 }, "Changing " + propertyName + ", an independent inherited property, pr
opagates correctly with a single style recalc."); | 99 }, "Changing " + propertyName + ", an independent inherited property, pr
opagates correctly with a single style recalc."); |
88 } | 100 } |
89 }) | 101 }) |
90 </script> | 102 </script> |
OLD | NEW |