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

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

Issue 2807433003: No pointer captured when the pointer lock is applied (Closed)
Patch Set: pointer lock Created 3 years, 7 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/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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 SetNodeUnderPointer(pointer_event, pending_pointer_capture_target); 600 SetNodeUnderPointer(pointer_event, pending_pointer_capture_target);
601 DispatchPointerEvent(pending_pointer_capture_target, 601 DispatchPointerEvent(pending_pointer_capture_target,
602 pointer_event_factory_.CreatePointerCaptureEvent( 602 pointer_event_factory_.CreatePointerCaptureEvent(
603 pointer_event, EventTypeNames::gotpointercapture)); 603 pointer_event, EventTypeNames::gotpointercapture));
604 pointer_capture_target_.Set(pointer_id, pending_pointer_capture_target); 604 pointer_capture_target_.Set(pointer_id, pending_pointer_capture_target);
605 } else { 605 } else {
606 pointer_capture_target_.erase(pointer_id); 606 pointer_capture_target_.erase(pointer_id);
607 } 607 }
608 } 608 }
609 609
610 void PointerEventManager::ProcessPendingPointerCapture(
611 const WebMouseEvent& mouse_event,
612 const Vector<WebMouseEvent>& coalesced_events) {
613 PointerEvent* pointer_event = pointer_event_factory_.Create(
614 EventTypeNames::mousemove, mouse_event, coalesced_events,
615 frame_->GetDocument()->domWindow());
616 ProcessPendingPointerCapture(pointer_event);
617 }
618
610 void PointerEventManager::RemoveTargetFromPointerCapturingMapping( 619 void PointerEventManager::RemoveTargetFromPointerCapturingMapping(
611 PointerCapturingMap& map, 620 PointerCapturingMap& map,
612 const EventTarget* target) { 621 const EventTarget* target) {
613 // We could have kept a reverse mapping to make this deletion possibly 622 // We could have kept a reverse mapping to make this deletion possibly
614 // faster but it adds some code complication which might not be worth of 623 // faster but it adds some code complication which might not be worth of
615 // the performance improvement considering there might not be a lot of 624 // the performance improvement considering there might not be a lot of
616 // active pointer or pointer captures at the same time. 625 // active pointer or pointer captures at the same time.
617 PointerCapturingMap tmp = map; 626 PointerCapturingMap tmp = map;
618 for (PointerCapturingMap::iterator it = tmp.begin(); it != tmp.end(); ++it) { 627 for (PointerCapturingMap::iterator it = tmp.begin(); it != tmp.end(); ++it) {
619 if (it->value == target) 628 if (it->value == target)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // the capture. Note that this might be different from 668 // the capture. Note that this might be different from
660 // |m_pointercaptureTarget|. |m_pointercaptureTarget| holds the element 669 // |m_pointercaptureTarget|. |m_pointercaptureTarget| holds the element
661 // that had the capture until now and has been receiving the pointerevents 670 // that had the capture until now and has been receiving the pointerevents
662 // but |m_pendingPointerCaptureTarget| indicated the element that gets the 671 // but |m_pendingPointerCaptureTarget| indicated the element that gets the
663 // very next pointer event. They will be the same if there was no change in 672 // very next pointer event. They will be the same if there was no change in
664 // capturing of a particular |pointerId|. See crbug.com/614481. 673 // capturing of a particular |pointerId|. See crbug.com/614481.
665 if (pending_pointer_capture_target_.at(pointer_id) == target) 674 if (pending_pointer_capture_target_.at(pointer_id) == target)
666 ReleasePointerCapture(pointer_id); 675 ReleasePointerCapture(pointer_id);
667 } 676 }
668 677
678 void PointerEventManager::ReleaseMousePointerCapture() {
679 ReleasePointerCapture(PointerEventFactory::kMouseId);
680 }
681
669 bool PointerEventManager::HasPointerCapture(int pointer_id, 682 bool PointerEventManager::HasPointerCapture(int pointer_id,
670 const EventTarget* target) const { 683 const EventTarget* target) const {
671 return pending_pointer_capture_target_.at(pointer_id) == target; 684 return pending_pointer_capture_target_.at(pointer_id) == target;
672 } 685 }
673 686
674 bool PointerEventManager::HasProcessedPointerCapture( 687 bool PointerEventManager::HasProcessedPointerCapture(
675 int pointer_id, 688 int pointer_id,
676 const EventTarget* target) const { 689 const EventTarget* target) const {
677 return pointer_capture_target_.at(pointer_id) == target; 690 return pointer_capture_target_.at(pointer_id) == target;
678 } 691 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 if (first_id > unique_touch_event_id) 730 if (first_id > unique_touch_event_id)
718 return false; 731 return false;
719 touch_ids_for_canceled_pointerdowns_.TakeFirst(); 732 touch_ids_for_canceled_pointerdowns_.TakeFirst();
720 if (first_id == unique_touch_event_id) 733 if (first_id == unique_touch_event_id)
721 return true; 734 return true;
722 } 735 }
723 return false; 736 return false;
724 } 737 }
725 738
726 } // namespace blink 739 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698