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

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

Issue 2394593002: revert "SourceEventType added to LatencyInfo." (Closed)
Patch Set: Created 4 years, 2 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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 DismissOwnedPopups, 1933 DismissOwnedPopups,
1934 reinterpret_cast<LPARAM>(toplevel_hwnd)); 1934 reinterpret_cast<LPARAM>(toplevel_hwnd));
1935 } 1935 }
1936 #endif 1936 #endif
1937 blink::WebMouseWheelEvent mouse_wheel_event = 1937 blink::WebMouseWheelEvent mouse_wheel_event =
1938 ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event), 1938 ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event),
1939 base::Bind(&GetScreenLocationFromEvent)); 1939 base::Bind(&GetScreenLocationFromEvent));
1940 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { 1940 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) {
1941 if (ShouldRouteEvent(event)) { 1941 if (ShouldRouteEvent(event)) {
1942 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( 1942 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent(
1943 this, &mouse_wheel_event, *event->latency()); 1943 this, &mouse_wheel_event);
1944 } else { 1944 } else {
1945 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency()); 1945 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency());
1946 } 1946 }
1947 } 1947 }
1948 } else { 1948 } else {
1949 bool is_selection_popup = 1949 bool is_selection_popup =
1950 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); 1950 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab();
1951 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && 1951 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) &&
1952 !(event->flags() & ui::EF_FROM_TOUCH)) { 1952 !(event->flags() & ui::EF_FROM_TOUCH)) {
1953 // Confirm existing composition text on mouse press, to make sure 1953 // Confirm existing composition text on mouse press, to make sure
1954 // the input caret won't be moved with an ongoing composition text. 1954 // the input caret won't be moved with an ongoing composition text.
1955 if (event->type() == ui::ET_MOUSE_PRESSED) 1955 if (event->type() == ui::ET_MOUSE_PRESSED)
1956 FinishImeCompositionSession(); 1956 FinishImeCompositionSession();
1957 1957
1958 blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent( 1958 blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent(
1959 *event, base::Bind(&GetScreenLocationFromEvent)); 1959 *event, base::Bind(&GetScreenLocationFromEvent));
1960 ModifyEventMovementAndCoords(&mouse_event); 1960 ModifyEventMovementAndCoords(&mouse_event);
1961 if (ShouldRouteEvent(event)) { 1961 if (ShouldRouteEvent(event)) {
1962 host_->delegate()->GetInputEventRouter()->RouteMouseEvent( 1962 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this,
1963 this, &mouse_event, *event->latency()); 1963 &mouse_event);
1964 } else { 1964 } else {
1965 ProcessMouseEvent(mouse_event, *event->latency()); 1965 ProcessMouseEvent(mouse_event, *event->latency());
1966 } 1966 }
1967 1967
1968 // Ensure that we get keyboard focus on mouse down as a plugin window may 1968 // Ensure that we get keyboard focus on mouse down as a plugin window may
1969 // have grabbed keyboard focus. 1969 // have grabbed keyboard focus.
1970 if (event->type() == ui::ET_MOUSE_PRESSED) 1970 if (event->type() == ui::ET_MOUSE_PRESSED)
1971 SetKeyboardFocus(); 1971 SetKeyboardFocus();
1972 } 1972 }
1973 } 1973 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEventFlingCancel(); 2087 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEventFlingCancel();
2088 // Coordinates need to be transferred to the fling cancel gesture only 2088 // Coordinates need to be transferred to the fling cancel gesture only
2089 // for Surface-targeting to ensure that it is targeted to the correct 2089 // for Surface-targeting to ensure that it is targeted to the correct
2090 // RenderWidgetHost. 2090 // RenderWidgetHost.
2091 gesture_event.x = event->x(); 2091 gesture_event.x = event->x();
2092 gesture_event.y = event->y(); 2092 gesture_event.y = event->y();
2093 blink::WebMouseWheelEvent mouse_wheel_event = ui::MakeWebMouseWheelEvent( 2093 blink::WebMouseWheelEvent mouse_wheel_event = ui::MakeWebMouseWheelEvent(
2094 *event, base::Bind(&GetScreenLocationFromEvent)); 2094 *event, base::Bind(&GetScreenLocationFromEvent));
2095 if (ShouldRouteEvent(event)) { 2095 if (ShouldRouteEvent(event)) {
2096 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 2096 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
2097 this, &gesture_event, ui::LatencyInfo(ui::SourceEventType::WHEEL)); 2097 this, &gesture_event, ui::LatencyInfo());
2098 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( 2098 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent(
2099 this, &mouse_wheel_event, *event->latency()); 2099 this, &mouse_wheel_event);
2100 } else { 2100 } else {
2101 host_->ForwardGestureEvent(gesture_event); 2101 host_->ForwardGestureEvent(gesture_event);
2102 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, 2102 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event,
2103 *event->latency()); 2103 *event->latency());
2104 } 2104 }
2105 RecordAction(base::UserMetricsAction("TrackpadScroll")); 2105 RecordAction(base::UserMetricsAction("TrackpadScroll"));
2106 } else if (event->type() == ui::ET_SCROLL_FLING_START || 2106 } else if (event->type() == ui::ET_SCROLL_FLING_START ||
2107 event->type() == ui::ET_SCROLL_FLING_CANCEL) { 2107 event->type() == ui::ET_SCROLL_FLING_CANCEL) {
2108 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent( 2108 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent(
2109 *event, base::Bind(&GetScreenLocationFromEvent)); 2109 *event, base::Bind(&GetScreenLocationFromEvent));
2110 if (ShouldRouteEvent(event)) { 2110 if (ShouldRouteEvent(event)) {
2111 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 2111 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
2112 this, &gesture_event, ui::LatencyInfo(ui::SourceEventType::WHEEL)); 2112 this, &gesture_event, ui::LatencyInfo());
2113 } else { 2113 } else {
2114 host_->ForwardGestureEvent(gesture_event); 2114 host_->ForwardGestureEvent(gesture_event);
2115 } 2115 }
2116 if (event->type() == ui::ET_SCROLL_FLING_START) 2116 if (event->type() == ui::ET_SCROLL_FLING_START)
2117 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); 2117 RecordAction(base::UserMetricsAction("TrackpadScrollFling"));
2118 } 2118 }
2119 2119
2120 event->SetHandled(); 2120 event->SetHandled();
2121 } 2121 }
2122 2122
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 blink::WebGestureEvent gesture = 2188 blink::WebGestureEvent gesture =
2189 ui::MakeWebGestureEvent(*event, base::Bind(&GetScreenLocationFromEvent)); 2189 ui::MakeWebGestureEvent(*event, base::Bind(&GetScreenLocationFromEvent));
2190 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 2190 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
2191 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an 2191 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an
2192 // event to stop any in-progress flings. 2192 // event to stop any in-progress flings.
2193 blink::WebGestureEvent fling_cancel = gesture; 2193 blink::WebGestureEvent fling_cancel = gesture;
2194 fling_cancel.type = blink::WebInputEvent::GestureFlingCancel; 2194 fling_cancel.type = blink::WebInputEvent::GestureFlingCancel;
2195 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen; 2195 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen;
2196 if (ShouldRouteEvent(event)) { 2196 if (ShouldRouteEvent(event)) {
2197 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 2197 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
2198 this, &fling_cancel, ui::LatencyInfo(ui::SourceEventType::TOUCH)); 2198 this, &fling_cancel, ui::LatencyInfo());
2199 } else { 2199 } else {
2200 host_->ForwardGestureEvent(fling_cancel); 2200 host_->ForwardGestureEvent(fling_cancel);
2201 } 2201 }
2202 } 2202 }
2203 2203
2204 if (gesture.type != blink::WebInputEvent::Undefined) { 2204 if (gesture.type != blink::WebInputEvent::Undefined) {
2205 if (ShouldRouteEvent(event)) { 2205 if (ShouldRouteEvent(event)) {
2206 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 2206 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
2207 this, &gesture, *event->latency()); 2207 this, &gesture, *event->latency());
2208 } else { 2208 } else {
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 ->GetTextSelection(focused_view) 3045 ->GetTextSelection(focused_view)
3046 ->GetSelectedText(&selected_text)) { 3046 ->GetSelectedText(&selected_text)) {
3047 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 3047 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
3048 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); 3048 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
3049 clipboard_writer.WriteText(selected_text); 3049 clipboard_writer.WriteText(selected_text);
3050 } 3050 }
3051 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 3051 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
3052 } 3052 }
3053 3053
3054 } // namespace content 3054 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698