diff --git a/DEPS b/DEPS index 53533c01..97f4f91 100644 --- a/DEPS +++ b/DEPS
@@ -40,7 +40,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'e52577ff9f69c67a3872a4969e9ce3e9247edf52', + 'skia_revision': '89e62f898856654cc8523d65dc86bf0a04d1ae9e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other.
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp index aaca3de..4f51a22 100644 --- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp +++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -556,9 +556,7 @@ const MouseEventWithHitTestResults& event) { TRACE_EVENT0("blink", "MouseEventManager::handleMousePressEvent"); - // Reset drag state. - dragState().m_dragSrc = nullptr; - + resetDragState(); cancelFakeMouseMoveEvent(); m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); @@ -672,7 +670,7 @@ EventHandlingUtil::performMouseEventHitTest(m_frame, request, mouseDragEvent); m_mouseDownMayStartDrag = true; - dragState().m_dragSrc = nullptr; + resetDragState(); m_mouseDownPos = m_frame->view()->rootFrameToContents( flooredIntPoint(mouseDragEvent.positionInRootFrame())); return handleDrag(mev, DragInitiator::Touch); @@ -778,7 +776,7 @@ m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); } else { - dragState().m_dragSrc = nullptr; + resetDragState(); } if (!dragState().m_dragSrc) @@ -801,7 +799,7 @@ if (initiator == DragInitiator::Mouse && !dragThresholdExceeded( flooredIntPoint(event.event().positionInRootFrame()))) { - dragState().m_dragSrc = nullptr; + resetDragState(); return true; } @@ -812,7 +810,7 @@ if (!tryStartDrag(event)) { // Something failed to start the drag, clean up. clearDragDataTransfer(); - dragState().m_dragSrc = nullptr; + resetDragState(); } m_mouseDownMayStartDrag = false; @@ -922,15 +920,21 @@ dispatchDragSrcEvent(EventTypeNames::dragend, event); } clearDragDataTransfer(); - dragState().m_dragSrc = nullptr; + resetDragState(); // In case the drag was ended due to an escape key press we need to ensure // that consecutive mousemove events don't reinitiate the drag and drop. m_mouseDownMayStartDrag = false; } DragState& MouseEventManager::dragState() { - DEFINE_STATIC_LOCAL(DragState, state, (new DragState)); - return state; + DCHECK(m_frame->page()); + return m_frame->page()->dragController().dragState(); +} + +void MouseEventManager::resetDragState() { + if (!m_frame->page()) + return; + dragState().m_dragSrc = nullptr; } bool MouseEventManager::dragThresholdExceeded(
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.h b/third_party/WebKit/Source/core/input/MouseEventManager.h index 0628dfb..f144769f 100644 --- a/third_party/WebKit/Source/core/input/MouseEventManager.h +++ b/third_party/WebKit/Source/core/input/MouseEventManager.h
@@ -99,7 +99,7 @@ WebInputEventResult handleMouseReleaseEvent( const MouseEventWithHitTestResults&); - static DragState& dragState(); + DragState& dragState(); void focusDocumentView(); @@ -189,6 +189,8 @@ void clearDragDataTransfer(); DataTransfer* createDraggingDataTransfer() const; + void resetDragState(); + // Implementations of |SynchronousMutationObserver| void nodeChildrenWillBeRemoved(ContainerNode&) final; void nodeWillBeRemoved(Node& nodeToBeRemoved) final;
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp index b4ff410..c762db6 100644 --- a/third_party/WebKit/Source/core/page/DragController.cpp +++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -1229,10 +1229,17 @@ #endif } +DragState& DragController::dragState() { + if (!m_dragState) + m_dragState = new DragState; + return *m_dragState; +} + DEFINE_TRACE(DragController) { visitor->trace(m_page); visitor->trace(m_documentUnderMouse); visitor->trace(m_dragInitiator); + visitor->trace(m_dragState); visitor->trace(m_fileInputElementUnderMouse); }
diff --git a/third_party/WebKit/Source/core/page/DragController.h b/third_party/WebKit/Source/core/page/DragController.h index 763f657..23325da 100644 --- a/third_party/WebKit/Source/core/page/DragController.h +++ b/third_party/WebKit/Source/core/page/DragController.h
@@ -79,10 +79,12 @@ const WebMouseEvent& dragEvent, const IntPoint& dragOrigin); + DragState& dragState(); + DECLARE_TRACE(); private: - DragController(Page*); + explicit DragController(Page*); DispatchEventResult dispatchTextInputEventFor(LocalFrame*, DragData*); bool canProcessDrag(DragData*, LocalFrame& localRoot); @@ -114,6 +116,8 @@ // The Document (if any) that initiated the drag. Member<Document> m_dragInitiator; + Member<DragState> m_dragState; + Member<HTMLInputElement> m_fileInputElementUnderMouse; bool m_documentIsHandlingDrag;