diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 7064e30192c6..ca23f31ca350 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2448,6 +2448,7 @@ public: return; } + TABC_LOG("Got refresh, sending target APZCs for input block %" PRIu64 "\n", mInputBlockId); mTabChild->SendSetTargetAPZC(mInputBlockId, mTargets); if (!mPresShell->RemovePostRefreshObserver(this)) { @@ -2494,21 +2495,34 @@ TabChild::SendSetTargetAPZCNotification(const WidgetTouchEvent& aEvent, nsIScrollableFrame* scrollAncestor = GetScrollableAncestorFrame(target); nsCOMPtr dpElement = GetDisplayportElementFor(scrollAncestor); + nsAutoString dpElementDesc; + if (dpElement) { + dpElement->Describe(dpElementDesc); + } + TABC_LOG("For input block %" PRIu64 " found scrollable element %p (%s)\n", + aInputBlockId, dpElement.get(), + NS_LossyConvertUTF16toASCII(dpElementDesc).get()); + bool guidIsValid = APZCCallbackHelper::GetOrCreateScrollIdentifiers( dpElement, &(guid.mPresShellId), &(guid.mScrollId)); targets.AppendElement(guid); if (guidIsValid && !nsLayoutUtils::GetDisplayPort(dpElement, nullptr)) { + TABC_LOG("%p didn't have a displayport, so setting one...\n", dpElement.get()); waitForRefresh |= nsLayoutUtils::CalculateAndSetDisplayPortMargins( scrollAncestor, nsLayoutUtils::RepaintMode::Repaint); } } if (waitForRefresh) { + TABC_LOG("At least one target got a new displayport, need to wait for refresh\n"); waitForRefresh = shell->AddPostRefreshObserver( new DisplayportSetListener(this, shell, aInputBlockId, targets)); } if (!waitForRefresh) { + TABC_LOG("Sending target APZCs for input block %" PRIu64 "\n", aInputBlockId); SendSetTargetAPZC(aInputBlockId, targets); + } else { + TABC_LOG("Successfully registered post-refresh observer\n"); } } diff --git a/gfx/layers/apz/src/InputBlockState.cpp b/gfx/layers/apz/src/InputBlockState.cpp index a2d22e4ab2b0..a0d7951407cf 100644 --- a/gfx/layers/apz/src/InputBlockState.cpp +++ b/gfx/layers/apz/src/InputBlockState.cpp @@ -37,6 +37,16 @@ InputBlockState::SetConfirmedTargetApzc(const nsRefPtr& } mTargetConfirmed = true; + if (mTargetApzc == aTargetApzc) { + // The confirmed target is the same as the tentative one, so we're done. + return true; + } + + // Log enabled by default for now, we will put it in a TBS_LOG eventually + // once this code is more baked + printf_stderr("%p replacing unconfirmed target %p with real target %p\n", + this, mTargetApzc.get(), aTargetApzc.get()); + // note that aTargetApzc MAY be null here. mTargetApzc = aTargetApzc; mOverscrollHandoffChain = (mTargetApzc ? mTargetApzc->BuildOverscrollHandoffChain() : nullptr); diff --git a/gfx/layers/apz/src/InputQueue.cpp b/gfx/layers/apz/src/InputQueue.cpp index 398b10175423..29d6a820b03c 100644 --- a/gfx/layers/apz/src/InputQueue.cpp +++ b/gfx/layers/apz/src/InputQueue.cpp @@ -227,7 +227,8 @@ void InputQueue::SetConfirmedTargetApzc(uint64_t aInputBlockId, const nsRefPtr& aTargetApzc) { AsyncPanZoomController::AssertOnControllerThread(); - INPQ_LOG("got a target apzc; block=%" PRIu64 "\n", aInputBlockId); + INPQ_LOG("got a target apzc; block=%" PRIu64 " guid=%s\n", + aInputBlockId, aTargetApzc ? Stringify(aTargetApzc->GetGuid()).c_str() : ""); bool success = false; for (size_t i = 0; i < mTouchBlockQueue.Length(); i++) { if (mTouchBlockQueue[i]->GetBlockId() == aInputBlockId) {