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

Unified Diff: ui/views/controls/styled_label.h

Issue 342833002: [Password Generation] Update Aura UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest coments Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/styled_label.h
diff --git a/ui/views/controls/styled_label.h b/ui/views/controls/styled_label.h
index 4c599a0d438c5de58e98cd5cde3927a8ccdb7e86..c926ed359ab717fcadf85511bda36945d671ace9 100644
--- a/ui/views/controls/styled_label.h
+++ b/ui/views/controls/styled_label.h
@@ -73,6 +73,13 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener {
// a range set by AddStyleRange.
void SetDefaultStyle(const RangeStyleInfo& style_info);
+ // Sets line height similar to CSS line-height. Line height of 0 will overlay
+ // new lines of text on top of each other. For line heights greater than
+ // the height of the current font, the text will be vertically centered
+ // in the space provided. Set |height| to a negative value to reset to the
+ // default height.
+ void SetLineHeight(int height);
+
// Sets the color of the background on which the label is drawn. This won't
// be explicitly drawn, but the label will force the text color to be
// readable over it.
@@ -116,12 +123,23 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener {
// The return value is the necessary size.
gfx::Size CalculateAndDoLayout(int width, bool dry_run);
+ // Returns the line height, either default or user specified.
+ int GetLineHeight();
+
+ // Returns the vetical offset for a given line. This is necessary to
+ // vertically center text when a user specifies a line height great than the
+ // default.
+ int GetOffsetForLine(int line);
+
// The text to display.
base::string16 text_;
// Fonts used to display text. Can be augmented by RangeStyleInfo.
gfx::FontList font_list_;
+ // Line height in pixels.
+ int line_height_;
+
// The default style to use for any part of the text that isn't within
// a range in |style_ranges_|.
RangeStyleInfo default_style_info_;

Powered by Google App Engine
This is Rietveld 408576698