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

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

Issue 1774123006: Implement link selection on alt+mouse drag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static and rename function. Created 4 years, 9 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 e26e1732d57ef92bb4111b2507ed4856c894f2d5..d348c387dc112c462cb10a95dd47f050ba99a1f6 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -432,7 +432,8 @@ void SelectionController::handleMousePressEvent(const MouseEventWithHitTestResul
{
// If we got the event back, that must mean it wasn't prevented,
// so it's allowed to start a drag or selection if it wasn't in a scrollbar.
- m_mouseDownMayStartSelect = canMouseDownStartSelect(event.innerNode()) && !event.scrollbar();
+ m_mouseDownMayStartSelect = (canMouseDownStartSelect(event.innerNode()) || mayBeLinkSelection(event))
+ && !event.scrollbar();
m_mouseDownWasSingleClickInSelection = false;
// Avoid double-tap touch gesture confusion by restricting multi-click side
// effects, e.g., word selection, to editable regions.
@@ -562,7 +563,8 @@ void SelectionController::sendContextMenuEvent(const MouseEventWithHitTestResult
|| !(selection().isContentEditable() || (mev.innerNode() && mev.innerNode()->isTextNode())))
return;
- m_mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
+ // Context menu events are always allowed to perform a selection.
+ TemporaryChange<bool> mouseDownMayStartSelectChange(m_mouseDownMayStartSelect, true);
if (mev.hitTestResult().isMisspelled())
return selectClosestMisspellingFromMouseEvent(mev);
@@ -623,4 +625,9 @@ FrameSelection& SelectionController::selection() const
return m_frame->selection();
}
+bool mayBeLinkSelection(const MouseEventWithHitTestResults& event)
tkent 2016/03/25 03:33:02 This looks "isLinkSelection" to me. Why "mayBe"?
+{
+ return event.event().altKey() && event.isOverLink();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698