Bug 1245925 - Don't allow expiring the displayport on root scrollframes. r?tnikkel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 10 Feb 2016 17:11:28 -0500
changeset 330173 d0f010148d49b428171fc088122bb46184e86174
parent 330112 ac39fba33c6daf95b2cda71e588ca18e2eb752ab
child 514118 a19ed84b88b29a036955feccf7d3686899a415d3
push id10698
push userkgupta@mozilla.com
push dateWed, 10 Feb 2016 22:12:44 +0000
reviewerstnikkel
bugs1245925
milestone47.0a1
Bug 1245925 - Don't allow expiring the displayport on root scrollframes. r?tnikkel MozReview-Commit-ID: 8LGsk9uKyL5
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
--- 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();