Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 } | 648 } |
| 649 | 649 |
| 650 void PointerEventManager::releasePointerCapture(int pointerId) { | 650 void PointerEventManager::releasePointerCapture(int pointerId) { |
| 651 m_pendingPointerCaptureTarget.remove(pointerId); | 651 m_pendingPointerCaptureTarget.remove(pointerId); |
| 652 } | 652 } |
| 653 | 653 |
| 654 bool PointerEventManager::isActive(const int pointerId) const { | 654 bool PointerEventManager::isActive(const int pointerId) const { |
| 655 return m_pointerEventFactory.isActive(pointerId); | 655 return m_pointerEventFactory.isActive(pointerId); |
| 656 } | 656 } |
| 657 | 657 |
| 658 bool PointerEventManager::isTouchPointerIdActiveOnFrame( | |
| 659 int pointerId, | |
| 660 LocalFrame* frame) const { | |
| 661 if (m_pointerEventFactory.getPointerType(pointerId) != | |
|
mustaq
2016/10/17 20:18:56
Please add a comment about why this is Touch-only.
Navid Zolghadr
2016/10/18 14:18:11
Done.
| |
| 662 WebPointerProperties::PointerType::Touch) | |
| 663 return false; | |
| 664 Node* lastNodeReceivingEvent = | |
| 665 m_nodeUnderPointer.contains(pointerId) | |
| 666 ? m_nodeUnderPointer.get(pointerId).target->toNode() | |
| 667 : nullptr; | |
| 668 return lastNodeReceivingEvent && | |
| 669 lastNodeReceivingEvent->document().frame() == frame; | |
| 670 } | |
| 671 | |
| 658 bool PointerEventManager::isAnyTouchActive() const { | 672 bool PointerEventManager::isAnyTouchActive() const { |
| 659 return m_touchEventManager->isAnyTouchActive(); | 673 return m_touchEventManager->isAnyTouchActive(); |
| 660 } | 674 } |
| 661 | 675 |
| 662 bool PointerEventManager::primaryPointerdownCanceled( | 676 bool PointerEventManager::primaryPointerdownCanceled( |
| 663 uint32_t uniqueTouchEventId) { | 677 uint32_t uniqueTouchEventId) { |
| 664 // It's safe to assume that uniqueTouchEventIds won't wrap back to 0 from | 678 // It's safe to assume that uniqueTouchEventIds won't wrap back to 0 from |
| 665 // 2^32-1 (>4.2 billion): even with a generous 100 unique ids per touch | 679 // 2^32-1 (>4.2 billion): even with a generous 100 unique ids per touch |
| 666 // sequence & one sequence per 10 second, it takes 13+ years to wrap back. | 680 // sequence & one sequence per 10 second, it takes 13+ years to wrap back. |
| 667 while (!m_touchIdsForCanceledPointerdowns.isEmpty()) { | 681 while (!m_touchIdsForCanceledPointerdowns.isEmpty()) { |
| 668 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); | 682 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); |
| 669 if (firstId > uniqueTouchEventId) | 683 if (firstId > uniqueTouchEventId) |
| 670 return false; | 684 return false; |
| 671 m_touchIdsForCanceledPointerdowns.takeFirst(); | 685 m_touchIdsForCanceledPointerdowns.takeFirst(); |
| 672 if (firstId == uniqueTouchEventId) | 686 if (firstId == uniqueTouchEventId) |
| 673 return true; | 687 return true; |
| 674 } | 688 } |
| 675 return false; | 689 return false; |
| 676 } | 690 } |
| 677 | 691 |
| 678 EventTarget* PointerEventManager::getMouseCapturingNode() { | 692 EventTarget* PointerEventManager::getMouseCapturingNode() { |
| 679 return getCapturingNode(PointerEventFactory::s_mouseId); | 693 return getCapturingNode(PointerEventFactory::s_mouseId); |
| 680 } | 694 } |
| 681 | 695 |
| 682 } // namespace blink | 696 } // namespace blink |
| OLD | NEW |