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

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

Issue 2467913002: Touch event flag should control only DOM event firing. (Closed)
Patch Set: Deprecate the histogram. 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
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/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/events/TouchEvent.h" 8 #include "core/events/TouchEvent.h"
9 #include "core/frame/Deprecation.h" 9 #include "core/frame/Deprecation.h"
10 #include "core/frame/EventHandlerRegistry.h" 10 #include "core/frame/EventHandlerRegistry.h"
11 #include "core/frame/FrameHost.h" 11 #include "core/frame/FrameHost.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLCanvasElement.h" 13 #include "core/html/HTMLCanvasElement.h"
14 #include "core/input/EventHandlingUtil.h" 14 #include "core/input/EventHandlingUtil.h"
15 #include "core/input/TouchActionUtil.h" 15 #include "core/input/TouchActionUtil.h"
16 #include "core/layout/HitTestCanvasResult.h" 16 #include "core/layout/HitTestCanvasResult.h"
17 #include "core/page/ChromeClient.h" 17 #include "core/page/ChromeClient.h"
18 #include "core/page/Page.h" 18 #include "core/page/Page.h"
19 #include "platform/Histogram.h" 19 #include "platform/Histogram.h"
20 #include "platform/PlatformTouchEvent.h" 20 #include "platform/PlatformTouchEvent.h"
21 #include "platform/RuntimeEnabledFeatures.h"
21 #include "wtf/CurrentTime.h" 22 #include "wtf/CurrentTime.h"
22 #include "wtf/PtrUtil.h" 23 #include "wtf/PtrUtil.h"
23 #include <memory> 24 #include <memory>
24 25
25 namespace blink { 26 namespace blink {
26 27
27 namespace { 28 namespace {
28 29
29 bool hasTouchHandlers(const EventHandlerRegistry& registry) { 30 bool hasTouchHandlers(const EventHandlerRegistry& registry) {
30 return registry.hasEventHandlers( 31 return registry.hasEventHandlers(
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 479 }
479 ~CurrentEventHolder() { m_target = PlatformEvent::NoType; } 480 ~CurrentEventHolder() { m_target = PlatformEvent::NoType; }
480 481
481 private: 482 private:
482 PlatformEvent::EventType& m_target; 483 PlatformEvent::EventType& m_target;
483 }; 484 };
484 485
485 WebInputEventResult TouchEventManager::handleTouchEvent( 486 WebInputEventResult TouchEventManager::handleTouchEvent(
486 const PlatformTouchEvent& event, 487 const PlatformTouchEvent& event,
487 HeapVector<TouchInfo>& touchInfos) { 488 HeapVector<TouchInfo>& touchInfos) {
489 if (!RuntimeEnabledFeatures::touchEventAPIEnabled())
490 return WebInputEventResult::HandledSuppressed;
491
488 // Track the current event for the scope of this function. 492 // Track the current event for the scope of this function.
489 CurrentEventHolder holder(m_currentEvent, event.type()); 493 CurrentEventHolder holder(m_currentEvent, event.type());
490 494
491 if (!reHitTestTouchPointsIfNeeded(event, touchInfos)) 495 if (!reHitTestTouchPointsIfNeeded(event, touchInfos))
492 return WebInputEventResult::NotHandled; 496 return WebInputEventResult::NotHandled;
493 497
494 bool allTouchesReleased = true; 498 bool allTouchesReleased = true;
495 for (const auto& point : event.touchPoints()) { 499 for (const auto& point : event.touchPoints()) {
496 if (point.state() != PlatformTouchPoint::TouchReleased && 500 if (point.state() != PlatformTouchPoint::TouchReleased &&
497 point.state() != PlatformTouchPoint::TouchCancelled) 501 point.state() != PlatformTouchPoint::TouchCancelled)
498 allTouchesReleased = false; 502 allTouchesReleased = false;
499 } 503 }
500 504
501 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 505 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
502 } 506 }
503 507
504 bool TouchEventManager::isAnyTouchActive() const { 508 bool TouchEventManager::isAnyTouchActive() const {
505 return m_touchPressed; 509 return m_touchPressed;
506 } 510 }
507 511
508 } // namespace blink 512 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698