| 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::isTouchPointerEventActiveOnFrame(int pointerId, |
| 659 LocalFrame* frame) { |
| 660 Node* lastNodeReceivingEvent = |
| 661 m_nodeUnderPointer.contains(pointerId) |
| 662 ? m_nodeUnderPointer.get(pointerId).target->toNode() |
| 663 : nullptr; |
| 664 return m_pointerEventFactory.isActive(pointerId) && lastNodeReceivingEvent && |
| 665 lastNodeReceivingEvent->document().frame() == frame; |
| 666 } |
| 667 |
| 658 bool PointerEventManager::isAnyTouchActive() const { | 668 bool PointerEventManager::isAnyTouchActive() const { |
| 659 return m_touchEventManager->isAnyTouchActive(); | 669 return m_touchEventManager->isAnyTouchActive(); |
| 660 } | 670 } |
| 661 | 671 |
| 662 bool PointerEventManager::primaryPointerdownCanceled( | 672 bool PointerEventManager::primaryPointerdownCanceled( |
| 663 uint32_t uniqueTouchEventId) { | 673 uint32_t uniqueTouchEventId) { |
| 664 // It's safe to assume that uniqueTouchEventIds won't wrap back to 0 from | 674 // 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 | 675 // 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. | 676 // sequence & one sequence per 10 second, it takes 13+ years to wrap back. |
| 667 while (!m_touchIdsForCanceledPointerdowns.isEmpty()) { | 677 while (!m_touchIdsForCanceledPointerdowns.isEmpty()) { |
| 668 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); | 678 uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); |
| 669 if (firstId > uniqueTouchEventId) | 679 if (firstId > uniqueTouchEventId) |
| 670 return false; | 680 return false; |
| 671 m_touchIdsForCanceledPointerdowns.takeFirst(); | 681 m_touchIdsForCanceledPointerdowns.takeFirst(); |
| 672 if (firstId == uniqueTouchEventId) | 682 if (firstId == uniqueTouchEventId) |
| 673 return true; | 683 return true; |
| 674 } | 684 } |
| 675 return false; | 685 return false; |
| 676 } | 686 } |
| 677 | 687 |
| 678 EventTarget* PointerEventManager::getMouseCapturingNode() { | 688 EventTarget* PointerEventManager::getMouseCapturingNode() { |
| 679 return getCapturingNode(PointerEventFactory::s_mouseId); | 689 return getCapturingNode(PointerEventFactory::s_mouseId); |
| 680 } | 690 } |
| 681 | 691 |
| 682 } // namespace blink | 692 } // namespace blink |
| OLD | NEW |