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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 // The Disambiguation popup does not parent itself from this window, so we | 1912 // The Disambiguation popup does not parent itself from this window, so we |
1913 // manually dismiss it. | 1913 // manually dismiss it. |
1914 HideDisambiguationPopup(); | 1914 HideDisambiguationPopup(); |
1915 | 1915 |
1916 blink::WebMouseWheelEvent mouse_wheel_event = | 1916 blink::WebMouseWheelEvent mouse_wheel_event = |
1917 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); | 1917 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); |
1918 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1918 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
1919 host_->ForwardWheelEvent(mouse_wheel_event); | 1919 host_->ForwardWheelEvent(mouse_wheel_event); |
1920 } else if (CanRendererHandleEvent(event) && | 1920 } else if (CanRendererHandleEvent(event) && |
1921 !(event->flags() & ui::EF_FROM_TOUCH)) { | 1921 !(event->flags() & ui::EF_FROM_TOUCH)) { |
| 1922 // Confirm existing composition text on mouse press, to make sure |
| 1923 // the input caret won't be moved with an ongoing composition text. |
| 1924 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 1925 FinishImeCompositionSession(); |
| 1926 |
1922 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(event); | 1927 blink::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
1923 ModifyEventMovementAndCoords(&mouse_event); | 1928 ModifyEventMovementAndCoords(&mouse_event); |
1924 host_->ForwardMouseEvent(mouse_event); | 1929 host_->ForwardMouseEvent(mouse_event); |
1925 // Ensure that we get keyboard focus on mouse down as a plugin window may | 1930 // Ensure that we get keyboard focus on mouse down as a plugin window may |
1926 // have grabbed keyboard focus. | 1931 // have grabbed keyboard focus. |
1927 if (event->type() == ui::ET_MOUSE_PRESSED) | 1932 if (event->type() == ui::ET_MOUSE_PRESSED) |
1928 SetKeyboardFocus(); | 1933 SetKeyboardFocus(); |
1929 } | 1934 } |
1930 | 1935 |
1931 switch (event->type()) { | 1936 switch (event->type()) { |
1932 case ui::ET_MOUSE_PRESSED: | 1937 case ui::ET_MOUSE_PRESSED: |
1933 window_->SetCapture(); | 1938 window_->SetCapture(); |
1934 // Confirm existing composition text on mouse click events, to make sure | |
1935 // the input caret won't be moved with an ongoing composition text. | |
1936 FinishImeCompositionSession(); | |
1937 break; | 1939 break; |
1938 case ui::ET_MOUSE_RELEASED: | 1940 case ui::ET_MOUSE_RELEASED: |
1939 if (!NeedsMouseCapture()) | 1941 if (!NeedsMouseCapture()) |
1940 window_->ReleaseCapture(); | 1942 window_->ReleaseCapture(); |
1941 break; | 1943 break; |
1942 default: | 1944 default: |
1943 break; | 1945 break; |
1944 } | 1946 } |
1945 | 1947 |
1946 // Needed to propagate mouse event to |window_->parent()->delegate()|, but | 1948 // Needed to propagate mouse event to |window_->parent()->delegate()|, but |
1947 // note that it might be something other than a WebContentsViewAura instance. | 1949 // note that it might be something other than a WebContentsViewAura instance. |
1948 // TODO(pkotwicz): Find a better way of doing this. | 1950 // TODO(pkotwicz): Find a better way of doing this. |
1949 // In fullscreen mode which is typically used by flash, don't forward | 1951 // In fullscreen mode which is typically used by flash, don't forward |
1950 // the mouse events to the parent. The renderer and the plugin process | 1952 // the mouse events to the parent. The renderer and the plugin process |
1951 // handle these events. | 1953 // handle these events. |
1952 if (!is_fullscreen_ && window_->parent()->delegate() && | 1954 if (!is_fullscreen_ && window_->parent() && window_->parent()->delegate() && |
1953 !(event->flags() & ui::EF_FROM_TOUCH)) { | 1955 !(event->flags() & ui::EF_FROM_TOUCH)) { |
1954 event->ConvertLocationToTarget(window_, window_->parent()); | 1956 event->ConvertLocationToTarget(window_, window_->parent()); |
1955 window_->parent()->delegate()->OnMouseEvent(event); | 1957 window_->parent()->delegate()->OnMouseEvent(event); |
1956 } | 1958 } |
1957 | 1959 |
1958 if (!IsXButtonUpEvent(event)) | 1960 if (!IsXButtonUpEvent(event)) |
1959 event->SetHandled(); | 1961 event->SetHandled(); |
1960 } | 1962 } |
1961 | 1963 |
1962 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 1964 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2022 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2021 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2023 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2022 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2024 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2023 event->SetHandled(); | 2025 event->SetHandled(); |
2024 return; | 2026 return; |
2025 } | 2027 } |
2026 | 2028 |
2027 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2029 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
2028 return; | 2030 return; |
2029 | 2031 |
| 2032 // Confirm existing composition text on TAP gesture, to make sure the input |
| 2033 // caret won't be moved with an ongoing composition text. |
| 2034 if (event->type() == ui::ET_GESTURE_TAP) |
| 2035 FinishImeCompositionSession(); |
| 2036 |
2030 RenderViewHostDelegate* delegate = NULL; | 2037 RenderViewHostDelegate* delegate = NULL; |
2031 if (host_->IsRenderView()) | 2038 if (host_->IsRenderView()) |
2032 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2039 delegate = RenderViewHost::From(host_)->GetDelegate(); |
2033 | 2040 |
2034 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2041 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
2035 event->details().touch_points() == 1) { | 2042 event->details().touch_points() == 1) { |
2036 delegate->HandleGestureBegin(); | 2043 delegate->HandleGestureBegin(); |
2037 } | 2044 } |
2038 | 2045 |
2039 blink::WebGestureEvent gesture = MakeWebGestureEvent(event); | 2046 blink::WebGestureEvent gesture = MakeWebGestureEvent(event); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 | 2576 |
2570 //////////////////////////////////////////////////////////////////////////////// | 2577 //////////////////////////////////////////////////////////////////////////////// |
2571 // RenderWidgetHostViewBase, public: | 2578 // RenderWidgetHostViewBase, public: |
2572 | 2579 |
2573 // static | 2580 // static |
2574 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2581 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2575 GetScreenInfoForWindow(results, NULL); | 2582 GetScreenInfoForWindow(results, NULL); |
2576 } | 2583 } |
2577 | 2584 |
2578 } // namespace content | 2585 } // namespace content |
OLD | NEW |