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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 // web design, so text will be legible without zooming). Also disable | 1227 // web design, so text will be legible without zooming). Also disable |
1228 // double tap and pinch for pages that prevent zooming in or out. | 1228 // double tap and pinch for pages that prevent zooming in or out. |
1229 bool has_mobile_viewport = HasMobileViewport(frame_metadata); | 1229 bool has_mobile_viewport = HasMobileViewport(frame_metadata); |
1230 bool has_fixed_page_scale = HasFixedPageScale(frame_metadata); | 1230 bool has_fixed_page_scale = HasFixedPageScale(frame_metadata); |
1231 gesture_provider_.SetDoubleTapSupportForPageEnabled( | 1231 gesture_provider_.SetDoubleTapSupportForPageEnabled( |
1232 !has_fixed_page_scale && !has_mobile_viewport); | 1232 !has_fixed_page_scale && !has_mobile_viewport); |
1233 | 1233 |
1234 if (!content_view_core_) | 1234 if (!content_view_core_) |
1235 return; | 1235 return; |
1236 | 1236 |
1237 const cc::ViewportSelectionBound& selection_start = | |
1238 frame_metadata.selection_start; | |
1239 const cc::ViewportSelectionBound& selection_end = | |
1240 frame_metadata.selection_start; | |
1237 if (selection_controller_) { | 1241 if (selection_controller_) { |
1238 selection_controller_->OnSelectionBoundsChanged( | 1242 selection_controller_->OnSelectionBoundsChanged(selection_start, |
1239 frame_metadata.selection_start, frame_metadata.selection_end); | 1243 selection_end); |
1240 } | 1244 } |
1241 | 1245 |
1246 const bool has_insertion_marker = | |
1247 selection_start.type == cc::SELECTION_BOUND_CENTER && | |
1248 selection_end.type == cc::SELECTION_BOUND_CENTER && | |
1249 selection_start.edge_top.x() == selection_start.edge_bottom.x() && | |
1250 selection_end.edge_top.x() == selection_end.edge_bottom.x() && | |
1251 selection_start.edge_top.x() == selection_end.edge_bottom.x(); | |
bcwhite
2014/11/06 18:57:19
Is there any chance these floats have tiny differe
yukawa
2014/11/07 00:52:47
Good point. Basically those conditions are always
bcwhite
2014/11/07 01:15:07
Yes. If it's not broken, don't fix it. You could
| |
1252 const float insertion_marker_x = | |
1253 has_insertion_marker ? selection_start.edge_top.x() : 0.0f; | |
1254 const float insertion_marker_top = | |
1255 has_insertion_marker ? selection_start.edge_top.y() : 0.0f; | |
1256 const float insertion_marker_bottom = | |
1257 has_insertion_marker ? selection_start.edge_bottom.y() : 0.0f; | |
1258 | |
1242 // All offsets and sizes are in CSS pixels. | 1259 // All offsets and sizes are in CSS pixels. |
1243 content_view_core_->UpdateFrameInfo( | 1260 content_view_core_->UpdateFrameInfo( |
1244 frame_metadata.root_scroll_offset, | 1261 frame_metadata.root_scroll_offset, |
1245 frame_metadata.page_scale_factor, | 1262 frame_metadata.page_scale_factor, |
1246 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1263 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1247 frame_metadata.max_page_scale_factor), | 1264 frame_metadata.max_page_scale_factor), |
1248 frame_metadata.root_layer_size, | 1265 frame_metadata.root_layer_size, |
1249 frame_metadata.scrollable_viewport_size, | 1266 frame_metadata.scrollable_viewport_size, |
1250 frame_metadata.location_bar_offset, | 1267 frame_metadata.location_bar_offset, |
1251 frame_metadata.location_bar_content_translation); | 1268 frame_metadata.location_bar_content_translation, |
1269 has_insertion_marker, | |
1270 insertion_marker_x, | |
1271 insertion_marker_top, | |
1272 insertion_marker_bottom); | |
1252 #if defined(VIDEO_HOLE) | 1273 #if defined(VIDEO_HOLE) |
1253 if (host_ && host_->IsRenderView()) { | 1274 if (host_ && host_->IsRenderView()) { |
1254 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1275 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1255 RenderViewHost::From(host_)); | 1276 RenderViewHost::From(host_)); |
1256 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1277 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
1257 } | 1278 } |
1258 #endif // defined(VIDEO_HOLE) | 1279 #endif // defined(VIDEO_HOLE) |
1259 } | 1280 } |
1260 | 1281 |
1261 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int route_id) { | 1282 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int route_id) { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1811 results->orientationAngle = display.RotationAsDegree(); | 1832 results->orientationAngle = display.RotationAsDegree(); |
1812 results->orientationType = | 1833 results->orientationType = |
1813 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1834 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1814 gfx::DeviceDisplayInfo info; | 1835 gfx::DeviceDisplayInfo info; |
1815 results->depth = info.GetBitsPerPixel(); | 1836 results->depth = info.GetBitsPerPixel(); |
1816 results->depthPerComponent = info.GetBitsPerComponent(); | 1837 results->depthPerComponent = info.GetBitsPerComponent(); |
1817 results->isMonochrome = (results->depthPerComponent == 0); | 1838 results->isMonochrome = (results->depthPerComponent == 0); |
1818 } | 1839 } |
1819 | 1840 |
1820 } // namespace content | 1841 } // namespace content |
OLD | NEW |