Index: Source/core/input/EventHandler.cpp |
diff --git a/Source/core/input/EventHandler.cpp b/Source/core/input/EventHandler.cpp |
index 3788a52df2b13812b6a69145673453db57c674ac..314c6a382d0c34a25fb4ec22f16e39bb30c9f3cb 100644 |
--- a/Source/core/input/EventHandler.cpp |
+++ b/Source/core/input/EventHandler.cpp |
@@ -362,7 +362,6 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve |
bool swallowEvent = false; |
m_mousePressed = true; |
- selectionController().initializeSelectionState(); |
if (event.event().clickCount() == 2) |
swallowEvent = selectionController().handleMousePressEventDoubleClick(event); |
@@ -950,6 +949,10 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) |
m_frame->selection().setCaretBlinkingSuspended(true); |
bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mouseEvent, true); |
+ // m_selectionInitiationState is initialized after dispatching mousedown event in order not to keep the selection by DOM APIs |
yosin_UTC9
2015/07/06 01:57:30
nit: Could you try to keep comments in 80 chars? I
Miyoung Shin(g)
2015/07/13 03:32:57
Done.
|
+ // Because we can't give the user the chance to handle the selection by user action like dragging if we keep the selection in case of mousedown. |
+ // FireFox also has the same behavior and it's more compatible with other browsers. |
+ selectionController().initializeSelectionState(); |
HitTestResult hitTestResult = hitTestResultInFrame(m_frame, mouseEvent.position(), HitTestRequest::ReadOnly); |
swallowEvent = swallowEvent || handleMouseFocus(MouseEventWithHitTestResults(mouseEvent, hitTestResult)); |
m_capturesDragging = !swallowEvent || mev.scrollbar(); |
@@ -2021,6 +2024,7 @@ bool EventHandler::handleGestureTap(const GestureEventWithHitTestResults& target |
static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftButtonDown), |
PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); |
+ selectionController().initializeSelectionState(); |
if (!swallowMouseDownEvent) |
swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fakeMouseDown, currentHitTest)); |
if (!swallowMouseDownEvent) |