Index: Source/core/page/EventHandler.cpp |
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
index 5350361f2990e7d48ef8b5cbd82ca2afb1fb8ab0..21ed824b1a70e8a6b4251948d86f695876461802 100644 |
--- a/Source/core/page/EventHandler.cpp |
+++ b/Source/core/page/EventHandler.cpp |
@@ -620,7 +620,6 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve |
bool swallowEvent = false; |
m_mousePressed = true; |
- m_selectionInitiationState = HaveNotStartedSelection; |
if (event.event().clickCount() == 2) |
swallowEvent = handleMousePressEventDoubleClick(event); |
@@ -1283,6 +1282,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 |
+ // 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. |
+ m_selectionInitiationState = HaveNotStartedSelection; |
swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); |
m_capturesDragging = !swallowEvent || mev.scrollbar(); |
@@ -2937,6 +2940,11 @@ void EventHandler::notifyElementActivated() |
m_lastDeferredTapElement = nullptr; |
} |
+void EventHandler::notifySelectionChanged() |
+{ |
+ m_selectionInitiationState = ExtendedSelection; |
+} |
+ |
bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt) |
{ |
// FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. |