Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html

Issue 2620383008: Updated independent-inheritance-fast-path.html to test all keywords. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var independent_properties = [ 13 var independent_properties = [
14 // Property name, Value 1, Value 2 14 // Property name, Value 1, Value 2
15 ["pointerEvents", "auto", "all"], 15 ["pointerEvents", ["none", "auto", "stroke", "fill", "painted", "visible", " visibleStroke", "visibleFill", "visiblePainted", "bounding-box", "all"]],
16 ["visibility", "visible", "hidden"], 16 ["visibility", ["visible", "hidden", "collapse"]],
17 ["whiteSpace", "normal", "nowrap"], 17 ["whiteSpace", ["normal", "pre", "pre-wrap", "pre-line", "nowrap"]],
18 ["borderCollapse", "separate", "collapse"], 18 ["borderCollapse", ["separate", "collapse"]],
19 ["emptyCells", "show", "hide"], 19 ["emptyCells", ["show", "hide"]],
20 ["captionSide", "left", "right"], 20 ["captionSide", ["top", "bottom", "left", "right"]],
21 ["listStylePosition", "outside", "inside"], 21 ["listStylePosition", ["outside", "inside"]],
22 ["webkitBoxDirection", "normal", "reverse"], 22 ["webkitBoxDirection", ["normal", "reverse"]],
23 ["webkitPrintColorAdjust", "economy", "exact"], 23 ["webkitPrintColorAdjust", ["economy", "exact"]],
24 ["textTransform", "capitalize", "uppercase"], 24 ["textTransform", ["capitalize", "uppercase", "lowercase", "none"]],
25 ["webkitRtlOrdering", "logical", "visual"], 25 ["webkitRtlOrdering", ["logical", "visual"]],
26 ]; 26 ];
27 27
28 independent_properties.forEach(function(test_data) 28 independent_properties.forEach(function(test_data)
29 { 29 {
30 var propertyName = test_data[0]; 30 var propertyName = test_data[0];
31 var value1 = test_data[1]; 31 var keywords = test_data[1];
32 var value2 = test_data[2]; 32 var num_keywords = keywords.length;
33 // Tests style change propagation for each keyword, verifying there is only a single
34 // style recalc.
35 for (i = 0; i < num_keywords; i++) {
36 var value1 = keywords[i];
37 // Use the next keyword in the list, or if it is the last one, wrap arou nd and
38 // use the first.
39 var value2 = keywords[(i + 1) % num_keywords];
33 40
34 test(function(t) 41 test(function(t)
35 { 42 {
36 if (!window.internals) 43 if (!window.internals)
37 assert_unreached('This test requires window.internals.'); 44 assert_unreached('This test requires window.internals.');
sashab 2017/01/13 01:00:30 How come all this whitespace changed? Was it incor
38 45
39 // Create a nested div structure for the test. 46 // Create a nested div structure for the test.
40 var outer = document.createElement("div"); 47 var outer = document.createElement("div");
41 var inner = document.createElement("div"); 48 var inner = document.createElement("div");
42 var innermost = document.createElement("div"); 49 var innermost = document.createElement("div");
43 testContainer.appendChild(outer); 50 testContainer.appendChild(outer);
44 outer.appendChild(inner); 51 outer.appendChild(inner);
45 inner.appendChild(innermost); 52 inner.appendChild(innermost);
46 53
47 outer.offsetTop; // Force recalc. 54 outer.offsetTop; // Force recalc.
48 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); 55 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0);
49 56
50 // Set the whole container to the first value. 57 // Set the whole container to the first value.
51 testContainer.style[propertyName] = value1; 58 testContainer.style[propertyName] = value1;
52 59
53 // All elements start as the first value. 60 // All elements start as the first value.
54 assert_equals(getComputedStyle(outer)[propertyName], value1); 61 assert_equals(getComputedStyle(outer)[propertyName], value1);
55 assert_equals(getComputedStyle(inner)[propertyName], value1); 62 assert_equals(getComputedStyle(inner)[propertyName], value1);
56 assert_equals(getComputedStyle(innermost)[propertyName], value1); 63 assert_equals(getComputedStyle(innermost)[propertyName], value1);
57 outer.offsetTop; // Force recalc. 64 outer.offsetTop; // Force recalc.
58 65
59 // Changing outer also changes inner and innermost. 66 // Changing outer also changes inner and innermost.
60 outer.style[propertyName] = value2; 67 outer.style[propertyName] = value2;
61 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, " Only outer should be recalced (3 without fast path)"); 68 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only outer should be recalced (3 without fast path)");
62 69
63 assert_equals(getComputedStyle(outer)[propertyName], value2); 70 assert_equals(getComputedStyle(outer)[propertyName], value2);
64 assert_equals(getComputedStyle(inner)[propertyName], value2); 71 assert_equals(getComputedStyle(inner)[propertyName], value2);
65 assert_equals(getComputedStyle(innermost)[propertyName], value2); 72 assert_equals(getComputedStyle(innermost)[propertyName], value2);
66 outer.offsetTop; // Force recalc. 73 outer.offsetTop; // Force recalc.
67 74
68 // Changing inner to value1 changes all its children to that value. 75 // Changing inner to value1 changes all its children to that value.
69 inner.style[propertyName] = value1; 76 inner.style[propertyName] = value1;
70 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, " Only inner should be recalced (2 without fast path)"); 77 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only inner should be recalced (2 without fast path)");
71 78
72 assert_equals(getComputedStyle(outer)[propertyName], value2); 79 assert_equals(getComputedStyle(outer)[propertyName], value2);
73 assert_equals(getComputedStyle(inner)[propertyName], value1); 80 assert_equals(getComputedStyle(inner)[propertyName], value1);
74 assert_equals(getComputedStyle(innermost)[propertyName], value1); 81 assert_equals(getComputedStyle(innermost)[propertyName], value1);
75 outer.offsetTop; // Force recalc. 82 outer.offsetTop; // Force recalc.
76 83
77 // Clear for next test. 84 // Clear for next test.
78 outer.remove(); 85 outer.remove();
79 }, "Changing " + propertyName + ", an independent inherited property, propag ates correctly with a single style recalc."); 86 }, "Changing " + propertyName + ", an independent inherited property, pr opagates correctly with a single style recalc.");
87 }
80 }) 88 })
81 </script> 89 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698