Bug 1322570 Part 3 - Get StyleContext from parent frame in nsFlexContainerFrame::Init(). draft
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 20 Mar 2017 14:12:28 +0800
changeset 504311 1fab92884b75b658a707f34d7b75eaf3967f5507
parent 504310 a4ed86633048f5691eeb3ab4ba67e5de846340df
child 504312 0d7a157692c2e52d068cf600b6c1f2844c30c152
push id50776
push userbmo:tlin@mozilla.com
push dateFri, 24 Mar 2017 06:09:16 +0000
bugs1322570
milestone55.0a1
Bug 1322570 Part 3 - Get StyleContext from parent frame in nsFlexContainerFrame::Init(). In stylo, nsStyleContext::GetParent() is not valid. MozReview-Commit-ID: 5FbgUwobG3U
layout/generic/nsFlexContainerFrame.cpp
--- 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());
   }