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

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

Issue 1838973003: Send lostpointercapture on touch capturing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enhance the multi-touch test Created 4 years, 8 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/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/shadow/FlatTreeTraversal.h" 7 #include "core/dom/shadow/FlatTreeTraversal.h"
8 #include "core/events/MouseEvent.h" 8 #include "core/events/MouseEvent.h"
9 #include "core/input/EventHandler.h" 9 #include "core/input/EventHandler.h"
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create PointerCancelEvent(point); 300 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create PointerCancelEvent(point);
301 301
302 302
303 processCaptureAndPositionOfPointerEvent(pointerEvent, target); 303 processCaptureAndPositionOfPointerEvent(pointerEvent, target);
304 304
305 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing 305 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing
306 dispatchPointerEvent( 306 dispatchPointerEvent(
307 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), 307 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
308 pointerEvent.get()); 308 pointerEvent.get());
309 309
310 setNodeUnderPointer(pointerEvent, nullptr); 310 releasePointerCapture(pointerEvent->pointerId());
311
312 // Sending the leave/out events as well as lostpointercapture if required
313 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr);
311 314
312 removePointer(pointerEvent); 315 removePointer(pointerEvent);
313 } 316 }
314 317
315 WebInputEventResult PointerEventManager::sendTouchPointerEvent( 318 WebInputEventResult PointerEventManager::sendTouchPointerEvent(
316 PassRefPtrWillBeRawPtr<EventTarget> prpTarget, 319 PassRefPtrWillBeRawPtr<EventTarget> prpTarget,
317 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers, 320 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers,
318 const double width, const double height, 321 const double width, const double height,
319 const double clientX, const double clientY) 322 const double clientX, const double clientY)
320 { 323 {
321 RefPtrWillBeRawPtr<EventTarget> target = prpTarget; 324 RefPtrWillBeRawPtr<EventTarget> target = prpTarget;
322 325
323 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = 326 RefPtrWillBeRawPtr<PointerEvent> pointerEvent =
324 m_pointerEventFactory.create( 327 m_pointerEventFactory.create(
325 pointerEventNameForTouchPointState(touchPoint.state()), 328 pointerEventNameForTouchPointState(touchPoint.state()),
326 touchPoint, modifiers, width, height, clientX, clientY); 329 touchPoint, modifiers, width, height, clientX, clientY);
327 330
328 processCaptureAndPositionOfPointerEvent(pointerEvent, target); 331 processCaptureAndPositionOfPointerEvent(pointerEvent, target);
329 332
330 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing 333 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing
331 WebInputEventResult result = dispatchPointerEvent( 334 WebInputEventResult result = dispatchPointerEvent(
332 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), 335 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
333 pointerEvent.get()); 336 pointerEvent.get());
334 337
338 // Setting the implicit capture for touch
339 if (touchPoint.state() == PlatformTouchPoint::TouchPressed)
340 setPointerCapture(pointerEvent->pointerId(), target);
341
335 if (touchPoint.state() == PlatformTouchPoint::TouchReleased 342 if (touchPoint.state() == PlatformTouchPoint::TouchReleased
336 || touchPoint.state() == PlatformTouchPoint::TouchCancelled) { 343 || touchPoint.state() == PlatformTouchPoint::TouchCancelled) {
337 setNodeUnderPointer(pointerEvent, nullptr); 344 releasePointerCapture(pointerEvent->pointerId());
345
346 // Sending the leave/out events as well as lostpointercapture if require d
mustaq 2016/04/05 15:46:18 Replace "...if required" with something like "...b
Navid Zolghadr 2016/04/05 16:23:51 Done.
347 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr);
348
338 removePointer(pointerEvent); 349 removePointer(pointerEvent);
339 } 350 }
340 351
341 return result; 352 return result;
342 } 353 }
343 354
344 WebInputEventResult PointerEventManager::sendMousePointerEvent( 355 WebInputEventResult PointerEventManager::sendMousePointerEvent(
345 PassRefPtrWillBeRawPtr<Node> prpTarget, const AtomicString& mouseEventType, 356 PassRefPtrWillBeRawPtr<Node> prpTarget, const AtomicString& mouseEventType,
346 int clickCount, const PlatformMouseEvent& mouseEvent, 357 int clickCount, const PlatformMouseEvent& mouseEvent,
347 PassRefPtrWillBeRawPtr<Node> relatedTarget, 358 PassRefPtrWillBeRawPtr<Node> relatedTarget,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 405
395 PointerEventManager::~PointerEventManager() 406 PointerEventManager::~PointerEventManager()
396 { 407 {
397 } 408 }
398 409
399 void PointerEventManager::clear() 410 void PointerEventManager::clear()
400 { 411 {
401 m_preventMouseEventForPointerTypeMouse = false; 412 m_preventMouseEventForPointerTypeMouse = false;
402 m_pointerEventFactory.clear(); 413 m_pointerEventFactory.clear();
403 m_nodeUnderPointer.clear(); 414 m_nodeUnderPointer.clear();
415 m_pointerCaptureTarget.clear();
416 m_pendingPointerCaptureTarget.clear();
404 } 417 }
405 418
406 void PointerEventManager::processCaptureAndPositionOfPointerEvent( 419 void PointerEventManager::processCaptureAndPositionOfPointerEvent(
407 const PassRefPtrWillBeRawPtr<PointerEvent> prpPointerEvent, 420 const PassRefPtrWillBeRawPtr<PointerEvent> prpPointerEvent,
408 const PassRefPtrWillBeRawPtr<EventTarget> prpHitTestTarget, 421 const PassRefPtrWillBeRawPtr<EventTarget> prpHitTestTarget,
409 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse, 422 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse,
410 const PlatformMouseEvent& mouseEvent, 423 const PlatformMouseEvent& mouseEvent,
411 bool sendMouseEvent, bool setPointerPosition) 424 bool sendMouseEvent, bool setPointerPosition)
412 { 425 {
413 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = prpPointerEvent; 426 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = prpPointerEvent;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 void PointerEventManager::releasePointerCapture(int pointerId) 572 void PointerEventManager::releasePointerCapture(int pointerId)
560 { 573 {
561 m_pendingPointerCaptureTarget.remove(pointerId); 574 m_pendingPointerCaptureTarget.remove(pointerId);
562 } 575 }
563 576
564 bool PointerEventManager::isActive(const int pointerId) 577 bool PointerEventManager::isActive(const int pointerId)
565 { 578 {
566 return m_pointerEventFactory.isActive(pointerId); 579 return m_pointerEventFactory.isActive(pointerId);
567 } 580 }
568 581
582 WebPointerProperties::PointerType PointerEventManager::getPointerEventType(
583 const int pointerId)
584 {
585 return m_pointerEventFactory.getPointerType(pointerId);
586 }
587
569 DEFINE_TRACE(PointerEventManager) 588 DEFINE_TRACE(PointerEventManager)
570 { 589 {
571 #if ENABLE(OILPAN) 590 #if ENABLE(OILPAN)
572 visitor->trace(m_nodeUnderPointer); 591 visitor->trace(m_nodeUnderPointer);
573 visitor->trace(m_pointerCaptureTarget); 592 visitor->trace(m_pointerCaptureTarget);
574 visitor->trace(m_pendingPointerCaptureTarget); 593 visitor->trace(m_pendingPointerCaptureTarget);
575 #endif 594 #endif
576 } 595 }
577 596
578 597
579 } // namespace blink 598 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698