Chromium Code Reviews| Index: ui/wm/core/shadow_controller.cc |
| diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc |
| index 76a2ae2cc5ca6911b3a3973387250187f8e60974..123505c139cad5e0923a3f2cd0d56ba276a256c7 100644 |
| --- a/ui/wm/core/shadow_controller.cc |
| +++ b/ui/wm/core/shadow_controller.cc |
| @@ -46,20 +46,22 @@ ShadowType GetShadowTypeFromWindow(aura::Window* window) { |
| return SHADOW_TYPE_NONE; |
| } |
| -bool ShouldUseSmallShadowForWindow(aura::Window* window) { |
| +Shadow::Style GetShadowStyleForWindow(aura::Window* window) { |
| switch (window->type()) { |
| case ui::wm::WINDOW_TYPE_MENU: |
| case ui::wm::WINDOW_TYPE_TOOLTIP: |
| - return true; |
| + return Shadow::STYLE_SMALL; |
| + |
| + // System tray bubbles render like active windows. TODO(estade): this |
| + // mechanism will need to be revisited for applying WM shadows to other |
| + // types of bubbles which don't want to render such large shadows. |
| + case ui::wm::WINDOW_TYPE_POPUP: |
|
James Cook
2016/12/09 19:40:13
From the code this looks like it will apply large
Evan Stade
2016/12/09 21:09:18
I'll look into it. I had hoped that other popups w
Evan Stade
2016/12/09 21:20:32
Do you have an example of a drag widget? When I dr
|
| + return Shadow::STYLE_ACTIVE; |
| + |
| default: |
| - break; |
| + return IsActiveWindow(window) ? Shadow::STYLE_ACTIVE |
| + : Shadow::STYLE_INACTIVE; |
| } |
| - return false; |
| -} |
| - |
| -Shadow::Style GetShadowStyleForWindow(aura::Window* window) { |
| - return ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL : |
| - (IsActiveWindow(window) ? Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE); |
| } |
| // Returns the shadow style to be applied to |losing_active| when it is losing |
| @@ -194,12 +196,13 @@ void ShadowController::Impl::OnWindowActivated(ActivationReason reason, |
| aura::Window* lost_active) { |
| if (gained_active) { |
| Shadow* shadow = GetShadowForWindow(gained_active); |
| - if (shadow && !ShouldUseSmallShadowForWindow(gained_active)) |
| - shadow->SetStyle(Shadow::STYLE_ACTIVE); |
| + if (shadow) |
| + shadow->SetStyle(GetShadowStyleForWindow(gained_active)); |
| } |
| if (lost_active) { |
| Shadow* shadow = GetShadowForWindow(lost_active); |
| - if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { |
| + if (shadow && |
| + GetShadowStyleForWindow(lost_active) == Shadow::STYLE_INACTIVE) { |
|
James Cook
2016/12/09 19:40:13
Shouldn't you be checking if the window that lost
Evan Stade
2016/12/09 21:09:18
I don't think this change affects the behavior at
James Cook
2016/12/10 00:19:16
What if |lost_active| had shadow style Shadow::STY
|
| shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, |
| gained_active)); |
| } |