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

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: Use String instead of std::string. 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..6db0a912dafdea61dad967c26d31f9bb57d8ce8b 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()) || isLinkSelection(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 isLinkSelection(const MouseEventWithHitTestResults& event)
+{
+ return event.event().altKey() && event.isOverLink();
+}
+
} // 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