Commit b0bddce1 authored by oshima's avatar oshima Committed by Commit bot

Do not call LayerAnimator::SetOpacity if the new value is same as the target value.

I think this is safer to merge than https://codereview.chromium.org/2291923002/. I'll remove the check once the bug 64223 is fixed.

BUG=642222

Review-Url: https://codereview.chromium.org/2291933002
Cr-Commit-Position: refs/heads/master@{#415341}
parent 20c9a731
...@@ -1253,6 +1253,7 @@ void ShellSurface::UpdateShadow() { ...@@ -1253,6 +1253,7 @@ void ShellSurface::UpdateShadow() {
window->StackChildAtBottom(shadow_underlay_); window->StackChildAtBottom(shadow_underlay_);
} }
float shadow_underlay_opacity = rectangular_shadow_background_opacity_;
// Put the black background layer behind the window if // Put the black background layer behind the window if
// 1) the window is in immersive fullscreen. // 1) the window is in immersive fullscreen.
// 2) the window can control the bounds of the window in fullscreen ( // 2) the window can control the bounds of the window in fullscreen (
...@@ -1264,14 +1265,20 @@ void ShellSurface::UpdateShadow() { ...@@ -1264,14 +1265,20 @@ void ShellSurface::UpdateShadow() {
window->layer()->transform().IsIdentity()) { window->layer()->transform().IsIdentity()) {
gfx::Point origin; gfx::Point origin;
origin -= window->bounds().origin().OffsetFromOrigin(); origin -= window->bounds().origin().OffsetFromOrigin();
gfx::Rect background_bounds(origin, window->parent()->bounds().size()); shadow_bounds.set_origin(origin);
shadow_underlay_->SetBounds(background_bounds); shadow_bounds.set_size(window->parent()->bounds().size());
shadow_underlay_->layer()->SetOpacity(1.f); shadow_underlay_opacity = 1.0f;
} else {
shadow_underlay_->SetBounds(shadow_bounds);
shadow_underlay_->layer()->SetOpacity(
rectangular_shadow_background_opacity_);
} }
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(); shadow_underlay_->Show();
wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment