Bug 821449: Marked flex items whose height is stretched (via "align-items/align-self") as having a relative height. r=dbaron
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 26 Dec 2012 12:31:23 -0800
changeset 126167 ecf7bc3e34b3d8a3f09f5f9dfeff9694f12c55bc
parent 126166 0e917dc864c26cca4750542dc8a9e0fd62f63e26
child 126168 8f5e2129e89db8c8205c6fd037b6bf734907178b
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs821449
milestone20.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 821449: Marked flex items whose height is stretched (via "align-items/align-self") as having a relative height. r=dbaron
layout/generic/nsFlexContainerFrame.cpp
layout/reftests/flexbox/flexbox-dyn-changePadding-1b.xhtml
layout/reftests/flexbox/reftest.list
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -2193,16 +2193,18 @@ nsFlexContainerFrame::Reflow(nsPresConte
 
       // Override reflow state's computed cross-size, for stretched items.
       if (curItem.IsStretched()) {
         MOZ_ASSERT(curItem.GetAlignSelf() == NS_STYLE_ALIGN_ITEMS_STRETCH,
                    "stretched item w/o 'align-self: stretch'?");
         if (IsAxisHorizontal(axisTracker.GetCrossAxis())) {
           childReflowState.SetComputedWidth(curItem.GetCrossSize());
         } else {
+          // If this item's height is stretched, it's a relative height.
+          curItem.Frame()->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
           childReflowState.SetComputedHeight(curItem.GetCrossSize());
         }
       }
 
       // XXXdholbert Might need to actually set the correct margins in the
       // reflow state at some point, so that they can be saved on the frame for
       // UsedMarginPropeorty().  Maybe doesn't matter though...?
 
copy from layout/reftests/flexbox/flexbox-dyn-changePadding-1a.xhtml
copy to layout/reftests/flexbox/flexbox-dyn-changePadding-1b.xhtml
--- a/layout/reftests/flexbox/flexbox-dyn-changePadding-1a.xhtml
+++ b/layout/reftests/flexbox/flexbox-dyn-changePadding-1b.xhtml
@@ -1,46 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
      Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/
 -->
 <!--
-    This test checks that we reflow sufficiently when a grandchild of a
+    This test checks that we reflow sufficiently when a stretched, nested
     flex container needs an incremental reflow.  This test should end up
     rendering as a lime square, 100px by 100px.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"
       class="reftest-wait">
   <head>
     <style>
-      #container {
+      #outerContainer {
         display: flex;
-        flex-direction: column;
         width: 100px;
-      }
-      #item {
+        height: 100px;
         background: red;
       }
       #tweakMe {
-        height: 100px;
+        display: flex;
         background: orange;
+        width: 100px;
+        /* height should stretch to fill parent's height, via
+         * parent's "align-items: stretch" (the default) */
+
         padding-left: 1px;
       }
     </style>
     <script>
       function tweak() {
         var tweakMe = document.getElementById("tweakMe");
         tweakMe.style.paddingLeft = "0";
         tweakMe.style.background = "lime";
         document.documentElement.removeAttribute("class");
       }
       window.addEventListener("MozReftestInvalidate", tweak, false);
     </script>
   </head>
   <body>
-    <div id="container">
-      <div id="item">
-        <div id="tweakMe"></div>
-      </div>
+    <div id="outerContainer">
+      <div id="tweakMe"></div>
     </div>
   </body>
 </html>
--- a/layout/reftests/flexbox/reftest.list
+++ b/layout/reftests/flexbox/reftest.list
@@ -55,16 +55,17 @@ fails == flexbox-basic-img-vert-2.xhtml 
 == flexbox-basic-textarea-vert-2.xhtml  flexbox-basic-textarea-vert-2-ref.xhtml
 == flexbox-basic-video-horiz-1.xhtml    flexbox-basic-video-horiz-1-ref.xhtml
 == flexbox-basic-video-horiz-2.xhtml    flexbox-basic-video-horiz-2-ref.xhtml
 == flexbox-basic-video-vert-1.xhtml     flexbox-basic-video-vert-1-ref.xhtml
 fails == flexbox-basic-video-vert-2.xhtml flexbox-basic-video-vert-2-ref.xhtml # bug 794660
 
 # Tests for dynamic modifications of content inside a flex container
 == flexbox-dyn-changePadding-1a.xhtml flexbox-dyn-changePadding-1-ref.xhtml
+== flexbox-dyn-changePadding-1b.xhtml flexbox-dyn-changePadding-1-ref.xhtml
 
 # Tests for dynamic insertions of content into a flex container
 # (with existing [div | span | text] inside the flexbox, and new content
 # inserted adjacent to that existing content.)
 == flexbox-dyn-insertAroundDiv-1.xhtml flexbox-dyn-insertAroundDiv-1-ref.xhtml
 == flexbox-dyn-insertAroundDiv-2.xhtml flexbox-dyn-insertAroundDiv-2-ref.xhtml
 == flexbox-dyn-insertAroundDiv-3.xhtml flexbox-dyn-insertAroundDiv-3-ref.xhtml