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

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

Issue 1993383002: Adding Event.Latency.Browser.WheelUI, Passing latency_info to ProcessMouse/MouseWheelEvent functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 reinterpret_cast<LPARAM>(toplevel_hwnd)); 1997 reinterpret_cast<LPARAM>(toplevel_hwnd));
1998 } 1998 }
1999 #endif 1999 #endif
2000 blink::WebMouseWheelEvent mouse_wheel_event = 2000 blink::WebMouseWheelEvent mouse_wheel_event =
2001 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); 2001 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event));
2002 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { 2002 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) {
2003 if (ShouldRouteEvent(event)) { 2003 if (ShouldRouteEvent(event)) {
2004 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( 2004 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent(
2005 this, &mouse_wheel_event); 2005 this, &mouse_wheel_event);
2006 } else { 2006 } else {
2007 ProcessMouseWheelEvent(mouse_wheel_event); 2007 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency());
2008 } 2008 }
2009 } 2009 }
2010 } else { 2010 } else {
2011 bool is_selection_popup = 2011 bool is_selection_popup =
2012 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); 2012 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab();
2013 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && 2013 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) &&
2014 !(event->flags() & ui::EF_FROM_TOUCH)) { 2014 !(event->flags() & ui::EF_FROM_TOUCH)) {
2015 // Confirm existing composition text on mouse press, to make sure 2015 // Confirm existing composition text on mouse press, to make sure
2016 // the input caret won't be moved with an ongoing composition text. 2016 // the input caret won't be moved with an ongoing composition text.
2017 if (event->type() == ui::ET_MOUSE_PRESSED) 2017 if (event->type() == ui::ET_MOUSE_PRESSED)
2018 FinishImeCompositionSession(); 2018 FinishImeCompositionSession();
2019 2019
2020 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); 2020 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event);
2021 ModifyEventMovementAndCoords(&mouse_event); 2021 ModifyEventMovementAndCoords(&mouse_event);
2022 if (ShouldRouteEvent(event)) { 2022 if (ShouldRouteEvent(event)) {
2023 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, 2023 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this,
2024 &mouse_event); 2024 &mouse_event);
2025 } else { 2025 } else {
2026 ProcessMouseEvent(mouse_event); 2026 ProcessMouseEvent(mouse_event, *event->latency());
2027 } 2027 }
2028 2028
2029 // Ensure that we get keyboard focus on mouse down as a plugin window may 2029 // Ensure that we get keyboard focus on mouse down as a plugin window may
2030 // have grabbed keyboard focus. 2030 // have grabbed keyboard focus.
2031 if (event->type() == ui::ET_MOUSE_PRESSED) 2031 if (event->type() == ui::ET_MOUSE_PRESSED)
2032 SetKeyboardFocus(); 2032 SetKeyboardFocus();
2033 } 2033 }
2034 } 2034 }
2035 2035
2036 switch (event->type()) { 2036 switch (event->type()) {
(...skipping 28 matching lines...) Expand all
2065 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); 2065 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point);
2066 2066
2067 // It is possible that the renderer has not yet produced a surface, in which 2067 // It is possible that the renderer has not yet produced a surface, in which
2068 // case we return our current namespace. 2068 // case we return our current namespace.
2069 if (id.is_null()) 2069 if (id.is_null())
2070 return GetSurfaceIdNamespace(); 2070 return GetSurfaceIdNamespace();
2071 return id.id_namespace(); 2071 return id.id_namespace();
2072 } 2072 }
2073 2073
2074 void RenderWidgetHostViewAura::ProcessMouseEvent( 2074 void RenderWidgetHostViewAura::ProcessMouseEvent(
2075 const blink::WebMouseEvent& event) { 2075 const blink::WebMouseEvent& event,
2076 host_->ForwardMouseEvent(event); 2076 const ui::LatencyInfo& latency) {
2077 host_->ForwardMouseEventWithLatencyInfo(event, latency);
2077 } 2078 }
2078 2079
2079 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( 2080 void RenderWidgetHostViewAura::ProcessMouseWheelEvent(
2080 const blink::WebMouseWheelEvent& event) { 2081 const blink::WebMouseWheelEvent& event,
2081 host_->ForwardWheelEvent(event); 2082 const ui::LatencyInfo& latency) {
2083 host_->ForwardWheelEventWithLatencyInfo(event, latency);
2082 } 2084 }
2083 2085
2084 void RenderWidgetHostViewAura::ProcessTouchEvent( 2086 void RenderWidgetHostViewAura::ProcessTouchEvent(
2085 const blink::WebTouchEvent& event, 2087 const blink::WebTouchEvent& event,
2086 const ui::LatencyInfo& latency) { 2088 const ui::LatencyInfo& latency) {
2087 host_->ForwardTouchEventWithLatencyInfo(event, latency); 2089 host_->ForwardTouchEventWithLatencyInfo(event, latency);
2088 } 2090 }
2089 2091
2090 void RenderWidgetHostViewAura::ProcessGestureEvent( 2092 void RenderWidgetHostViewAura::ProcessGestureEvent(
2091 const blink::WebGestureEvent& event, 2093 const blink::WebGestureEvent& event,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 // TODO(ananta) 2132 // TODO(ananta)
2131 // Investigate if this is true for Windows 8 Metro ASH as well. 2133 // Investigate if this is true for Windows 8 Metro ASH as well.
2132 if (event->finger_count() != 2) 2134 if (event->finger_count() != 2)
2133 return; 2135 return;
2134 #endif 2136 #endif
2135 blink::WebGestureEvent gesture_event = 2137 blink::WebGestureEvent gesture_event =
2136 MakeWebGestureEventFlingCancel(); 2138 MakeWebGestureEventFlingCancel();
2137 host_->ForwardGestureEvent(gesture_event); 2139 host_->ForwardGestureEvent(gesture_event);
2138 blink::WebMouseWheelEvent mouse_wheel_event = 2140 blink::WebMouseWheelEvent mouse_wheel_event =
2139 MakeWebMouseWheelEvent(*event); 2141 MakeWebMouseWheelEvent(*event);
2140 host_->ForwardWheelEvent(mouse_wheel_event); 2142 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event,
2143 *event->latency());
2141 RecordAction(base::UserMetricsAction("TrackpadScroll")); 2144 RecordAction(base::UserMetricsAction("TrackpadScroll"));
2142 } else if (event->type() == ui::ET_SCROLL_FLING_START || 2145 } else if (event->type() == ui::ET_SCROLL_FLING_START ||
2143 event->type() == ui::ET_SCROLL_FLING_CANCEL) { 2146 event->type() == ui::ET_SCROLL_FLING_CANCEL) {
2144 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); 2147 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event);
2145 host_->ForwardGestureEvent(gesture_event); 2148 host_->ForwardGestureEvent(gesture_event);
2146 if (event->type() == ui::ET_SCROLL_FLING_START) 2149 if (event->type() == ui::ET_SCROLL_FLING_START)
2147 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); 2150 RecordAction(base::UserMetricsAction("TrackpadScrollFling"));
2148 } 2151 }
2149 2152
2150 event->SetHandled(); 2153 event->SetHandled();
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 3000
2998 //////////////////////////////////////////////////////////////////////////////// 3001 ////////////////////////////////////////////////////////////////////////////////
2999 // RenderWidgetHostViewBase, public: 3002 // RenderWidgetHostViewBase, public:
3000 3003
3001 // static 3004 // static
3002 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3005 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3003 GetScreenInfoForWindow(results, NULL); 3006 GetScreenInfoForWindow(results, NULL);
3004 } 3007 }
3005 3008
3006 } // namespace content 3009 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698