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

Unified Diff: ash/wm/resize_shadow.cc

Issue 2820323003: Ash: Make window resize shadow extend beneath window it's attached to. (Closed)
Patch Set: Created 3 years, 8 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: ash/wm/resize_shadow.cc
diff --git a/ash/wm/resize_shadow.cc b/ash/wm/resize_shadow.cc
index 847ded20d50b79547df4ea0161a9a8c7ef7a2281..959fe6a6602bbea75b84c643eb5b78b4d733f74a 100644
--- a/ash/wm/resize_shadow.cc
+++ b/ash/wm/resize_shadow.cc
@@ -19,6 +19,11 @@ namespace {
// window.
constexpr int kVisualThickness = 8;
+// The corner radius of the resize shadow, which not coincidentally matches
+// the corner radius of the actual window.
varkha 2017/04/18 22:31:58 Should one just be equal to the other, even if you
Evan Stade 2017/04/19 13:23:10 Arguably. I actually think it's easier to read lik
+static constexpr int kCornerRadiusOfResizeShadow = 2;
+static constexpr int kCornerRadiusOfWindow = 2;
+
// This class simply draws a roundrect. The layout and tiling is handled by
// ResizeShadow and NinePatchLayer.
class ResizeShadowImageSource : public gfx::CanvasImageSource {
@@ -34,12 +39,16 @@ class ResizeShadowImageSource : public gfx::CanvasImageSource {
cc::PaintFlags paint;
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLACK);
- canvas->DrawRoundRect(gfx::RectF(gfx::SizeF(size())), kCornerRadius, paint);
+ canvas->DrawRoundRect(gfx::RectF(gfx::SizeF(size())),
+ kCornerRadiusOfResizeShadow, paint);
}
private:
- static constexpr int kCornerRadius = 2;
- static constexpr int kImageSide = 2 * kVisualThickness + 1;
+ // The image has to have enough space to depict the visual thickness (left and
+ // right) plus an inset for extending beneath the window's rounded corner plus
+ // one pixel for the center of the nine patch.
+ static constexpr int kImageSide =
+ 2 * (kVisualThickness + kCornerRadiusOfWindow) + 1;
DISALLOW_COPY_AND_ASSIGN(ResizeShadowImageSource);
};
@@ -69,7 +78,8 @@ ResizeShadow::ResizeShadow(aura::Window* window)
}
layer_->UpdateNinePatchLayerImage(*g_shadow_image.Get());
gfx::Rect aperture(g_shadow_image.Get()->size());
- constexpr gfx::Insets kApertureInsets(kVisualThickness);
+ constexpr gfx::Insets kApertureInsets(kVisualThickness +
+ kCornerRadiusOfWindow);
aperture.Inset(kApertureInsets);
layer_->UpdateNinePatchLayerAperture(aperture);
layer_->UpdateNinePatchLayerBorder(
« 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