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 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1341 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); |
1342 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1342 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
1343 | 1343 |
1344 if (!content_view_core_) | 1344 if (!content_view_core_) |
1345 return; | 1345 return; |
1346 | 1346 |
1347 if (overscroll_controller_) | 1347 if (overscroll_controller_) |
1348 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1348 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
1349 | 1349 |
1350 if (selection_controller_) { | 1350 if (selection_controller_) { |
| 1351 gfx::SizeF view_size(frame_metadata.scrollable_viewport_size); |
| 1352 view_size.Scale(frame_metadata.page_scale_factor); |
1351 selection_controller_->OnSelectionBoundsChanged( | 1353 selection_controller_->OnSelectionBoundsChanged( |
1352 ConvertSelectionBound(frame_metadata.selection_start), | 1354 ConvertSelectionBound(frame_metadata.selection_start), |
1353 ConvertSelectionBound(frame_metadata.selection_end)); | 1355 ConvertSelectionBound(frame_metadata.selection_end), view_size, |
| 1356 frame_metadata.location_bar_offset); |
1354 } | 1357 } |
1355 | 1358 |
1356 // All offsets and sizes are in CSS pixels. | 1359 // All offsets and sizes are in CSS pixels. |
1357 content_view_core_->UpdateFrameInfo( | 1360 content_view_core_->UpdateFrameInfo( |
1358 frame_metadata.root_scroll_offset, | 1361 frame_metadata.root_scroll_offset, |
1359 frame_metadata.page_scale_factor, | 1362 frame_metadata.page_scale_factor, |
1360 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1363 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1361 frame_metadata.max_page_scale_factor), | 1364 frame_metadata.max_page_scale_factor), |
1362 frame_metadata.root_layer_size, | 1365 frame_metadata.root_layer_size, |
1363 frame_metadata.scrollable_viewport_size, | 1366 frame_metadata.scrollable_viewport_size, |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 // of the region have been updated, explicitly set the properties now. | 1664 // of the region have been updated, explicitly set the properties now. |
1662 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1665 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
1663 // notifications are no longer required, crbug.com/398170. | 1666 // notifications are no longer required, crbug.com/398170. |
1664 ui::SelectionBound insertion_bound; | 1667 ui::SelectionBound insertion_bound; |
1665 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1668 insertion_bound.set_type(ui::SelectionBound::CENTER); |
1666 insertion_bound.set_visible(true); | 1669 insertion_bound.set_visible(true); |
1667 insertion_bound.SetEdge(point, point); | 1670 insertion_bound.SetEdge(point, point); |
1668 selection_controller_->HideAndDisallowShowingAutomatically(); | 1671 selection_controller_->HideAndDisallowShowingAutomatically(); |
1669 selection_controller_->OnSelectionEditable(true); | 1672 selection_controller_->OnSelectionEditable(true); |
1670 selection_controller_->OnSelectionEmpty(true); | 1673 selection_controller_->OnSelectionEmpty(true); |
| 1674 gfx::SizeF size; |
| 1675 gfx::Vector2dF vec; |
1671 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1676 selection_controller_->OnSelectionBoundsChanged(insertion_bound, |
1672 insertion_bound); | 1677 insertion_bound, size, vec); |
1673 selection_controller_->AllowShowingFromCurrentSelection(); | 1678 selection_controller_->AllowShowingFromCurrentSelection(); |
1674 } | 1679 } |
1675 | 1680 |
1676 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1681 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
1677 return cached_background_color_; | 1682 return cached_background_color_; |
1678 } | 1683 } |
1679 | 1684 |
1680 void RenderWidgetHostViewAndroid::DidOverscroll( | 1685 void RenderWidgetHostViewAndroid::DidOverscroll( |
1681 const DidOverscrollParams& params) { | 1686 const DidOverscrollParams& params) { |
1682 if (!content_view_core_ || !layer_.get() || !is_showing_) | 1687 if (!content_view_core_ || !layer_.get() || !is_showing_) |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 results->orientationAngle = display.RotationAsDegree(); | 1945 results->orientationAngle = display.RotationAsDegree(); |
1941 results->orientationType = | 1946 results->orientationType = |
1942 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1947 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1943 gfx::DeviceDisplayInfo info; | 1948 gfx::DeviceDisplayInfo info; |
1944 results->depth = info.GetBitsPerPixel(); | 1949 results->depth = info.GetBitsPerPixel(); |
1945 results->depthPerComponent = info.GetBitsPerComponent(); | 1950 results->depthPerComponent = info.GetBitsPerComponent(); |
1946 results->isMonochrome = (results->depthPerComponent == 0); | 1951 results->isMonochrome = (results->depthPerComponent == 0); |
1947 } | 1952 } |
1948 | 1953 |
1949 } // namespace content | 1954 } // namespace content |
OLD | NEW |