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

Side by Side Diff: Source/core/input/EventHandler.cpp

Issue 1227363006: Virtualize EventDispatchMediator creation and cleanup calling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main
Patch Set: Rebase Created 5 years, 5 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 | « Source/core/events/WheelEvent.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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 3568
3569 pointerEventInit.setCtrlKey(event.ctrlKey()); 3569 pointerEventInit.setCtrlKey(event.ctrlKey());
3570 pointerEventInit.setShiftKey(event.shiftKey()); 3570 pointerEventInit.setShiftKey(event.shiftKey());
3571 pointerEventInit.setAltKey(event.altKey()); 3571 pointerEventInit.setAltKey(event.altKey());
3572 pointerEventInit.setMetaKey(event.metaKey()); 3572 pointerEventInit.setMetaKey(event.metaKey());
3573 3573
3574 pointerEventInit.setBubbles(!isEnterOrLeave); 3574 pointerEventInit.setBubbles(!isEnterOrLeave);
3575 pointerEventInit.setCancelable(!isEnterOrLeave && pointState != Platform TouchPoint::TouchCancelled); 3575 pointerEventInit.setCancelable(!isEnterOrLeave && pointState != Platform TouchPoint::TouchCancelled);
3576 3576
3577 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(eve ntName, pointerEventInit); 3577 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(eve ntName, pointerEventInit);
3578 touchInfo.touchTarget->toNode()->dispatchPointerEvent(pointerEvent.get() ); 3578 touchInfo.touchTarget->dispatchEvent(pointerEvent.get());
3579 touchInfo.consumed = pointerEvent->defaultPrevented() || pointerEvent->d efaultHandled(); 3579 touchInfo.consumed = pointerEvent->defaultPrevented() || pointerEvent->d efaultHandled();
3580 3580
3581 // Remove the released/cancelled id at the end to correctly determine pr imary id above. 3581 // Remove the released/cancelled id at the end to correctly determine pr imary id above.
3582 if (pointerReleasedOrCancelled) 3582 if (pointerReleasedOrCancelled)
3583 m_pointerIdManager.remove(PointerIdManager::PointerTypeTouch, pointe rId); 3583 m_pointerIdManager.remove(PointerIdManager::PointerTypeTouch, pointe rId);
3584 } 3584 }
3585 } 3585 }
3586 3586
3587 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos) 3587 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos)
3588 { 3588 {
3589 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3589 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3590 TouchInfo& touchInfo = touchInfos[i]; 3590 TouchInfo& touchInfo = touchInfos[i];
3591 const PlatformTouchPoint& point = touchInfo.point; 3591 const PlatformTouchPoint& point = touchInfo.point;
3592 const unsigned& pointerId = point.id(); 3592 const unsigned& pointerId = point.id();
3593 const PlatformTouchPoint::State pointState = point.state(); 3593 const PlatformTouchPoint::State pointState = point.state();
3594 3594
3595 if (pointState == PlatformTouchPoint::TouchReleased 3595 if (pointState == PlatformTouchPoint::TouchReleased
3596 || pointState == PlatformTouchPoint::TouchCancelled) 3596 || pointState == PlatformTouchPoint::TouchCancelled)
3597 continue; 3597 continue;
3598 3598
3599 PointerEventInit pointerEventInit; 3599 PointerEventInit pointerEventInit;
3600 pointerEventInit.setPointerId(pointerId); 3600 pointerEventInit.setPointerId(pointerId);
3601 pointerEventInit.setBubbles(true); 3601 pointerEventInit.setBubbles(true);
3602 pointerEventInit.setCancelable(false); 3602 pointerEventInit.setCancelable(false);
3603 3603
3604 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create( 3604 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(
3605 EventTypeNames::pointercancel, pointerEventInit); 3605 EventTypeNames::pointercancel, pointerEventInit);
3606 touchInfo.touchTarget->toNode()->dispatchPointerEvent(pointerEvent.get() ); 3606 touchInfo.touchTarget->dispatchEvent(pointerEvent.get());
3607 3607
3608 m_pointerIdManager.remove(PointerIdManager::PointerTypeTouch, pointerId) ; 3608 m_pointerIdManager.remove(PointerIdManager::PointerTypeTouch, pointerId) ;
3609 } 3609 }
3610 } 3610 }
3611 3611
3612 bool EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event, 3612 bool EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event,
3613 WillBeHeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouc hReleased) 3613 WillBeHeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouc hReleased)
3614 { 3614 {
3615 // Build up the lists to use for the 'touches', 'targetTouches' and 3615 // Build up the lists to use for the 'touches', 'targetTouches' and
3616 // 'changedTouches' attributes in the JS event. See 3616 // 'changedTouches' attributes in the JS event. See
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::State>(state))); 3699 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::State>(state)));
3700 const EventTargetSet& targetsForState = changedTouches[state].m_targets; 3700 const EventTargetSet& targetsForState = changedTouches[state].m_targets;
3701 for (const RefPtrWillBeMember<EventTarget>& eventTarget : targetsForStat e) { 3701 for (const RefPtrWillBeMember<EventTarget>& eventTarget : targetsForStat e) {
3702 EventTarget* touchEventTarget = eventTarget.get(); 3702 EventTarget* touchEventTarget = eventTarget.get();
3703 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create( 3703 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(
3704 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(), 3704 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(),
3705 eventName, touchEventTarget->toNode()->document().domWindow(), 3705 eventName, touchEventTarget->toNode()->document().domWindow(),
3706 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey (), 3706 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey (),
3707 event.cancelable(), event.causesScrollingIfUncanceled(), event.t imestamp()); 3707 event.cancelable(), event.causesScrollingIfUncanceled(), event.t imestamp());
3708 3708
3709 touchEventTarget->toNode()->dispatchTouchEvent(touchEvent.get()); 3709 touchEventTarget->dispatchEvent(touchEvent.get());
3710 swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() || touchEvent->defaultHandled(); 3710 swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() || touchEvent->defaultHandled();
3711 } 3711 }
3712 } 3712 }
3713 3713
3714 return swallowedEvent; 3714 return swallowedEvent;
3715 } 3715 }
3716 3716
3717 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) 3717 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
3718 { 3718 {
3719 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 3719 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 unsigned EventHandler::accessKeyModifiers() 4020 unsigned EventHandler::accessKeyModifiers()
4021 { 4021 {
4022 #if OS(MACOSX) 4022 #if OS(MACOSX)
4023 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4023 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4024 #else 4024 #else
4025 return PlatformEvent::AltKey; 4025 return PlatformEvent::AltKey;
4026 #endif 4026 #endif
4027 } 4027 }
4028 4028
4029 } // namespace blink 4029 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/WheelEvent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698