Bug 1322570 Part 3 - Get StyleContext from parent frame in nsFlexContainerFrame::Init().
In stylo, nsStyleContext::GetParent() is not valid.
MozReview-Commit-ID: 5FbgUwobG3U
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -2359,20 +2359,21 @@ nsFlexContainerFrame::Init(nsIContent*
const nsStyleDisplay* styleDisp = StyleContext()->StyleDisplay();
// Figure out if we should set a frame state bit to indicate that this frame
// represents a legacy -webkit-{inline-}box container.
// First, the trivial case: just check "display" directly.
bool isLegacyBox = IsDisplayValueLegacyBox(styleDisp);
// If this frame is for a scrollable element, then it will actually have
- // "display:block", and its *parent* will have the real flex-flavored display
- // value. So in that case, check the parent to find out if we're legacy.
+ // "display:block", and its *parent frame* will have the real
+ // flex-flavored display value. So in that case, check the parent frame to
+ // find out if we're legacy.
if (!isLegacyBox && styleDisp->mDisplay == mozilla::StyleDisplay::Block) {
- nsStyleContext* parentStyleContext = mStyleContext->GetParent();
+ nsStyleContext* parentStyleContext = GetParent()->StyleContext();
NS_ASSERTION(parentStyleContext &&
(mStyleContext->GetPseudo() == nsCSSAnonBoxes::buttonContent ||
mStyleContext->GetPseudo() == nsCSSAnonBoxes::scrolledContent),
"The only way a nsFlexContainerFrame can have 'display:block' "
"should be if it's the inner part of a scrollable or button "
"element");
isLegacyBox = IsDisplayValueLegacyBox(parentStyleContext->StyleDisplay());
}