Chromium Code Reviews| 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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1737 | 1737 |
| 1738 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1738 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
| 1739 while (!ack_callbacks_.empty()) { | 1739 while (!ack_callbacks_.empty()) { |
| 1740 ack_callbacks_.front().Run(); | 1740 ack_callbacks_.front().Run(); |
| 1741 ack_callbacks_.pop(); | 1741 ack_callbacks_.pop(); |
| 1742 } | 1742 } |
| 1743 } | 1743 } |
| 1744 | 1744 |
| 1745 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1745 void RenderWidgetHostViewAndroid::OnGestureEvent( |
| 1746 const ui::GestureEventData& gesture) { | 1746 const ui::GestureEventData& gesture) { |
| 1747 // Confirm existing composition text on TAP gesture, to make sure the input | |
| 1748 // caret won't be moved with an ongoing composition text. | |
| 1749 if (gesture.type() == ui::ET_GESTURE_TAP) | |
| 1750 FinishImeCompositionSession(); | |
| 1751 | |
| 1747 blink::WebGestureEvent web_gesture = | 1752 blink::WebGestureEvent web_gesture = |
| 1748 CreateWebGestureEventFromGestureEventData(gesture); | 1753 CreateWebGestureEventFromGestureEventData(gesture); |
| 1749 // TODO(jdduke): Remove this workaround after Android fixes UiAutomator to | 1754 // TODO(jdduke): Remove this workaround after Android fixes UiAutomator to |
| 1750 // stop providing shift meta values to synthetic MotionEvents. This prevents | 1755 // stop providing shift meta values to synthetic MotionEvents. This prevents |
| 1751 // unintended shift+click interpretation of all accessibility clicks. | 1756 // unintended shift+click interpretation of all accessibility clicks. |
| 1752 // See crbug.com/443247. | 1757 // See crbug.com/443247. |
| 1753 if (web_gesture.type == blink::WebInputEvent::GestureTap && | 1758 if (web_gesture.type == blink::WebInputEvent::GestureTap && |
| 1754 web_gesture.modifiers == blink::WebInputEvent::ShiftKey) { | 1759 web_gesture.modifiers == blink::WebInputEvent::ShiftKey) { |
| 1755 web_gesture.modifiers = 0; | 1760 web_gesture.modifiers = 0; |
| 1756 } | 1761 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1921 float x, | 1926 float x, |
| 1922 float y) { | 1927 float y) { |
| 1923 // Treat the stylus tap as a long press, activating either a word selection or | 1928 // Treat the stylus tap as a long press, activating either a word selection or |
| 1924 // context menu depending on the targetted content. | 1929 // context menu depending on the targetted content. |
| 1925 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( | 1930 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( |
| 1926 blink::WebInputEvent::GestureLongPress, | 1931 blink::WebInputEvent::GestureLongPress, |
| 1927 (time - base::TimeTicks()).InSecondsF(), x, y); | 1932 (time - base::TimeTicks()).InSecondsF(), x, y); |
| 1928 SendGestureEvent(long_press); | 1933 SendGestureEvent(long_press); |
| 1929 } | 1934 } |
| 1930 | 1935 |
| 1936 void RenderWidgetHostViewAndroid::FinishImeCompositionSession() { | |
| 1937 if (!ime_adapter_android_.HasComposition()) | |
| 1938 return; | |
| 1939 if (host_) { | |
| 1940 host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(), | |
|
aurimas (slooooooooow)
2015/03/19 05:40:30
This will get called even if the user taps inside
| |
| 1941 false); | |
| 1942 } | |
| 1943 ImeCancelComposition(); | |
| 1944 } | |
| 1945 | |
| 1931 // static | 1946 // static |
| 1932 void RenderWidgetHostViewBase::GetDefaultScreenInfo( | 1947 void RenderWidgetHostViewBase::GetDefaultScreenInfo( |
| 1933 blink::WebScreenInfo* results) { | 1948 blink::WebScreenInfo* results) { |
| 1934 const gfx::Display& display = | 1949 const gfx::Display& display = |
| 1935 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 1950 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 1936 results->rect = display.bounds(); | 1951 results->rect = display.bounds(); |
| 1937 // TODO(husky): Remove any system controls from availableRect. | 1952 // TODO(husky): Remove any system controls from availableRect. |
| 1938 results->availableRect = display.work_area(); | 1953 results->availableRect = display.work_area(); |
| 1939 results->deviceScaleFactor = display.device_scale_factor(); | 1954 results->deviceScaleFactor = display.device_scale_factor(); |
| 1940 results->orientationAngle = display.RotationAsDegree(); | 1955 results->orientationAngle = display.RotationAsDegree(); |
| 1941 results->orientationType = | 1956 results->orientationType = |
| 1942 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1957 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1943 gfx::DeviceDisplayInfo info; | 1958 gfx::DeviceDisplayInfo info; |
| 1944 results->depth = info.GetBitsPerPixel(); | 1959 results->depth = info.GetBitsPerPixel(); |
| 1945 results->depthPerComponent = info.GetBitsPerComponent(); | 1960 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1946 results->isMonochrome = (results->depthPerComponent == 0); | 1961 results->isMonochrome = (results->depthPerComponent == 0); |
| 1947 } | 1962 } |
| 1948 | 1963 |
| 1949 } // namespace content | 1964 } // namespace content |
| OLD | NEW |