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

Side by Side Diff: third_party/WebKit/Source/core/input/MouseEventManager.cpp

Issue 2734793002: Expand FrameSelection::isInPasswordFiled() into call sites (Closed)
Patch Set: 2017-03-07T11:24:31 Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/MouseEventManager.h" 5 #include "core/input/MouseEventManager.h"
6 6
7 #include "core/clipboard/DataObject.h" 7 #include "core/clipboard/DataObject.h"
8 #include "core/clipboard/DataTransfer.h" 8 #include "core/clipboard/DataTransfer.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
11 #include "core/dom/TaskRunnerHelper.h" 11 #include "core/dom/TaskRunnerHelper.h"
12 #include "core/editing/EditingUtilities.h"
12 #include "core/editing/FrameSelection.h" 13 #include "core/editing/FrameSelection.h"
13 #include "core/editing/SelectionController.h" 14 #include "core/editing/SelectionController.h"
14 #include "core/events/DragEvent.h" 15 #include "core/events/DragEvent.h"
15 #include "core/events/MouseEvent.h" 16 #include "core/events/MouseEvent.h"
16 #include "core/frame/FrameView.h" 17 #include "core/frame/FrameView.h"
17 #include "core/frame/LocalFrame.h" 18 #include "core/frame/LocalFrame.h"
18 #include "core/frame/Settings.h" 19 #include "core/frame/Settings.h"
19 #include "core/html/HTMLCanvasElement.h" 20 #include "core/html/HTMLCanvasElement.h"
20 #include "core/input/EventHandler.h" 21 #include "core/input/EventHandler.h"
21 #include "core/input/EventHandlingUtil.h" 22 #include "core/input/EventHandlingUtil.h"
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 if (!dragController.populateDragDataTransfer(m_frame, dragState(), 841 if (!dragController.populateDragDataTransfer(m_frame, dragState(),
841 m_mouseDownPos)) 842 m_mouseDownPos))
842 return false; 843 return false;
843 844
844 // If dispatching dragstart brings about another mouse down -- one way 845 // If dispatching dragstart brings about another mouse down -- one way
845 // this will happen is if a DevTools user breaks within a dragstart 846 // this will happen is if a DevTools user breaks within a dragstart
846 // handler and then clicks on the suspended page -- the drag state is 847 // handler and then clicks on the suspended page -- the drag state is
847 // reset. Hence, need to check if this particular drag operation can 848 // reset. Hence, need to check if this particular drag operation can
848 // continue even if dispatchEvent() indicates no (direct) cancellation. 849 // continue even if dispatchEvent() indicates no (direct) cancellation.
849 // Do that by checking if m_dragSrc is still set. 850 // Do that by checking if m_dragSrc is still set.
850 m_mouseDownMayStartDrag = 851 m_mouseDownMayStartDrag = false;
851 dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown) == 852 if (dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown) ==
852 WebInputEventResult::NotHandled && 853 WebInputEventResult::NotHandled &&
853 !m_frame->selection().isInPasswordField() && dragState().m_dragSrc; 854 dragState().m_dragSrc) {
855 // TODO(editing-dev): The use of
856 // updateStyleAndLayoutIgnorePendingStylesheets needs to be audited. See
857 // http://crbug.com/590369 for more details.
858 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
859 m_mouseDownMayStartDrag = !isInPasswordField(
860 m_frame->selection().computeVisibleSelectionInDOMTree().start());
861 }
854 862
855 // Invalidate clipboard here against anymore pasteboard writing for security. 863 // Invalidate clipboard here against anymore pasteboard writing for security.
856 // The drag image can still be changed as we drag, but not the pasteboard 864 // The drag image can still be changed as we drag, but not the pasteboard
857 // data. 865 // data.
858 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable); 866 dragState().m_dragDataTransfer->setAccessPolicy(DataTransferImageWritable);
859 867
860 if (m_mouseDownMayStartDrag) { 868 if (m_mouseDownMayStartDrag) {
861 // Dispatching the event could cause Page to go away. Make sure it's still 869 // Dispatching the event could cause Page to go away. Make sure it's still
862 // valid before trying to use DragController. 870 // valid before trying to use DragController.
863 if (m_frame->page() && 871 if (m_frame->page() &&
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1019
1012 void MouseEventManager::setClickCount(int clickCount) { 1020 void MouseEventManager::setClickCount(int clickCount) {
1013 m_clickCount = clickCount; 1021 m_clickCount = clickCount;
1014 } 1022 }
1015 1023
1016 bool MouseEventManager::mouseDownMayStartDrag() { 1024 bool MouseEventManager::mouseDownMayStartDrag() {
1017 return m_mouseDownMayStartDrag; 1025 return m_mouseDownMayStartDrag;
1018 } 1026 }
1019 1027
1020 } // namespace blink 1028 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698