1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_
14 #include "base/gtest_prod_util.h"
15 #include "base/i18n/rtl.h"
16 #include "base/strings/string16.h"
17 #include "skia/ext/refptr.h"
18 #include "third_party/skia/include/core/SkColor.h"
19 #include "third_party/skia/include/core/SkPaint.h"
20 #include "third_party/skia/include/core/SkRect.h"
21 #include "ui/gfx/break_list.h"
22 #include "ui/gfx/font_list.h"
23 #include "ui/gfx/point.h"
24 #include "ui/gfx/range/range.h"
25 #include "ui/gfx/rect.h"
26 #include "ui/gfx/selection_model.h"
27 #include "ui/gfx/shadow_value.h"
28 #include "ui/gfx/size_f.h"
29 #include "ui/gfx/text_constants.h"
30 #include "ui/gfx/vector2d.h"
46 // Internal helper class used by derived classes to draw text through Skia.
47 class SkiaTextRenderer {
49 explicit SkiaTextRenderer(Canvas* canvas);
52 void SetDrawLooper(SkDrawLooper* draw_looper);
53 void SetFontSmoothingSettings(bool enable_smoothing, bool enable_lcd_text);
54 void SetTypeface(SkTypeface* typeface);
55 void SetTextSize(SkScalar size);
56 void SetFontFamilyWithStyle(const std::string& family, int font_style);
57 void SetForegroundColor(SkColor foreground);
58 void SetShader(SkShader* shader, const Rect& bounds);
59 // Sets underline metrics to use if the text will be drawn with an underline.
60 // If not set, default values based on the size of the text will be used. The
61 // two metrics must be set together.
62 void SetUnderlineMetrics(SkScalar thickness, SkScalar position);
63 void DrawSelection(const std::vector<Rect>& selection, SkColor color);
64 void DrawPosText(const SkPoint* pos,
67 // Draw underline and strike-through text decorations.
68 // Based on |SkCanvas::DrawTextDecorations()| and constants from:
69 // third_party/skia/src/core/SkTextFormatParams.h
70 void DrawDecorations(int x, int y, int width, bool underline, bool strike,
71 bool diagonal_strike);
72 void DrawUnderline(int x, int y, int width);
73 void DrawStrike(int x, int y, int width) const;
74 void DrawDiagonalStrike(int x, int y, int width) const;
77 SkCanvas* canvas_skia_;
78 bool started_drawing_;
81 skia::RefPtr<SkShader> deferred_fade_shader_;
82 SkScalar underline_thickness_;
83 SkScalar underline_position_;
85 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer);
88 // Internal helper class used by derived classes to iterate colors and styles.
91 StyleIterator(const BreakList<SkColor>& colors,
92 const std::vector<BreakList<bool> >& styles);
95 // Get the colors and styles at the current iterator position.
96 SkColor color() const { return color_->second; }
97 bool style(TextStyle s) const { return style_[s]->second; }
99 // Get the intersecting range of the current iterator set.
100 Range GetRange() const;
102 // Update the iterator to point to colors and styles applicable at |position|.
103 void UpdatePosition(size_t position);
106 BreakList<SkColor> colors_;
107 std::vector<BreakList<bool> > styles_;
109 BreakList<SkColor>::const_iterator color_;
110 std::vector<BreakList<bool>::const_iterator> style_;
112 DISALLOW_COPY_AND_ASSIGN(StyleIterator);
115 // Line segments are slices of the layout text to be rendered on a single line.
120 // X coordinates of this line segment in text space.
123 // The character range this segment corresponds to.
126 // Index of the text run that generated this segment.
130 // A line of layout text, comprised of a line segment list and some metrics.
135 // Segments that make up this line in visual order.
136 std::vector<LineSegment> segments;
138 // A line size is the sum of segment widths and the maximum of segment
142 // Sum of preceding lines' heights.
143 int preceding_heights;
145 // Maximum baseline of all segments on this line.
149 } // namespace internal
151 // RenderText represents an abstract model of styled text and its corresponding
152 // visual layout. Support is built in for a cursor, a selection, simple styling,
153 // complex scripts, and bi-directional text. Implementations provide mechanisms
154 // for rendering and translation between logical and visual data.
155 class GFX_EXPORT RenderText {
157 virtual ~RenderText();
159 // Creates a platform-specific RenderText instance.
160 static RenderText* CreateInstance();
162 const base::string16& text() const { return text_; }
163 void SetText(const base::string16& text);
165 HorizontalAlignment horizontal_alignment() const {
166 return horizontal_alignment_;
168 void SetHorizontalAlignment(HorizontalAlignment alignment);
170 const FontList& font_list() const { return font_list_; }
171 void SetFontList(const FontList& font_list);
172 void SetFont(const Font& font);
174 // Set the font size to |size| in pixels.
175 void SetFontSize(int size);
177 // Get the first font in |font_list_|.
178 const Font& GetPrimaryFont() const;
180 bool cursor_enabled() const { return cursor_enabled_; }
181 void SetCursorEnabled(bool cursor_enabled);
183 bool cursor_visible() const { return cursor_visible_; }
184 void set_cursor_visible(bool visible) { cursor_visible_ = visible; }
186 bool insert_mode() const { return insert_mode_; }
187 void ToggleInsertMode();
189 SkColor cursor_color() const { return cursor_color_; }
190 void set_cursor_color(SkColor color) { cursor_color_ = color; }
192 SkColor selection_color() const { return selection_color_; }
193 void set_selection_color(SkColor color) { selection_color_ = color; }
195 SkColor selection_background_focused_color() const {
196 return selection_background_focused_color_;
198 void set_selection_background_focused_color(SkColor color) {
199 selection_background_focused_color_ = color;
202 bool focused() const { return focused_; }
203 void set_focused(bool focused) { focused_ = focused; }
205 bool clip_to_display_rect() const { return clip_to_display_rect_; }
206 void set_clip_to_display_rect(bool clip) { clip_to_display_rect_ = clip; }
208 // In an obscured (password) field, all text is drawn as asterisks or bullets.
209 bool obscured() const { return obscured_; }
210 void SetObscured(bool obscured);
212 // Makes a char in obscured text at |index| to be revealed. |index| should be
213 // a UTF16 text index. If there is a previous revealed index, the previous one
214 // is cleared and only the last set index will be revealed. If |index| is -1
215 // or out of range, no char will be revealed. The revealed index is also
216 // cleared when SetText or SetObscured is called.
217 void SetObscuredRevealIndex(int index);
219 // TODO(ckocagil): Multiline text rendering is currently only supported on
220 // Windows. Support other platforms.
221 bool multiline() const { return multiline_; }
222 void SetMultiline(bool multiline);
224 // Set the maximum length of the displayed layout text, not the actual text.
225 // A |length| of 0 forgoes a hard limit, but does not guarantee proper
226 // functionality of very long strings. Applies to subsequent SetText calls.
227 // WARNING: Only use this for system limits, it lacks complex text support.
228 void set_truncate_length(size_t length) { truncate_length_ = length; }
230 const Rect& display_rect() const { return display_rect_; }
231 void SetDisplayRect(const Rect& r);
233 void set_fade_head(bool fade_head) { fade_head_ = fade_head; }
234 bool fade_head() const { return fade_head_; }
235 void set_fade_tail(bool fade_tail) { fade_tail_ = fade_tail; }
236 bool fade_tail() const { return fade_tail_; }
238 bool background_is_transparent() const { return background_is_transparent_; }
239 void set_background_is_transparent(bool transparent) {
240 background_is_transparent_ = transparent;
243 const SelectionModel& selection_model() const { return selection_model_; }
245 const Range& selection() const { return selection_model_.selection(); }
247 size_t cursor_position() const { return selection_model_.caret_pos(); }
248 void SetCursorPosition(size_t position);
250 // Moves the cursor left or right. Cursor movement is visual, meaning that
251 // left and right are relative to screen, not the directionality of the text.
252 // If |select| is false, the selection start is moved to the same position.
253 void MoveCursor(BreakType break_type,
254 VisualCursorDirection direction,
257 // Set the selection_model_ to the value of |selection|.
258 // The selection range is clamped to text().length() if out of range.
259 // Returns true if the cursor position or selection range changed.
260 // If any index in |selection_model| is not a cursorable position (not on a
261 // grapheme boundary), it is a no-op and returns false.
262 bool MoveCursorTo(const SelectionModel& selection_model);
264 // Move the cursor to the position associated with the clicked point.
265 // If |select| is false, the selection start is moved to the same position.
266 // Returns true if the cursor position or selection range changed.
267 bool MoveCursorTo(const Point& point, bool select);
269 // Set the selection_model_ based on |range|.
270 // If the |range| start or end is greater than text length, it is modified
271 // to be the text length.
272 // If the |range| start or end is not a cursorable position (not on grapheme
273 // boundary), it is a NO-OP and returns false. Otherwise, returns true.
274 bool SelectRange(const Range& range);
276 // Returns true if the local point is over selected text.
277 bool IsPointInSelection(const Point& point);
279 // Selects no text, keeping the current cursor position and caret affinity.
280 void ClearSelection();
282 // Select the entire text range. If |reversed| is true, the range will end at
283 // the logical beginning of the text; this generally shows the leading portion
284 // of text that overflows its display area.
285 void SelectAll(bool reversed);
287 // Selects the word at the current cursor position. If there is a non-empty
288 // selection, the selection bounds are extended to their nearest word
292 const Range& GetCompositionRange() const;
293 void SetCompositionRange(const Range& composition_range);
295 // Set the text color over the entire text or a logical character range.
296 // The |range| should be valid, non-reversed, and within [0, text().length()].
297 void SetColor(SkColor value);
298 void ApplyColor(SkColor value, const Range& range);
300 // Set various text styles over the entire text or a logical character range.
301 // The respective |style| is applied if |value| is true, or removed if false.
302 // The |range| should be valid, non-reversed, and within [0, text().length()].
303 void SetStyle(TextStyle style, bool value);
304 void ApplyStyle(TextStyle style, bool value, const Range& range);
306 // Returns whether this style is enabled consistently across the entire
308 bool GetStyle(TextStyle style) const;
310 // Set the text directionality mode and get the text direction yielded.
311 void SetDirectionalityMode(DirectionalityMode mode);
312 base::i18n::TextDirection GetTextDirection();
314 // Returns the visual movement direction corresponding to the logical end
315 // of the text, considering only the dominant direction returned by
316 // |GetTextDirection()|, not the direction of a particular run.
317 VisualCursorDirection GetVisualDirectionOfLogicalEnd();
319 // Returns the size required to display the current string (which is the
320 // wrapped size in multiline mode). Note that this returns the raw size of the
321 // string, which does not include the cursor or the margin area of text
323 virtual Size GetStringSize() = 0;
325 // This is same as GetStringSize except that fractional size is returned.
326 // The default implementation is same as GetStringSize. Certain platforms that
327 // compute the text size as floating-point values, like Mac, will override
329 // See comment in Canvas::GetStringWidthF for its usage.
330 virtual SizeF GetStringSizeF();
332 // Returns the width of the content (which is the wrapped width in multiline
333 // mode). Reserves room for the cursor if |cursor_enabled_| is true.
334 int GetContentWidth();
336 // Returns the common baseline of the text. The return value is the vertical
337 // offset from the top of |display_rect_| to the text baseline, in pixels.
338 // The baseline is determined from the font list and display rect, and does
339 // not depend on the text.
342 void Draw(Canvas* canvas);
344 // Draws a cursor at |position|.
345 void DrawCursor(Canvas* canvas, const SelectionModel& position);
347 // Draw the selected text without a cursor or selection highlight. Subpixel
348 // antialiasing is disabled and foreground color is forced to black.
349 void DrawSelectedTextForDrag(Canvas* canvas);
351 // Gets the SelectionModel from a visual point in local coordinates.
352 virtual SelectionModel FindCursorPosition(const Point& point) = 0;
354 // Get the visual bounds of a cursor at |selection|. These bounds typically
355 // represent a vertical line, but if |insert_mode| is true they contain the
356 // bounds of the associated glyph. These bounds are in local coordinates, but
357 // may be outside the visible region if the text is longer than the textfield.
358 // Subsequent text, cursor, or bounds changes may invalidate returned values.
359 Rect GetCursorBounds(const SelectionModel& selection, bool insert_mode);
361 // Compute the current cursor bounds, panning the text to show the cursor in
362 // the display rect if necessary. These bounds are in local coordinates.
363 // Subsequent text, cursor, or bounds changes may invalidate returned values.
364 const Rect& GetUpdatedCursorBounds();
366 // Given an |index| in text(), return the next or previous grapheme boundary
367 // in logical order (that is, the nearest index for which
368 // |IsCursorablePosition(index)| returns true). The return value is in the
369 // range 0 to text().length() inclusive (the input is clamped if it is out of
370 // that range). Always moves by at least one character index unless the
371 // supplied index is already at the boundary of the string.
372 size_t IndexOfAdjacentGrapheme(size_t index,
373 LogicalCursorDirection direction);
375 // Return a SelectionModel with the cursor at the current selection's start.
376 // The returned value represents a cursor/caret position without a selection.
377 SelectionModel GetSelectionModelForSelectionStart();
379 // Sets shadows to drawn with text.
380 void SetTextShadows(const ShadowValues& shadows);
382 typedef std::pair<Font, Range> FontSpan;
383 // For testing purposes, returns which fonts were chosen for which parts of
384 // the text by returning a vector of Font and Range pairs, where each range
385 // specifies the character range for which the corresponding font has been
387 virtual std::vector<FontSpan> GetFontSpansForTesting() = 0;
392 const BreakList<SkColor>& colors() const { return colors_; }
393 const std::vector<BreakList<bool> >& styles() const { return styles_; }
395 const std::vector<internal::Line>& lines() const { return lines_; }
396 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); }
398 // Returns the baseline of the current text. The return value depends on
399 // the text and its layout while the return value of GetBaseline() doesn't.
400 // GetAlignmentOffset() takes into account the difference between them.
402 // We'd like a RenderText to show the text always on the same baseline
403 // regardless of the text, so the text does not jump up or down depending
404 // on the text. However, underlying layout engines return different baselines
405 // depending on the text. In general, layout engines determine the minimum
406 // bounding box for the text and return the baseline from the top of the
407 // bounding box. So the baseline changes depending on font metrics used to
410 // For example, suppose there are FontA and FontB and the baseline of FontA
411 // is smaller than the one of FontB. If the text is laid out only with FontA,
412 // then the baseline of FontA may be returned. If the text includes some
413 // characters which are laid out with FontB, then the baseline of FontB may
416 // GetBaseline() returns the fixed baseline regardless of the text.
417 // GetLayoutTextBaseline() returns the baseline determined by the underlying
418 // layout engine, and it changes depending on the text. GetAlignmentOffset()
419 // returns the difference between them.
420 virtual int GetLayoutTextBaseline() = 0;
422 const Vector2d& GetUpdatedDisplayOffset();
424 void set_cached_bounds_and_offset_valid(bool valid) {
425 cached_bounds_and_offset_valid_ = valid;
428 // Get the selection model that visually neighbors |position| by |break_type|.
429 // The returned value represents a cursor/caret position without a selection.
430 SelectionModel GetAdjacentSelectionModel(const SelectionModel& current,
431 BreakType break_type,
432 VisualCursorDirection direction);
434 // Get the selection model visually left/right of |selection| by one grapheme.
435 // The returned value represents a cursor/caret position without a selection.
436 virtual SelectionModel AdjacentCharSelectionModel(
437 const SelectionModel& selection,
438 VisualCursorDirection direction) = 0;
440 // Get the selection model visually left/right of |selection| by one word.
441 // The returned value represents a cursor/caret position without a selection.
442 virtual SelectionModel AdjacentWordSelectionModel(
443 const SelectionModel& selection,
444 VisualCursorDirection direction) = 0;
446 // Get the SelectionModels corresponding to visual text ends.
447 // The returned value represents a cursor/caret position without a selection.
448 SelectionModel EdgeSelectionModel(VisualCursorDirection direction);
450 // Sets the selection model, the argument is assumed to be valid.
451 virtual void SetSelectionModel(const SelectionModel& model);
453 // Get the horizontal bounds (relative to the left of the text, not the view)
454 // of the glyph starting at |index|. If the glyph is RTL then the returned
455 // Range will have is_reversed() true. (This does not return a Rect because a
456 // Rect can't have a negative width.)
457 virtual Range GetGlyphBounds(size_t index) = 0;
459 // Get the visual bounds containing the logical substring within the |range|.
460 // If |range| is empty, the result is empty. These bounds could be visually
461 // discontinuous if the substring is split by a LTR/RTL level change.
462 // These bounds are in local coordinates, but may be outside the visible
463 // region if the text is longer than the textfield. Subsequent text, cursor,
464 // or bounds changes may invalidate returned values.
465 virtual std::vector<Rect> GetSubstringBounds(const Range& range) = 0;
467 // Convert between indices into |text_| and indices into |obscured_text_|,
468 // which differ when the text is obscured. Regardless of whether or not the
469 // text is obscured, the character (code point) offsets always match.
470 virtual size_t TextIndexToLayoutIndex(size_t index) const = 0;
471 virtual size_t LayoutIndexToTextIndex(size_t index) const = 0;
473 // Return true if cursor can appear in front of the character at |position|,
474 // which means it is a grapheme boundary or the first character in the text.
475 virtual bool IsCursorablePosition(size_t position) = 0;
477 // Reset the layout to be invalid.
478 virtual void ResetLayout() = 0;
480 // Ensure the text is laid out, lines are computed, and |lines_| is valid.
481 virtual void EnsureLayout() = 0;
484 virtual void DrawVisualText(Canvas* canvas) = 0;
486 // Returns the text used for layout, which may be obscured or truncated.
487 const base::string16& GetLayoutText() const;
489 // Returns layout text positions that are suitable for breaking lines.
490 const BreakList<size_t>& GetLineBreaks();
492 // Apply (and undo) temporary composition underlines and selection colors.
493 void ApplyCompositionAndSelectionStyles();
494 void UndoCompositionAndSelectionStyles();
496 // Returns the line offset from the origin after applying the text alignment
497 // and the display offset.
498 Vector2d GetLineOffset(size_t line_number);
500 // Convert points from the text space to the view space and back. Handles the
501 // display area, display offset, application LTR/RTL mode and multiline.
502 Point ToTextPoint(const Point& point);
503 Point ToViewPoint(const Point& point);
505 // Convert a text space x-coordinate range to corresponding rects in view
507 std::vector<Rect> TextBoundsToViewBounds(const Range& x);
509 // Returns the line offset from the origin, accounting for text alignment
511 Vector2d GetAlignmentOffset(size_t line_number);
513 // Applies fade effects to |renderer|.
514 void ApplyFadeEffects(internal::SkiaTextRenderer* renderer);
516 // Applies text shadows to |renderer|.
517 void ApplyTextShadows(internal::SkiaTextRenderer* renderer);
519 // A convenience function to check whether the glyph attached to the caret
520 // is within the given range.
521 static bool RangeContainsCaret(const Range& range,
523 LogicalCursorDirection caret_affinity);
526 friend class RenderTextTest;
527 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle);
528 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SetColorAndStyle);
529 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ApplyColorAndStyle);
530 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ObscuredText);
531 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, RevealObscuredText);
532 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedText);
533 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText);
534 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
535 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, EdgeSelectionModels);
536 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffset);
537 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffsetHorizontalDefaultInRTL);
538 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth);
539 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth);
540 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_SufficientWidth);
542 // Set the cursor to |position|, with the caret trailing the previous
543 // grapheme, or if there is no previous grapheme, leading the cursor position.
544 // If |select| is false, the selection start is moved to the same position.
545 // If the |position| is not a cursorable position (not on grapheme boundary),
547 void MoveCursorTo(size_t position, bool select);
549 // Updates |layout_text_| if the text is obscured or truncated.
550 void UpdateLayoutText();
552 // Update the cached bounds and display offset to ensure that the current
553 // cursor is within the visible display area.
554 void UpdateCachedBoundsAndOffset();
556 // Draw the selection.
557 void DrawSelection(Canvas* canvas);
559 // Logical UTF-16 string data to be drawn.
560 base::string16 text_;
562 // Horizontal alignment of the text with respect to |display_rect_|. The
563 // default is to align left if the application UI is LTR and right if RTL.
564 HorizontalAlignment horizontal_alignment_;
566 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT.
567 DirectionalityMode directionality_mode_;
569 // The cached text direction, potentially computed from the text or UI locale.
570 // Use GetTextDirection(), do not use this potentially invalid value directly!
571 base::i18n::TextDirection text_direction_;
573 // A list of fonts used to render |text_|.
576 // Logical selection range and visual cursor position.
577 SelectionModel selection_model_;
579 // The cached cursor bounds; get these bounds with GetUpdatedCursorBounds.
582 // Specifies whether the cursor is enabled. If disabled, no space is reserved
583 // for the cursor when positioning text.
584 bool cursor_enabled_;
586 // The cursor visibility and insert mode.
587 bool cursor_visible_;
590 // The color used for the cursor.
591 SkColor cursor_color_;
593 // The color used for drawing selected text.
594 SkColor selection_color_;
596 // The background color used for drawing the selection when focused.
597 SkColor selection_background_focused_color_;
599 // The focus state of the text.
602 // Composition text range.
603 Range composition_range_;
605 // Color and style breaks, used to color and stylize ranges of text.
606 // BreakList positions are stored with text indices, not layout indices.
607 // TODO(msw): Expand to support cursor, selection, background, etc. colors.
608 BreakList<SkColor> colors_;
609 std::vector<BreakList<bool> > styles_;
611 // Breaks saved without temporary composition and selection styling.
612 BreakList<SkColor> saved_colors_;
613 BreakList<bool> saved_underlines_;
614 bool composition_and_selection_styles_applied_;
616 // A flag to obscure actual text with asterisks for password fields.
618 // The index at which the char should be revealed in the obscured text.
619 int obscured_reveal_index_;
621 // The maximum length of text to display, 0 forgoes a hard limit.
622 size_t truncate_length_;
624 // The obscured and/or truncated text that will be displayed.
625 base::string16 layout_text_;
627 // Whether the text should be broken into multiple lines. Uses the width of
628 // |display_rect_| as the width cap.
631 // Fade text head and/or tail, if text doesn't fit into |display_rect_|.
635 // Is the background transparent (either partially or fully)?
636 bool background_is_transparent_;
638 // The local display area for rendering the text.
641 // Flag to work around a Skia bug with the PDF path (http://crbug.com/133548)
642 // that results in incorrect clipping when drawing to the document margins.
643 // This field allows disabling clipping to work around the issue.
644 // TODO(asvitkine): Remove this when the underlying Skia bug is fixed.
645 bool clip_to_display_rect_;
647 // The offset for the text to be drawn, relative to the display area.
648 // Get this point with GetUpdatedDisplayOffset (or risk using a stale value).
649 Vector2d display_offset_;
651 // The baseline of the text. This is determined from the height of the
652 // display area and the cap height of the font list so the text is vertically
656 // The cached bounds and offset are invalidated by changes to the cursor,
657 // selection, font, and other operations that adjust the visible text bounds.
658 bool cached_bounds_and_offset_valid_;
660 // Text shadows to be drawn.
661 ShadowValues text_shadows_;
663 // A list of valid layout text line break positions.
664 BreakList<size_t> line_breaks_;
666 // Lines computed by EnsureLayout. These should be invalidated with
667 // ResetLayout and on |display_rect_| changes.
668 std::vector<internal::Line> lines_;
670 DISALLOW_COPY_AND_ASSIGN(RenderText);
675 #endif // UI_GFX_RENDER_TEXT_H_