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/TouchEventManager.h" | 5 #include "core/input/TouchEventManager.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
| 9 #include "core/events/TouchEvent.h" | 9 #include "core/events/TouchEvent.h" |
| 10 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
| 11 #include "core/frame/EventHandlerRegistry.h" | 11 #include "core/frame/EventHandlerRegistry.h" |
| 12 #include "core/frame/FrameHost.h" | 12 #include "core/frame/FrameHost.h" |
| 13 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
| 14 #include "core/html/HTMLCanvasElement.h" | 14 #include "core/html/HTMLCanvasElement.h" |
| 15 #include "core/input/EventHandlingUtil.h" | 15 #include "core/input/EventHandlingUtil.h" |
| 16 #include "core/input/TouchActionUtil.h" | 16 #include "core/input/TouchActionUtil.h" |
| 17 #include "core/layout/HitTestCanvasResult.h" | 17 #include "core/layout/HitTestCanvasResult.h" |
| 18 #include "core/page/ChromeClient.h" | 18 #include "core/page/ChromeClient.h" |
| 19 #include "core/page/Page.h" | 19 #include "core/page/Page.h" |
| 20 #include "platform/Histogram.h" | 20 #include "platform/Histogram.h" |
| 21 #include "platform/PlatformTouchEvent.h" | 21 #include "platform/PlatformTouchEvent.h" |
| 22 #include "platform/RuntimeEnabledFeatures.h" | |
| 22 #include "wtf/CurrentTime.h" | 23 #include "wtf/CurrentTime.h" |
| 23 #include "wtf/PtrUtil.h" | 24 #include "wtf/PtrUtil.h" |
| 24 #include <memory> | 25 #include <memory> |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 bool hasTouchHandlers(const EventHandlerRegistry& registry) { | 31 bool hasTouchHandlers(const EventHandlerRegistry& registry) { |
| 31 return registry.hasEventHandlers( | 32 return registry.hasEventHandlers( |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 } | 481 } |
| 481 ~CurrentEventHolder() { m_target = PlatformEvent::NoType; } | 482 ~CurrentEventHolder() { m_target = PlatformEvent::NoType; } |
| 482 | 483 |
| 483 private: | 484 private: |
| 484 PlatformEvent::EventType& m_target; | 485 PlatformEvent::EventType& m_target; |
| 485 }; | 486 }; |
| 486 | 487 |
| 487 WebInputEventResult TouchEventManager::handleTouchEvent( | 488 WebInputEventResult TouchEventManager::handleTouchEvent( |
| 488 const PlatformTouchEvent& event, | 489 const PlatformTouchEvent& event, |
| 489 HeapVector<TouchInfo>& touchInfos) { | 490 HeapVector<TouchInfo>& touchInfos) { |
| 491 if (!RuntimeEnabledFeatures::touchAPIEnabled()) | |
| 492 return WebInputEventResult::HandledSystem; | |
|
mustaq
2016/11/03 18:10:49
Should be NotHandled instead, to let the upstream
| |
| 493 | |
| 490 // Track the current event for the scope of this function. | 494 // Track the current event for the scope of this function. |
| 491 CurrentEventHolder holder(m_currentEvent, event.type()); | 495 CurrentEventHolder holder(m_currentEvent, event.type()); |
| 492 | 496 |
| 493 if (!reHitTestTouchPointsIfNeeded(event, touchInfos)) | 497 if (!reHitTestTouchPointsIfNeeded(event, touchInfos)) |
| 494 return WebInputEventResult::NotHandled; | 498 return WebInputEventResult::NotHandled; |
| 495 | 499 |
| 496 bool allTouchesReleased = true; | 500 bool allTouchesReleased = true; |
| 497 for (const auto& point : event.touchPoints()) { | 501 for (const auto& point : event.touchPoints()) { |
| 498 if (point.state() != PlatformTouchPoint::TouchReleased && | 502 if (point.state() != PlatformTouchPoint::TouchReleased && |
| 499 point.state() != PlatformTouchPoint::TouchCancelled) | 503 point.state() != PlatformTouchPoint::TouchCancelled) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 569 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
| 566 break; | 570 break; |
| 567 default: | 571 default: |
| 568 NOTREACHED(); | 572 NOTREACHED(); |
| 569 return; | 573 return; |
| 570 } | 574 } |
| 571 Deprecation::countDeprecation(m_frame, feature); | 575 Deprecation::countDeprecation(m_frame, feature); |
| 572 } | 576 } |
| 573 | 577 |
| 574 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |