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

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

Issue 2678683002: Delay instantiating InputDeviceCapabilities until accessed. (Closed)
Patch Set: rebased 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 "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/dom/DocumentUserGestureToken.h" 8 #include "core/dom/DocumentUserGestureToken.h"
9 #include "core/editing/SelectionController.h" 9 #include "core/editing/SelectionController.h"
10 #include "core/events/GestureEvent.h" 10 #include "core/events/GestureEvent.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (!m_suppressMouseEventsFromGestures) { 209 if (!m_suppressMouseEventsFromGestures) {
210 m_mouseEventManager->setClickCount(gestureEvent.tapCount()); 210 m_mouseEventManager->setClickCount(gestureEvent.tapCount());
211 211
212 mouseDownEventResult = 212 mouseDownEventResult =
213 m_mouseEventManager->setMousePositionAndDispatchMouseEvent( 213 m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
214 currentHitTest.innerNode(), currentHitTest.canvasRegionId(), 214 currentHitTest.innerNode(), currentHitTest.canvasRegionId(),
215 EventTypeNames::mousedown, fakeMouseDown); 215 EventTypeNames::mousedown, fakeMouseDown);
216 m_selectionController->initializeSelectionState(); 216 m_selectionController->initializeSelectionState();
217 if (mouseDownEventResult == WebInputEventResult::NotHandled) { 217 if (mouseDownEventResult == WebInputEventResult::NotHandled) {
218 mouseDownEventResult = m_mouseEventManager->handleMouseFocus( 218 mouseDownEventResult = m_mouseEventManager->handleMouseFocus(
219 currentHitTest, m_frame->document() 219 currentHitTest, InputDeviceCapabilities::FiresTouchEvents);
220 ->domWindow()
221 ->getInputDeviceCapabilities()
222 ->firesTouchEvents(true));
223 } 220 }
224 if (mouseDownEventResult == WebInputEventResult::NotHandled) { 221 if (mouseDownEventResult == WebInputEventResult::NotHandled) {
225 mouseDownEventResult = m_mouseEventManager->handleMousePressEvent( 222 mouseDownEventResult = m_mouseEventManager->handleMousePressEvent(
226 MouseEventWithHitTestResults(fakeMouseDown, currentHitTest)); 223 MouseEventWithHitTestResults(fakeMouseDown, currentHitTest));
227 } 224 }
228 } 225 }
229 226
230 if (currentHitTest.innerNode()) { 227 if (currentHitTest.innerNode()) {
231 DCHECK(gestureEvent.type() == WebInputEvent::GestureTap); 228 DCHECK(gestureEvent.type() == WebInputEvent::GestureTap);
232 HitTestResult result = currentHitTest; 229 HitTestResult result = currentHitTest;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 WebInputEvent::IsCompatibilityEventForTouch), 388 WebInputEvent::IsCompatibilityEventForTouch),
392 gestureEvent.timeStampSeconds()); 389 gestureEvent.timeStampSeconds());
393 390
394 if (!m_suppressMouseEventsFromGestures && m_frame->view()) { 391 if (!m_suppressMouseEventsFromGestures && m_frame->view()) {
395 HitTestRequest request(HitTestRequest::Active); 392 HitTestRequest request(HitTestRequest::Active);
396 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents( 393 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents(
397 flooredIntPoint(targetedEvent.event().positionInRootFrame())); 394 flooredIntPoint(targetedEvent.event().positionInRootFrame()));
398 MouseEventWithHitTestResults mev = 395 MouseEventWithHitTestResults mev =
399 m_frame->document()->performMouseEventHitTest(request, documentPoint, 396 m_frame->document()->performMouseEventHitTest(request, documentPoint,
400 mouseEvent); 397 mouseEvent);
401 m_mouseEventManager->handleMouseFocus(mev.hitTestResult(), 398 m_mouseEventManager->handleMouseFocus(
402 m_frame->document() 399 mev.hitTestResult(), InputDeviceCapabilities::FiresTouchEvents);
403 ->domWindow()
404 ->getInputDeviceCapabilities()
405 ->firesTouchEvents(true));
406 } 400 }
407 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent); 401 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
408 } 402 }
409 403
410 WebInputEventResult GestureManager::handleGestureShowPress() { 404 WebInputEventResult GestureManager::handleGestureShowPress() {
411 m_lastShowPressTimestamp = TimeTicks::Now(); 405 m_lastShowPressTimestamp = TimeTicks::Now();
412 406
413 FrameView* view = m_frame->view(); 407 FrameView* view = m_frame->view();
414 if (!view) 408 if (!view)
415 return WebInputEventResult::NotHandled; 409 return WebInputEventResult::NotHandled;
(...skipping 16 matching lines...) Expand all
432 426
433 return &m_frame->page()->frameHost(); 427 return &m_frame->page()->frameHost();
434 } 428 }
435 429
436 WTF::Optional<WTF::TimeTicks> GestureManager::getLastShowPressTimestamp() 430 WTF::Optional<WTF::TimeTicks> GestureManager::getLastShowPressTimestamp()
437 const { 431 const {
438 return m_lastShowPressTimestamp; 432 return m_lastShowPressTimestamp;
439 } 433 }
440 434
441 } // namespace blink 435 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/input/InputDeviceCapabilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698