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

Side by Side 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: Selecting with shift+drag results in unexpected drag-n-drop Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * Copyright (C) 2015 Google Inc. All rights reserved. 5 * Copyright (C) 2015 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH itTestResults& event) 122 bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH itTestResults& event)
123 { 123 {
124 TRACE_EVENT0("blink", "SelectionController::handleMousePressEventSingleClick "); 124 TRACE_EVENT0("blink", "SelectionController::handleMousePressEventSingleClick ");
125 125
126 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 126 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
127 Node* innerNode = event.innerNode(); 127 Node* innerNode = event.innerNode();
128 if (!(innerNode && innerNode->layoutObject() && m_mouseDownMayStartSelect)) 128 if (!(innerNode && innerNode->layoutObject() && m_mouseDownMayStartSelect))
129 return false; 129 return false;
130 130
131 // Extend the selection if the Shift key is down, unless the click is in a l ink. 131 // Extend the selection if the Shift key is down, unless the click is in a l ink or image.
132 bool extendSelection = event.event().shiftKey() && !event.isOverLink(); 132 bool extendSelection = isExtendingSelection(event);
133 133
134 // Don't restart the selection when the mouse is pressed on an 134 // Don't restart the selection when the mouse is pressed on an
135 // existing selection so we can allow for text dragging. 135 // existing selection so we can allow for text dragging.
136 if (FrameView* view = m_frame->view()) { 136 if (FrameView* view = m_frame->view()) {
137 LayoutPoint vPoint = view->rootFrameToContents(event.event().position()) ; 137 LayoutPoint vPoint = view->rootFrameToContents(event.event().position()) ;
138 if (!extendSelection && selection().contains(vPoint)) { 138 if (!extendSelection && selection().contains(vPoint)) {
139 m_mouseDownWasSingleClickInSelection = true; 139 m_mouseDownWasSingleClickInSelection = true;
140 return false; 140 return false;
141 } 141 }
142 } 142 }
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 FrameSelection& SelectionController::selection() const 663 FrameSelection& SelectionController::selection() const
664 { 664 {
665 return m_frame->selection(); 665 return m_frame->selection();
666 } 666 }
667 667
668 bool isLinkSelection(const MouseEventWithHitTestResults& event) 668 bool isLinkSelection(const MouseEventWithHitTestResults& event)
669 { 669 {
670 return event.event().altKey() && event.isOverLink(); 670 return event.event().altKey() && event.isOverLink();
671 } 671 }
672 672
673 bool isExtendingSelection(const MouseEventWithHitTestResults& event)
674 {
675 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image();
676 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
677 }
678
673 } // namespace blink 679 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698