Bug 1365830 - Don't flush layout for (0, 0) in nsGlobalWindow::ScrollTo(); r=bzbarsky

Accurate layout information for this operation isn't ever
needed.
This commit is contained in:
Ehsan Akhgari 2017-05-18 00:51:16 -04:00
parent ce1514ce6c
commit 1a146ac9e1

View File

@ -8433,7 +8433,14 @@ nsGlobalWindow::ScrollTo(double aXScroll, double aYScroll)
void
nsGlobalWindow::ScrollTo(const ScrollToOptions& aOptions)
{
FlushPendingNotifications(FlushType::Layout);
// When scrolling to a non-zero offset, we need to determine whether that
// position is within our scrollable range, so we need updated layout
// information which requires a layout flush, otherwise all we need is to
// flush frames to be able to access our scrollable frame here.
FlushType flushType = (aScroll.x || aScroll.y) ?
FlushType::Layout :
FlushType::Frames;
FlushPendingNotifications(flushType);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
@ -8459,7 +8466,14 @@ void
nsGlobalWindow::ScrollTo(const CSSIntPoint& aScroll,
const ScrollOptions& aOptions)
{
FlushPendingNotifications(FlushType::Layout);
// When scrolling to a non-zero offset, we need to determine whether that
// position is within our scrollable range, so we need updated layout
// information which requires a layout flush, otherwise all we need is to
// flush frames to be able to access our scrollable frame here.
FlushType flushType = (aScroll.x || aScroll.y) ?
FlushType::Layout :
FlushType::Frames;
FlushPendingNotifications(flushType);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {