Chromium Code Reviews| Index: ui/wm/core/shadow.cc |
| diff --git a/ui/wm/core/shadow.cc b/ui/wm/core/shadow.cc |
| index 83190954208d81601426d32d89684697b7b71fb6..5bdd69460a370259955cdf5280fdc0d5389b8a82 100644 |
| --- a/ui/wm/core/shadow.cc |
| +++ b/ui/wm/core/shadow.cc |
| @@ -153,15 +153,6 @@ void Shadow::OnImplicitAnimationsCompleted() { |
| void Shadow::UpdateImagesForStyle() { |
| const ShadowDetails& details = GetDetailsForElevation(ElevationForStyle()); |
| shadow_layer_->UpdateNinePatchLayerImage(details.ninebox_image); |
| - // The ninebox grid is defined in terms of the image size. The shadow blurs in |
| - // both inward and outward directions from the edge of the contents, so the |
| - // aperture goes further inside the image than the shadow margins (which |
| - // represent exterior blur). |
| - gfx::Rect aperture(details.ninebox_image.size()); |
| - gfx::Insets blur_region = gfx::ShadowValue::GetBlurRegion(details.values) + |
| - gfx::Insets(kRoundedCornerRadius); |
| - aperture.Inset(blur_region); |
| - shadow_layer_->UpdateNinePatchLayerAperture(aperture); |
| UpdateLayerBounds(); |
| } |
| @@ -193,6 +184,21 @@ void Shadow::UpdateLayerBounds() { |
| int border_y = border_h * blur_region.top() / blur_region.height(); |
| shadow_layer_->UpdateNinePatchLayerBorder( |
| gfx::Rect(border_x, border_y, border_w, border_h)); |
| + |
| + // The ninebox grid is defined in terms of the image size. The shadow blurs in |
| + // both inward and outward directions from the edge of the contents, so the |
| + // aperture goes further inside the image than the shadow margins (which |
| + // represent exterior blur). |
| + gfx::Rect aperture(details.ninebox_image.size()); |
| + // The insets for the aperture are nominally |blur_region| but we need to |
| + // resize them if the contents are too small. |
| + // TODO(estade): by cutting out parts of ninebox, we lose the smooth |
| + // horizontal or vertical transition. This isn't very noticeable, but we may |
| + // need to address it by using a separate shadow layer for each ShadowValue, |
| + // by adjusting the shadow for very small windows, or other means. |
|
James Cook
2016/12/09 19:40:13
Aside: I vaguely recall from long ago that we deci
Evan Stade
2016/12/09 21:09:18
I ran into this problem for the message center bub
|
| + aperture.Inset(gfx::Insets(border_y, border_x, border_h - border_y, |
| + border_w - border_x)); |
| + shadow_layer_->UpdateNinePatchLayerAperture(aperture); |
| } |
| int Shadow::ElevationForStyle() { |