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
--- 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;
}