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

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

Issue 2521993003: Send boundary events before gotpointercapture (Closed)
Patch Set: Fix the tests 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
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('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/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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // Re-target lostpointercapture to the document when the element is 567 // Re-target lostpointercapture to the document when the element is
568 // no longer participating in the tree. 568 // no longer participating in the tree.
569 EventTarget* target = pointerCaptureTarget; 569 EventTarget* target = pointerCaptureTarget;
570 if (target->toNode() && !target->toNode()->isConnected()) { 570 if (target->toNode() && !target->toNode()->isConnected()) {
571 target = target->toNode()->ownerDocument(); 571 target = target->toNode()->ownerDocument();
572 } 572 }
573 dispatchPointerEvent(target, 573 dispatchPointerEvent(target,
574 m_pointerEventFactory.createPointerCaptureEvent( 574 m_pointerEventFactory.createPointerCaptureEvent(
575 pointerEvent, EventTypeNames::lostpointercapture)); 575 pointerEvent, EventTypeNames::lostpointercapture));
576 } 576 }
577 // Note that If pendingPointerCaptureTarget is null dispatchPointerEvent
578 // automatically does nothing.
579 dispatchPointerEvent(pendingPointerCaptureTarget,
580 m_pointerEventFactory.createPointerCaptureEvent(
581 pointerEvent, EventTypeNames::gotpointercapture));
582 577
583 if (pendingPointerCaptureTarget) 578 if (pendingPointerCaptureTarget) {
579 setNodeUnderPointer(pointerEvent, pendingPointerCaptureTarget);
580 dispatchPointerEvent(pendingPointerCaptureTarget,
581 m_pointerEventFactory.createPointerCaptureEvent(
582 pointerEvent, EventTypeNames::gotpointercapture));
584 m_pointerCaptureTarget.set(pointerId, pendingPointerCaptureTarget); 583 m_pointerCaptureTarget.set(pointerId, pendingPointerCaptureTarget);
585 else 584 } else {
586 m_pointerCaptureTarget.remove(pointerId); 585 m_pointerCaptureTarget.remove(pointerId);
586 }
587 } 587 }
588 588
589 void PointerEventManager::removeTargetFromPointerCapturingMapping( 589 void PointerEventManager::removeTargetFromPointerCapturingMapping(
590 PointerCapturingMap& map, 590 PointerCapturingMap& map,
591 const EventTarget* target) { 591 const EventTarget* target) {
592 // We could have kept a reverse mapping to make this deletion possibly 592 // We could have kept a reverse mapping to make this deletion possibly
593 // faster but it adds some code complication which might not be worth of 593 // faster but it adds some code complication which might not be worth of
594 // the performance improvement considering there might not be a lot of 594 // the performance improvement considering there might not be a lot of
595 // active pointer or pointer captures at the same time. 595 // active pointer or pointer captures at the same time.
596 PointerCapturingMap tmp = map; 596 PointerCapturingMap tmp = map;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); 690 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first();
691 if (firstId > uniqueTouchEventId) 691 if (firstId > uniqueTouchEventId)
692 return false; 692 return false;
693 m_touchIdsForCanceledPointerdowns.takeFirst(); 693 m_touchIdsForCanceledPointerdowns.takeFirst();
694 if (firstId == uniqueTouchEventId) 694 if (firstId == uniqueTouchEventId)
695 return true; 695 return true;
696 } 696 }
697 return false; 697 return false;
698 } 698 }
699 699
700 EventTarget* PointerEventManager::getMouseCapturingNode() {
701 return getCapturingNode(PointerEventFactory::s_mouseId);
702 }
703
704 } // namespace blink 700 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/PointerEventManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698