Bug 1368315 - Avoid calling SetContentResponse() on an already-consumed drag block. r=kats
MozReview-Commit-ID: LnObFmoB3Bi
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -972,26 +972,30 @@ APZCTreeManager::ReceiveInputEvent(Input
thumbTransform = ComputeTransformForNode(hitScrollbarNode);
}
// Only consider the translation, since we do not support both
// zooming and scrollbar dragging on any platform.
CSSCoord thumbStart = thumbData.mThumbStart
+ ((thumbData.mDirection == ScrollDirection::HORIZONTAL)
? thumbTransform._41 : thumbTransform._42);
dragStart -= thumbStart;
+
+ // Content can't prevent scrollbar dragging with preventDefault(),
+ // so we don't need to wait for a content response. It's important
+ // to do this before calling ConfirmDragBlock() since that can
+ // potentially process and consume the block.
+ dragBlock->SetContentResponse(false);
+
mInputQueue->ConfirmDragBlock(
dragBlockId, apzc,
AsyncDragMetrics(apzc->GetGuid().mScrollId,
apzc->GetGuid().mPresShellId,
dragBlockId,
dragStart,
thumbData.mDirection));
- // Content can't prevent scrollbar dragging with preventDefault(),
- // so we don't need to wait for a content response.
- dragBlock->SetContentResponse(false);
}
}
if (result == nsEventStatus_eConsumeDoDefault) {
// This input event is part of a drag block, so whether or not it is
// directed at a scrollbar depends on whether the drag block started
// on a scrollbar.
hitScrollbar = mInputQueue->IsDragOnScrollbar(hitScrollbar);