Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index ce0a027b7a1607a39fc7cca89e6226609875cc2a..aba04f42d60b4fdb2a355c5c85bd2ad23b8abe16 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -167,11 +167,6 @@ class GFX_EXPORT RenderText { |
| } |
| void SetHorizontalAlignment(HorizontalAlignment alignment); |
| - VerticalAlignment vertical_alignment() const { |
| - return vertical_alignment_; |
| - } |
| - void SetVerticalAlignment(VerticalAlignment alignment); |
|
msw
2013/10/23 01:18:00
Hmm, I wonder if this will be needed for multi-lin
Yuki
2013/10/24 14:32:54
Okay, let me remove them now.
I think, if RenderT
|
| - |
| const FontList& font_list() const { return font_list_; } |
| void SetFontList(const FontList& font_list); |
| void SetFont(const Font& font); |
| @@ -338,9 +333,11 @@ class GFX_EXPORT RenderText { |
| // mode). Reserves room for the cursor if |cursor_enabled_| is true. |
| int GetContentWidth(); |
| - // Returns the common baseline of the text. The returned value is the vertical |
| - // offset from the top of |display_rect| to the text baseline, in pixels. |
| - virtual int GetBaseline() = 0; |
| + // Returns the common baseline of the text. The return value is the vertical |
| + // offset from the top of |display_rect_| to the text baseline, in pixels. |
| + // The baseline is determined from the font list and display rect, and does |
| + // not depend on the text. |
| + int GetBaseline(); |
| void Draw(Canvas* canvas); |
| @@ -398,6 +395,11 @@ class GFX_EXPORT RenderText { |
| const std::vector<internal::Line>& lines() const { return lines_; } |
| void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } |
| + // Returns the baseline of the layouted text. The return value depends on |
|
msw
2013/10/23 01:18:00
nit: s/layouted/laid out/ (or just say "current te
Yuki
2013/10/24 14:32:54
Done.
|
| + // the text and its layout while the return value of GetBaseline() doesn't. |
|
msw
2013/10/23 01:18:00
Add to this comment to explain exactly when/why th
Yuki
2013/10/24 14:32:54
Done.
|
| + // GetAlignmentOffset() takes into account the difference between them. |
|
Alexei Svitkine (slow)
2013/10/22 17:25:30
Can you expand this comment to make the purpose mo
Yuki
2013/10/24 14:32:54
Done.
|
| + virtual int GetBaselineOfTextLayout() = 0; |
|
msw
2013/10/23 01:18:00
nit: I'd prefer GetLayoutTextBaseline (or GetBasel
Yuki
2013/10/24 14:32:54
Done.
|
| + |
| const Vector2d& GetUpdatedDisplayOffset(); |
| void set_cached_bounds_and_offset_valid(bool valid) { |
| @@ -542,10 +544,6 @@ class GFX_EXPORT RenderText { |
| // default is to align left if the application UI is LTR and right if RTL. |
| HorizontalAlignment horizontal_alignment_; |
| - // Vertical alignment of the text with respect to |display_rect_|. The |
| - // default is to align vertically centered. |
| - VerticalAlignment vertical_alignment_; |
| - |
| // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. |
| DirectionalityMode directionality_mode_; |
| @@ -631,6 +629,10 @@ class GFX_EXPORT RenderText { |
| // Get this point with GetUpdatedDisplayOffset (or risk using a stale value). |
| Vector2d display_offset_; |
| + // The baseline of the text. This is determined from height and cap height |
|
msw
2013/10/23 01:18:00
nit: "from the height"
Yuki
2013/10/24 14:32:54
Done.
|
| + // of the font list so the text is vertically centered. |
| + int baseline_; |
| + |
| // The cached bounds and offset are invalidated by changes to the cursor, |
| // selection, font, and other operations that adjust the visible text bounds. |
| bool cached_bounds_and_offset_valid_; |