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

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: rebase Created 5 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
« no previous file with comments | « ui/gfx/render_text_mac.cc ('k') | ui/views/controls/label.h » ('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/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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 label_->SetFontList( 149 label_->SetFontList(
150 style_ == STYLE_BUTTON && is_default_ ? 150 style_ == STYLE_BUTTON && is_default_ ?
151 cached_bold_font_list_ : cached_normal_font_list_); 151 cached_bold_font_list_ : cached_normal_font_list_);
152 } 152 }
153 153
154 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) { 154 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) {
155 label_->SetElideBehavior(elide_behavior); 155 label_->SetElideBehavior(elide_behavior);
156 } 156 }
157 157
158 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const { 158 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const {
159 return label_->GetHorizontalAlignment(); 159 return label_->horizontal_alignment();
160 } 160 }
161 161
162 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { 162 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) {
163 label_->SetHorizontalAlignment(alignment); 163 label_->SetHorizontalAlignment(alignment);
164 InvalidateLayout(); 164 InvalidateLayout();
165 } 165 }
166 166
167 void LabelButton::SetMinSize(const gfx::Size& min_size) { 167 void LabelButton::SetMinSize(const gfx::Size& min_size) {
168 min_size_ = min_size; 168 min_size_ = min_size;
169 ResetCachedPreferredSize(); 169 ResetCachedPreferredSize();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 GetExtraParams(params); 516 GetExtraParams(params);
517 return ui::NativeTheme::kHovered; 517 return ui::NativeTheme::kHovered;
518 } 518 }
519 519
520 void LabelButton::ResetCachedPreferredSize() { 520 void LabelButton::ResetCachedPreferredSize() {
521 cached_preferred_size_valid_ = false; 521 cached_preferred_size_valid_ = false;
522 cached_preferred_size_ = gfx::Size(); 522 cached_preferred_size_ = gfx::Size();
523 } 523 }
524 524
525 } // namespace views 525 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.cc ('k') | ui/views/controls/label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698