Bug 1420722: Just use GetInFlowParent for now. r=mattwoodrow
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 16 Jan 2018 11:19:36 +0100
changeset 453835 5d33d01409e34363b93d1029ce747dd70042c43c
parent 453834 73b38134f4bfd06905370102959ff9a4e701858c
child 453836 e027f4bf3ed2324f094eed7e6fe51a53f05dd355
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1420722
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 1420722: Just use GetInFlowParent for now. r=mattwoodrow display: contents is about to ship in other engines, let's prevent subtle bugs. MozReview-Commit-ID: C8saQnRvRuI
layout/generic/nsFrame.cpp
layout/generic/nsIFrame.h
layout/painting/nsDisplayList.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1597,17 +1597,17 @@ nsIFrame::Extend3DContext(const nsStyleD
          !GetClipPropClipRect(disp, effects, GetSize()) &&
          !nsSVGIntegrationUtils::UsingEffectsForFrame(this);
 }
 
 bool
 nsIFrame::Combines3DTransformWithAncestors(const nsStyleDisplay* aStyleDisplay) const
 {
   MOZ_ASSERT(aStyleDisplay == StyleDisplay());
-  nsIFrame* parent = GetFlattenedTreeParentPrimaryFrame();
+  nsIFrame* parent = GetInFlowParent();
   if (!parent || !parent->Extend3DContext()) {
     return false;
   }
   return IsCSSTransformed(aStyleDisplay) ||
          BackfaceIsHidden(aStyleDisplay);
 }
 
 bool
@@ -2578,19 +2578,19 @@ CheckForApzAwareEventHandlers(nsDisplayL
 /**
  * True if aDescendant participates the context aAncestor participating.
  */
 static bool
 FrameParticipatesIn3DContext(nsIFrame* aAncestor, nsIFrame* aDescendant) {
   MOZ_ASSERT(aAncestor != aDescendant);
   MOZ_ASSERT(aAncestor->Extend3DContext());
   nsIFrame* frame;
-  for (frame = aDescendant->GetFlattenedTreeParentPrimaryFrame();
+  for (frame = aDescendant->GetInFlowParent();
        frame && aAncestor != frame;
-       frame = frame->GetFlattenedTreeParentPrimaryFrame()) {
+       frame = frame->GetInFlowParent()) {
     if (!frame->Extend3DContext()) {
       return false;
     }
   }
   MOZ_ASSERT(frame == aAncestor);
   return true;
 }
 
@@ -6794,26 +6794,16 @@ nsIFrame::GetNearestWidget(nsPoint& aOff
   nsPoint offsetToView;
   nsPoint offsetToWidget;
   nsIWidget* widget =
     GetClosestView(&offsetToView)->GetNearestWidget(&offsetToWidget);
   aOffset = offsetToView + offsetToWidget;
   return widget;
 }
 
-nsIFrame*
-nsIFrame::GetFlattenedTreeParentPrimaryFrame() const
-{
-  if (!GetContent()) {
-    return nullptr;
-  }
-  nsIContent* parent = GetContent()->GetFlattenedTreeParent();
-  return parent ? parent->GetPrimaryFrame() : nullptr;
-}
-
 Matrix4x4
 nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
                              nsIFrame** aOutAncestor,
                              uint32_t aFlags)
 {
   NS_PRECONDITION(aOutAncestor, "Need a place to put the ancestor!");
 
   /* If we're transformed, we want to hand back the combination
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -882,26 +882,24 @@ 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.
+   *
+   * This is effectively the primary frame (or one of the continuations) of the
+   * closest flattened tree ancestor that has a frame (flattened tree ancestors
+   * may not have frames in presence of display: contents).
    */
   inline nsContainerFrame* GetInFlowParent() const;
 
   /**
-   * Gets the primary frame of the Content's flattened tree
-   * parent, if one exists.
-   */
-  nsIFrame* GetFlattenedTreeParentPrimaryFrame() const;
-
-  /**
    * Return the placeholder for this frame (which must be out-of-flow).
    * @note this will only return non-null if |this| is the first-in-flow
    * although we don't assert that here for legacy reasons.
    */
   inline nsPlaceholderFrame* GetPlaceholderFrame() const {
     MOZ_ASSERT(HasAnyStateBits(NS_FRAME_OUT_OF_FLOW));
     return GetProperty(PlaceholderFrameProperty());
   }
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -8215,17 +8215,17 @@ nsDisplayTransform::GetResultingTransfor
     if (ComputePerspectiveMatrix(frame, aAppUnitsPerPixel, perspectiveMatrix)) {
       result *= perspectiveMatrix;
     }
   }
 
   if ((aFlags & INCLUDE_PRESERVE3D_ANCESTORS) &&
       frame && frame->Combines3DTransformWithAncestors()) {
     // Include the transform set on our parent
-    nsIFrame* parentFrame = frame->GetFlattenedTreeParentPrimaryFrame();
+    nsIFrame* parentFrame = frame->GetInFlowParent();
     NS_ASSERTION(parentFrame && parentFrame->IsTransformed() &&
                  parentFrame->Extend3DContext(),
                  "Preserve3D mismatch!");
     FrameTransformProperties props(parentFrame,
                                    aAppUnitsPerPixel,
                                    nullptr);
 
     uint32_t flags = aFlags & (INCLUDE_PRESERVE3D_ANCESTORS|INCLUDE_PERSPECTIVE);
@@ -8441,17 +8441,17 @@ nsDisplayTransform::GetAccumulatedPreser
     if (!IsLeafOf3DContext()) {
       mTransformPreserves3D = GetTransform();
       return mTransformPreserves3D;
     }
 
     const nsIFrame* establisher; // Establisher of the 3D rendering context.
     for (establisher = mFrame;
          establisher && establisher->Combines3DTransformWithAncestors();
-         establisher = establisher->GetFlattenedTreeParentPrimaryFrame()) {
+         establisher = establisher->GetInFlowParent()) {
     }
     const nsIFrame* establisherReference =
       aBuilder->FindReferenceFrameFor(nsLayoutUtils::GetCrossDocParentFrame(establisher));
 
     nsPoint offset = establisher->GetOffsetToCrossDoc(establisherReference);
     float scale = mFrame->PresContext()->AppUnitsPerDevPixel();
     uint32_t flags = INCLUDE_PRESERVE3D_ANCESTORS|INCLUDE_PERSPECTIVE|OFFSET_BY_ORIGIN;
     mTransformPreserves3D =