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 draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 28 Sep 2016 23:53:20 -0700
changeset 418887 4be8ac901e10de20747ed44b889d234646d4b2fd
parent 418456 b1d60f2f68c7cccc96fcf9a2075bb430a500a0f2
child 532444 33518df2fcfb1fe8f8269619ba6d248ecef8ca35
push id30789
push userdholbert@mozilla.com
push dateThu, 29 Sep 2016 06:53:39 +0000
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;
   }