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

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

Issue 2525973002: Remove the pointer event capturing flag (Closed)
Patch Set: Created 4 years 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/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/DocumentUserGestureToken.h" 7 #include "core/dom/DocumentUserGestureToken.h"
8 #include "core/dom/ElementTraversal.h" 8 #include "core/dom/ElementTraversal.h"
9 #include "core/dom/shadow/FlatTreeTraversal.h" 9 #include "core/dom/shadow/FlatTreeTraversal.h"
10 #include "core/events/MouseEvent.h" 10 #include "core/events/MouseEvent.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 mouseEvent.pointerProperties().pointerType)] = false; 202 mouseEvent.pointerProperties().pointerType)] = false;
203 } 203 }
204 204
205 processCaptureAndPositionOfPointerEvent(dummyPointerEvent, enteredNode, 205 processCaptureAndPositionOfPointerEvent(dummyPointerEvent, enteredNode,
206 mouseEvent, true); 206 mouseEvent, true);
207 } 207 }
208 208
209 void PointerEventManager::sendBoundaryEvents(EventTarget* exitedTarget, 209 void PointerEventManager::sendBoundaryEvents(EventTarget* exitedTarget,
210 EventTarget* enteredTarget, 210 EventTarget* enteredTarget,
211 PointerEvent* pointerEvent) { 211 PointerEvent* pointerEvent) {
212 if (RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled()) {
213 if (exitedTarget == enteredTarget)
214 return;
215 if (EventTarget* capturingTarget =
216 getCapturingNode(pointerEvent->pointerId())) {
217 if (capturingTarget == exitedTarget)
218 enteredTarget = nullptr;
219 else if (capturingTarget == enteredTarget)
220 exitedTarget = nullptr;
221 else
222 return;
223 }
224 }
225 PointerEventBoundaryEventDispatcher boundaryEventDispatcher(this, 212 PointerEventBoundaryEventDispatcher boundaryEventDispatcher(this,
226 pointerEvent); 213 pointerEvent);
227 boundaryEventDispatcher.sendBoundaryEvents(exitedTarget, enteredTarget); 214 boundaryEventDispatcher.sendBoundaryEvents(exitedTarget, enteredTarget);
228 } 215 }
229 216
230 void PointerEventManager::setNodeUnderPointer(PointerEvent* pointerEvent, 217 void PointerEventManager::setNodeUnderPointer(PointerEvent* pointerEvent,
231 EventTarget* target) { 218 EventTarget* target) {
232 if (m_nodeUnderPointer.contains(pointerEvent->pointerId())) { 219 if (m_nodeUnderPointer.contains(pointerEvent->pointerId())) {
233 EventTargetAttributes node = 220 EventTargetAttributes node =
234 m_nodeUnderPointer.get(pointerEvent->pointerId()); 221 m_nodeUnderPointer.get(pointerEvent->pointerId());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 TouchEventManager::TouchInfo touchInfo; 324 TouchEventManager::TouchInfo touchInfo;
338 touchInfo.point = touchPoint; 325 touchInfo.point = touchPoint;
339 326
340 int pointerId = 327 int pointerId =
341 m_pointerEventFactory.getPointerEventId(touchPoint.pointerProperties()); 328 m_pointerEventFactory.getPointerEventId(touchPoint.pointerProperties());
342 // Do the hit test either when the touch first starts or when the touch 329 // Do the hit test either when the touch first starts or when the touch
343 // is not captured. |m_pendingPointerCaptureTarget| indicates the target 330 // is not captured. |m_pendingPointerCaptureTarget| indicates the target
344 // that will be capturing this event. |m_pointerCaptureTarget| may not 331 // that will be capturing this event. |m_pointerCaptureTarget| may not
345 // have this target yet since the processing of that will be done right 332 // have this target yet since the processing of that will be done right
346 // before firing the event. 333 // before firing the event.
347 if (RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled() || 334 if (touchInfo.point.state() == PlatformTouchPoint::TouchPressed ||
348 touchInfo.point.state() == PlatformTouchPoint::TouchPressed ||
349 !m_pendingPointerCaptureTarget.contains(pointerId)) { 335 !m_pendingPointerCaptureTarget.contains(pointerId)) {
350 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent | 336 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent |
351 HitTestRequest::ReadOnly | 337 HitTestRequest::ReadOnly |
352 HitTestRequest::Active; 338 HitTestRequest::Active;
353 LayoutPoint pagePoint = LayoutPoint( 339 LayoutPoint pagePoint = LayoutPoint(
354 m_frame->view()->rootFrameToContents(touchInfo.point.pos())); 340 m_frame->view()->rootFrameToContents(touchInfo.point.pos()));
355 HitTestResult hitTestTesult = 341 HitTestResult hitTestTesult =
356 m_frame->eventHandler().hitTestResultAtPoint(pagePoint, hitType); 342 m_frame->eventHandler().hitTestResultAtPoint(pagePoint, hitType);
357 Node* node = hitTestTesult.innerNode(); 343 Node* node = hitTestTesult.innerNode();
358 if (node) { 344 if (node) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 417
432 WebInputEventResult PointerEventManager::sendTouchPointerEvent( 418 WebInputEventResult PointerEventManager::sendTouchPointerEvent(
433 EventTarget* target, 419 EventTarget* target,
434 PointerEvent* pointerEvent) { 420 PointerEvent* pointerEvent) {
435 if (m_inCanceledStateForPointerTypeTouch) 421 if (m_inCanceledStateForPointerTypeTouch)
436 return WebInputEventResult::NotHandled; 422 return WebInputEventResult::NotHandled;
437 423
438 processCaptureAndPositionOfPointerEvent(pointerEvent, target); 424 processCaptureAndPositionOfPointerEvent(pointerEvent, target);
439 425
440 // Setting the implicit capture for touch 426 // Setting the implicit capture for touch
441 if (!RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled() && 427 if (pointerEvent->type() == EventTypeNames::pointerdown)
442 pointerEvent->type() == EventTypeNames::pointerdown)
443 setPointerCapture(pointerEvent->pointerId(), target); 428 setPointerCapture(pointerEvent->pointerId(), target);
444 429
445 WebInputEventResult result = dispatchPointerEvent( 430 WebInputEventResult result = dispatchPointerEvent(
446 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), 431 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
447 pointerEvent); 432 pointerEvent);
448 433
449 if (pointerEvent->type() == EventTypeNames::pointerup || 434 if (pointerEvent->type() == EventTypeNames::pointerup ||
450 pointerEvent->type() == EventTypeNames::pointercancel) { 435 pointerEvent->type() == EventTypeNames::pointercancel) {
451 releasePointerCapture(pointerEvent->pointerId()); 436 releasePointerCapture(pointerEvent->pointerId());
452 437
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 return pointerCaptureTargetTemp != pendingPointercaptureTargetTemp; 536 return pointerCaptureTargetTemp != pendingPointercaptureTargetTemp;
552 } 537 }
553 538
554 EventTarget* PointerEventManager::processCaptureAndPositionOfPointerEvent( 539 EventTarget* PointerEventManager::processCaptureAndPositionOfPointerEvent(
555 PointerEvent* pointerEvent, 540 PointerEvent* pointerEvent,
556 EventTarget* hitTestTarget, 541 EventTarget* hitTestTarget,
557 const PlatformMouseEvent& mouseEvent, 542 const PlatformMouseEvent& mouseEvent,
558 bool sendMouseEvent) { 543 bool sendMouseEvent) {
559 processPendingPointerCapture(pointerEvent); 544 processPendingPointerCapture(pointerEvent);
560 545
561 if (!RuntimeEnabledFeatures::pointerEventV1SpecCapturingEnabled()) { 546 PointerCapturingMap::const_iterator it =
562 PointerCapturingMap::const_iterator it = 547 m_pointerCaptureTarget.find(pointerEvent->pointerId());
563 m_pointerCaptureTarget.find(pointerEvent->pointerId()); 548 if (EventTarget* pointercaptureTarget =
564 if (EventTarget* pointercaptureTarget = 549 (it != m_pointerCaptureTarget.end()) ? it->value : nullptr)
565 (it != m_pointerCaptureTarget.end()) ? it->value : nullptr) 550 hitTestTarget = pointercaptureTarget;
566 hitTestTarget = pointercaptureTarget;
567 }
568 551
569 setNodeUnderPointer(pointerEvent, hitTestTarget); 552 setNodeUnderPointer(pointerEvent, hitTestTarget);
570 if (sendMouseEvent) { 553 if (sendMouseEvent) {
571 m_mouseEventManager->setNodeUnderMouse( 554 m_mouseEventManager->setNodeUnderMouse(
572 hitTestTarget ? hitTestTarget->toNode() : nullptr, mouseEvent); 555 hitTestTarget ? hitTestTarget->toNode() : nullptr, mouseEvent);
573 } 556 }
574 return hitTestTarget; 557 return hitTestTarget;
575 } 558 }
576 559
577 void PointerEventManager::processPendingPointerCapture( 560 void PointerEventManager::processPendingPointerCapture(
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 return true; 702 return true;
720 } 703 }
721 return false; 704 return false;
722 } 705 }
723 706
724 EventTarget* PointerEventManager::getMouseCapturingNode() { 707 EventTarget* PointerEventManager::getMouseCapturingNode() {
725 return getCapturingNode(PointerEventFactory::s_mouseId); 708 return getCapturingNode(PointerEventFactory::s_mouseId);
726 } 709 }
727 710
728 } // namespace blink 711 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698