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

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: 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 2c317f259e65caae5930dd13894feb023c9c87b5..8924f88ce894ee30dbd8e4d5a40a555dfc77abe4 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,12 @@ bool isLinkSelection(const MouseEventWithHitTestResults& event)
return event.event().altKey() && event.isOverLink();
}
+bool isExtendingSelection(const MouseEventWithHitTestResults& event)
+{
+ DCHECK_LE(event.event().clickCount(), 1);
+
yosin_UTC9 2016/06/08 01:37:21 nit: no need to have an extra blank line here.
tonikitoo 2016/06/24 18:39:20 The assert was not actually right. I removed it.
+ bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().image();
+ return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698