| 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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 base::LazyInstance<RoutingIDWidgetMap> g_routing_id_widget_map = | 101 base::LazyInstance<RoutingIDWidgetMap> g_routing_id_widget_map = |
| 102 LAZY_INSTANCE_INITIALIZER; | 102 LAZY_INSTANCE_INITIALIZER; |
| 103 | 103 |
| 104 int GetInputRouterViewFlagsFromCompositorFrameMetadata( | 104 int GetInputRouterViewFlagsFromCompositorFrameMetadata( |
| 105 const cc::CompositorFrameMetadata metadata) { | 105 const cc::CompositorFrameMetadata metadata) { |
| 106 int view_flags = InputRouter::VIEW_FLAGS_NONE; | 106 int view_flags = InputRouter::VIEW_FLAGS_NONE; |
| 107 | 107 |
| 108 if (metadata.min_page_scale_factor == metadata.max_page_scale_factor) | 108 if (metadata.min_page_scale_factor == metadata.max_page_scale_factor) |
| 109 view_flags |= InputRouter::FIXED_PAGE_SCALE; | 109 view_flags |= InputRouter::FIXED_PAGE_SCALE; |
| 110 | 110 |
| 111 const float window_width_dip = | 111 const float window_width_dip = std::ceil( |
| 112 std::ceil(metadata.page_scale_factor * metadata.viewport_size.width()); | 112 metadata.page_scale_factor * metadata.scrollable_viewport_size.width()); |
| 113 const float content_width_css = metadata.root_layer_size.width(); | 113 const float content_width_css = metadata.root_layer_size.width(); |
| 114 if (content_width_css <= window_width_dip) | 114 if (content_width_css <= window_width_dip) |
| 115 view_flags |= InputRouter::MOBILE_VIEWPORT; | 115 view_flags |= InputRouter::MOBILE_VIEWPORT; |
| 116 | 116 |
| 117 return view_flags; | 117 return view_flags; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Implements the RenderWidgetHostIterator interface. It keeps a list of | 120 // Implements the RenderWidgetHostIterator interface. It keeps a list of |
| 121 // RenderWidgetHosts, and makes sure it returns a live RenderWidgetHost at each | 121 // RenderWidgetHosts, and makes sure it returns a live RenderWidgetHost at each |
| 122 // iteration (or NULL if there isn't any left). | 122 // iteration (or NULL if there isn't any left). |
| (...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 } | 2381 } |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2384 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2385 if (view_) | 2385 if (view_) |
| 2386 return view_->PreferredReadbackFormat(); | 2386 return view_->PreferredReadbackFormat(); |
| 2387 return kN32_SkColorType; | 2387 return kN32_SkColorType; |
| 2388 } | 2388 } |
| 2389 | 2389 |
| 2390 } // namespace content | 2390 } // namespace content |
| OLD | NEW |