From bf198cf202690c30024879ec5d8bdb956d9fd5b6 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Thu, 18 Aug 2016 19:23:26 -0700 Subject: [PATCH] Backed out 2 changesets (bug 1198135) for e10s reftest assertion failures CLOSED TREE Backed out changeset 05d5dee06384 (bug 1198135) Backed out changeset 0d6ede0caa26 (bug 1198135) --- layout/generic/nsGfxScrollFrame.cpp | 155 +---------------------- layout/generic/nsGfxScrollFrame.h | 7 +- layout/generic/test/mochitest.ini | 1 - layout/generic/test/test_bug1198135.html | 83 ------------ 4 files changed, 2 insertions(+), 244 deletions(-) delete mode 100644 layout/generic/test/test_bug1198135.html diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 8ff77fbafa0e..c9f5a45f3130 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -727,20 +727,13 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowInput* aState, } void -nsHTMLScrollFrame::PlaceScrollArea(ScrollReflowInput& aState, +nsHTMLScrollFrame::PlaceScrollArea(const ScrollReflowInput& aState, const nsPoint& aScrollPosition) { nsIFrame *scrolledFrame = mHelper.mScrolledFrame; // Set the x,y of the scrolled frame to the correct value scrolledFrame->SetPosition(mHelper.mScrollPort.TopLeft() - aScrollPosition); - // Recompute our scrollable overflow, taking perspective children into - // account. Note that this only recomputes the overflow areas stored on the - // helper (which are used to compute scrollable length and scrollbar thumb - // sizes) but not the overflow areas stored on the frame. This seems to work - // for now, but it's possible that we may need to update both in the future. - AdjustForPerspective(aState.mContentsOverflowAreas.ScrollableOverflow()); - nsRect scrolledArea; // Preserve the width or height of empty rects nsSize portSize = mHelper.mScrollPort.Size(); @@ -843,137 +836,6 @@ GetBrowserRoot(nsIContent* aContent) return nullptr; } -// When we have perspective set on the outer scroll frame, and transformed -// children (possibly with preserve-3d) then the effective transform on the -// child depends on the offset to the scroll frame, which changes as we scroll. -// This perspective transform can cause the element to move relative to the -// scrolled inner frame, which would cause the scrollable length changes during -// scrolling if we didn't account for it. Since we don't want scrollHeight/Width -// and the size of scrollbar thumbs to change during scrolling, we compute the -// scrollable overflow by determining the scroll position at which the child -// becomes completely visible within the scrollport rather than using the union -// of the overflow areas at their current position. -void -GetScrollableOverflowForPerspective(nsIFrame* aScrolledFrame, - nsIFrame* aCurrentFrame, - const nsRect aScrollPort, - nsPoint aOffset, - nsRect& aScrolledFrameOverflowArea) -{ - // Iterate over all children except pop-ups. - FrameChildListIDs skip = nsIFrame::kSelectPopupList | nsIFrame::kPopupList; - for (nsIFrame::ChildListIterator childLists(aCurrentFrame); - !childLists.IsDone(); childLists.Next()) { - if (skip.Contains(childLists.CurrentID())) { - continue; - } - - for (nsIFrame* child : childLists.CurrentList()) { - nsPoint offset = aOffset; - - // When we reach a direct child of the scroll, then we record the offset - // to convert from that frame's coordinate into the scroll frame's - // coordinates. Preserve-3d descendant frames use the same offset as their - // ancestors, since TransformRect already converts us into the coordinate - // space of the preserve-3d root. - if (aScrolledFrame == aCurrentFrame) { - offset = child->GetPosition(); - } - - if (child->Extend3DContext()) { - // If we're a preserve-3d frame, then recurse and include our - // descendants since overflow of preserve-3d frames is only included - // in the post-transform overflow area of the preserve-3d root frame. - GetScrollableOverflowForPerspective(aScrolledFrame, child, aScrollPort, - offset, aScrolledFrameOverflowArea); - } - - // If we're transformed, then we want to consider the possibility that - // this frame might move relative to the scrolled frame when scrolling. - // For preserve-3d, leaf frames have correct overflow rects relative to - // themselves. preserve-3d 'nodes' (intermediate frames and the root) have - // only their untransformed children included in their overflow relative - // to self, which is what we want to include here. - if (child->IsTransformed()) { - // Compute the overflow rect for this leaf transform frame in the - // coordinate space of the scrolled frame. - nsPoint scrollPos = aScrolledFrame->GetPosition(); - nsRect preScroll = nsDisplayTransform::TransformRect( - child->GetScrollableOverflowRectRelativeToSelf(), child); - - // Temporarily override the scroll position of the scrolled frame by - // 10 CSS pixels, and then recompute what the overflow rect would be. - // This scroll position may not be valid, but that shouldn't matter - // for our calculations. - aScrolledFrame->SetPosition(scrollPos + nsPoint(600, 600)); - nsRect postScroll = nsDisplayTransform::TransformRect( - child->GetScrollableOverflowRectRelativeToSelf(), child); - aScrolledFrame->SetPosition(scrollPos); - - // Compute how many app units the overflow rects moves by when we adjust - // the scroll position by 1 app unit. - double rightDelta = - (postScroll.XMost() - preScroll.XMost() + 600.0) / 600.0; - double bottomDelta = - (postScroll.YMost() - preScroll.YMost() + 600.0) / 600.0; - - // We can't ever have negative scrolling. - MOZ_ASSERT(rightDelta >= 1.0f && bottomDelta >= 1.0f); - - // Move preScroll into the coordinate space of the scrollport. - preScroll += offset + scrollPos; - - // For each of the four edges of preScroll, figure out how far they - // extend beyond the scrollport. Ignore negative values since that means - // that side is already scrolled in to view and we don't need to add - // overflow to account for it. - nsMargin overhang(std::max(0, aScrollPort.Y() - preScroll.Y()), - std::max(0, preScroll.XMost() - aScrollPort.XMost()), - std::max(0, preScroll.YMost() - aScrollPort.YMost()), - std::max(0, aScrollPort.X() - preScroll.X())); - - // Scale according to rightDelta/bottomDelta to adjust for the different - // scroll rates. - overhang.top /= bottomDelta; - overhang.right /= rightDelta; - overhang.bottom /= bottomDelta; - overhang.left /= rightDelta; - - // Take the base overflow rect that covers just the scrollport. - nsRect overflow(0, 0, aScrollPort.width, aScrollPort.height); - - // Expand it by our margins to get an overflow rect that would allow all - // edges of our transformed content to be scrolled into view. - overflow.Inflate(overhang); - - // Merge it with the combined overflow - aScrolledFrameOverflowArea.UnionRect(aScrolledFrameOverflowArea, - overflow); - } else if (aCurrentFrame == aScrolledFrame) { - aScrolledFrameOverflowArea.UnionRect( - aScrolledFrameOverflowArea, - child->GetScrollableOverflowRectRelativeToParent()); - } - } - } -} - -void -nsHTMLScrollFrame::AdjustForPerspective(nsRect& aScrollableOverflow) -{ - // If we have perspective that is being applied to our children, then - // the effective transform on the child depends on the relative position - // of the child to us and changes during scrolling. - if (!ChildrenHavePerspective()) { - return; - } - aScrollableOverflow.SetEmpty(); - GetScrollableOverflowForPerspective(mHelper.mScrolledFrame, - mHelper.mScrolledFrame, - mHelper.mScrollPort, - nsPoint(), aScrollableOverflow); -} - void nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, @@ -2882,18 +2744,7 @@ ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsIAtom* aOri if (mOuter->ChildrenHavePerspective()) { // The overflow areas of descendants may depend on the scroll position, // so ensure they get updated. - - // First we recompute the overflow areas of the transformed children - // that use the perspective. FinishAndStoreOverflow only calls this - // if the size changes, so we need to do it manually. mOuter->RecomputePerspectiveChildrenOverflow(mOuter); - - // Update the overflow for the scrolled frame to take any changes from the - // children into account. - mScrolledFrame->UpdateOverflow(); - - // Update the overflow for the outer so that we recompute scrollbars. - mOuter->UpdateOverflow(); } ScheduleSyntheticMouseMove(); @@ -4850,10 +4701,6 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState, if (minSize.width > childRect.width) childRect.width = minSize.width; - // TODO: Handle transformed children that inherit perspective - // from this frame. See AdjustForPerspective for how we handle - // this for HTML scroll frames. - aState.SetLayoutFlags(flags); ClampAndSetBounds(aState, childRect, aScrollPosition); mHelper.mScrolledFrame->XULLayout(aState); diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 93c07d931d72..dfee0e24753a 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -687,7 +687,7 @@ public: bool aFirstPass); void ReflowContents(ScrollReflowInput* aState, const ReflowOutput& aDesiredSize); - void PlaceScrollArea(ScrollReflowInput& aState, + void PlaceScrollArea(const ScrollReflowInput& aState, const nsPoint& aScrollPosition); nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext); @@ -710,11 +710,6 @@ public: return mHelper.ComputeCustomOverflow(aOverflowAreas); } - // Recomputes the scrollable overflow area we store in the helper to take children - // that are affected by perpsective set on the outer frame and scroll at different - // rates. - void AdjustForPerspective(nsRect& aScrollableOverflow); - // Called to set the child frames. We typically have three: the scroll area, // the vertical scrollbar, and the horizontal scrollbar. virtual void SetInitialChildList(ChildListID aListID, diff --git a/layout/generic/test/mochitest.ini b/layout/generic/test/mochitest.ini index 219731b07ca3..b356708c00f5 100644 --- a/layout/generic/test/mochitest.ini +++ b/layout/generic/test/mochitest.ini @@ -101,7 +101,6 @@ skip-if = buildapp == 'b2g' # b2g(Target should not have scrolled - got 114.1000 [test_bug970363.html] [test_bug1062406.html] [test_bug1174521.html] -[test_bug1198135.html] [test_contained_plugin_transplant.html] skip-if = os=='win' [test_image_selection.html] diff --git a/layout/generic/test/test_bug1198135.html b/layout/generic/test/test_bug1198135.html deleted file mode 100644 index 2e3cbb1da289..000000000000 --- a/layout/generic/test/test_bug1198135.html +++ /dev/null @@ -1,83 +0,0 @@ - - - -Test for Bug 1198135 - - -Mozilla Bug 1198135 - - - - - -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- - - -