| 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);
|
| -
|
| 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
|
| + // the text and its layout while the return value of GetBaseline() doesn't.
|
| + // GetAlignmentOffset() takes into account the difference between them.
|
| + virtual int GetBaselineOfTextLayout() = 0;
|
| +
|
| 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
|
| + // 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_;
|
|
|