Bug 1027309 - Add some more logging in APZ code. r=drs, a=2.0+
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 25 Jun 2014 19:13:26 -0400
changeset 207370 a10d2edbefe8bb909d87bd262b1a699ddb9d112f
parent 207369 a2df04e4f4d8b41042e6b612ce08e9fc13e32b4f
child 207371 ad16ee0c251bd99869e808c5d97d0d9e6f99edff
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrs, 2
bugs1027309
milestone32.0a2
Bug 1027309 - Add some more logging in APZ code. r=drs, a=2.0+
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1042,16 +1042,18 @@ APZCTreeManager::BuildOverscrollHandoffC
   // scroll parent links we just walk up the tree to find the scroll parent.
   AsyncPanZoomController* apzc = aInitialTarget;
   while (apzc != nullptr) {
     if (!mOverscrollHandoffChain.append(apzc)) {
       NS_WARNING("Vector::append failed");
       mOverscrollHandoffChain.clear();
       return;
     }
+    APZCTM_LOG("mOverscrollHandoffChain[%d] = %p\n", mOverscrollHandoffChain.length(), apzc);
+
     if (apzc->GetScrollHandoffParentId() == FrameMetrics::NULL_SCROLL_ID) {
       if (!apzc->IsRootForLayersId()) {
         // This probably indicates a bug or missed case in layout code
         NS_WARNING("Found a non-root APZ with no handoff parent");
       }
       apzc = apzc->GetParent();
       continue;
     }
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -938,16 +938,17 @@ nsEventStatus AsyncPanZoomController::On
           // Graceful handling of error condition
           FlushRepaintForOverscrollHandoff();
         }
       }
     }
     mX.EndTouch(aEvent.mTime);
     mY.EndTouch(aEvent.mTime);
     SetState(FLING);
+    APZC_LOG("%p starting a fling animation\n", this);
     StartAnimation(new FlingAnimation(*this,
                                       true  /* apply acceleration */,
                                       false /* allow overscroll */));
     return nsEventStatus_eConsumeNoDefault;
 
   case PINCHING:
     SetState(NOTHING);
     // Scale gesture listener should have handled this.
@@ -1484,16 +1485,17 @@ bool AsyncPanZoomController::AttemptScro
   // is what's left of "displacement", and "displacement" is "start - end".
   if (CallDispatchScroll(aEndPoint + overscroll, aEndPoint, aOverscrollHandoffChainIndex + 1)) {
     return true;
   }
 
   // If there is no APZC later in the handoff chain that accepted the
   // overscroll, try to accept it ourselves. We only accept it if we
   // are pannable.
+  APZC_LOG("%p taking overscroll during panning\n", this);
   return OverscrollBy(cssOverscroll);
 }
 
 bool AsyncPanZoomController::OverscrollBy(const CSSPoint& aOverscroll) {
   if (!gfxPrefs::APZOverscrollEnabled()) {
     return false;
   }
 
@@ -1610,16 +1612,17 @@ bool FlingAnimation::Sample(FrameMetrics
                                 : gfxPrefs::APZFlingFriction();
   float threshold = overscrolled ? gfxPrefs::APZOverscrollFlingStoppedThreshold()
                                  : gfxPrefs::APZFlingStoppedThreshold();
 
   bool shouldContinueFlingX = mApzc.mX.FlingApplyFrictionOrCancel(aDelta, friction, threshold),
        shouldContinueFlingY = mApzc.mY.FlingApplyFrictionOrCancel(aDelta, friction, threshold);
   // If we shouldn't continue the fling, let's just stop and repaint.
   if (!shouldContinueFlingX && !shouldContinueFlingY) {
+    APZC_LOG("%p ending fling animation. overscrolled=%d\n", &mApzc, mApzc.IsOverscrolled());
     // If we are in overscroll, schedule the snap-back animation that relieves it.
     if (mApzc.IsOverscrolled()) {
       mDeferredTasks.append(NewRunnableMethod(&mApzc, &AsyncPanZoomController::StartSnapBack));
     }
     return false;
   }
 
   // AdjustDisplacement() zeroes out the Axis velocity if we're in overscroll.