| OLD | NEW |
| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // The background layer draws in 2 cases: | 234 // The background layer draws in 2 cases: |
| 235 // 1) When we don't have any content from the renderer. | 235 // 1) When we don't have any content from the renderer. |
| 236 // 2) When the bounds of the content received from the renderer does not match | 236 // 2) When the bounds of the content received from the renderer does not match |
| 237 // the desired content bounds. | 237 // the desired content bounds. |
| 238 bool background_is_drawable = false; | 238 bool background_is_drawable = false; |
| 239 | 239 |
| 240 if (current_frame_) { | 240 if (current_frame_) { |
| 241 float device_scale_factor = gfx::DeviceDisplayInfo().GetDIPScale(); | 241 float device_scale_factor = gfx::DeviceDisplayInfo().GetDIPScale(); |
| 242 gfx::Size content_size_in_dip = gfx::ConvertSizeToDIP( | 242 gfx::Size content_size_in_dip = gfx::ConvertSizeToDIP( |
| 243 device_scale_factor, current_frame_->surface_size); | 243 device_scale_factor, current_frame_->surface_size); |
| 244 float top_bar_shown = current_frame_->top_controls_height * | |
| 245 current_frame_->top_controls_shown_ratio; | |
| 246 float bottom_bar_shown = current_frame_->bottom_controls_height * | |
| 247 current_frame_->bottom_controls_shown_ratio; | |
| 248 content_size_in_dip.set_height( | |
| 249 content_size_in_dip.height() - top_bar_shown - bottom_bar_shown); | |
| 250 background_is_drawable = | 244 background_is_drawable = |
| 251 content_size_in_dip.width() < container_size_in_dip_.width() || | 245 content_size_in_dip.width() < container_size_in_dip_.width() || |
| 252 content_size_in_dip.height() < container_size_in_dip_.height(); | 246 content_size_in_dip.height() < container_size_in_dip_.height(); |
| 253 } else { | 247 } else { |
| 254 background_is_drawable = true; | 248 background_is_drawable = true; |
| 255 } | 249 } |
| 256 | 250 |
| 257 background_layer_->SetIsDrawable(background_is_drawable); | 251 background_layer_->SetIsDrawable(background_is_drawable); |
| 258 } | 252 } |
| 259 | 253 |
| 260 } // namespace ui | 254 } // namespace ui |
| OLD | NEW |