Bug 1306213: When resolving a flex item's "align-self: auto", use the flex container (not style-context parent) as the "align-items" source. r=mats
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 28 Sep 2016 23:53:20 -0700
changeset 315789 d40e2abb42d61e0411135c624f9fba88fe6c85c8
parent 315788 578a4588fb7cb7c6140edeb268c9f0c3cc13edc3
child 315790 7e9f453f768f0fc533f6ace26b06bd8f8324543e
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1306213
milestone52.0a1
Bug 1306213: When resolving a flex item's "align-self: auto", use the flex container (not style-context parent) as the "align-items" source. r=mats (Normally, the style-context parent will *be* the flex container's style context, so this patch won't change behavior at all. But if a flex container has a "display:table" child, then there's an extra style context in the inheritance chain (due to how style inheritance works for nsTableWrapperFrame). And we don't want that extra style context to mess up the ability of a flex container's "align-items" property to actually align the flex items.) MozReview-Commit-ID: GFyxhEwM68S
layout/generic/nsFlexContainerFrame.cpp
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1713,17 +1713,17 @@ FlexItem::FlexItem(ReflowInput& aFlexIte
     // (2) Suppress the ability for flex items to override that with their own
     //     cross-axis alignment. (The legacy box model doesn't support this.)
     // So, each FlexItem simply copies the container's converted "align-items"
     // value and disregards their own "align-self" property.
     const nsStyleXUL* containerStyleXUL = containerRS->mFrame->StyleXUL();
     mAlignSelf = ConvertLegacyStyleToAlignItems(containerStyleXUL);
   } else {
     mAlignSelf = aFlexItemReflowInput.mStylePosition->ComputedAlignSelf(
-                   mFrame->StyleContext()->GetParent());
+                   containerRS->mFrame->StyleContext());
     if (MOZ_LIKELY(mAlignSelf == NS_STYLE_ALIGN_NORMAL)) {
       mAlignSelf = NS_STYLE_ALIGN_STRETCH;
     }
 
     // XXX strip off the <overflow-position> bit until we implement that
     mAlignSelf &= ~NS_STYLE_ALIGN_FLAG_BITS;
   }