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

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

Issue 10916222: Conservative update button/label/textfield content (Closed) Base URL: https://git.chromium.org/git/chromium/src@git-svn
Patch Set: Nit fixes.wq Created 8 years, 3 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 | « no previous file | ui/views/controls/label.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/text_button.h" 5 #include "ui/views/controls/button/text_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return; 284 return;
285 is_default_ = is_default; 285 is_default_ = is_default;
286 if (is_default_) 286 if (is_default_)
287 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 287 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
288 else 288 else
289 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 289 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
290 SchedulePaint(); 290 SchedulePaint();
291 } 291 }
292 292
293 void TextButtonBase::SetText(const string16& text) { 293 void TextButtonBase::SetText(const string16& text) {
294 if (text == text_)
295 return;
294 text_ = text; 296 text_ = text;
295 SetAccessibleName(text); 297 SetAccessibleName(text);
296 UpdateTextSize(); 298 UpdateTextSize();
297 } 299 }
298 300
299 void TextButtonBase::SetFont(const gfx::Font& font) { 301 void TextButtonBase::SetFont(const gfx::Font& font) {
300 font_ = font; 302 font_ = font;
301 UpdateTextSize(); 303 UpdateTextSize();
302 } 304 }
303 305
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 // Windows may paint a dotted focus rect in 865 // Windows may paint a dotted focus rect in
864 // NativeTextButton::OnPaintFocusBorder. To avoid getting two focus 866 // NativeTextButton::OnPaintFocusBorder. To avoid getting two focus
865 // indications (A dotted rect and a highlighted border) only set is_focused on 867 // indications (A dotted rect and a highlighted border) only set is_focused on
866 // non windows platforms. 868 // non windows platforms.
867 params->button.is_focused = HasFocus() && 869 params->button.is_focused = HasFocus() &&
868 (focusable() || IsAccessibilityFocusable()); 870 (focusable() || IsAccessibilityFocusable());
869 #endif 871 #endif
870 } 872 }
871 873
872 } // namespace views 874 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698