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

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

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Make patch smaller temporarily. Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // All callers currently pass STYLE_BUTTON, and should only call this once, to 207 // All callers currently pass STYLE_BUTTON, and should only call this once, to
208 // change from the default style. 208 // change from the default style.
209 DCHECK_EQ(style, STYLE_BUTTON); 209 DCHECK_EQ(style, STYLE_BUTTON);
210 DCHECK_EQ(style_, STYLE_TEXTBUTTON); 210 DCHECK_EQ(style_, STYLE_TEXTBUTTON);
211 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; 211 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget.";
212 212
213 style_ = style; 213 style_ = style;
214 214
215 SetFocusPainter(nullptr); 215 SetFocusPainter(nullptr);
216 SetHorizontalAlignment(gfx::ALIGN_CENTER); 216 SetHorizontalAlignment(gfx::ALIGN_CENTER);
217 SetFocusable(true); 217 SetFocusBehavior(CONTROL);
218 SetMinSize(gfx::Size(70, 33)); 218 SetMinSize(gfx::Size(70, 33));
219 219
220 // Themed borders will be set once the button is added to a Widget, since that 220 // Themed borders will be set once the button is added to a Widget, since that
221 // provides the value of GetNativeTheme(). 221 // provides the value of GetNativeTheme().
222 } 222 }
223 223
224 void LabelButton::SetImageLabelSpacing(int spacing) { 224 void LabelButton::SetImageLabelSpacing(int spacing) {
225 if (spacing == image_label_spacing_) 225 if (spacing == image_label_spacing_)
226 return; 226 return;
227 image_label_spacing_ = spacing; 227 image_label_spacing_ = spacing;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 GetExtraParams(params); 567 GetExtraParams(params);
568 return ui::NativeTheme::kHovered; 568 return ui::NativeTheme::kHovered;
569 } 569 }
570 570
571 void LabelButton::ResetCachedPreferredSize() { 571 void LabelButton::ResetCachedPreferredSize() {
572 cached_preferred_size_valid_ = false; 572 cached_preferred_size_valid_ = false;
573 cached_preferred_size_ = gfx::Size(); 573 cached_preferred_size_ = gfx::Size();
574 } 574 }
575 575
576 } // namespace views 576 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698