Bug 1368315 - Avoid calling SetContentResponse() on an already-consumed drag block. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Mon, 29 May 2017 11:21:15 -0400
changeset 586033 f7db4d059ac94789da8837c5d7057c0114dc8e22
parent 585145 1bfa4578aa56f768626ba278a6929e23fc48db54
child 630859 49c94d78473adf3dae36da69f6e36c7e789b04ac
push id61263
push userbballo@mozilla.com
push dateMon, 29 May 2017 15:23:00 +0000
reviewerskats
bugs1368315
milestone55.0a1
Bug 1368315 - Avoid calling SetContentResponse() on an already-consumed drag block. r=kats MozReview-Commit-ID: LnObFmoB3Bi
gfx/layers/apz/src/APZCTreeManager.cpp
--- 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);