| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 | 1225 |
| 1226 if (overscroll_controller_) | 1226 if (overscroll_controller_) |
| 1227 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1227 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1228 | 1228 |
| 1229 if (selection_controller_) { | 1229 if (selection_controller_) { |
| 1230 selection_controller_->OnSelectionEditable( | 1230 selection_controller_->OnSelectionEditable( |
| 1231 frame_metadata.selection.is_editable); | 1231 frame_metadata.selection.is_editable); |
| 1232 selection_controller_->OnSelectionEmpty( | 1232 selection_controller_->OnSelectionEmpty( |
| 1233 frame_metadata.selection.is_empty_text_form_control); | 1233 frame_metadata.selection.is_empty_text_form_control); |
| 1234 selection_controller_->OnSelectionBoundsChanged( | 1234 selection_controller_->OnSelectionBoundsChanged( |
| 1235 frame_metadata.selection.start, frame_metadata.selection.end); | 1235 frame_metadata.selection.start, frame_metadata.selection.end, |
| 1236 | 1236 frame_metadata.selection.is_handle_visible); |
| 1237 // Set parameters for adaptive handle orientation. | 1237 // Set parameters for adaptive handle orientation. |
| 1238 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); | 1238 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1239 viewport_size.Scale(frame_metadata.page_scale_factor); | 1239 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1240 gfx::RectF viewport_rect( | 1240 gfx::RectF viewport_rect( |
| 1241 frame_metadata.location_bar_content_translation.x(), | 1241 frame_metadata.location_bar_content_translation.x(), |
| 1242 frame_metadata.location_bar_content_translation.y(), | 1242 frame_metadata.location_bar_content_translation.y(), |
| 1243 viewport_size.width(), viewport_size.height()); | 1243 viewport_size.width(), viewport_size.height()); |
| 1244 selection_controller_->OnViewportChanged(viewport_rect); | 1244 selection_controller_->OnViewportChanged(viewport_rect); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1630 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1631 // notifications are no longer required, crbug.com/398170. | 1631 // notifications are no longer required, crbug.com/398170. |
| 1632 gfx::SelectionBound insertion_bound; | 1632 gfx::SelectionBound insertion_bound; |
| 1633 insertion_bound.set_type(gfx::SelectionBound::CENTER); | 1633 insertion_bound.set_type(gfx::SelectionBound::CENTER); |
| 1634 insertion_bound.set_visible(true); | 1634 insertion_bound.set_visible(true); |
| 1635 insertion_bound.SetEdge(point, point); | 1635 insertion_bound.SetEdge(point, point); |
| 1636 selection_controller_->HideAndDisallowShowingAutomatically(); | 1636 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1637 selection_controller_->OnSelectionEditable(true); | 1637 selection_controller_->OnSelectionEditable(true); |
| 1638 selection_controller_->OnSelectionEmpty(true); | 1638 selection_controller_->OnSelectionEmpty(true); |
| 1639 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1639 selection_controller_->OnSelectionBoundsChanged(insertion_bound, |
| 1640 insertion_bound); | 1640 insertion_bound, |
| 1641 selection_controller_->AllowShowingFromCurrentSelection(); | 1641 true); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1644 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1645 return cached_background_color_; | 1645 return cached_background_color_; |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 void RenderWidgetHostViewAndroid::DidOverscroll( | 1648 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1649 const DidOverscrollParams& params) { | 1649 const DidOverscrollParams& params) { |
| 1650 if (sync_compositor_) | 1650 if (sync_compositor_) |
| 1651 sync_compositor_->DidOverscroll(params); | 1651 sync_compositor_->DidOverscroll(params); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 float x1, | 1927 float x1, |
| 1928 float y1) { | 1928 float y1) { |
| 1929 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); | 1929 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 void RenderWidgetHostViewAndroid::OnStylusSelectUpdate(float x, float y) { | 1932 void RenderWidgetHostViewAndroid::OnStylusSelectUpdate(float x, float y) { |
| 1933 MoveRangeSelectionExtent(gfx::PointF(x, y)); | 1933 MoveRangeSelectionExtent(gfx::PointF(x, y)); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 void RenderWidgetHostViewAndroid::OnStylusSelectEnd() { | 1936 void RenderWidgetHostViewAndroid::OnStylusSelectEnd() { |
| 1937 if (selection_controller_) | |
| 1938 selection_controller_->AllowShowingFromCurrentSelection(); | |
| 1939 } | 1937 } |
| 1940 | 1938 |
| 1941 void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time, | 1939 void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time, |
| 1942 float x, | 1940 float x, |
| 1943 float y) { | 1941 float y) { |
| 1944 // Treat the stylus tap as a long press, activating either a word selection or | 1942 // Treat the stylus tap as a long press, activating either a word selection or |
| 1945 // context menu depending on the targetted content. | 1943 // context menu depending on the targetted content. |
| 1946 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( | 1944 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( |
| 1947 blink::WebInputEvent::GestureLongPress, | 1945 blink::WebInputEvent::GestureLongPress, |
| 1948 (time - base::TimeTicks()).InSecondsF(), x, y); | 1946 (time - base::TimeTicks()).InSecondsF(), x, y); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 case ui::MotionEvent::ACTION_UP: | 1982 case ui::MotionEvent::ACTION_UP: |
| 1985 case ui::MotionEvent::ACTION_POINTER_UP: | 1983 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1986 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1984 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1987 delta.InMicroseconds(), 1, 1000000, 50); | 1985 delta.InMicroseconds(), 1, 1000000, 50); |
| 1988 default: | 1986 default: |
| 1989 return; | 1987 return; |
| 1990 } | 1988 } |
| 1991 } | 1989 } |
| 1992 | 1990 |
| 1993 } // namespace content | 1991 } // namespace content |
| OLD | NEW |