Bug 1245925 - Don't allow expiring the displayport on root scrollframes. r?tnikkel
MozReview-Commit-ID: 8LGsk9uKyL5
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2342,17 +2342,17 @@ RemoveDisplayPortCallback(nsITimer* aTim
ScrollFrameHelper* helper = static_cast<ScrollFrameHelper*>(aClosure);
// This function only ever gets called from the expiry timer, so it must
// be non-null here. Set it to null here so that we don't keep resetting
// it unnecessarily in MarkRecentlyScrolled().
MOZ_ASSERT(helper->mDisplayPortExpiryTimer);
helper->mDisplayPortExpiryTimer = nullptr;
- if (helper->IsAlwaysActive() || helper->mIsScrollParent) {
+ if (!helper->AllowDisplayPortExpiration() || helper->mIsScrollParent) {
// If this is a scroll parent for some other scrollable frame, don't
// expire the displayport because it would break scroll handoff. Once the
// descendant scrollframes have their displayports expired, they will
// trigger the displayport expiration on this scrollframe as well, and
// mIsScrollParent will presumably be false when that kicks in.
return;
}
@@ -2406,19 +2406,30 @@ void ScrollFrameHelper::ResetDisplayPort
{
if (mDisplayPortExpiryTimer) {
mDisplayPortExpiryTimer->InitWithFuncCallback(
RemoveDisplayPortCallback, this,
gfxPrefs::APZDisplayPortExpiryTime(), nsITimer::TYPE_ONE_SHOT);
}
}
-void ScrollFrameHelper::TriggerDisplayPortExpiration()
+bool ScrollFrameHelper::AllowDisplayPortExpiration()
{
if (IsAlwaysActive()) {
+ return false;
+ }
+ if (mIsRoot && mOuter->PresContext()->IsRoot()) {
+ return false;
+ }
+ return true;
+}
+
+void ScrollFrameHelper::TriggerDisplayPortExpiration()
+{
+ if (!AllowDisplayPortExpiration()) {
return;
}
if (!gfxPrefs::APZDisplayPortExpiryTime()) {
// a zero time disables the expiry
return;
}
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -365,16 +365,17 @@ public:
bool UsesContainerScrolling() const;
bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
nsRect* aDirtyRect,
bool aAllowCreateDisplayPort);
void NotifyImageVisibilityUpdate();
bool GetDisplayPortAtLastImageVisibilityUpdate(nsRect* aDisplayPort);
+ bool AllowDisplayPortExpiration();
void TriggerDisplayPortExpiration();
void ResetDisplayPortExpiryTimer();
void ScheduleSyntheticMouseMove();
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
void HandleScrollbarStyleSwitching();