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

Side by Side Diff: ui/events/blink/input_handler_proxy.cc

Issue 2471523002: Make touch events uncancelable during fling when they are on the current active scroll layer (Closed)
Patch Set: fling layer 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 928 }
929 return DROP_EVENT; 929 return DROP_EVENT;
930 } 930 }
931 } 931 }
932 return DID_NOT_HANDLE; 932 return DID_NOT_HANDLE;
933 } 933 }
934 934
935 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( 935 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart(
936 const blink::WebTouchEvent& touch_event) { 936 const blink::WebTouchEvent& touch_event) {
937 EventDisposition result = DROP_EVENT; 937 EventDisposition result = DROP_EVENT;
938 bool maybe_passive_due_to_fling = false;
tdresser 2016/11/24 19:53:41 What does this bool actually mean? Should this be
lanwei 2016/11/24 20:28:01 Done.
938 for (size_t i = 0; i < touch_event.touchesLength; ++i) { 939 for (size_t i = 0; i < touch_event.touchesLength; ++i) {
939 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) 940 if (touch_event.touches[i].state != WebTouchPoint::StatePressed)
940 continue; 941 continue;
941 if (input_handler_->DoTouchEventsBlockScrollAt( 942 cc::InputHandler::TouchStartEventListenerType event_listener_type =
943 input_handler_->EventListenerTypeForTouchStartAt(
942 gfx::Point(touch_event.touches[i].position.x, 944 gfx::Point(touch_event.touches[i].position.x,
943 touch_event.touches[i].position.y))) { 945 touch_event.touches[i].position.y));
946 if (event_listener_type !=
947 cc::InputHandler::TouchStartEventListenerType::NO_HANDLER) {
948 maybe_passive_due_to_fling =
949 event_listener_type == cc::InputHandler::TouchStartEventListenerType::
950 HANDLER_ON_FLINGING_LAYER;
944 result = DID_NOT_HANDLE; 951 result = DID_NOT_HANDLE;
945 break; 952 break;
946 } 953 }
947 } 954 }
948 955
949 // If |result| is DROP_EVENT it wasn't processed above. 956 // If |result| is DROP_EVENT it wasn't processed above.
950 if (result == DROP_EVENT) { 957 if (result == DROP_EVENT) {
951 switch (input_handler_->GetEventListenerProperties( 958 switch (input_handler_->GetEventListenerProperties(
952 cc::EventListenerClass::kTouchStartOrMove)) { 959 cc::EventListenerClass::kTouchStartOrMove)) {
953 case cc::EventListenerProperties::kPassive: 960 case cc::EventListenerProperties::kPassive:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // code is explicitly after the assignment of the |touch_start_result_| 992 // code is explicitly after the assignment of the |touch_start_result_|
986 // so the touch moves are not sent to the main thread un-necessarily. 993 // so the touch moves are not sent to the main thread un-necessarily.
987 if (result == DROP_EVENT && 994 if (result == DROP_EVENT &&
988 input_handler_->GetEventListenerProperties( 995 input_handler_->GetEventListenerProperties(
989 cc::EventListenerClass::kTouchEndOrCancel) != 996 cc::EventListenerClass::kTouchEndOrCancel) !=
990 cc::EventListenerProperties::kNone) { 997 cc::EventListenerProperties::kNone) {
991 result = DID_HANDLE_NON_BLOCKING; 998 result = DID_HANDLE_NON_BLOCKING;
992 } 999 }
993 1000
994 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; 1001 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_;
995 if (result == DID_NOT_HANDLE && is_fling_on_impl) 1002 if (is_fling_on_impl && maybe_passive_due_to_fling)
996 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; 1003 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING;
997 1004
998 return result; 1005 return result;
999 } 1006 }
1000 1007
1001 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( 1008 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove(
1002 const blink::WebTouchEvent& touch_event) { 1009 const blink::WebTouchEvent& touch_event) {
1003 if (touch_start_result_ != kEventDispositionUndefined) 1010 if (touch_start_result_ != kEventDispositionUndefined)
1004 return static_cast<EventDisposition>(touch_start_result_); 1011 return static_cast<EventDisposition>(touch_start_result_);
1005 return DID_NOT_HANDLE; 1012 return DID_NOT_HANDLE;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1532 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1526 scroll_result)); 1533 scroll_result));
1527 } 1534 }
1528 1535
1529 void InputHandlerProxy::SetTickClockForTesting( 1536 void InputHandlerProxy::SetTickClockForTesting(
1530 std::unique_ptr<base::TickClock> tick_clock) { 1537 std::unique_ptr<base::TickClock> tick_clock) {
1531 tick_clock_ = std::move(tick_clock); 1538 tick_clock_ = std::move(tick_clock);
1532 } 1539 }
1533 1540
1534 } // namespace ui 1541 } // namespace ui
OLDNEW
« no previous file with comments | « content/renderer/input/input_handler_manager.cc ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698