| Index: Source/core/page/EventHandler.cpp
|
| diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
|
| index 51777a95d8c993c1ae4a2fe24e8db7da092958b1..95c78da7773ae4c22357fa8c8b1dcf77d025df0f 100644
|
| --- a/Source/core/page/EventHandler.cpp
|
| +++ b/Source/core/page/EventHandler.cpp
|
| @@ -228,6 +228,7 @@ EventHandler::EventHandler(LocalFrame* frame)
|
| , m_longTapShouldInvokeContextMenu(false)
|
| , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired)
|
| , m_lastShowPressTimestamp(0)
|
| + , m_selectionChanged(false)
|
| {
|
| }
|
|
|
| @@ -302,6 +303,7 @@ void EventHandler::clear()
|
| m_mouseDownMayStartDrag = false;
|
| m_lastShowPressTimestamp = 0;
|
| m_lastDeferredTapElement = nullptr;
|
| + m_selectionChanged = false;
|
| }
|
|
|
| void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved)
|
| @@ -775,14 +777,18 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
|
|
|
| bool handled = false;
|
|
|
| + bool isSelectionChanged = m_selectionChanged;
|
| + m_selectionChanged = false;
|
| +
|
| // Clear the selection if the mouse didn't move after the last mouse
|
| - // press and it's not a context menu click. We do this so when clicking
|
| - // on the selection, the selection goes away. However, if we are
|
| + // press and it's not a context menu click and it's not set by setSelectionRange during handling mouse event.
|
| + // We do this so when clicking on the selection, the selection goes away. However, if we are
|
| // editing, place the caret.
|
| if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != ExtendedSelection
|
| - && m_dragStartPos == event.event().position()
|
| - && m_frame->selection().isRange()
|
| - && event.event().button() != RightButton) {
|
| + && m_dragStartPos == event.event().position()
|
| + && m_frame->selection().isRange()
|
| + && event.event().button() != RightButton
|
| + && !isSelectionChanged) {
|
| VisibleSelection newSelection;
|
| Node* node = event.targetNode();
|
| bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
|
| @@ -1285,6 +1291,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
|
| m_frame->selection().setCaretBlinkingSuspended(true);
|
|
|
| bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targetNode(), m_clickCount, mouseEvent, true);
|
| + m_selectionChanged = false;
|
| swallowEvent = swallowEvent || handleMouseFocus(mouseEvent);
|
| m_capturesDragging = !swallowEvent || mev.scrollbar();
|
|
|
| @@ -2933,6 +2940,11 @@ void EventHandler::notifyElementActivated()
|
| m_lastDeferredTapElement = nullptr;
|
| }
|
|
|
| +void EventHandler::notifySelectionChanged()
|
| +{
|
| + m_selectionChanged = true;
|
| +}
|
| +
|
| bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt)
|
| {
|
| // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do.
|
|
|