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

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

Issue 867003002: Cache gfx::RenderText instances in views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: early exit for Set... methods Created 5 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 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 "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/animation/throb_animation.h" 9 #include "ui/gfx/animation/throb_animation.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 label_->SetFontList( 148 label_->SetFontList(
149 style_ == STYLE_BUTTON && is_default_ ? 149 style_ == STYLE_BUTTON && is_default_ ?
150 cached_bold_font_list_ : cached_normal_font_list_); 150 cached_bold_font_list_ : cached_normal_font_list_);
151 } 151 }
152 152
153 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) { 153 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) {
154 label_->SetElideBehavior(elide_behavior); 154 label_->SetElideBehavior(elide_behavior);
155 } 155 }
156 156
157 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const { 157 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const {
158 return label_->GetHorizontalAlignment(); 158 return label_->horizontal_alignment();
159 } 159 }
160 160
161 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { 161 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) {
162 label_->SetHorizontalAlignment(alignment); 162 label_->SetHorizontalAlignment(alignment);
163 InvalidateLayout(); 163 InvalidateLayout();
164 } 164 }
165 165
166 void LabelButton::SetMinSize(const gfx::Size& min_size) { 166 void LabelButton::SetMinSize(const gfx::Size& min_size) {
167 min_size_ = min_size; 167 min_size_ = min_size;
168 ResetCachedPreferredSize(); 168 ResetCachedPreferredSize();
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 GetExtraParams(params); 509 GetExtraParams(params);
510 return ui::NativeTheme::kHovered; 510 return ui::NativeTheme::kHovered;
511 } 511 }
512 512
513 void LabelButton::ResetCachedPreferredSize() { 513 void LabelButton::ResetCachedPreferredSize() {
514 cached_preferred_size_valid_ = false; 514 cached_preferred_size_valid_ = false;
515 cached_preferred_size_= gfx::Size(); 515 cached_preferred_size_= gfx::Size();
516 } 516 }
517 517
518 } // namespace views 518 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698