Bug 1428276 - Make ExpectedOwnerForChild deal with abs.pos. anon boxes. r=heycam
authorKuoE0 <kuoe0.tw@gmail.com>
Fri, 05 Jan 2018 16:26:01 +0800
changeset 449927 7a30d386b21a20eca4852969885413f606bdbd99
parent 449926 7560a29b0f9755c158996781e2e73b3b3a3d49ee
child 449928 1249a196a5a040f502110a564b591f7784d69a7b
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1428276
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1428276 - Make ExpectedOwnerForChild deal with abs.pos. anon boxes. r=heycam For an OOF frame, the parent frame that's associated with our parent style context is the *placeholder's* parent -- not the OOF frame's parent. MozReview-Commit-ID: CUSBkWDqxWz
layout/base/ServoRestyleManager.cpp
layout/generic/nsIFrame.h
layout/generic/nsIFrameInlines.h
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -102,17 +102,19 @@ ExpectedOwnerForChild(const nsIFrame& aF
   while (parent && (IsAnonBox(*parent) || parent->IsLineFrame())) {
     auto* pseudo = parent->StyleContext()->GetPseudo();
     if (pseudo == nsCSSAnonBoxes::tableWrapper) {
       const nsIFrame* tableFrame = parent->PrincipalChildList().FirstChild();
       MOZ_ASSERT(tableFrame->IsTableFrame());
       // Handle :-moz-table and :-moz-inline-table.
       parent = IsAnonBox(*tableFrame) ? parent->GetParent() : tableFrame;
     } else {
-      parent = parent->GetParent();
+      // We get the in-flow parent here so that we can handle the OOF anonymous
+      // boxed to get the correct parent.
+      parent = parent->GetInFlowParent();
     }
     parent = FirstContinuationOrPartOfIBSplit(parent);
   }
 
   return parent;
 }
 
 void
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -883,17 +883,17 @@ public:
    * Accessor functions for geometric parent.
    */
   nsContainerFrame* GetParent() const { return mParent; }
 
   /**
    * Gets the parent of a frame, using the parent of the placeholder for
    * out-of-flow frames.
    */
-  inline nsContainerFrame* GetInFlowParent();
+  inline nsContainerFrame* GetInFlowParent() const;
 
   /**
    * Gets the primary frame of the Content's flattened tree
    * parent, if one exists.
    */
   nsIFrame* GetFlattenedTreeParentPrimaryFrame() const;
 
   /**
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -165,17 +165,17 @@ nsIFrame::PropagateRootElementWritingMod
 {
   MOZ_ASSERT(IsCanvasFrame());
   for (auto f = this; f; f = f->GetParent()) {
     f->mWritingMode = aRootElemWM;
   }
 }
 
 nsContainerFrame*
-nsIFrame::GetInFlowParent()
+nsIFrame::GetInFlowParent() const
 {
   if (GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
     nsIFrame* ph = FirstContinuation()->GetProperty(nsIFrame::PlaceholderFrameProperty());
     return ph->GetParent();
   }
 
   return GetParent();
 }