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

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

Issue 2326653003: Conditional hittesting & sending boundary events for captured pointer events (Closed)
Patch Set: Fix double function call Created 4 years, 3 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 | « third_party/WebKit/Source/core/input/EventHandler.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 // 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/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/dom/shadow/FlatTreeTraversal.h" 8 #include "core/dom/shadow/FlatTreeTraversal.h"
9 #include "core/events/MouseEvent.h" 9 #include "core/events/MouseEvent.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 processCaptureAndPositionOfPointerEvent(dummyPointerEvent, enteredNode, 174 processCaptureAndPositionOfPointerEvent(dummyPointerEvent, enteredNode,
175 exitedNode, mouseEvent, true, isFrameBoundaryTransition); 175 exitedNode, mouseEvent, true, isFrameBoundaryTransition);
176 } 176 }
177 177
178 void PointerEventManager::sendBoundaryEvents( 178 void PointerEventManager::sendBoundaryEvents(
179 EventTarget* exitedTarget, 179 EventTarget* exitedTarget,
180 EventTarget* enteredTarget, 180 EventTarget* enteredTarget,
181 PointerEvent* pointerEvent) 181 PointerEvent* pointerEvent)
182 { 182 {
183 if (RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled()) {
184 if (exitedTarget == enteredTarget)
185 return;
186 if (EventTarget* capturingTarget = getCapturingNode(pointerEvent->pointe rId())) {
187 if (capturingTarget == exitedTarget)
188 enteredTarget = nullptr;
189 else if (capturingTarget == enteredTarget)
190 exitedTarget = nullptr;
191 else
192 return;
193 }
194 }
183 PointerEventBoundaryEventDispatcher boundaryEventDispatcher(this, pointerEve nt); 195 PointerEventBoundaryEventDispatcher boundaryEventDispatcher(this, pointerEve nt);
184 boundaryEventDispatcher.sendBoundaryEvents(exitedTarget, enteredTarget); 196 boundaryEventDispatcher.sendBoundaryEvents(exitedTarget, enteredTarget);
185 } 197 }
186 198
187 void PointerEventManager::setNodeUnderPointer( 199 void PointerEventManager::setNodeUnderPointer(
188 PointerEvent* pointerEvent, 200 PointerEvent* pointerEvent,
189 EventTarget* target) 201 EventTarget* target)
190 { 202 {
191 if (m_nodeUnderPointer.contains(pointerEvent->pointerId())) { 203 if (m_nodeUnderPointer.contains(pointerEvent->pointerId())) {
192 EventTargetAttributes node = m_nodeUnderPointer.get( 204 EventTargetAttributes node = m_nodeUnderPointer.get(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 TouchEventManager::TouchInfo touchInfo; 295 TouchEventManager::TouchInfo touchInfo;
284 touchInfo.point = touchPoint; 296 touchInfo.point = touchPoint;
285 297
286 int pointerId = m_pointerEventFactory.getPointerEventId( 298 int pointerId = m_pointerEventFactory.getPointerEventId(
287 touchPoint.pointerProperties()); 299 touchPoint.pointerProperties());
288 // Do the hit test either when the touch first starts or when the touch 300 // Do the hit test either when the touch first starts or when the touch
289 // is not captured. |m_pendingPointerCaptureTarget| indicates the target 301 // is not captured. |m_pendingPointerCaptureTarget| indicates the target
290 // that will be capturing this event. |m_pointerCaptureTarget| may not 302 // that will be capturing this event. |m_pointerCaptureTarget| may not
291 // have this target yet since the processing of that will be done right 303 // have this target yet since the processing of that will be done right
292 // before firing the event. 304 // before firing the event.
293 if (touchInfo.point.state() == PlatformTouchPoint::TouchPressed 305 if (RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled()
306 || touchInfo.point.state() == PlatformTouchPoint::TouchPressed
294 || !m_pendingPointerCaptureTarget.contains(pointerId)) { 307 || !m_pendingPointerCaptureTarget.contains(pointerId)) {
295 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEv ent | HitTestRequest::ReadOnly | HitTestRequest::Active; 308 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEv ent | HitTestRequest::ReadOnly | HitTestRequest::Active;
296 LayoutPoint pagePoint = roundedLayoutPoint(m_frame->view()->rootFram eToContents(touchInfo.point.pos())); 309 LayoutPoint pagePoint = roundedLayoutPoint(m_frame->view()->rootFram eToContents(touchInfo.point.pos()));
297 HitTestResult hitTestTesult = m_frame->eventHandler().hitTestResultA tPoint(pagePoint, hitType); 310 HitTestResult hitTestTesult = m_frame->eventHandler().hitTestResultA tPoint(pagePoint, hitType);
298 Node* node = hitTestTesult.innerNode(); 311 Node* node = hitTestTesult.innerNode();
299 if (node) { 312 if (node) {
300 touchInfo.targetFrame = node->document().frame(); 313 touchInfo.targetFrame = node->document().frame();
301 if (isHTMLCanvasElement(node)) { 314 if (isHTMLCanvasElement(node)) {
302 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasEleme nt(node)->getControlAndIdIfHitRegionExists(hitTestTesult.pointInInnerNodeFrame() ); 315 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasEleme nt(node)->getControlAndIdIfHitRegionExists(hitTestTesult.pointInInnerNodeFrame() );
303 if (hitTestCanvasResult->getControl()) 316 if (hitTestCanvasResult->getControl())
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 EventTarget* PointerEventManager::processCaptureAndPositionOfPointerEvent( 529 EventTarget* PointerEventManager::processCaptureAndPositionOfPointerEvent(
517 PointerEvent* pointerEvent, 530 PointerEvent* pointerEvent,
518 EventTarget* hitTestTarget, 531 EventTarget* hitTestTarget,
519 EventTarget* lastNodeUnderMouse, 532 EventTarget* lastNodeUnderMouse,
520 const PlatformMouseEvent& mouseEvent, 533 const PlatformMouseEvent& mouseEvent,
521 bool sendMouseEvent, bool setPointerPosition) 534 bool sendMouseEvent, bool setPointerPosition)
522 { 535 {
523 if (setPointerPosition) { 536 if (setPointerPosition) {
524 processPendingPointerCapture(pointerEvent); 537 processPendingPointerCapture(pointerEvent);
525 538
526 PointerCapturingMap::const_iterator it = m_pointerCaptureTarget.find(poi nterEvent->pointerId()); 539 if (!RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled()) {
527 if (EventTarget* pointercaptureTarget = (it != m_pointerCaptureTarget.en d()) ? it->value : nullptr) 540 PointerCapturingMap::const_iterator it = m_pointerCaptureTarget.find (pointerEvent->pointerId());
528 hitTestTarget = pointercaptureTarget; 541 if (EventTarget* pointercaptureTarget = (it != m_pointerCaptureTarge t.end()) ? it->value : nullptr)
542 hitTestTarget = pointercaptureTarget;
543 }
529 544
530 setNodeUnderPointer(pointerEvent, hitTestTarget); 545 setNodeUnderPointer(pointerEvent, hitTestTarget);
531 } 546 }
532 if (sendMouseEvent) { 547 if (sendMouseEvent) {
533 // lastNodeUnderMouse is needed here because it is still stored in Event Handler. 548 // lastNodeUnderMouse is needed here because it is still stored in Event Handler.
534 m_mouseEventManager->sendBoundaryEvents(lastNodeUnderMouse, 549 m_mouseEventManager->sendBoundaryEvents(lastNodeUnderMouse,
535 hitTestTarget, mouseEvent); 550 hitTestTarget, mouseEvent);
536 } 551 }
537 return hitTestTarget; 552 return hitTestTarget;
538 } 553 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 visitor->trace(m_frame); 699 visitor->trace(m_frame);
685 visitor->trace(m_nodeUnderPointer); 700 visitor->trace(m_nodeUnderPointer);
686 visitor->trace(m_pointerCaptureTarget); 701 visitor->trace(m_pointerCaptureTarget);
687 visitor->trace(m_pendingPointerCaptureTarget); 702 visitor->trace(m_pendingPointerCaptureTarget);
688 visitor->trace(m_touchEventManager); 703 visitor->trace(m_touchEventManager);
689 visitor->trace(m_mouseEventManager); 704 visitor->trace(m_mouseEventManager);
690 } 705 }
691 706
692 707
693 } // namespace blink 708 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698