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

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

Issue 2350433002: Extract more of the mouse logic from EventHandler (Closed)
Patch Set: applying comments Created 4 years, 2 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 "core/input/GestureManager.h" 5 #include "core/input/GestureManager.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/editing/SelectionController.h" 8 #include "core/editing/SelectionController.h"
9 #include "core/events/GestureEvent.h" 9 #include "core/events/GestureEvent.h"
10 #include "core/frame/FrameHost.h" 10 #include "core/frame/FrameHost.h"
11 #include "core/frame/FrameView.h" 11 #include "core/frame/FrameView.h"
12 #include "core/frame/Settings.h" 12 #include "core/frame/Settings.h"
13 #include "core/frame/VisualViewport.h" 13 #include "core/frame/VisualViewport.h"
14 #include "core/input/EventHandler.h" 14 #include "core/input/EventHandler.h"
15 #include "core/input/EventHandlingUtil.h" 15 #include "core/input/EventHandlingUtil.h"
16 #include "core/page/ChromeClient.h" 16 #include "core/page/ChromeClient.h"
17 #include "core/page/Page.h" 17 #include "core/page/Page.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 GestureManager::GestureManager(LocalFrame* frame, ScrollManager* scrollManager, 21 GestureManager::GestureManager(LocalFrame* frame, ScrollManager* scrollManager,
22 MouseEventManager* mouseEventManager,
22 PointerEventManager* pointerEventManager, 23 PointerEventManager* pointerEventManager,
23 SelectionController* selectionController) 24 SelectionController* selectionController)
24 : m_frame(frame) 25 : m_frame(frame)
25 , m_scrollManager(scrollManager) 26 , m_scrollManager(scrollManager)
27 , m_mouseEventManager(mouseEventManager)
26 , m_pointerEventManager(pointerEventManager) 28 , m_pointerEventManager(pointerEventManager)
27 , m_selectionController(selectionController) 29 , m_selectionController(selectionController)
28 { 30 {
29 clear(); 31 clear();
30 } 32 }
31 33
32 void GestureManager::clear() 34 void GestureManager::clear()
33 { 35 {
34 m_suppressMouseEventsFromGestures = false; 36 m_suppressMouseEventsFromGestures = false;
35 m_longTapShouldInvokeContextMenu = false; 37 m_longTapShouldInvokeContextMenu = false;
36 m_lastShowPressTimestamp = 0; 38 m_lastShowPressTimestamp = 0;
37 } 39 }
38 40
39 DEFINE_TRACE(GestureManager) 41 DEFINE_TRACE(GestureManager)
40 { 42 {
41 visitor->trace(m_frame); 43 visitor->trace(m_frame);
44 visitor->trace(m_scrollManager);
45 visitor->trace(m_mouseEventManager);
46 visitor->trace(m_pointerEventManager);
42 visitor->trace(m_selectionController); 47 visitor->trace(m_selectionController);
43 visitor->trace(m_pointerEventManager);
44 visitor->trace(m_scrollManager);
45 } 48 }
46 49
47 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType(Plat formEvent::EventType type) 50 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType(Plat formEvent::EventType type)
48 { 51 {
49 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; 52 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
50 switch (type) { 53 switch (type) {
51 case PlatformEvent::GestureShowPress: 54 case PlatformEvent::GestureShowPress:
52 case PlatformEvent::GestureTapUnconfirmed: 55 case PlatformEvent::GestureTapUnconfirmed:
53 return hitType | HitTestRequest::Active; 56 return hitType | HitTestRequest::Active;
54 case PlatformEvent::GestureTapDownCancel: 57 case PlatformEvent::GestureTapDownCancel:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // co-ordinates outside the target's bounds. 142 // co-ordinates outside the target's bounds.
140 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio n()); 143 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio n());
141 144
142 const unsigned modifiers = gestureEvent.getModifiers(); 145 const unsigned modifiers = gestureEvent.getModifiers();
143 146
144 if (!m_suppressMouseEventsFromGestures) { 147 if (!m_suppressMouseEventsFromGestures) {
145 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g lobalPosition(), 148 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g lobalPosition(),
146 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, / * clickCount */ 0, 149 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, / * clickCount */ 0,
147 static_cast<PlatformEvent::Modifiers>(modifiers), 150 static_cast<PlatformEvent::Modifiers>(modifiers),
148 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse); 151 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse);
149 m_frame->eventHandler().dispatchMouseEvent(EventTypeNames::mousemove, cu rrentHitTest.innerNode(), 0, fakeMouseMove); 152 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(currentHitTes t.innerNode(), EventTypeNames::mousemove, fakeMouseMove);
150 } 153 }
151 154
152 // Do a new hit-test in case the mousemove event changed the DOM. 155 // Do a new hit-test in case the mousemove event changed the DOM.
153 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we 156 // Note that if the original hit test wasn't over an element (eg. was over a scrollbar) we
154 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page 157 // don't want to re-hit-test because it may be in the wrong frame (and there 's no way the page
155 // could have seen the event anyway). 158 // could have seen the event anyway).
156 // Also note that the position of the frame may have changed, so we need to recompute the content 159 // Also note that the position of the frame may have changed, so we need to recompute the content
157 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul d). 160 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul d).
158 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 161 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
159 if (currentHitTest.innerNode()) { 162 if (currentHitTest.innerNode()) {
160 LocalFrame* mainFrame = m_frame->localFrameRoot(); 163 LocalFrame* mainFrame = m_frame->localFrameRoot();
161 if (mainFrame && mainFrame->view()) 164 if (mainFrame && mainFrame->view())
162 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); 165 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling();
163 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 166 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
164 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust edPoint, hitType); 167 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust edPoint, hitType);
165 } 168 }
166 169
167 // Capture data for showUnhandledTapUIIfNeeded. 170 // Capture data for showUnhandledTapUIIfNeeded.
168 Node* tappedNode = currentHitTest.innerNode(); 171 Node* tappedNode = currentHitTest.innerNode();
169 IntPoint tappedPosition = gestureEvent.position(); 172 IntPoint tappedPosition = gestureEvent.position();
170 Node* tappedNonTextNode = tappedNode; 173 Node* tappedNonTextNode = tappedNode;
171 174
172 if (tappedNonTextNode && tappedNonTextNode->isTextNode()) 175 if (tappedNonTextNode && tappedNonTextNode->isTextNode())
173 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode); 176 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode);
174 177
175 m_frame->eventHandler().setClickNode(tappedNonTextNode); 178 m_mouseEventManager->setClickNode(tappedNonTextNode);
176 179
177 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(), 180 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(),
178 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, gesture Event.tapCount(), 181 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, gesture Event.tapCount(),
179 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown), 182 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown),
180 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse); 183 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse);
181 184
182 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that 185 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that
183 // mean for for TEs? What's the right balance here? crbug.com/617255 186 // mean for for TEs? What's the right balance here? crbug.com/617255
184 WebInputEventResult mouseDownEventResult = WebInputEventResult::HandledSuppr essed; 187 WebInputEventResult mouseDownEventResult = WebInputEventResult::HandledSuppr essed;
185 if (!m_suppressMouseEventsFromGestures) { 188 if (!m_suppressMouseEventsFromGestures) {
186 mouseDownEventResult = m_frame->eventHandler().dispatchMouseEvent(EventT ypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMo useDown); 189 m_mouseEventManager->setClickCount(gestureEvent.tapCount());
190 mouseDownEventResult = m_mouseEventManager->setMousePositionAndDispatchM ouseEvent(currentHitTest.innerNode(), EventTypeNames::mousedown, fakeMouseDown);
187 m_selectionController->initializeSelectionState(); 191 m_selectionController->initializeSelectionState();
188 if (mouseDownEventResult == WebInputEventResult::NotHandled) 192 if (mouseDownEventResult == WebInputEventResult::NotHandled)
189 mouseDownEventResult = m_frame->eventHandler().handleMouseFocus(curr entHitTest, InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); 193 mouseDownEventResult = m_mouseEventManager->handleMouseFocus(current HitTest, InputDeviceCapabilities::firesTouchEventsSourceCapabilities());
190 if (mouseDownEventResult == WebInputEventResult::NotHandled) 194 if (mouseDownEventResult == WebInputEventResult::NotHandled)
191 mouseDownEventResult = m_frame->eventHandler().handleMousePressEvent (MouseEventWithHitTestResults(fakeMouseDown, currentHitTest)); 195 mouseDownEventResult = m_mouseEventManager->handleMousePressEvent(Mo useEventWithHitTestResults(fakeMouseDown, currentHitTest));
192 } 196 }
193 197
194 if (currentHitTest.innerNode()) { 198 if (currentHitTest.innerNode()) {
195 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap); 199 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap);
196 HitTestResult result = currentHitTest; 200 HitTestResult result = currentHitTest;
197 result.setToShadowHostIfInUserAgentShadowRoot(); 201 result.setToShadowHostIfInUserAgentShadowRoot();
198 m_frame->chromeClient().onMouseDown(result.innerNode()); 202 m_frame->chromeClient().onMouseDown(result.innerNode());
199 } 203 }
200 204
201 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920 205 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug. com/398920
202 if (currentHitTest.innerNode()) { 206 if (currentHitTest.innerNode()) {
203 LocalFrame* mainFrame = m_frame->localFrameRoot(); 207 LocalFrame* mainFrame = m_frame->localFrameRoot();
204 if (mainFrame && mainFrame->view()) 208 if (mainFrame && mainFrame->view())
205 mainFrame->view()->updateAllLifecyclePhases(); 209 mainFrame->view()->updateAllLifecyclePhases();
206 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 210 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
207 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust edPoint, hitType); 211 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust edPoint, hitType);
208 } 212 }
209 213
210 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(), 214 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP osition(),
211 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, gestur eEvent.tapCount(), 215 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, gestur eEvent.tapCount(),
212 static_cast<PlatformEvent::Modifiers>(modifiers), 216 static_cast<PlatformEvent::Modifiers>(modifiers),
213 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse); 217 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse);
214 WebInputEventResult mouseUpEventResult = m_suppressMouseEventsFromGestures 218 WebInputEventResult mouseUpEventResult = m_suppressMouseEventsFromGestures
215 ? WebInputEventResult::HandledSuppressed 219 ? WebInputEventResult::HandledSuppressed
216 : m_frame->eventHandler().dispatchMouseEvent(EventTypeNames::mouseup, cu rrentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp); 220 : m_mouseEventManager->setMousePositionAndDispatchMouseEvent(currentHitT est.innerNode(), EventTypeNames::mouseup, fakeMouseUp);
217 221
218 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 222 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
219 if (tappedNonTextNode) { 223 if (tappedNonTextNode) {
220 if (currentHitTest.innerNode()) { 224 if (currentHitTest.innerNode()) {
221 // Updates distribution because a mouseup (or mousedown) event liste ner can make the 225 // Updates distribution because a mouseup (or mousedown) event liste ner can make the
222 // tree dirty at dispatchMouseEvent() invocation above. 226 // tree dirty at dispatchMouseEvent() invocation above.
223 // Unless distribution is updated, commonAncestor would hit DCHECK. 227 // Unless distribution is updated, commonAncestor would hit DCHECK.
224 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need to be updated 228 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need to be updated
225 // because commonAncestor() will exit early if their documents are d ifferent. 229 // because commonAncestor() will exit early if their documents are d ifferent.
226 tappedNonTextNode->updateDistribution(); 230 tappedNonTextNode->updateDistribution();
227 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(* tappedNonTextNode, EventHandler::parentForClickEvent); 231 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(* tappedNonTextNode, EventHandlingUtil::parentForClickEvent);
228 clickEventResult = m_frame->eventHandler().dispatchMouseEvent(EventT ypeNames::click, clickTargetNode, gestureEvent.tapCount(), fakeMouseUp); 232 clickEventResult = m_mouseEventManager->setMousePositionAndDispatchM ouseEvent(clickTargetNode, EventTypeNames::click, fakeMouseUp);
229 } 233 }
230 m_frame->eventHandler().setClickNode(nullptr); 234 m_mouseEventManager->setClickNode(nullptr);
231 } 235 }
232 236
233 if (mouseUpEventResult == WebInputEventResult::NotHandled) 237 if (mouseUpEventResult == WebInputEventResult::NotHandled)
234 mouseUpEventResult = m_frame->eventHandler().handleMouseReleaseEvent(Mou seEventWithHitTestResults(fakeMouseUp, currentHitTest)); 238 mouseUpEventResult = m_mouseEventManager->handleMouseReleaseEvent(MouseE ventWithHitTestResults(fakeMouseUp, currentHitTest));
235 m_frame->eventHandler().clearDragHeuristicState(); 239 m_mouseEventManager->clearDragHeuristicState();
236 240
237 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult(EventH andlingUtil::mergeEventResult(mouseDownEventResult, mouseUpEventResult), clickEv entResult); 241 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult(EventH andlingUtil::mergeEventResult(mouseDownEventResult, mouseUpEventResult), clickEv entResult);
238 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame- >page()) { 242 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame- >page()) {
239 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()-> domTreeVersion(); 243 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()-> domTreeVersion();
240 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl eVersion(); 244 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl eVersion();
241 245
242 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr ameToViewport(tappedPosition); 246 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr ameToViewport(tappedPosition);
243 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp ort, tappedNode, domTreeChanged || styleChanged); 247 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp ort, tappedNode, domTreeChanged || styleChanged);
244 } 248 }
245 return eventResult; 249 return eventResult;
246 } 250 }
247 251
248 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit hHitTestResults& targetedEvent) 252 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit hHitTestResults& targetedEvent)
249 { 253 {
250 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 254 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
251 255
252 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the 256 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the
253 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code 257 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code
254 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice. 258 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice.
255 259
256 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition()); 260 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition());
257 HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(h itTestPoint); 261 HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(h itTestPoint);
258 262
259 m_longTapShouldInvokeContextMenu = false; 263 m_longTapShouldInvokeContextMenu = false;
260 bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.abs oluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull(); 264 bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.abs oluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull();
261 265
262 if (!hitTestContainsLinks && m_frame->eventHandler().handleDragDropIfPossibl e(targetedEvent)) { 266 if (!hitTestContainsLinks && m_mouseEventManager->handleDragDropIfPossible(t argetedEvent)) {
263 m_longTapShouldInvokeContextMenu = true; 267 m_longTapShouldInvokeContextMenu = true;
264 return WebInputEventResult::HandledSystem; 268 return WebInputEventResult::HandledSystem;
265 } 269 }
266 270
267 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul t)) { 271 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul t)) {
268 m_frame->eventHandler().focusDocumentView(); 272 m_mouseEventManager->focusDocumentView();
269 return WebInputEventResult::HandledSystem; 273 return WebInputEventResult::HandledSystem;
270 } 274 }
271 275
272 return sendContextMenuEventForGesture(targetedEvent); 276 return sendContextMenuEventForGesture(targetedEvent);
273 } 277 }
274 278
275 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent) 279 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent)
276 { 280 {
277 #if !OS(ANDROID) 281 #if !OS(ANDROID)
278 if (m_longTapShouldInvokeContextMenu) { 282 if (m_longTapShouldInvokeContextMenu) {
(...skipping 13 matching lines...) Expand all
292 { 296 {
293 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 297 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
294 unsigned modifiers = gestureEvent.getModifiers(); 298 unsigned modifiers = gestureEvent.getModifiers();
295 299
296 if (!m_suppressMouseEventsFromGestures) { 300 if (!m_suppressMouseEventsFromGestures) {
297 // Send MouseMoved event prior to handling (https://crbug.com/485290). 301 // Send MouseMoved event prior to handling (https://crbug.com/485290).
298 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g lobalPosition(), 302 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g lobalPosition(),
299 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, / * clickCount */ 0, 303 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, / * clickCount */ 0,
300 static_cast<PlatformEvent::Modifiers>(modifiers), 304 static_cast<PlatformEvent::Modifiers>(modifiers),
301 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse); 305 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP roperties::PointerType::Mouse);
302 m_frame->eventHandler().dispatchMouseEvent( 306 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
303 EventTypeNames::mousemove, targetedEvent.hitTestResult().innerNode() , 0, fakeMouseMove); 307 targetedEvent.hitTestResult().innerNode(), EventTypeNames::mousemove , fakeMouseMove);
304 } 308 }
305 309
306 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; 310 PlatformEvent::EventType eventType = PlatformEvent::MousePressed;
307 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) 311 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
308 eventType = PlatformEvent::MouseReleased; 312 eventType = PlatformEvent::MouseReleased;
309 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), WebPointerProperties::Button::NoButton, 313 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), WebPointerProperties::Button::NoButton,
310 eventType, /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(mod ifiers), PlatformMouseEvent::FromTouch, 314 eventType, /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(mod ifiers), PlatformMouseEvent::FromTouch,
311 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse); 315 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse);
312 316
313 if (!m_suppressMouseEventsFromGestures && m_frame->view()) { 317 if (!m_suppressMouseEventsFromGestures && m_frame->view()) {
314 HitTestRequest request(HitTestRequest::Active); 318 HitTestRequest request(HitTestRequest::Active);
315 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents(targete dEvent.event().position()); 319 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents(targete dEvent.event().position());
316 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEven t(request, documentPoint, mouseEvent); 320 MouseEventWithHitTestResults mev = m_frame->document()->performMouseEven tHitTest(request, documentPoint, mouseEvent);
317 321
318 WebInputEventResult eventResult = m_frame->eventHandler().dispatchMouseE vent( 322 WebInputEventResult eventResult = m_mouseEventManager->setMousePositionA ndDispatchMouseEvent(
319 EventTypeNames::mousedown, mev.innerNode(), /* clickCount */ 0, mous eEvent); 323 mev.innerNode(), EventTypeNames::mousedown, mouseEvent);
320 324
321 if (eventResult == WebInputEventResult::NotHandled) 325 if (eventResult == WebInputEventResult::NotHandled)
322 eventResult = m_frame->eventHandler().handleMouseFocus(mev.hitTestRe sult(), InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); 326 eventResult = m_mouseEventManager->handleMouseFocus(mev.hitTestResul t(), InputDeviceCapabilities::firesTouchEventsSourceCapabilities());
323 327
324 if (eventResult == WebInputEventResult::NotHandled) 328 if (eventResult == WebInputEventResult::NotHandled)
325 m_frame->eventHandler().handleMousePressEvent(mev); 329 m_mouseEventManager->handleMousePressEvent(mev);
326 } 330 }
327 331
328 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent); 332 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
329 } 333 }
330 334
331 WebInputEventResult GestureManager::handleGestureShowPress() 335 WebInputEventResult GestureManager::handleGestureShowPress()
332 { 336 {
333 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); 337 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime();
334 338
335 FrameView* view = m_frame->view(); 339 FrameView* view = m_frame->view();
(...skipping 19 matching lines...) Expand all
355 359
356 return &m_frame->page()->frameHost(); 360 return &m_frame->page()->frameHost();
357 } 361 }
358 362
359 double GestureManager::getLastShowPressTimestamp() const 363 double GestureManager::getLastShowPressTimestamp() const
360 { 364 {
361 return m_lastShowPressTimestamp; 365 return m_lastShowPressTimestamp;
362 } 366 }
363 367
364 } // namespace blink 368 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698