| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 27 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 28 #include "content/browser/bad_message.h" | 28 #include "content/browser/bad_message.h" |
| 29 #include "content/browser/frame_host/frame_tree.h" | 29 #include "content/browser/frame_host/frame_tree.h" |
| 30 #include "content/browser/frame_host/frame_tree_node.h" | 30 #include "content/browser/frame_host/frame_tree_node.h" |
| 31 #include "content/browser/frame_host/render_frame_host_impl.h" | 31 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 32 #include "content/browser/gpu/compositor_util.h" | 32 #include "content/browser/gpu/compositor_util.h" |
| 33 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 33 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" |
| 34 #include "content/browser/renderer_host/dip_util.h" | 34 #include "content/browser/renderer_host/dip_util.h" |
| 35 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 35 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
| 36 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 36 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
| 37 #include "content/browser/renderer_host/input/web_input_event_util.h" | |
| 38 #include "content/browser/renderer_host/overscroll_controller.h" | 37 #include "content/browser/renderer_host/overscroll_controller.h" |
| 39 #include "content/browser/renderer_host/render_view_host_delegate.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 40 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 39 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 41 #include "content/browser/renderer_host/render_view_host_impl.h" | 40 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 42 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 41 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 43 #include "content/browser/renderer_host/render_widget_host_impl.h" | 42 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 44 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 43 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 45 #include "content/browser/renderer_host/ui_events_helper.h" | 44 #include "content/browser/renderer_host/ui_events_helper.h" |
| 46 #include "content/browser/renderer_host/web_input_event_aura.h" | |
| 47 #include "content/common/content_switches_internal.h" | 45 #include "content/common/content_switches_internal.h" |
| 48 #include "content/common/input_messages.h" | 46 #include "content/common/input_messages.h" |
| 49 #include "content/common/site_isolation_policy.h" | 47 #include "content/common/site_isolation_policy.h" |
| 50 #include "content/common/text_input_state.h" | 48 #include "content/common/text_input_state.h" |
| 51 #include "content/common/view_messages.h" | 49 #include "content/common/view_messages.h" |
| 52 #include "content/public/browser/content_browser_client.h" | 50 #include "content/public/browser/content_browser_client.h" |
| 53 #include "content/public/browser/overscroll_configuration.h" | 51 #include "content/public/browser/overscroll_configuration.h" |
| 54 #include "content/public/browser/render_view_host.h" | 52 #include "content/public/browser/render_view_host.h" |
| 55 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 53 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 56 #include "content/public/browser/user_metrics.h" | 54 #include "content/public/browser/user_metrics.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 72 #include "ui/aura/window_tree_host.h" | 70 #include "ui/aura/window_tree_host.h" |
| 73 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 71 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 74 #include "ui/base/hit_test.h" | 72 #include "ui/base/hit_test.h" |
| 75 #include "ui/base/ime/input_method.h" | 73 #include "ui/base/ime/input_method.h" |
| 76 #include "ui/base/ui_base_types.h" | 74 #include "ui/base/ui_base_types.h" |
| 77 #include "ui/compositor/compositor_vsync_manager.h" | 75 #include "ui/compositor/compositor_vsync_manager.h" |
| 78 #include "ui/compositor/dip_util.h" | 76 #include "ui/compositor/dip_util.h" |
| 79 #include "ui/display/display.h" | 77 #include "ui/display/display.h" |
| 80 #include "ui/display/screen.h" | 78 #include "ui/display/screen.h" |
| 81 #include "ui/events/blink/blink_event_util.h" | 79 #include "ui/events/blink/blink_event_util.h" |
| 80 #include "ui/events/blink/web_input_event.h" |
| 82 #include "ui/events/event.h" | 81 #include "ui/events/event.h" |
| 83 #include "ui/events/event_utils.h" | 82 #include "ui/events/event_utils.h" |
| 84 #include "ui/events/gesture_detection/gesture_configuration.h" | 83 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 85 #include "ui/events/gestures/gesture_recognizer.h" | 84 #include "ui/events/gestures/gesture_recognizer.h" |
| 86 #include "ui/gfx/canvas.h" | 85 #include "ui/gfx/canvas.h" |
| 87 #include "ui/gfx/geometry/dip_util.h" | 86 #include "ui/gfx/geometry/dip_util.h" |
| 88 #include "ui/gfx/geometry/rect_conversions.h" | 87 #include "ui/gfx/geometry/rect_conversions.h" |
| 89 #include "ui/gfx/geometry/size_conversions.h" | 88 #include "ui/gfx/geometry/size_conversions.h" |
| 90 #include "ui/gfx/skia_util.h" | 89 #include "ui/gfx/skia_util.h" |
| 91 #include "ui/touch_selection/touch_selection_controller.h" | 90 #include "ui/touch_selection/touch_selection_controller.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 int changed_touch_id) { | 178 int changed_touch_id) { |
| 180 if (event->type == blink::WebInputEvent::TouchMove || | 179 if (event->type == blink::WebInputEvent::TouchMove || |
| 181 event->type == blink::WebInputEvent::TouchCancel) { | 180 event->type == blink::WebInputEvent::TouchCancel) { |
| 182 for (size_t i = 0; i < event->touchesLength; ++i) { | 181 for (size_t i = 0; i < event->touchesLength; ++i) { |
| 183 if (event->touches[i].id != changed_touch_id) | 182 if (event->touches[i].id != changed_touch_id) |
| 184 event->touches[i].state = blink::WebTouchPoint::StateStationary; | 183 event->touches[i].state = blink::WebTouchPoint::StateStationary; |
| 185 } | 184 } |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 | 187 |
| 188 gfx::Point GetScreenLocationFromEvent(const ui::LocatedEvent& event) { |
| 189 aura::Window* root = |
| 190 static_cast<aura::Window*>(event.target())->GetRootWindow(); |
| 191 aura::client::ScreenPositionClient* spc = |
| 192 aura::client::GetScreenPositionClient(root); |
| 193 if (!spc) |
| 194 return event.root_location(); |
| 195 |
| 196 gfx::Point screen_location(event.root_location()); |
| 197 spc->ConvertPointToScreen(root, &screen_location); |
| 198 return screen_location; |
| 199 } |
| 200 |
| 189 #if defined(OS_WIN) | 201 #if defined(OS_WIN) |
| 190 // This class implements the ui::OnScreenKeyboardObserver interface | 202 // This class implements the ui::OnScreenKeyboardObserver interface |
| 191 // which provides notifications about the on screen keyboard on Windows getting | 203 // which provides notifications about the on screen keyboard on Windows getting |
| 192 // displayed or hidden in response to taps on editable fields. | 204 // displayed or hidden in response to taps on editable fields. |
| 193 // It provides functionality to request blink to scroll the input field if it | 205 // It provides functionality to request blink to scroll the input field if it |
| 194 // is obscured by the on screen keyboard. | 206 // is obscured by the on screen keyboard. |
| 195 class WinScreenKeyboardObserver : public ui::OnScreenKeyboardObserver { | 207 class WinScreenKeyboardObserver : public ui::OnScreenKeyboardObserver { |
| 196 public: | 208 public: |
| 197 WinScreenKeyboardObserver(RenderWidgetHostImpl* host, | 209 WinScreenKeyboardObserver(RenderWidgetHostImpl* host, |
| 198 const gfx::Point& location_in_screen, | 210 const gfx::Point& location_in_screen, |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 // breaks drop-down lists which means something is incorrectly setting | 1834 // breaks drop-down lists which means something is incorrectly setting |
| 1823 // event->handled to true (http://crbug.com/577983). | 1835 // event->handled to true (http://crbug.com/577983). |
| 1824 | 1836 |
| 1825 if (mouse_locked_) { | 1837 if (mouse_locked_) { |
| 1826 aura::client::CursorClient* cursor_client = | 1838 aura::client::CursorClient* cursor_client = |
| 1827 aura::client::GetCursorClient(window_->GetRootWindow()); | 1839 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 1828 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1840 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
| 1829 | 1841 |
| 1830 if (event->type() == ui::ET_MOUSEWHEEL) { | 1842 if (event->type() == ui::ET_MOUSEWHEEL) { |
| 1831 blink::WebMouseWheelEvent mouse_wheel_event = | 1843 blink::WebMouseWheelEvent mouse_wheel_event = |
| 1832 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1844 ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event), |
| 1845 base::Bind(&GetScreenLocationFromEvent)); |
| 1833 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1846 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
| 1834 host_->ForwardWheelEvent(mouse_wheel_event); | 1847 host_->ForwardWheelEvent(mouse_wheel_event); |
| 1835 return; | 1848 return; |
| 1836 } | 1849 } |
| 1837 | 1850 |
| 1838 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); | 1851 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 1839 | 1852 |
| 1840 // If we receive non client mouse messages while we are in the locked state | 1853 // If we receive non client mouse messages while we are in the locked state |
| 1841 // it probably means that the mouse left the borders of our window and | 1854 // it probably means that the mouse left the borders of our window and |
| 1842 // needs to be moved back to the center. | 1855 // needs to be moved back to the center. |
| 1843 if (event->flags() & ui::EF_IS_NON_CLIENT) { | 1856 if (event->flags() & ui::EF_IS_NON_CLIENT) { |
| 1844 synthetic_move_sent_ = true; | 1857 synthetic_move_sent_ = true; |
| 1845 window_->MoveCursorTo(center); | 1858 window_->MoveCursorTo(center); |
| 1846 return; | 1859 return; |
| 1847 } | 1860 } |
| 1848 | 1861 |
| 1849 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 1862 blink::WebMouseEvent mouse_event = |
| 1863 ui::MakeWebMouseEvent(*event, base::Bind(&GetScreenLocationFromEvent)); |
| 1850 | 1864 |
| 1851 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || | 1865 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || |
| 1852 event->type() == ui::ET_MOUSE_DRAGGED) && | 1866 event->type() == ui::ET_MOUSE_DRAGGED) && |
| 1853 mouse_event.x == center.x() && mouse_event.y == center.y(); | 1867 mouse_event.x == center.x() && mouse_event.y == center.y(); |
| 1854 | 1868 |
| 1855 // For fractional scale factors, the conversion from pixels to dip and | 1869 // For fractional scale factors, the conversion from pixels to dip and |
| 1856 // vice versa could result in off by 1 or 2 errors which hurts us because | 1870 // vice versa could result in off by 1 or 2 errors which hurts us because |
| 1857 // we want to avoid sending the artificial move to center event to the | 1871 // we want to avoid sending the artificial move to center event to the |
| 1858 // renderer. Sending the move to center to the renderer cause the cursor | 1872 // renderer. Sending the move to center to the renderer cause the cursor |
| 1859 // to bounce around the center of the screen leading to the lock operation | 1873 // to bounce around the center of the screen leading to the lock operation |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 aura::WindowTreeHost* host = window_->GetHost(); | 1935 aura::WindowTreeHost* host = window_->GetHost(); |
| 1922 if (host) { | 1936 if (host) { |
| 1923 HWND parent = host->GetAcceleratedWidget(); | 1937 HWND parent = host->GetAcceleratedWidget(); |
| 1924 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); | 1938 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); |
| 1925 EnumThreadWindows(GetCurrentThreadId(), | 1939 EnumThreadWindows(GetCurrentThreadId(), |
| 1926 DismissOwnedPopups, | 1940 DismissOwnedPopups, |
| 1927 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 1941 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
| 1928 } | 1942 } |
| 1929 #endif | 1943 #endif |
| 1930 blink::WebMouseWheelEvent mouse_wheel_event = | 1944 blink::WebMouseWheelEvent mouse_wheel_event = |
| 1931 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1945 ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event), |
| 1946 base::Bind(&GetScreenLocationFromEvent)); |
| 1932 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { | 1947 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { |
| 1933 if (ShouldRouteEvent(event)) { | 1948 if (ShouldRouteEvent(event)) { |
| 1934 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 1949 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| 1935 this, &mouse_wheel_event); | 1950 this, &mouse_wheel_event); |
| 1936 } else { | 1951 } else { |
| 1937 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency()); | 1952 ProcessMouseWheelEvent(mouse_wheel_event, *event->latency()); |
| 1938 } | 1953 } |
| 1939 } | 1954 } |
| 1940 } else { | 1955 } else { |
| 1941 bool is_selection_popup = | 1956 bool is_selection_popup = |
| 1942 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); | 1957 popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); |
| 1943 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && | 1958 if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && |
| 1944 !(event->flags() & ui::EF_FROM_TOUCH)) { | 1959 !(event->flags() & ui::EF_FROM_TOUCH)) { |
| 1945 // Confirm existing composition text on mouse press, to make sure | 1960 // Confirm existing composition text on mouse press, to make sure |
| 1946 // the input caret won't be moved with an ongoing composition text. | 1961 // the input caret won't be moved with an ongoing composition text. |
| 1947 if (event->type() == ui::ET_MOUSE_PRESSED) | 1962 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 1948 FinishImeCompositionSession(); | 1963 FinishImeCompositionSession(); |
| 1949 | 1964 |
| 1950 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 1965 blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent( |
| 1966 *event, base::Bind(&GetScreenLocationFromEvent)); |
| 1951 ModifyEventMovementAndCoords(&mouse_event); | 1967 ModifyEventMovementAndCoords(&mouse_event); |
| 1952 if (ShouldRouteEvent(event)) { | 1968 if (ShouldRouteEvent(event)) { |
| 1953 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, | 1969 host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, |
| 1954 &mouse_event); | 1970 &mouse_event); |
| 1955 } else { | 1971 } else { |
| 1956 ProcessMouseEvent(mouse_event, *event->latency()); | 1972 ProcessMouseEvent(mouse_event, *event->latency()); |
| 1957 } | 1973 } |
| 1958 | 1974 |
| 1959 // Ensure that we get keyboard focus on mouse down as a plugin window may | 1975 // Ensure that we get keyboard focus on mouse down as a plugin window may |
| 1960 // have grabbed keyboard focus. | 1976 // have grabbed keyboard focus. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2082 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2067 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 2083 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2068 | 2084 |
| 2069 if (event->type() == ui::ET_SCROLL) { | 2085 if (event->type() == ui::ET_SCROLL) { |
| 2070 #if !defined(OS_WIN) | 2086 #if !defined(OS_WIN) |
| 2071 // TODO(ananta) | 2087 // TODO(ananta) |
| 2072 // Investigate if this is true for Windows 8 Metro ASH as well. | 2088 // Investigate if this is true for Windows 8 Metro ASH as well. |
| 2073 if (event->finger_count() != 2) | 2089 if (event->finger_count() != 2) |
| 2074 return; | 2090 return; |
| 2075 #endif | 2091 #endif |
| 2076 blink::WebGestureEvent gesture_event = | 2092 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEventFlingCancel(); |
| 2077 MakeWebGestureEventFlingCancel(); | |
| 2078 // Coordinates need to be transferred to the fling cancel gesture only | 2093 // Coordinates need to be transferred to the fling cancel gesture only |
| 2079 // for Surface-targeting to ensure that it is targeted to the correct | 2094 // for Surface-targeting to ensure that it is targeted to the correct |
| 2080 // RenderWidgetHost. | 2095 // RenderWidgetHost. |
| 2081 gesture_event.x = event->x(); | 2096 gesture_event.x = event->x(); |
| 2082 gesture_event.y = event->y(); | 2097 gesture_event.y = event->y(); |
| 2083 blink::WebMouseWheelEvent mouse_wheel_event = | 2098 blink::WebMouseWheelEvent mouse_wheel_event = ui::MakeWebMouseWheelEvent( |
| 2084 MakeWebMouseWheelEvent(*event); | 2099 *event, base::Bind(&GetScreenLocationFromEvent)); |
| 2085 if (ShouldRouteEvent(event)) { | 2100 if (ShouldRouteEvent(event)) { |
| 2086 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 2101 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 2087 this, &gesture_event, ui::LatencyInfo()); | 2102 this, &gesture_event, ui::LatencyInfo()); |
| 2088 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 2103 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| 2089 this, &mouse_wheel_event); | 2104 this, &mouse_wheel_event); |
| 2090 } else { | 2105 } else { |
| 2091 host_->ForwardGestureEvent(gesture_event); | 2106 host_->ForwardGestureEvent(gesture_event); |
| 2092 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, | 2107 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, |
| 2093 *event->latency()); | 2108 *event->latency()); |
| 2094 } | 2109 } |
| 2095 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 2110 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
| 2096 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2111 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2097 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2112 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2098 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 2113 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent( |
| 2114 *event, base::Bind(&GetScreenLocationFromEvent)); |
| 2099 if (ShouldRouteEvent(event)) { | 2115 if (ShouldRouteEvent(event)) { |
| 2100 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 2116 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 2101 this, &gesture_event, ui::LatencyInfo()); | 2117 this, &gesture_event, ui::LatencyInfo()); |
| 2102 } else { | 2118 } else { |
| 2103 host_->ForwardGestureEvent(gesture_event); | 2119 host_->ForwardGestureEvent(gesture_event); |
| 2104 } | 2120 } |
| 2105 if (event->type() == ui::ET_SCROLL_FLING_START) | 2121 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2106 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 2122 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
| 2107 } | 2123 } |
| 2108 | 2124 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 | 2183 |
| 2168 HandleGestureForTouchSelection(event); | 2184 HandleGestureForTouchSelection(event); |
| 2169 if (event->handled()) | 2185 if (event->handled()) |
| 2170 return; | 2186 return; |
| 2171 | 2187 |
| 2172 // Confirm existing composition text on TAP gesture, to make sure the input | 2188 // Confirm existing composition text on TAP gesture, to make sure the input |
| 2173 // caret won't be moved with an ongoing composition text. | 2189 // caret won't be moved with an ongoing composition text. |
| 2174 if (event->type() == ui::ET_GESTURE_TAP) | 2190 if (event->type() == ui::ET_GESTURE_TAP) |
| 2175 FinishImeCompositionSession(); | 2191 FinishImeCompositionSession(); |
| 2176 | 2192 |
| 2177 blink::WebGestureEvent gesture = MakeWebGestureEvent(*event); | 2193 blink::WebGestureEvent gesture = |
| 2194 ui::MakeWebGestureEvent(*event, base::Bind(&GetScreenLocationFromEvent)); |
| 2178 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 2195 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 2179 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an | 2196 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an |
| 2180 // event to stop any in-progress flings. | 2197 // event to stop any in-progress flings. |
| 2181 blink::WebGestureEvent fling_cancel = gesture; | 2198 blink::WebGestureEvent fling_cancel = gesture; |
| 2182 fling_cancel.type = blink::WebInputEvent::GestureFlingCancel; | 2199 fling_cancel.type = blink::WebInputEvent::GestureFlingCancel; |
| 2183 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen; | 2200 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 2184 if (ShouldRouteEvent(event)) { | 2201 if (ShouldRouteEvent(event)) { |
| 2185 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 2202 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 2186 this, &fling_cancel, ui::LatencyInfo()); | 2203 this, &fling_cancel, ui::LatencyInfo()); |
| 2187 } else { | 2204 } else { |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 return; | 3069 return; |
| 3053 } | 3070 } |
| 3054 | 3071 |
| 3055 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3072 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3056 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3073 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3057 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); | 3074 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); |
| 3058 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3075 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3059 } | 3076 } |
| 3060 | 3077 |
| 3061 } // namespace content | 3078 } // namespace content |
| OLD | NEW |