Bug 1506687 Part 3: Update test expectations. r=dholbert
☠☠ backed out by 9bff4fddd787 ☠ ☠
authorBrad Werth <bwerth@mozilla.com>
Thu, 15 Nov 2018 16:20:58 +0000
changeset 503069 2788a93e179aff117492e29f911c4449cd101a40
parent 503068 1c3baa04d4ce66c9a8b3428b3d475c73bc07f76b
child 503070 eb3e04662bd5fa6b0bc465501df537adc11c6f9f
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1506687
milestone65.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 1506687 Part 3: Update test expectations. r=dholbert Depends on D11783 Differential Revision: https://phabricator.services.mozilla.com/D11784
dom/flex/test/chrome/test_flex_items.html
--- a/dom/flex/test/chrome/test_flex_items.html
+++ b/dom/flex/test/chrome/test_flex_items.html
@@ -37,36 +37,41 @@
   .white       { background: white;  }
 
   .crossMinMax { min-height: 40px;
                  max-height: 120px; }
 
   .mainMinMax  { min-width: 120px;
                  max-width: 500px; }
 
-  .flexGrow    { flex-grow: 1; }
   .spacer150   { width: 150px;
                  box-sizing: border-box;
                  height: 10px;
                  border: 1px solid teal; }
 
 </style>
 
 <script>
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
-const TEXT_NODE = Node.TEXT_NODE;
-
 function testItemMatchesExpectedValues(item, values, index) {
   if (typeof(values.node) != "undefined") {
     is(item.node, values.node, "Item index " + index + " has expected node.");
   }
 
+  if (typeof(values.mainPosition) != "undefined") {
+    is(item.mainPosition, values.mainPosition, "Item index " + index + " has expected mainPosition.");
+  }
+
+  if (typeof(values.mainSize) != "undefined") {
+    is(item.mainSize, values.mainSize, "Item index " + index + " has expected mainSize.");
+  }
+
   if (typeof(values.mainBaseSize) != "undefined") {
     is(item.mainBaseSize, values.mainBaseSize, "Item index " + index + " has expected mainBaseSize.");
   }
 
   if (typeof(values.mainDeltaSize) != "undefined") {
     is(item.mainDeltaSize, values.mainDeltaSize, "Item index " + index + " has expected mainDeltaSize.");
   }
 
@@ -79,16 +84,24 @@ function testItemMatchesExpectedValues(i
   } else {
     // If we didn't specify an expected mainMaxSize, then it's implied
     // that the max main-size property (max-width/max-height) is at its
     // default "none" value, which our FlexItem API represents as +infinity.
     is(item.mainMaxSize, Number.POSITIVE_INFINITY,
        "Item index " + index + " has expected (default) mainMaxSize.");
   }
 
+  if (typeof(values.crossPosition) != "undefined") {
+    is(item.crossPosition, values.crossPosition, "Item index " + index + " has expected crossPosition.");
+  }
+
+  if (typeof(values.crossSize) != "undefined") {
+    is(item.crossSize, values.crossSize, "Item index " + index + " has expected crossSize.");
+  }
+
   if (typeof(values.crossMinSize) != "undefined") {
     is(item.crossMinSize, values.crossMinSize, "Item index " + index + " has expected crossMinSize.");
   }
 
   if (typeof(values.crossMaxSize) != "undefined") {
     is(item.crossMaxSize, values.crossMaxSize, "Item index " + index + " has expected crossMaxSize.");
   } else {
     // As above for mainMaxSize, no-expected-value implies we expect +infinity.
@@ -125,41 +138,51 @@ function testFlexSanity() {
   let lbElem = document.querySelector(".lastbase");
   let lbElemBoundingRect = lbElem.getBoundingClientRect();
   ok(line.lastBaselineOffset > containerHeight - lbElemBoundingRect.bottom &&
      line.lastBaselineOffset < containerHeight - lbElemBoundingRect.top,
      "Line lastBaselineOffset should land somewhere within the element" +
      "that determines it.");
 
   let expectedValues = [
-    { crossMinSize: 0 },
-    { mainBaseSize: 100,
-      mainDeltaSize: 0 },
-    { crossMinSize: 40,
-      crossMaxSize: 120,
-      mainDeltaSize: 0 },
-    { mainMinSize: 120,
-      mainMaxSize: 500,
-      mainDeltaSize: 0 },
-    { mainMinSize: 120,
-      mainMaxSize: 500,
-      mainBaseSize: 150,
-      mainDeltaSize: 0 },
-    { mainBaseSize:  10,
-      mainMaxSize:   5,
-      mainDeltaSize: 0 },
-    { mainBaseSize: 10,
-      mainMinSize:  15,
-      mainDeltaSize: 0 },
-    { mainBaseSize: 50,
-      mainMaxSize: 10 },
-    { mainBaseSize: 1650,
-      mainMaxSize: 10,
-      mainDeltaSize: 0 },
-    { mainDeltaSize: 0 },
+    { mainPosition:    0,
+      crossMinSize:    0 },
+    { mainPosition:  300,
+      mainBaseSize:  100,
+      mainDeltaSize:   0 },
+    { crossMinSize:   40,
+      crossMaxSize:  120,
+      mainDeltaSize:   0 },
+    { mainMinSize:   120,
+      mainMaxSize:   500,
+      mainDeltaSize:   0 },
+    { mainMinSize:   120,
+      mainMaxSize:   500,
+      mainBaseSize:  150,
+      mainDeltaSize:   0 },
+    { mainSize:        5,
+      mainBaseSize:   10,
+      mainMaxSize:     5,
+      mainDeltaSize:   0 },
+    { mainSize:       15,
+      mainBaseSize:   10,
+      mainMinSize:    15,
+      mainDeltaSize:   0 },
+    { mainSize:       10,
+      mainBaseSize:   50,
+      mainMaxSize:    10 },
+    { crossSize:      20 },
+    { mainSize:       10,
+      mainBaseSize: 1650,
+      mainMaxSize:    10,
+      mainDeltaSize:   0 },
+    { mainDeltaSize:   0 },
+    { crossPosition:  10,
+      crossSize:      40 },
+    { mainSize:       20 },
     { /* final item is anonymous flex item */ },
   ];
 
   let items = line.getItems();
   is(items.length, expectedValues.length,
      "Line should have expected number of items.");
   is(items.length, container.children.length + 1,
      "Line should have as many items as the flex container has child elems, " +
@@ -173,27 +196,21 @@ function testFlexSanity() {
     // - the display:contents element (whose item is its first child)
     // - the final item (which is an anonymous flex item around text)
     if (i < container.children.length) {
       let curElem = container.children[i];
       values.node = (curElem.style.display == "contents"
                      ? curElem.firstElementChild
                      : curElem);
     } else {
-      is(container.lastChild.nodeType, TEXT_NODE,
-         "container's last child should be a text node");
-      values.node = container.lastChild;
+      // The final item should be an anonymous flex item with no node reported.
+      values.node = null;
     }
     testItemMatchesExpectedValues(item, values, i);
   }
-
-  // Check that the delta size of the first item is (roughly) equal to the
-  // actual size minus the base size.
-  isfuzzy(items[0].mainDeltaSize, firstRect.width - items[0].mainBaseSize, 1e-4,
-          "flex-grow item should have expected mainDeltaSize.");
 }
 
 // Test for items in "flex-growing" flex container:
 function testFlexGrowing() {
   let expectedValues = [
     { mainBaseSize:  10,
       mainDeltaSize: 10,
       mainMinSize:   35 },
@@ -230,36 +247,40 @@ function runTests() {
 <body onLoad="runTests();">
   <!-- First flex container to be tested: "flex-sanity".
        We test a few general things, e.g.:
        - accuracy of reported baselines.
        - accuracy of reported flex base size, min/max sizes, & trivial deltas.
        - flex items formation for display:contents subtrees & text nodes.
    -->
   <div id="flex-sanity" class="container">
-    <div class="lime base flexGrow">one line (first)</div>
+    <div class="lime base" style="min-width: 300px">one line (first)</div>
     <div class="yellow lastbase" style="width: 100px">one line (last)</div>
     <div class="orange offset lastbase crossMinMax">two<br/>lines and offset (last)</div>
     <div class="pink offset base mainMinMax">offset (first)</div>
     <!-- Inflexible item w/ content-derived flex base size, which has min/max
          but doesn't violate them: -->
     <div class="tan mainMinMax">
       <div class="spacer150"></div>
     </div>
     <!-- Inflexible item that is trivially clamped to smaller max-width: -->
     <div style="flex: 0 0 10px; max-width: 5px"></div>
     <!-- Inflexible item that is trivially clamped to larger min-width: -->
     <div style="flex: 0 0 10px; min-width: 15px"></div>
     <!-- Item that wants to grow but is trivially clamped to max-width
          below base size: -->
     <div style="flex: 1 1 50px; max-width: 10px"></div>
+    <!-- Item with a fixed cross size: -->
+    <div style="height:20px"></div>
     <div class="clamped-huge-item"></div>
     <div style="display:contents">
       <div class="white">replaced</div>
     </div>
+    <table style="margin-top: 10px"></table>
+    <div style="display:table-cell; width: 20px"></div>
     anon item for text
   </div>
 
   <!-- Second flex container to be tested, with items that grow by specific
        predictable amounts. This ends up triggering 4 passes of the main
        flexbox layout algorithm loop - and note that for each item, we only
        report (via 'mainDeltaSize') the delta that it wanted in the *last pass
        of the loop before that item was frozen*.