Bug 1331903 part 3 - Force a recreation of the display subtree after testing each property in test_*_computation.html. r?dbaron draft
authorXidorn Quan <me@upsuper.org>
Thu, 19 Jan 2017 16:49:49 +1100
changeset 463589 29f4830e86491c29495494c5df9ce6490b6c174a
parent 463588 f601c4ad3aca213aa0bb26a9411fd61cbd2d62f6
child 542728 a242a2fe2fe4e9befc7edd00e69c87c599e7d44f
push id42122
push userxquan@mozilla.com
push dateThu, 19 Jan 2017 11:35:42 +0000
reviewersdbaron
bugs1331903
milestone53.0a1
Bug 1331903 part 3 - Force a recreation of the display subtree after testing each property in test_*_computation.html. r?dbaron 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)