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

Side by Side Diff: ui/views/controls/styled_label.cc

Issue 1407093007: Autofill: Add legal message footer to save credit card bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change interface for retrieving lines + give each line its own StyledLabel. Created 5 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/styled_label.h" 5 #include "ui/views/controls/styled_label.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 void StyledLabel::PreferredSizeChanged() { 211 void StyledLabel::PreferredSizeChanged() {
212 calculated_size_ = gfx::Size(); 212 calculated_size_ = gfx::Size();
213 width_at_last_size_calculation_ = 0; 213 width_at_last_size_calculation_ = 0;
214 width_at_last_layout_ = 0; 214 width_at_last_layout_ = 0;
215 View::PreferredSizeChanged(); 215 View::PreferredSizeChanged();
216 } 216 }
217 217
218 void StyledLabel::LinkClicked(Link* source, int event_flags) { 218 void StyledLabel::LinkClicked(Link* source, int event_flags) {
219 if (listener_) 219 if (listener_)
220 listener_->StyledLabelLinkClicked(link_targets_[source], event_flags); 220 listener_->StyledLabelLinkClicked(*this, link_targets_[source],
221 event_flags);
221 } 222 }
222 223
223 gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) { 224 gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) {
224 if (width == width_at_last_size_calculation_ && 225 if (width == width_at_last_size_calculation_ &&
225 (dry_run || width == width_at_last_layout_)) 226 (dry_run || width == width_at_last_layout_))
226 return calculated_size_; 227 return calculated_size_;
227 228
228 width_at_last_size_calculation_ = width; 229 width_at_last_size_calculation_ = width;
229 if (!dry_run) 230 if (!dry_run)
230 width_at_last_layout_ = width; 231 width_at_last_layout_ = width;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 DCHECK_LE(used_width, width); 373 DCHECK_LE(used_width, width);
373 // The user-specified line height only applies to interline spacing, so the 374 // The user-specified line height only applies to interline spacing, so the
374 // final line's height is unaffected. 375 // final line's height is unaffected.
375 int total_height = line * line_height + 376 int total_height = line * line_height +
376 CalculateLineHeight(font_list_) + GetInsets().height(); 377 CalculateLineHeight(font_list_) + GetInsets().height();
377 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height); 378 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height);
378 return calculated_size_; 379 return calculated_size_;
379 } 380 }
380 381
381 } // namespace views 382 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698