Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2048733002: Selecting with shift+drag results in unexpected drag-n-drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index a67560462e77df24084ebd4b2ccb98ddacd915ce..c4b6b9fc3de7814b37a8d1956bef6a394803028e 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -128,8 +128,8 @@ bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH
if (!(innerNode && innerNode->layoutObject() && m_mouseDownMayStartSelect))
return false;
- // Extend the selection if the Shift key is down, unless the click is in a link.
- bool extendSelection = event.event().shiftKey() && !event.isOverLink();
+ // Extend the selection if the Shift key is down, unless the click is in a link or image.
+ bool extendSelection = isExtendingSelection(event);
// Don't restart the selection when the mouse is pressed on an
// existing selection so we can allow for text dragging.
@@ -635,4 +635,10 @@ bool isLinkSelection(const MouseEventWithHitTestResults& event)
return event.event().altKey() && event.isOverLink();
}
+bool isExtendingSelection(const MouseEventWithHitTestResults& event)
+{
+ bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().image();
+ return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698