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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 16114003: Don't send touch move to renderer while scrolling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "ui/aura/window.h" 53 #include "ui/aura/window.h"
54 #include "ui/aura/window_destruction_observer.h" 54 #include "ui/aura/window_destruction_observer.h"
55 #include "ui/aura/window_observer.h" 55 #include "ui/aura/window_observer.h"
56 #include "ui/aura/window_tracker.h" 56 #include "ui/aura/window_tracker.h"
57 #include "ui/base/clipboard/scoped_clipboard_writer.h" 57 #include "ui/base/clipboard/scoped_clipboard_writer.h"
58 #include "ui/base/events/event.h" 58 #include "ui/base/events/event.h"
59 #include "ui/base/events/event_utils.h" 59 #include "ui/base/events/event_utils.h"
60 #include "ui/base/gestures/gesture_recognizer.h" 60 #include "ui/base/gestures/gesture_recognizer.h"
61 #include "ui/base/hit_test.h" 61 #include "ui/base/hit_test.h"
62 #include "ui/base/ime/input_method.h" 62 #include "ui/base/ime/input_method.h"
63 #include "ui/base/ui_base_switches_util.h"
63 #include "ui/base/ui_base_types.h" 64 #include "ui/base/ui_base_types.h"
64 #include "ui/compositor/layer.h" 65 #include "ui/compositor/layer.h"
65 #include "ui/gfx/canvas.h" 66 #include "ui/gfx/canvas.h"
66 #include "ui/gfx/display.h" 67 #include "ui/gfx/display.h"
67 #include "ui/gfx/rect_conversions.h" 68 #include "ui/gfx/rect_conversions.h"
68 #include "ui/gfx/screen.h" 69 #include "ui/gfx/screen.h"
69 #include "ui/gfx/size_conversions.h" 70 #include "ui/gfx/size_conversions.h"
70 #include "ui/gfx/skia_util.h" 71 #include "ui/gfx/skia_util.h"
71 72
72 #if defined(OS_WIN) 73 #if defined(OS_WIN)
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); 2468 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event);
2468 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 2469 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
2469 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an 2470 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an
2470 // event to stop any in-progress flings. 2471 // event to stop any in-progress flings.
2471 WebKit::WebGestureEvent fling_cancel = gesture; 2472 WebKit::WebGestureEvent fling_cancel = gesture;
2472 fling_cancel.type = WebKit::WebInputEvent::GestureFlingCancel; 2473 fling_cancel.type = WebKit::WebInputEvent::GestureFlingCancel;
2473 fling_cancel.sourceDevice = WebKit::WebGestureEvent::Touchscreen; 2474 fling_cancel.sourceDevice = WebKit::WebGestureEvent::Touchscreen;
2474 host_->ForwardGestureEvent(fling_cancel); 2475 host_->ForwardGestureEvent(fling_cancel);
2475 } 2476 }
2476 2477
2478 if (switches::IsTouchCancelAfterScrollEnabled()) {
Rick Byers 2013/05/30 01:53:29 This code should apply to windows (non-aura) as we
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Moved the logic to render_widget_host_impl.cc
2479 // When there is touch handler on the page, once scrolling is started,
2480 // we send a touch cancel to the page, and stops forwarding touch moves to
2481 // the renderer. This is to align with Chrome on Android behavior.
2482 if (event->type() == ui::ET_GESTURE_SCROLL_UPDATE &&
2483 host_->ShouldForwardTouchEvent() &&
2484 !host_->scroll_update_in_progress()) {
2485 host_->scroll_update_in_progress() = true;
sadrul 2013/05/30 02:44:16 ew no
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
2486 // Insert a TouchCancel event.
2487 WebKit::WebTouchEvent cancel_event;
2488 cancel_event.type = WebKit::WebInputEvent::TouchCancel;
2489 cancel_event.timeStampSeconds = event->time_stamp().InSecondsF();
2490 int id = event->GetLowestTouchId();
2491 if (id != -1) {
2492 cancel_event.touchesLength = 1;
2493 cancel_event.touches[0].id = id;
2494 cancel_event.touches[0].state = WebKit::WebTouchPoint::StateCancelled;
2495 host_->skip_next_acked_touch_cancel() = true;
sadrul 2013/05/30 02:44:16 ew no
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
2496 host_->ForwardTouchEvent(cancel_event);
2497 }
2498 }
2499
2500 if (event->type() == ui::ET_GESTURE_SCROLL_END ||
2501 event->type() == ui::ET_SCROLL_FLING_START) {
2502 host_->scroll_update_in_progress() = false;
sadrul 2013/05/30 02:44:16 stahp
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
2503 }
2504 }
sadrul 2013/05/30 02:44:16 There may be a few more touch-move events in the t
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 moved to render_widge_host_impl.cc
2505
2477 if (gesture.type != WebKit::WebInputEvent::Undefined) { 2506 if (gesture.type != WebKit::WebInputEvent::Undefined) {
2478 host_->ForwardGestureEvent(gesture); 2507 host_->ForwardGestureEvent(gesture);
2479 2508
2480 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 2509 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
2481 event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 2510 event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
2482 event->type() == ui::ET_GESTURE_SCROLL_END) { 2511 event->type() == ui::ET_GESTURE_SCROLL_END) {
2483 RecordAction(UserMetricsAction("TouchscreenScroll")); 2512 RecordAction(UserMetricsAction("TouchscreenScroll"));
2484 } else if (event->type() == ui::ET_SCROLL_FLING_START) { 2513 } else if (event->type() == ui::ET_SCROLL_FLING_START) {
2485 RecordAction(UserMetricsAction("TouchscreenScrollFling")); 2514 RecordAction(UserMetricsAction("TouchscreenScrollFling"));
2486 } 2515 }
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 RenderWidgetHost* widget) { 2985 RenderWidgetHost* widget) {
2957 return new RenderWidgetHostViewAura(widget); 2986 return new RenderWidgetHostViewAura(widget);
2958 } 2987 }
2959 2988
2960 // static 2989 // static
2961 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2990 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
2962 GetScreenInfoForWindow(results, NULL); 2991 GetScreenInfoForWindow(results, NULL);
2963 } 2992 }
2964 2993
2965 } // namespace content 2994 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698