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

Unified Diff: ui/android/delegated_frame_host_android.cc

Issue 2707403004: Unify background color gutters. (Closed)
Patch Set: Rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/android/delegated_frame_host_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/delegated_frame_host_android.cc
diff --git a/ui/android/delegated_frame_host_android.cc b/ui/android/delegated_frame_host_android.cc
index 489003b2fb954f1f9effb8bf0c63d22cd63ef897..b2b73ce91b7691f2e357b6eb03f2ebfa77122922 100644
--- a/ui/android/delegated_frame_host_android.cc
+++ b/ui/android/delegated_frame_host_android.cc
@@ -53,13 +53,9 @@ void CopyOutputRequestCallback(
DelegatedFrameHostAndroid::DelegatedFrameHostAndroid(
ui::ViewAndroid* view,
- SkColor background_color,
Client* client,
const cc::FrameSinkId& frame_sink_id)
- : frame_sink_id_(frame_sink_id),
- view_(view),
- client_(client),
- background_layer_(cc::SolidColorLayer::Create()) {
+ : frame_sink_id_(frame_sink_id), view_(view), client_(client) {
DCHECK(view_);
DCHECK(client_);
@@ -69,10 +65,6 @@ DelegatedFrameHostAndroid::DelegatedFrameHostAndroid(
surface_manager_->RegisterFrameSinkId(frame_sink_id_);
surface_factory_ = base::WrapUnique(
new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this));
-
- background_layer_->SetBackgroundColor(background_color);
- view_->GetLayer()->AddChild(background_layer_);
- UpdateBackgroundLayer();
}
DelegatedFrameHostAndroid::~DelegatedFrameHostAndroid() {
@@ -80,7 +72,6 @@ DelegatedFrameHostAndroid::~DelegatedFrameHostAndroid() {
surface_factory_.reset();
DetachFromCompositor();
surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
- background_layer_->RemoveFromParent();
}
DelegatedFrameHostAndroid::FrameData::FrameData() = default;
@@ -132,7 +123,6 @@ void DelegatedFrameHostAndroid::SubmitCompositorFrame(
current_frame_->surface_size,
!current_frame_->has_transparent_background);
view_->GetLayer()->AddChild(content_layer_);
- UpdateBackgroundLayer();
} else {
surface_factory_->SubmitCompositorFrame(current_frame_->local_surface_id,
std::move(frame), draw_callback);
@@ -177,8 +167,6 @@ void DelegatedFrameHostAndroid::DestroyDelegatedContent() {
content_layer_ = nullptr;
surface_factory_->EvictSurface();
current_frame_.reset();
-
- UpdateBackgroundLayer();
}
bool DelegatedFrameHostAndroid::HasDelegatedContent() const {
@@ -190,20 +178,6 @@ void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() {
surface_factory_->Reset();
}
-void DelegatedFrameHostAndroid::UpdateBackgroundColor(SkColor color) {
- background_layer_->SetBackgroundColor(color);
-}
-
-void DelegatedFrameHostAndroid::UpdateContainerSizeinDIP(
- const gfx::Size& size_in_dip) {
- container_size_in_dip_ = size_in_dip;
- float device_scale_factor = display::Screen::GetScreen()
- ->GetDisplayNearestWindow(view_).device_scale_factor();
- background_layer_->SetBounds(
- gfx::ConvertSizeToPixel(device_scale_factor, container_size_in_dip_));
- UpdateBackgroundLayer();
-}
-
void DelegatedFrameHostAndroid::AttachToCompositor(
WindowAndroidCompositor* compositor) {
if (registered_parent_compositor_)
@@ -231,26 +205,4 @@ void DelegatedFrameHostAndroid::SetBeginFrameSource(
client_->SetBeginFrameSource(begin_frame_source);
}
-void DelegatedFrameHostAndroid::UpdateBackgroundLayer() {
- // The background layer draws in 2 cases:
- // 1) When we don't have any content from the renderer.
- // 2) When the bounds of the content received from the renderer does not match
- // the desired content bounds.
- bool background_is_drawable = false;
-
- if (current_frame_) {
- float device_scale_factor = display::Screen::GetScreen()
- ->GetDisplayNearestWindow(view_).device_scale_factor();
- gfx::Size content_size_in_dip = gfx::ConvertSizeToDIP(
- device_scale_factor, current_frame_->surface_size);
- background_is_drawable =
- content_size_in_dip.width() < container_size_in_dip_.width() ||
- content_size_in_dip.height() < container_size_in_dip_.height();
- } else {
- background_is_drawable = true;
- }
-
- background_layer_->SetIsDrawable(background_is_drawable);
-}
-
} // namespace ui
« no previous file with comments | « ui/android/delegated_frame_host_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698