Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: ui/android/delegated_frame_host_android.cc

Issue 2253313002: ui: Pass the correct container size to DelegatedFrameHostAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/android/delegated_frame_host_android.h" 5 #include "ui/android/delegated_frame_host_android.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/layers/solid_color_layer.h" 8 #include "cc/layers/solid_color_layer.h"
9 #include "cc/layers/surface_layer.h" 9 #include "cc/layers/surface_layer.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void DelegatedFrameHostAndroid::SubmitCompositorFrame( 103 void DelegatedFrameHostAndroid::SubmitCompositorFrame(
104 cc::CompositorFrame frame, 104 cc::CompositorFrame frame,
105 cc::SurfaceFactory::DrawCallback draw_callback) { 105 cc::SurfaceFactory::DrawCallback draw_callback) {
106 if (!surface_factory_) { 106 if (!surface_factory_) {
107 surface_factory_ = 107 surface_factory_ =
108 base::WrapUnique(new cc::SurfaceFactory(surface_manager_, this)); 108 base::WrapUnique(new cc::SurfaceFactory(surface_manager_, this));
109 } 109 }
110 110
111 cc::RenderPass* root_pass = 111 cc::RenderPass* root_pass =
112 frame.delegated_frame_data->render_pass_list.back().get(); 112 frame.delegated_frame_data->render_pass_list.back().get();
113 gfx::Size surface_size = root_pass->output_rect.size(); 113 gfx::Size surface_size = root_pass->output_rect.size();
no sievers 2016/08/22 21:47:46 Ok, I didn't expect this to include the top contro
Khushal 2016/08/22 21:52:01 Yeah, Me neither...
114 114
115 if (!current_frame_ || surface_size != current_frame_->surface_size || 115 if (!current_frame_ || surface_size != current_frame_->surface_size ||
116 current_frame_->location_bar_content_translation != 116 current_frame_->location_bar_content_translation !=
117 frame.metadata.location_bar_content_translation || 117 frame.metadata.location_bar_content_translation ||
118 current_frame_->viewport_selection != frame.metadata.selection) { 118 current_frame_->viewport_selection != frame.metadata.selection) {
119 DestroyDelegatedContent(); 119 DestroyDelegatedContent();
120 DCHECK(!content_layer_); 120 DCHECK(!content_layer_);
121 DCHECK(!current_frame_); 121 DCHECK(!current_frame_);
122 122
123 current_frame_ = base::MakeUnique<FrameData>(); 123 current_frame_ = base::MakeUnique<FrameData>();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // The background layer draws in 2 cases: 222 // The background layer draws in 2 cases:
223 // 1) When we don't have any content from the renderer. 223 // 1) When we don't have any content from the renderer.
224 // 2) When the bounds of the content received from the renderer does not match 224 // 2) When the bounds of the content received from the renderer does not match
225 // the desired content bounds. 225 // the desired content bounds.
226 bool background_is_drawable = false; 226 bool background_is_drawable = false;
227 227
228 if (current_frame_) { 228 if (current_frame_) {
229 float device_scale_factor = gfx::DeviceDisplayInfo().GetDIPScale(); 229 float device_scale_factor = gfx::DeviceDisplayInfo().GetDIPScale();
230 gfx::Size content_size_in_dip = gfx::ConvertSizeToDIP( 230 gfx::Size content_size_in_dip = gfx::ConvertSizeToDIP(
231 device_scale_factor, current_frame_->surface_size); 231 device_scale_factor, current_frame_->surface_size);
232 content_size_in_dip.set_height(
233 content_size_in_dip.height() +
234 current_frame_->location_bar_content_translation.y());
235 background_is_drawable = 232 background_is_drawable =
236 content_size_in_dip.width() < container_size_in_dip_.width() || 233 content_size_in_dip.width() < container_size_in_dip_.width() ||
237 content_size_in_dip.height() < container_size_in_dip_.height(); 234 content_size_in_dip.height() < container_size_in_dip_.height();
238 } else { 235 } else {
239 background_is_drawable = true; 236 background_is_drawable = true;
240 } 237 }
241 238
242 background_layer_->SetIsDrawable(background_is_drawable); 239 background_layer_->SetIsDrawable(background_is_drawable);
243 } 240 }
244 241
245 } // namespace ui 242 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698