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

Unified Diff: ui/views/controls/button/label_button.cc

Issue 11818044: Replace IDR_WEB_UI_CLOSE* with IDR_CLOSE_DIALOG*, cleanup, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 11 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 | « chrome/browser/ui/views/web_intent_picker_views.cc ('k') | ui/views/window/dialog_frame_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index c3033c82f662a5a9b431e408c5f935f8816f1977..2d9ff0c6076ee501f24dc70529d65ea70249e59f 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -119,7 +119,9 @@ void LabelButton::SetDefaultButton(bool default_button) {
void LabelButton::SetNativeTheme(bool native_theme) {
native_theme_ = native_theme;
- static_cast<LabelButtonBorder*>(border())->set_native_theme(native_theme);
+ LabelButtonBorder* border = new LabelButtonBorder();
+ border->set_native_theme(native_theme);
+ set_border(border);
// Invalidate the layout to pickup the new insets from the border.
InvalidateLayout();
ResetColorsFromNativeTheme();
@@ -198,7 +200,8 @@ void LabelButton::Layout() {
// avoids wasted space within the label that would look like awkward padding.
gfx::Size label_size(child_area.size());
if (!image_size.IsEmpty() && !label_size.IsEmpty()) {
- label_size.set_width(child_area.width() - image_size.width() - kSpacing);
+ label_size.set_width(
+ std::max(child_area.width() - image_size.width() - kSpacing, 0));
if (GetHorizontalAlignment() == gfx::ALIGN_CENTER) {
// Ensure multi-line labels paired with images use their available width.
if (GetTextMultiLine())
« no previous file with comments | « chrome/browser/ui/views/web_intent_picker_views.cc ('k') | ui/views/window/dialog_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698