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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with reporting uma metrics Created 4 years, 8 months 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 "content/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 OfferToHandlers(input_event, latency_info); 362 OfferToHandlers(input_event, latency_info);
363 } 363 }
364 364
365 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, 365 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
366 const ui::LatencyInfo& latency_info) { 366 const ui::LatencyInfo& latency_info) {
367 output_stream_validator_.Validate(input_event); 367 output_stream_validator_.Validate(input_event);
368 368
369 if (OfferToClient(input_event, latency_info)) 369 if (OfferToClient(input_event, latency_info))
370 return; 370 return;
371 371
372 // Touch events should always indicate in the event whether they are
373 // cancelable (respect ACK disposition) or not except touchmove.
374 bool should_block = WebInputEventTraits::ShouldBlockEventStream(input_event); 372 bool should_block = WebInputEventTraits::ShouldBlockEventStream(input_event);
375 373
376 OfferToRenderer(input_event, latency_info, 374 OfferToRenderer(input_event, latency_info,
377 should_block 375 should_block
378 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING 376 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING
379 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); 377 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING);
380 378
381 if (WebInputEvent::isTouchEventType(input_event.type) &&
382 input_event.type != WebInputEvent::TouchMove) {
383 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
384 DCHECK_EQ(should_block, touch.cancelable);
385 }
386
387 // Generate a synthetic ack if the event was sent so it doesn't block. 379 // Generate a synthetic ack if the event was sent so it doesn't block.
388 if (!should_block) { 380 if (!should_block) {
389 ProcessInputEventAck( 381 ProcessInputEventAck(
390 input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, latency_info, 382 input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, latency_info,
391 WebInputEventTraits::GetUniqueTouchEventId(input_event), 383 WebInputEventTraits::GetUniqueTouchEventId(input_event),
392 IGNORING_DISPOSITION); 384 IGNORING_DISPOSITION);
393 } 385 }
394 } 386 }
395 387
396 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event, 388 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 635
644 flush_requested_ = false; 636 flush_requested_ = false;
645 client_->DidFlush(); 637 client_->DidFlush();
646 } 638 }
647 639
648 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { 640 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) {
649 frame_tree_node_id_ = frameTreeNodeId; 641 frame_tree_node_id_ = frameTreeNodeId;
650 } 642 }
651 643
652 } // namespace content 644 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698