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

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: Added TODO to generate properties table from CSSProperties.in. 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 // TODO(napper): Generate this table from CSSProperties.in.
13 var independent_properties = [ 14 var independent_properties = [
14 // Property name, Value 1, Value 2 15 // Property name, Value 1, Value 2
sashab 2017/01/13 02:03:37 Change this to // Property name, [list of valid k
15 ["pointerEvents", "auto", "all"], 16 ["pointerEvents", ["none", "auto", "stroke", "fill", "painted", "visible", " visibleStroke", "visibleFill", "visiblePainted", "bounding-box", "all"]],
16 ["visibility", "visible", "hidden"], 17 ["visibility", ["visible", "hidden", "collapse"]],
17 ["whiteSpace", "normal", "nowrap"], 18 ["whiteSpace", ["normal", "pre", "pre-wrap", "pre-line", "nowrap"]],
18 ["borderCollapse", "separate", "collapse"], 19 ["borderCollapse", ["separate", "collapse"]],
19 ["emptyCells", "show", "hide"], 20 ["emptyCells", ["show", "hide"]],
20 ["captionSide", "left", "right"], 21 ["captionSide", ["top", "bottom", "left", "right"]],
21 ["listStylePosition", "outside", "inside"], 22 ["listStylePosition", ["outside", "inside"]],
22 ["webkitBoxDirection", "normal", "reverse"], 23 ["webkitBoxDirection", ["normal", "reverse"]],
23 ["webkitPrintColorAdjust", "economy", "exact"], 24 ["webkitPrintColorAdjust", ["economy", "exact"]],
24 ["textTransform", "capitalize", "uppercase"], 25 ["textTransform", ["capitalize", "uppercase", "lowercase", "none"]],
25 ["webkitRtlOrdering", "logical", "visual"], 26 ["webkitRtlOrdering", ["logical", "visual"]],
26 ]; 27 ];
27 28
28 independent_properties.forEach(function(test_data) 29 independent_properties.forEach(function(test_data)
29 { 30 {
30 var propertyName = test_data[0]; 31 var propertyName = test_data[0];
31 var value1 = test_data[1]; 32 var keywords = test_data[1];
32 var value2 = test_data[2]; 33 var num_keywords = keywords.length;
34 // Tests style change propagation for each keyword, verifying there is only a single
35 // style recalc.
36 for (i = 0; i < num_keywords; i++) {
37 var value1 = keywords[i];
38 // Use the next keyword in the list, or if it is the last one, wrap arou nd and
39 // use the first.
40 var value2 = keywords[(i + 1) % num_keywords];
33 41
34 test(function(t) 42 test(function(t)
35 { 43 {
36 if (!window.internals) 44 if (!window.internals)
37 assert_unreached('This test requires window.internals.'); 45 assert_unreached('This test requires window.internals.');
38 46
39 // Create a nested div structure for the test. 47 // Create a nested div structure for the test.
40 var outer = document.createElement("div"); 48 var outer = document.createElement("div");
41 var inner = document.createElement("div"); 49 var inner = document.createElement("div");
42 var innermost = document.createElement("div"); 50 var innermost = document.createElement("div");
43 testContainer.appendChild(outer); 51 testContainer.appendChild(outer);
44 outer.appendChild(inner); 52 outer.appendChild(inner);
45 inner.appendChild(innermost); 53 inner.appendChild(innermost);
46 54
47 outer.offsetTop; // Force recalc. 55 outer.offsetTop; // Force recalc.
48 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); 56 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0);
49 57
50 // Set the whole container to the first value. 58 // Set the whole container to the first value.
51 testContainer.style[propertyName] = value1; 59 testContainer.style[propertyName] = value1;
52 60
53 // All elements start as the first value. 61 // All elements start as the first value.
54 assert_equals(getComputedStyle(outer)[propertyName], value1); 62 assert_equals(getComputedStyle(outer)[propertyName], value1);
55 assert_equals(getComputedStyle(inner)[propertyName], value1); 63 assert_equals(getComputedStyle(inner)[propertyName], value1);
56 assert_equals(getComputedStyle(innermost)[propertyName], value1); 64 assert_equals(getComputedStyle(innermost)[propertyName], value1);
57 outer.offsetTop; // Force recalc. 65 outer.offsetTop; // Force recalc.
58 66
59 // Changing outer also changes inner and innermost. 67 // Changing outer also changes inner and innermost.
60 outer.style[propertyName] = value2; 68 outer.style[propertyName] = value2;
61 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, " Only outer should be recalced (3 without fast path)"); 69 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only outer should be recalced (3 without fast path)");
62 70
63 assert_equals(getComputedStyle(outer)[propertyName], value2); 71 assert_equals(getComputedStyle(outer)[propertyName], value2);
64 assert_equals(getComputedStyle(inner)[propertyName], value2); 72 assert_equals(getComputedStyle(inner)[propertyName], value2);
65 assert_equals(getComputedStyle(innermost)[propertyName], value2); 73 assert_equals(getComputedStyle(innermost)[propertyName], value2);
66 outer.offsetTop; // Force recalc. 74 outer.offsetTop; // Force recalc.
67 75
68 // Changing inner to value1 changes all its children to that value. 76 // Changing inner to value1 changes all its children to that value.
69 inner.style[propertyName] = value1; 77 inner.style[propertyName] = value1;
70 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, " Only inner should be recalced (2 without fast path)"); 78 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only inner should be recalced (2 without fast path)");
71 79
72 assert_equals(getComputedStyle(outer)[propertyName], value2); 80 assert_equals(getComputedStyle(outer)[propertyName], value2);
73 assert_equals(getComputedStyle(inner)[propertyName], value1); 81 assert_equals(getComputedStyle(inner)[propertyName], value1);
74 assert_equals(getComputedStyle(innermost)[propertyName], value1); 82 assert_equals(getComputedStyle(innermost)[propertyName], value1);
75 outer.offsetTop; // Force recalc. 83 outer.offsetTop; // Force recalc.
76 84
77 // Clear for next test. 85 // Clear for next test.
78 outer.remove(); 86 outer.remove();
79 }, "Changing " + propertyName + ", an independent inherited property, propag ates correctly with a single style recalc."); 87 }, "Changing " + propertyName + ", an independent inherited property, pr opagates correctly with a single style recalc.");
88 }
80 }) 89 })
81 </script> 90 </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