Bug 1562757 - Call ScrollToVisual for the pres shell of the given scrollable frame in ScrollToShowRect. r=botond
We should also check IsRootContentDocumentCrossProcess instead of IsRootContentDocument there, it will be fixed in bug 1562505. The test case in this commit is almost copied-n-pasted from helper_scroll_into_view_bug1516056.html. Differential Revision: https://phabricator.services.mozilla.com/D36556
This commit is contained in:
@@ -3336,15 +3336,8 @@ static nscoord ComputeWhereToScroll(WhereToScroll aWhereToScroll,
|
||||
* visual viewport.
|
||||
*
|
||||
* This needs to work even if aRect has a width or height of zero.
|
||||
*
|
||||
* Note that, since we are performing a layout scroll, it's possible that
|
||||
* this fnction will sometimes be unsuccessful; the content will move as
|
||||
* fast as it can on the screen using layout viewport scrolling, and then
|
||||
* stop there, even if it could get closer to the desired position by
|
||||
* moving the visual viewport within the layout viewport.
|
||||
*/
|
||||
static void ScrollToShowRect(PresShell* aPresShell,
|
||||
nsIScrollableFrame* aFrameAsScrollable,
|
||||
static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
|
||||
const nsRect& aRect, ScrollAxis aVertical,
|
||||
ScrollAxis aHorizontal, ScrollFlags aScrollFlags) {
|
||||
nsPoint scrollPt = aFrameAsScrollable->GetVisualViewportOffset();
|
||||
@@ -3423,9 +3416,9 @@ static void ScrollToShowRect(PresShell* aPresShell,
|
||||
// the visual viewport in scenarios where there is not enough layout
|
||||
// scroll range.
|
||||
if (aFrameAsScrollable->IsRootScrollFrameOfDocument() &&
|
||||
aPresShell->GetPresContext()->IsRootContentDocument()) {
|
||||
aPresShell->ScrollToVisual(scrollPt, FrameMetrics::eMainThread,
|
||||
scrollMode);
|
||||
frame->PresShell()->GetPresContext()->IsRootContentDocument()) {
|
||||
frame->PresShell()->ScrollToVisual(scrollPt, FrameMetrics::eMainThread,
|
||||
scrollMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3593,8 +3586,7 @@ bool PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame, const nsRect& aRect,
|
||||
|
||||
{
|
||||
AutoWeakFrame wf(container);
|
||||
ScrollToShowRect(this, sf, targetRect, aVertical, aHorizontal,
|
||||
aScrollFlags);
|
||||
ScrollToShowRect(sf, targetRect, aVertical, aHorizontal, aScrollFlags);
|
||||
if (!wf.IsAlive()) {
|
||||
return didScroll;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user