Bug 1334403 - Make <caption> inline size stretch again for table flex items. r=dholbert, a=jcristau
authorMats Palmgren <mats@mozilla.com>
Sun, 29 Jan 2017 04:02:59 +0100
changeset 353942 0e5fcab28382aa0dc2db37f34b30e51fc610cbc6
parent 353941 4271550cd0b402cfb44cc0bc4312338582a7418f
child 353943 9ac0e74f530d7f1f0fac6364f1a644b6c9e73381
push id6839
push usercbook@mozilla.com
push dateMon, 30 Jan 2017 14:41:09 +0000
treeherdermozilla-esr52@0f54c5ef73d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, jcristau
bugs1334403
milestone52.0
Bug 1334403 - Make <caption> inline size stretch again for table flex items. r=dholbert, a=jcristau
layout/generic/ReflowInput.cpp
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -2383,18 +2383,22 @@ ReflowInput::InitConstraints(nsPresConte
         computeSizeFlags =
           ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eUseAutoBSize);
       }
 
       nsIFrame* alignCB = mFrame->GetParent();
       nsIAtom* alignCBType = alignCB ? alignCB->GetType() : nullptr;
       if (alignCBType == nsGkAtoms::tableWrapperFrame &&
           alignCB->GetParent()) {
-        alignCB = alignCB->GetParent();
-        alignCBType = alignCB->GetType();
+        auto parentCBType = alignCB->GetParent()->GetType();
+        // XXX grid-specific for now; maybe remove this check after we address bug 799725
+        if (parentCBType == nsGkAtoms::gridContainerFrame) {
+          alignCB = alignCB->GetParent();
+          alignCBType = parentCBType;
+        }
       }
       if (alignCBType == nsGkAtoms::gridContainerFrame) {
         // Shrink-wrap grid items that will be aligned (rather than stretched)
         // in its inline axis.
         auto inlineAxisAlignment = wm.IsOrthogonalTo(cbwm) ?
           mStylePosition->UsedAlignSelf(mFrame->StyleContext()->GetParent()) :
           mStylePosition->UsedJustifySelf(mFrame->StyleContext()->GetParent());
         if ((inlineAxisAlignment != NS_STYLE_ALIGN_STRETCH &&