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

Unified Diff: ui/wm/core/shadow.cc

Issue 2555373004: Apply new MD shadows to CrOS tray bubbles. (Closed)
Patch Set: fix test for mac Created 4 years 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/wm/core/shadow.h ('k') | ui/wm/core/shadow_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/shadow.cc
diff --git a/ui/wm/core/shadow.cc b/ui/wm/core/shadow.cc
index 6b1290d154a84ac5213474706f146cb4cbf98d91..05174d28be59caeff717ce7a93f8964792951710 100644
--- a/ui/wm/core/shadow.cc
+++ b/ui/wm/core/shadow.cc
@@ -132,15 +132,6 @@ void Shadow::RecreateShadowLayer() {
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();
}
@@ -194,6 +185,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.
+ aperture.Inset(gfx::Insets(border_y, border_x, border_h - border_y,
+ border_w - border_x));
+ shadow_layer_->UpdateNinePatchLayerAperture(aperture);
}
int Shadow::ElevationForStyle() {
« no previous file with comments | « ui/wm/core/shadow.h ('k') | ui/wm/core/shadow_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698