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

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: Yet another rebase because of a presubmit rule bug 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, 21 GestureManager::GestureManager(LocalFrame* frame,
22 ScrollManager* scrollManager, 22 ScrollManager* scrollManager,
23 MouseEventManager* mouseEventManager,
23 PointerEventManager* pointerEventManager, 24 PointerEventManager* pointerEventManager,
24 SelectionController* selectionController) 25 SelectionController* selectionController)
25 : m_frame(frame), 26 : m_frame(frame),
26 m_scrollManager(scrollManager), 27 m_scrollManager(scrollManager),
28 m_mouseEventManager(mouseEventManager),
27 m_pointerEventManager(pointerEventManager), 29 m_pointerEventManager(pointerEventManager),
28 m_selectionController(selectionController) { 30 m_selectionController(selectionController) {
29 clear(); 31 clear();
30 } 32 }
31 33
32 void GestureManager::clear() { 34 void GestureManager::clear() {
33 m_suppressMouseEventsFromGestures = false; 35 m_suppressMouseEventsFromGestures = false;
34 m_longTapShouldInvokeContextMenu = false; 36 m_longTapShouldInvokeContextMenu = false;
35 m_lastShowPressTimestamp = 0; 37 m_lastShowPressTimestamp = 0;
36 } 38 }
37 39
38 DEFINE_TRACE(GestureManager) { 40 DEFINE_TRACE(GestureManager) {
39 visitor->trace(m_frame); 41 visitor->trace(m_frame);
42 visitor->trace(m_scrollManager);
43 visitor->trace(m_mouseEventManager);
44 visitor->trace(m_pointerEventManager);
40 visitor->trace(m_selectionController); 45 visitor->trace(m_selectionController);
41 visitor->trace(m_pointerEventManager);
42 visitor->trace(m_scrollManager);
43 } 46 }
44 47
45 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType( 48 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType(
46 PlatformEvent::EventType type) { 49 PlatformEvent::EventType type) {
47 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; 50 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
48 switch (type) { 51 switch (type) {
49 case PlatformEvent::GestureShowPress: 52 case PlatformEvent::GestureShowPress:
50 case PlatformEvent::GestureTapUnconfirmed: 53 case PlatformEvent::GestureTapUnconfirmed:
51 return hitType | HitTestRequest::Active; 54 return hitType | HitTestRequest::Active;
52 case PlatformEvent::GestureTapDownCancel: 55 case PlatformEvent::GestureTapDownCancel:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 149
147 const unsigned modifiers = gestureEvent.getModifiers(); 150 const unsigned modifiers = gestureEvent.getModifiers();
148 151
149 if (!m_suppressMouseEventsFromGestures) { 152 if (!m_suppressMouseEventsFromGestures) {
150 PlatformMouseEvent fakeMouseMove( 153 PlatformMouseEvent fakeMouseMove(
151 gestureEvent.position(), gestureEvent.globalPosition(), 154 gestureEvent.position(), gestureEvent.globalPosition(),
152 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 155 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved,
153 /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(modifiers), 156 /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(modifiers),
154 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), 157 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(),
155 WebPointerProperties::PointerType::Mouse); 158 WebPointerProperties::PointerType::Mouse);
156 m_frame->eventHandler().dispatchMouseEvent(EventTypeNames::mousemove, 159 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
157 currentHitTest.innerNode(), 0, 160 currentHitTest.innerNode(), EventTypeNames::mousemove, fakeMouseMove);
158 fakeMouseMove);
159 } 161 }
160 162
161 // Do a new hit-test in case the mousemove event changed the DOM. 163 // Do a new hit-test in case the mousemove event changed the DOM.
162 // Note that if the original hit test wasn't over an element (eg. was over a s crollbar) we 164 // Note that if the original hit test wasn't over an element (eg. was over a s crollbar) we
163 // don't want to re-hit-test because it may be in the wrong frame (and there's no way the page 165 // don't want to re-hit-test because it may be in the wrong frame (and there's no way the page
164 // could have seen the event anyway). 166 // could have seen the event anyway).
165 // Also note that the position of the frame may have changed, so we need to re compute the content 167 // Also note that the position of the frame may have changed, so we need to re compute the content
166 // co-ordinates (updating layout/style as hitTestResultAtPoint normally would) . 168 // co-ordinates (updating layout/style as hitTestResultAtPoint normally would) .
167 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.co m/398920 169 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.co m/398920
168 if (currentHitTest.innerNode()) { 170 if (currentHitTest.innerNode()) {
169 LocalFrame* mainFrame = m_frame->localFrameRoot(); 171 LocalFrame* mainFrame = m_frame->localFrameRoot();
170 if (mainFrame && mainFrame->view()) 172 if (mainFrame && mainFrame->view())
171 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); 173 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling();
172 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 174 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
173 currentHitTest = EventHandlingUtil::hitTestResultInFrame( 175 currentHitTest = EventHandlingUtil::hitTestResultInFrame(
174 m_frame, adjustedPoint, hitType); 176 m_frame, adjustedPoint, hitType);
175 } 177 }
176 178
177 // Capture data for showUnhandledTapUIIfNeeded. 179 // Capture data for showUnhandledTapUIIfNeeded.
178 Node* tappedNode = currentHitTest.innerNode(); 180 Node* tappedNode = currentHitTest.innerNode();
179 IntPoint tappedPosition = gestureEvent.position(); 181 IntPoint tappedPosition = gestureEvent.position();
180 Node* tappedNonTextNode = tappedNode; 182 Node* tappedNonTextNode = tappedNode;
181 183
182 if (tappedNonTextNode && tappedNonTextNode->isTextNode()) 184 if (tappedNonTextNode && tappedNonTextNode->isTextNode())
183 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode); 185 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode);
184 186
185 m_frame->eventHandler().setClickNode(tappedNonTextNode); 187 m_mouseEventManager->setClickNode(tappedNonTextNode);
186 188
187 PlatformMouseEvent fakeMouseDown( 189 PlatformMouseEvent fakeMouseDown(
188 gestureEvent.position(), gestureEvent.globalPosition(), 190 gestureEvent.position(), gestureEvent.globalPosition(),
189 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 191 WebPointerProperties::Button::Left, PlatformEvent::MousePressed,
190 gestureEvent.tapCount(), static_cast<PlatformEvent::Modifiers>( 192 gestureEvent.tapCount(), static_cast<PlatformEvent::Modifiers>(
191 modifiers | PlatformEvent::LeftButtonDown), 193 modifiers | PlatformEvent::LeftButtonDown),
192 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), 194 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(),
193 WebPointerProperties::PointerType::Mouse); 195 WebPointerProperties::PointerType::Mouse);
194 196
195 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that 197 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that
196 // mean for for TEs? What's the right balance here? crbug.com/617255 198 // mean for for TEs? What's the right balance here? crbug.com/617255
197 WebInputEventResult mouseDownEventResult = 199 WebInputEventResult mouseDownEventResult =
198 WebInputEventResult::HandledSuppressed; 200 WebInputEventResult::HandledSuppressed;
199 if (!m_suppressMouseEventsFromGestures) { 201 if (!m_suppressMouseEventsFromGestures) {
200 mouseDownEventResult = m_frame->eventHandler().dispatchMouseEvent( 202 m_mouseEventManager->setClickCount(gestureEvent.tapCount());
201 EventTypeNames::mousedown, currentHitTest.innerNode(), 203
202 gestureEvent.tapCount(), fakeMouseDown); 204 mouseDownEventResult =
205 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
206 currentHitTest.innerNode(), EventTypeNames::mousedown,
207 fakeMouseDown);
203 m_selectionController->initializeSelectionState(); 208 m_selectionController->initializeSelectionState();
204 if (mouseDownEventResult == WebInputEventResult::NotHandled) 209 if (mouseDownEventResult == WebInputEventResult::NotHandled)
205 mouseDownEventResult = m_frame->eventHandler().handleMouseFocus( 210 mouseDownEventResult = m_mouseEventManager->handleMouseFocus(
206 currentHitTest, 211 currentHitTest,
207 InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); 212 InputDeviceCapabilities::firesTouchEventsSourceCapabilities());
208 if (mouseDownEventResult == WebInputEventResult::NotHandled) 213 if (mouseDownEventResult == WebInputEventResult::NotHandled)
209 mouseDownEventResult = m_frame->eventHandler().handleMousePressEvent( 214 mouseDownEventResult = m_mouseEventManager->handleMousePressEvent(
210 MouseEventWithHitTestResults(fakeMouseDown, currentHitTest)); 215 MouseEventWithHitTestResults(fakeMouseDown, currentHitTest));
211 } 216 }
212 217
213 if (currentHitTest.innerNode()) { 218 if (currentHitTest.innerNode()) {
214 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap); 219 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap);
215 HitTestResult result = currentHitTest; 220 HitTestResult result = currentHitTest;
216 result.setToShadowHostIfInUserAgentShadowRoot(); 221 result.setToShadowHostIfInUserAgentShadowRoot();
217 m_frame->chromeClient().onMouseDown(result.innerNode()); 222 m_frame->chromeClient().onMouseDown(result.innerNode());
218 } 223 }
219 224
220 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.co m/398920 225 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.co m/398920
221 if (currentHitTest.innerNode()) { 226 if (currentHitTest.innerNode()) {
222 LocalFrame* mainFrame = m_frame->localFrameRoot(); 227 LocalFrame* mainFrame = m_frame->localFrameRoot();
223 if (mainFrame && mainFrame->view()) 228 if (mainFrame && mainFrame->view())
224 mainFrame->view()->updateAllLifecyclePhases(); 229 mainFrame->view()->updateAllLifecyclePhases();
225 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 230 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
226 currentHitTest = EventHandlingUtil::hitTestResultInFrame( 231 currentHitTest = EventHandlingUtil::hitTestResultInFrame(
227 m_frame, adjustedPoint, hitType); 232 m_frame, adjustedPoint, hitType);
228 } 233 }
229 234
230 PlatformMouseEvent fakeMouseUp( 235 PlatformMouseEvent fakeMouseUp(
231 gestureEvent.position(), gestureEvent.globalPosition(), 236 gestureEvent.position(), gestureEvent.globalPosition(),
232 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 237 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased,
233 gestureEvent.tapCount(), static_cast<PlatformEvent::Modifiers>(modifiers), 238 gestureEvent.tapCount(), static_cast<PlatformEvent::Modifiers>(modifiers),
234 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), 239 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(),
235 WebPointerProperties::PointerType::Mouse); 240 WebPointerProperties::PointerType::Mouse);
236 WebInputEventResult mouseUpEventResult = 241 WebInputEventResult mouseUpEventResult =
237 m_suppressMouseEventsFromGestures 242 m_suppressMouseEventsFromGestures
238 ? WebInputEventResult::HandledSuppressed 243 ? WebInputEventResult::HandledSuppressed
239 : m_frame->eventHandler().dispatchMouseEvent( 244 : m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
240 EventTypeNames::mouseup, currentHitTest.innerNode(), 245 currentHitTest.innerNode(), EventTypeNames::mouseup,
241 gestureEvent.tapCount(), fakeMouseUp); 246 fakeMouseUp);
242 247
243 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 248 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
244 if (tappedNonTextNode) { 249 if (tappedNonTextNode) {
245 if (currentHitTest.innerNode()) { 250 if (currentHitTest.innerNode()) {
246 // Updates distribution because a mouseup (or mousedown) event listener ca n make the 251 // Updates distribution because a mouseup (or mousedown) event listener ca n make the
247 // tree dirty at dispatchMouseEvent() invocation above. 252 // tree dirty at dispatchMouseEvent() invocation above.
248 // Unless distribution is updated, commonAncestor would hit DCHECK. 253 // Unless distribution is updated, commonAncestor would hit DCHECK.
249 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need to be updated 254 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need to be updated
250 // because commonAncestor() will exit early if their documents are differe nt. 255 // because commonAncestor() will exit early if their documents are differe nt.
251 tappedNonTextNode->updateDistribution(); 256 tappedNonTextNode->updateDistribution();
252 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor( 257 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(
253 *tappedNonTextNode, EventHandler::parentForClickEvent); 258 *tappedNonTextNode, EventHandlingUtil::parentForClickEvent);
254 clickEventResult = m_frame->eventHandler().dispatchMouseEvent( 259 clickEventResult =
255 EventTypeNames::click, clickTargetNode, gestureEvent.tapCount(), 260 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
256 fakeMouseUp); 261 clickTargetNode, EventTypeNames::click, fakeMouseUp);
257 } 262 }
258 m_frame->eventHandler().setClickNode(nullptr); 263 m_mouseEventManager->setClickNode(nullptr);
259 } 264 }
260 265
261 if (mouseUpEventResult == WebInputEventResult::NotHandled) 266 if (mouseUpEventResult == WebInputEventResult::NotHandled)
262 mouseUpEventResult = m_frame->eventHandler().handleMouseReleaseEvent( 267 mouseUpEventResult = m_mouseEventManager->handleMouseReleaseEvent(
263 MouseEventWithHitTestResults(fakeMouseUp, currentHitTest)); 268 MouseEventWithHitTestResults(fakeMouseUp, currentHitTest));
264 m_frame->eventHandler().clearDragHeuristicState(); 269 m_mouseEventManager->clearDragHeuristicState();
265 270
266 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult( 271 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult(
267 EventHandlingUtil::mergeEventResult(mouseDownEventResult, 272 EventHandlingUtil::mergeEventResult(mouseDownEventResult,
268 mouseUpEventResult), 273 mouseUpEventResult),
269 clickEventResult); 274 clickEventResult);
270 if (eventResult == WebInputEventResult::NotHandled && tappedNode && 275 if (eventResult == WebInputEventResult::NotHandled && tappedNode &&
271 m_frame->page()) { 276 m_frame->page()) {
272 bool domTreeChanged = 277 bool domTreeChanged =
273 preDispatchDomTreeVersion != m_frame->document()->domTreeVersion(); 278 preDispatchDomTreeVersion != m_frame->document()->domTreeVersion();
274 bool styleChanged = 279 bool styleChanged =
(...skipping 19 matching lines...) Expand all
294 m_frame->view()->rootFrameToContents(gestureEvent.position()); 299 m_frame->view()->rootFrameToContents(gestureEvent.position());
295 HitTestResult hitTestResult = 300 HitTestResult hitTestResult =
296 m_frame->eventHandler().hitTestResultAtPoint(hitTestPoint); 301 m_frame->eventHandler().hitTestResultAtPoint(hitTestPoint);
297 302
298 m_longTapShouldInvokeContextMenu = false; 303 m_longTapShouldInvokeContextMenu = false;
299 bool hitTestContainsLinks = hitTestResult.URLElement() || 304 bool hitTestContainsLinks = hitTestResult.URLElement() ||
300 !hitTestResult.absoluteImageURL().isNull() || 305 !hitTestResult.absoluteImageURL().isNull() ||
301 !hitTestResult.absoluteMediaURL().isNull(); 306 !hitTestResult.absoluteMediaURL().isNull();
302 307
303 if (!hitTestContainsLinks && 308 if (!hitTestContainsLinks &&
304 m_frame->eventHandler().handleDragDropIfPossible(targetedEvent)) { 309 m_mouseEventManager->handleDragDropIfPossible(targetedEvent)) {
305 m_longTapShouldInvokeContextMenu = true; 310 m_longTapShouldInvokeContextMenu = true;
306 return WebInputEventResult::HandledSystem; 311 return WebInputEventResult::HandledSystem;
307 } 312 }
308 313
309 if (m_selectionController->handleGestureLongPress(gestureEvent, 314 if (m_selectionController->handleGestureLongPress(gestureEvent,
310 hitTestResult)) { 315 hitTestResult)) {
311 m_frame->eventHandler().focusDocumentView(); 316 m_mouseEventManager->focusDocumentView();
312 return WebInputEventResult::HandledSystem; 317 return WebInputEventResult::HandledSystem;
313 } 318 }
314 319
315 return sendContextMenuEventForGesture(targetedEvent); 320 return sendContextMenuEventForGesture(targetedEvent);
316 } 321 }
317 322
318 WebInputEventResult GestureManager::handleGestureLongTap( 323 WebInputEventResult GestureManager::handleGestureLongTap(
319 const GestureEventWithHitTestResults& targetedEvent) { 324 const GestureEventWithHitTestResults& targetedEvent) {
320 #if !OS(ANDROID) 325 #if !OS(ANDROID)
321 if (m_longTapShouldInvokeContextMenu) { 326 if (m_longTapShouldInvokeContextMenu) {
(...skipping 15 matching lines...) Expand all
337 unsigned modifiers = gestureEvent.getModifiers(); 342 unsigned modifiers = gestureEvent.getModifiers();
338 343
339 if (!m_suppressMouseEventsFromGestures) { 344 if (!m_suppressMouseEventsFromGestures) {
340 // Send MouseMoved event prior to handling (https://crbug.com/485290). 345 // Send MouseMoved event prior to handling (https://crbug.com/485290).
341 PlatformMouseEvent fakeMouseMove( 346 PlatformMouseEvent fakeMouseMove(
342 gestureEvent.position(), gestureEvent.globalPosition(), 347 gestureEvent.position(), gestureEvent.globalPosition(),
343 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 348 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved,
344 /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(modifiers), 349 /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(modifiers),
345 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), 350 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(),
346 WebPointerProperties::PointerType::Mouse); 351 WebPointerProperties::PointerType::Mouse);
347 m_frame->eventHandler().dispatchMouseEvent( 352 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
348 EventTypeNames::mousemove, targetedEvent.hitTestResult().innerNode(), 0, 353 targetedEvent.hitTestResult().innerNode(), EventTypeNames::mousemove,
349 fakeMouseMove); 354 fakeMouseMove);
350 } 355 }
351 356
352 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; 357 PlatformEvent::EventType eventType = PlatformEvent::MousePressed;
353 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) 358 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
354 eventType = PlatformEvent::MouseReleased; 359 eventType = PlatformEvent::MouseReleased;
355 PlatformMouseEvent mouseEvent( 360 PlatformMouseEvent mouseEvent(
356 targetedEvent.event().position(), targetedEvent.event().globalPosition(), 361 targetedEvent.event().position(), targetedEvent.event().globalPosition(),
357 WebPointerProperties::Button::NoButton, eventType, /* clickCount */ 0, 362 WebPointerProperties::Button::NoButton, eventType, /* clickCount */ 0,
358 static_cast<PlatformEvent::Modifiers>(modifiers), 363 static_cast<PlatformEvent::Modifiers>(modifiers),
359 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), 364 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(),
360 WebPointerProperties::PointerType::Mouse); 365 WebPointerProperties::PointerType::Mouse);
361 366
362 if (!m_suppressMouseEventsFromGestures && m_frame->view()) { 367 if (!m_suppressMouseEventsFromGestures && m_frame->view()) {
363 HitTestRequest request(HitTestRequest::Active); 368 HitTestRequest request(HitTestRequest::Active);
364 LayoutPoint documentPoint = 369 LayoutPoint documentPoint =
365 m_frame->view()->rootFrameToContents(targetedEvent.event().position()); 370 m_frame->view()->rootFrameToContents(targetedEvent.event().position());
366 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent( 371 MouseEventWithHitTestResults mev =
367 request, documentPoint, mouseEvent); 372 m_frame->document()->performMouseEventHitTest(request, documentPoint,
373 mouseEvent);
368 374
369 WebInputEventResult eventResult = 375 WebInputEventResult eventResult =
370 m_frame->eventHandler().dispatchMouseEvent( 376 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
371 EventTypeNames::mousedown, mev.innerNode(), /* clickCount */ 0, 377 mev.innerNode(), EventTypeNames::mousedown, mouseEvent);
372 mouseEvent);
373 378
374 if (eventResult == WebInputEventResult::NotHandled) 379 if (eventResult == WebInputEventResult::NotHandled)
375 eventResult = m_frame->eventHandler().handleMouseFocus( 380 eventResult = m_mouseEventManager->handleMouseFocus(
376 mev.hitTestResult(), 381 mev.hitTestResult(),
377 InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); 382 InputDeviceCapabilities::firesTouchEventsSourceCapabilities());
378 383
379 if (eventResult == WebInputEventResult::NotHandled) 384 if (eventResult == WebInputEventResult::NotHandled)
380 m_frame->eventHandler().handleMousePressEvent(mev); 385 m_mouseEventManager->handleMousePressEvent(mev);
381 } 386 }
382 387
383 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent); 388 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
384 } 389 }
385 390
386 WebInputEventResult GestureManager::handleGestureShowPress() { 391 WebInputEventResult GestureManager::handleGestureShowPress() {
387 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); 392 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime();
388 393
389 FrameView* view = m_frame->view(); 394 FrameView* view = m_frame->view();
390 if (!view) 395 if (!view)
(...skipping 16 matching lines...) Expand all
407 return nullptr; 412 return nullptr;
408 413
409 return &m_frame->page()->frameHost(); 414 return &m_frame->page()->frameHost();
410 } 415 }
411 416
412 double GestureManager::getLastShowPressTimestamp() const { 417 double GestureManager::getLastShowPressTimestamp() const {
413 return m_lastShowPressTimestamp; 418 return m_lastShowPressTimestamp;
414 } 419 }
415 420
416 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/GestureManager.h ('k') | third_party/WebKit/Source/core/input/KeyboardEventManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698