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

Side by Side Diff: ui/views/controls/button/md_text_button.cc

Issue 2101863002: Adjust sizes of material design shadows based on Sebastien's feedback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add bug link Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/views/animation/ink_drop_painted_layer_delegates.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/md_text_button.h" 5 #include "ui/views/controls/button/md_text_button.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight() 175 std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight()
176 const { 176 const {
177 if (!ShouldShowInkDropHighlight()) 177 if (!ShouldShowInkDropHighlight())
178 return nullptr; 178 return nullptr;
179 if (!is_cta_) 179 if (!is_cta_)
180 return LabelButton::CreateInkDropHighlight(); 180 return LabelButton::CreateInkDropHighlight();
181 181
182 // The call to action hover effect is a shadow. 182 // The call to action hover effect is a shadow.
183 const int kYOffset = 2; 183 const int kYOffset = 1;
184 const int kSkiaBlurRadius = 2; 184 const int kSkiaBlurRadius = 1;
185 std::vector<gfx::ShadowValue> shadows; 185 std::vector<gfx::ShadowValue> shadows;
186 // The notion of blur that gfx::ShadowValue uses is twice the skia value, 186 // The notion of blur that gfx::ShadowValue uses is twice the Skia/CSS value.
187 // which is a number of pixels outside of the shadowed area. 187 // Skia counts the number of pixels outside the mask area whereas
188 // gfx::ShadowValue counts together the number of pixels inside and outside
189 // the mask bounds.
188 shadows.push_back(gfx::ShadowValue(gfx::Vector2d(0, kYOffset), 190 shadows.push_back(gfx::ShadowValue(gfx::Vector2d(0, kYOffset),
189 2 * kSkiaBlurRadius, 191 2 * kSkiaBlurRadius,
190 SkColorSetA(SK_ColorBLACK, 0x3D))); 192 SkColorSetA(SK_ColorBLACK, 0x3D)));
191 return base::WrapUnique(new InkDropHighlight( 193 return base::WrapUnique(new InkDropHighlight(
192 GetLocalBounds().CenterPoint(), 194 GetLocalBounds().CenterPoint(),
193 base::WrapUnique(new BorderShadowLayerDelegate( 195 base::WrapUnique(new BorderShadowLayerDelegate(
194 shadows, GetLocalBounds(), kInkDropSmallCornerRadius)))); 196 shadows, GetLocalBounds(), kInkDropSmallCornerRadius))));
195 } 197 }
196 198
197 bool MdTextButton::ShouldShowInkDropForFocus() const { 199 bool MdTextButton::ShouldShowInkDropForFocus() const {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color)) 273 SkColor stroke_color = (is_cta_ || color_utils::IsDark(text_color))
272 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity) 274 ? SkColorSetA(SK_ColorBLACK, kStrokeOpacity)
273 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity); 275 : SkColorSetA(SK_ColorWHITE, 2 * kStrokeOpacity);
274 276
275 set_background(Background::CreateBackgroundPainter( 277 set_background(Background::CreateBackgroundPainter(
276 true, Painter::CreateRoundRectWith1PxBorderPainter( 278 true, Painter::CreateRoundRectWith1PxBorderPainter(
277 bg_color, stroke_color, kInkDropSmallCornerRadius))); 279 bg_color, stroke_color, kInkDropSmallCornerRadius)));
278 } 280 }
279 281
280 } // namespace views 282 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_painted_layer_delegates.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698