Bug 1027309 - Add some more logging in APZ code. r=drs
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 25 Jun 2014 19:13:26 -0400
changeset 190739 466e508cbb86066817143cc028643e15070001b2
parent 190738 b99de1b61b6f4a24edb1866beda193ad5f45f0b9
child 190740 5518a4d5db5b2b24e2629c273f824accbb9d0875
push id8377
push userkgupta@mozilla.com
push dateWed, 25 Jun 2014 23:15:15 +0000
treeherderb2g-inbound@ba0403f3ef5d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrs
bugs1027309
milestone33.0a1
Bug 1027309 - Add some more logging in APZ code. r=drs
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
@@ -952,16 +952,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.
@@ -1498,16 +1499,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;
   }
 
@@ -1624,16 +1626,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.