From aefbcd85cf0c8fc88304a78c3ea674affe415ab3 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 21 Jan 2016 19:09:04 -0600 Subject: [PATCH] Bug 1241371. Properly update mLastUpdateImagesPos on scrollframes when the image visibility pass encounters them. r=mats This is a regression from bug 1002992 where we switch from the display list builder to the frame tree walker and didn't update mLastUpdateImagesPos in the frame walker. --- layout/base/nsPresShell.cpp | 1 + layout/generic/nsGfxScrollFrame.cpp | 8 +++++++- layout/generic/nsGfxScrollFrame.h | 8 +++++++- layout/generic/nsIScrollableFrame.h | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index f5c16f701f64..ee4479629e7b 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5577,6 +5577,7 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect) nsIScrollableFrame* scrollFrame = do_QueryFrame(aFrame); if (scrollFrame) { + scrollFrame->NotifyImageVisibilityUpdate(); nsRect displayPort; bool usingDisplayport = nsLayoutUtils::GetDisplayPortForVisibilityTesting( diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b8fa51286923..f891874fa251 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2474,6 +2474,12 @@ ScrollFrameHelper::ScheduleSyntheticMouseMove() ScrollActivityCallback, this, 100, nsITimer::TYPE_ONE_SHOT); } +void +ScrollFrameHelper::NotifyImageVisibilityUpdate() +{ + mLastUpdateImagesPos = GetScrollPosition(); +} + void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsIAtom* aOrigin) { @@ -2896,7 +2902,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { if (aBuilder->IsForImageVisibility()) { - mLastUpdateImagesPos = GetScrollPosition(); + NotifyImageVisibilityUpdate(); } mOuter->DisplayBorderBackgroundOutline(aBuilder, aLists); diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index b082c56ab4bf..02ca7385c1de 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -367,6 +367,7 @@ public: bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder, nsRect* aDirtyRect, bool aAllowCreateDisplayPort); + void NotifyImageVisibilityUpdate(); void ScheduleSyntheticMouseMove(); static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance); @@ -849,6 +850,9 @@ public: bool aAllowCreateDisplayPort) override { return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aAllowCreateDisplayPort); } + virtual void NotifyImageVisibilityUpdate() override { + mHelper.NotifyImageVisibilityUpdate(); + } // nsIStatefulFrame NS_IMETHOD SaveState(nsPresState** aState) override { @@ -1316,7 +1320,9 @@ public: bool aAllowCreateDisplayPort) override { return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aAllowCreateDisplayPort); } - + virtual void NotifyImageVisibilityUpdate() override { + mHelper.NotifyImageVisibilityUpdate(); + } #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const override; diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index 3313bb043979..e071c85426bc 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -441,6 +441,11 @@ public: virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder, nsRect* aDirtyRect, bool aAllowCreateDisplayPort) = 0; + + /** + * Notification that this scroll frame is getting its image visibility updated. + */ + virtual void NotifyImageVisibilityUpdate() = 0; }; #endif