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

Unified Diff: components/exo/shell_surface.cc

Issue 2291933002: Do not call LayerAnimator::SetOpacity if the new value is same as the target value (Closed)
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index da62c7779a4c368ccc8d44496f9e886dbb619026..6248a27c13212c96588327d4db216d9844e79d12 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -1253,6 +1253,7 @@ void ShellSurface::UpdateShadow() {
window->StackChildAtBottom(shadow_underlay_);
}
+ float shadow_underlay_opacity = rectangular_shadow_background_opacity_;
// Put the black background layer behind the window if
// 1) the window is in immersive fullscreen.
// 2) the window can control the bounds of the window in fullscreen (
@@ -1264,14 +1265,20 @@ void ShellSurface::UpdateShadow() {
window->layer()->transform().IsIdentity()) {
gfx::Point origin;
origin -= window->bounds().origin().OffsetFromOrigin();
- gfx::Rect background_bounds(origin, window->parent()->bounds().size());
- shadow_underlay_->SetBounds(background_bounds);
- shadow_underlay_->layer()->SetOpacity(1.f);
- } else {
- shadow_underlay_->SetBounds(shadow_bounds);
- shadow_underlay_->layer()->SetOpacity(
- rectangular_shadow_background_opacity_);
+ shadow_bounds.set_origin(origin);
+ shadow_bounds.set_size(window->parent()->bounds().size());
+ shadow_underlay_opacity = 1.0f;
}
+
+ shadow_underlay_->SetBounds(shadow_bounds);
+
+ // TODO(oshima): Setting to the same value should be no-op.
+ // crbug.com/642223.
+ if (shadow_underlay_opacity !=
+ shadow_underlay_->layer()->GetTargetOpacity()) {
+ shadow_underlay_->layer()->SetOpacity(shadow_underlay_opacity);
+ }
+
shadow_underlay_->Show();
wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698