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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetBase.cpp

Issue 2655463015: Correctly set dragLeave and dragEnd coords for OOPIF drag and drop (Closed)
Patch Set: Added checks for null RWH on drag end Created 3 years, 10 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 // 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 "web/WebFrameWidgetBase.h" 5 #include "web/WebFrameWidgetBase.h"
6 6
7 #include "core/frame/FrameHost.h" 7 #include "core/frame/FrameHost.h"
8 #include "core/frame/VisualViewport.h" 8 #include "core/frame/VisualViewport.h"
9 #include "core/input/EventHandler.h" 9 #include "core/input/EventHandler.h"
10 #include "core/page/DragActions.h" 10 #include "core/page/DragActions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const WebPoint& pointInViewport, 65 const WebPoint& pointInViewport,
66 const WebPoint& screenPoint, 66 const WebPoint& screenPoint,
67 WebDragOperationsMask operationsAllowed, 67 WebDragOperationsMask operationsAllowed,
68 int modifiers) { 68 int modifiers) {
69 m_operationsAllowed = operationsAllowed; 69 m_operationsAllowed = operationsAllowed;
70 70
71 return dragTargetDragEnterOrOver(pointInViewport, screenPoint, DragOver, 71 return dragTargetDragEnterOrOver(pointInViewport, screenPoint, DragOver,
72 modifiers); 72 modifiers);
73 } 73 }
74 74
75 void WebFrameWidgetBase::dragTargetDragLeave() { 75 void WebFrameWidgetBase::dragTargetDragLeave(const WebPoint& pointInViewport,
76 const WebPoint& screenPoint) {
76 DCHECK(m_currentDragData); 77 DCHECK(m_currentDragData);
77 78
78 if (ignoreInputEvents()) { 79 if (ignoreInputEvents()) {
79 cancelDrag(); 80 cancelDrag();
80 return; 81 return;
81 } 82 }
82 DragData dragData(m_currentDragData.get(), IntPoint(), IntPoint(), 83
84 WebPoint pointInRootFrame(viewportToRootFrame(pointInViewport));
85 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint,
83 static_cast<DragOperation>(m_operationsAllowed)); 86 static_cast<DragOperation>(m_operationsAllowed));
84 87
85 page()->dragController().dragExited(&dragData, *toCoreFrame(localRoot())); 88 page()->dragController().dragExited(&dragData, *toCoreFrame(localRoot()));
86 89
87 // FIXME: why is the drag scroll timer not stopped here? 90 // FIXME: why is the drag scroll timer not stopped here?
88 91
89 m_dragOperation = WebDragOperationNone; 92 m_dragOperation = WebDragOperationNone;
90 m_currentDragData = nullptr; 93 m_currentDragData = nullptr;
91 } 94 }
92 95
93 void WebFrameWidgetBase::dragTargetDrop(const WebDragData& webDragData, 96 void WebFrameWidgetBase::dragTargetDrop(const WebDragData& webDragData,
94 const WebPoint& pointInViewport, 97 const WebPoint& pointInViewport,
95 const WebPoint& screenPoint, 98 const WebPoint& screenPoint,
96 int modifiers) { 99 int modifiers) {
97 WebPoint pointInRootFrame(viewportToRootFrame(pointInViewport)); 100 WebPoint pointInRootFrame(viewportToRootFrame(pointInViewport));
98 101
99 DCHECK(m_currentDragData); 102 DCHECK(m_currentDragData);
100 m_currentDragData = DataObject::create(webDragData); 103 m_currentDragData = DataObject::create(webDragData);
101 WebViewImpl::UserGestureNotifier notifier(view()); 104 WebViewImpl::UserGestureNotifier notifier(view());
102 105
103 // If this webview transitions from the "drop accepting" state to the "not 106 // If this webview transitions from the "drop accepting" state to the "not
104 // accepting" state, then our IPC message reply indicating that may be in- 107 // accepting" state, then our IPC message reply indicating that may be in-
105 // flight, or else delayed by javascript processing in this webview. If a 108 // flight, or else delayed by javascript processing in this webview. If a
106 // drop happens before our IPC reply has reached the browser process, then 109 // drop happens before our IPC reply has reached the browser process, then
107 // the browser forwards the drop to this webview. So only allow a drop to 110 // the browser forwards the drop to this webview. So only allow a drop to
108 // proceed if our webview m_dragOperation state is not DragOperationNone. 111 // proceed if our webview m_dragOperation state is not DragOperationNone.
109 112
110 if (m_dragOperation == WebDragOperationNone) { 113 if (m_dragOperation == WebDragOperationNone) {
111 // IPC RACE CONDITION: do not allow this drop. 114 // IPC RACE CONDITION: do not allow this drop.
112 dragTargetDragLeave(); 115 dragTargetDragLeave(pointInViewport, screenPoint);
113 return; 116 return;
114 } 117 }
115 118
116 if (!ignoreInputEvents()) { 119 if (!ignoreInputEvents()) {
117 m_currentDragData->setModifiers(modifiers); 120 m_currentDragData->setModifiers(modifiers);
118 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint, 121 DragData dragData(m_currentDragData.get(), pointInRootFrame, screenPoint,
119 static_cast<DragOperation>(m_operationsAllowed)); 122 static_cast<DragOperation>(m_operationsAllowed));
120 123
121 page()->dragController().performDrag(&dragData, *toCoreFrame(localRoot())); 124 page()->dragController().performDrag(&dragData, *toCoreFrame(localRoot()));
122 } 125 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 212
210 WebViewImpl* WebFrameWidgetBase::view() const { 213 WebViewImpl* WebFrameWidgetBase::view() const {
211 return toWebLocalFrameImpl(localRoot())->viewImpl(); 214 return toWebLocalFrameImpl(localRoot())->viewImpl();
212 } 215 }
213 216
214 Page* WebFrameWidgetBase::page() const { 217 Page* WebFrameWidgetBase::page() const {
215 return view()->page(); 218 return view()->page();
216 } 219 }
217 220
218 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetBase.h ('k') | third_party/WebKit/public/web/WebFrameWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698