Bug 1331903 part 3 - Force a recreation of the display subtree after testing each property in test_*_computation.html. r=heycam
authorXidorn Quan <me@upsuper.org>
Thu, 19 Jan 2017 16:49:49 +1100
changeset 375250 4261558b51c923baab40598106189b6c44546f07
parent 375249 dc783cbd753b67ea9b07e5591bbe9ce802b228fd
child 375251 dad8acbe41e952e0b021a59784f45ac81ceb9516
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1331903
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1331903 part 3 - Force a recreation of the display subtree after testing each property in test_*_computation.html. r=heycam MozReview-Commit-ID: 5W1tTBLpxvh
layout/style/test/test_inherit_computation.html
layout/style/test/test_initial_computation.html
layout/style/test/test_value_computation.html
--- a/layout/style/test/test_inherit_computation.html
+++ b/layout/style/test/test_inherit_computation.html
@@ -17,16 +17,17 @@
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for computation of CSS 'inherit' on all properties and 'unset' on
     inherited properties **/
 
+var gDisplayTree = document.getElementById("display");
 // elements without a frame
 var gNParent = document.getElementById("nparent");
 var gNChild = document.getElementById("nchild");
 // elements with a frame
 var gFParent = document.getElementById("fparent");
 var gFChild = document.getElementById("fchild");
 
 var gStyleSheet = document.getElementById("stylesheet").sheet;
@@ -143,16 +144,24 @@ function test_property(property)
 
     if ("prerequisites" in info) {
       var prereqs = info.prerequisites;
       for (var prereq in prereqs) {
         gParentRuleTop.style.removeProperty(prereq);
         gChildRuleTop.style.removeProperty(prereq);
       }
     }
+
+    // FIXME -moz-binding value makes gElementF and its parent loses
+    // their frame. Force it to get recreated after each property.
+    // See bug 1331903.
+    gDisplayTree.style.display = "none";
+    get_computed_value(getComputedStyle(gFChild, ""), "width");
+    gDisplayTree.style.display = "";
+    get_computed_value(getComputedStyle(gFChild, ""), "width");
   });
 }
 
 for (var prop in gCSSProperties) {
   // Skip -moz-binding because it effectively drops the frame.
   if (prop == "-moz-binding") {
     continue;
   }
--- a/layout/style/test/test_initial_computation.html
+++ b/layout/style/test/test_initial_computation.html
@@ -41,16 +41,17 @@
 
 var gBrokenInitial = {
 };
 
 function xfail_initial(property) {
   return property in gBrokenInitial;
 }
 
+var gDisplayTree = document.getElementById("display");
 var gElementN = document.getElementById("elementn");
 var gElementF = document.getElementById("elementf");
 var gStyleSheet = document.getElementById("stylesheet").sheet;
 var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#elementn, #elementf {}", gStyleSheet.cssRules.length)];
 var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#elementn, #elementf {}", gStyleSheet.cssRules.length)];
 
 var gInitialValuesN;
 var gInitialValuesF;
@@ -131,23 +132,22 @@ function test_property(property)
         gInitialPrereqsRuleF.style.removeProperty(prereq);
       }
     }
     if (info.inherited) {
       gElementN.parentNode.style.removeProperty(property);
       gElementF.parentNode.style.removeProperty(property);
     }
 
-    // FIXME: Something (maybe with the -moz-binding values in
-    // test_value_computation.html, but may as well do it here to match)
-    // causes gElementF's frame to get lost.  Force it to get recreated
-    // after each property.
-    gElementF.parentNode.style.display = "none";
+    // FIXME -moz-binding value makes gElementF and its parent loses
+    // their frame. Force it to get recreated after each property.
+    // See bug 1331903.
+    gDisplayTree.style.display = "none";
     get_computed_value(getComputedStyle(gElementF, ""), "width");
-    gElementF.parentNode.style.display = "";
+    gDisplayTree.style.display = "";
     get_computed_value(getComputedStyle(gElementF, ""), "width");
   });
 }
 
 function run_tests() {
   setup_initial_values("unstyledn", "gInitialValuesN", "gInitialPrereqsRuleN");
   setup_initial_values("unstyledf", "gInitialValuesF", "gInitialPrereqsRuleF");
   for (var prop in gCSSProperties)
--- a/layout/style/test/test_value_computation.html
+++ b/layout/style/test/test_value_computation.html
@@ -99,16 +99,17 @@ var gSwapInitialWhenHaveFrame = {
   "width": [ "-moz-available" ],
 };
 
 function swap_when_frame(property, value) {
   return (property in gSwapInitialWhenHaveFrame) &&
          gSwapInitialWhenHaveFrame[property].indexOf(value) != -1;
 }
 
+var gDisplayTree = document.getElementById("display");
 var gElementN = document.getElementById("elementn");
 var gElementF = document.getElementById("elementf");
 var gStyleSheet = document.getElementById("stylesheet").sheet;
 var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#elementn, #elementf {}", gStyleSheet.cssRules.length)];
 var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#elementn, #elementf {}", gStyleSheet.cssRules.length)];
 
 var gInitialValuesN;
 var gInitialValuesF;
@@ -201,22 +202,22 @@ function test_value(property, val, is_in
       gInitialPrereqsRuleF.style.removeProperty(prereq);
     }
   }
   if (info.inherited && is_initial) {
     gElementN.parentNode.style.removeProperty(property);
     gElementF.parentNode.style.removeProperty(property);
   }
 
-  // FIXME: Something (maybe with the -moz-binding values) causes
-  // gElementF's frame to get lost.  Force it to get recreated after
-  // each property.
-  gElementF.parentNode.style.display = "none";
+  // FIXME -moz-binding value makes gElementF and its parent loses
+  // their frame. Force it to get recreated after each property.
+  // See bug 1331903.
+  gDisplayTree.style.display = "none";
   get_computed_value(getComputedStyle(gElementF, ""), "width");
-  gElementF.parentNode.style.display = "";
+  gDisplayTree.style.display = "";
   get_computed_value(getComputedStyle(gElementF, ""), "width");
 }
 
 function test_property(prop) {
   var info = gCSSProperties[prop];
   for (var idx in info.initial_values)
     test_value(prop, info.initial_values[idx], true);
   for (var idx in info.other_values)