diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 03:09:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 03:09:41 +0000 |
commit | 79b6066efef3091118f88a1c2bed093cbc830f3c (patch) | |
tree | bb64dfeed80368fd138d21a1b01d43a5c0324fe1 /ui | |
parent | 5af50b097ff297286c7e1e8c6f4a89267bd378f1 (diff) | |
download | chromium_src-79b6066efef3091118f88a1c2bed093cbc830f3c.zip chromium_src-79b6066efef3091118f88a1c2bed093cbc830f3c.tar.gz chromium_src-79b6066efef3091118f88a1c2bed093cbc830f3c.tar.bz2 |
add terms of service view to autocomplete dialog
BUG=168704
Review URL: https://chromiumcodereview.appspot.com/12898004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/styled_label.cc | 12 | ||||
-rw-r--r-- | ui/views/controls/styled_label.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/ui/views/controls/styled_label.cc b/ui/views/controls/styled_label.cc index f875c7f..d0fda3d 100644 --- a/ui/views/controls/styled_label.cc +++ b/ui/views/controls/styled_label.cc @@ -37,13 +37,21 @@ StyledLabel::StyledLabel(const string16& text, StyledLabelListener* listener) StyledLabel::~StyledLabel() {} +void StyledLabel::SetText(const string16& text) { + text_ = text; + calculated_size_ = gfx::Size(); + link_ranges_ = std::priority_queue<LinkRange>(); + RemoveAllChildViews(true); + PreferredSizeChanged(); +} + void StyledLabel::AddLink(const ui::Range& range) { DCHECK(!range.is_reversed()); DCHECK(!range.is_empty()); DCHECK(ui::Range(0, text_.size()).Contains(range)); link_ranges_.push(LinkRange(range)); calculated_size_ = gfx::Size(); - InvalidateLayout(); + PreferredSizeChanged(); } gfx::Insets StyledLabel::GetInsets() const { @@ -75,7 +83,7 @@ int StyledLabel::CalculateAndDoLayout(int width, bool dry_run) { } width -= GetInsets().width(); - if (width <= 0) + if (width <= 0 || text_.empty()) return 0; const int line_height = CalculateLineHeight(); diff --git a/ui/views/controls/styled_label.h b/ui/views/controls/styled_label.h index 3b683d2..70a0515 100644 --- a/ui/views/controls/styled_label.h +++ b/ui/views/controls/styled_label.h @@ -28,6 +28,9 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener { StyledLabel(const string16& text, StyledLabelListener* listener); virtual ~StyledLabel(); + // Sets the text to be displayed, and clears any previous styling. + void SetText(const string16& text); + // Marks the given range within |text_| as a link. void AddLink(const ui::Range& range); |