OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_RENDER_TEXT_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 private: | 129 private: |
130 BreakList<SkColor> colors_; | 130 BreakList<SkColor> colors_; |
131 std::vector<BreakList<bool> > styles_; | 131 std::vector<BreakList<bool> > styles_; |
132 | 132 |
133 BreakList<SkColor>::const_iterator color_; | 133 BreakList<SkColor>::const_iterator color_; |
134 std::vector<BreakList<bool>::const_iterator> style_; | 134 std::vector<BreakList<bool>::const_iterator> style_; |
135 | 135 |
136 DISALLOW_COPY_AND_ASSIGN(StyleIterator); | 136 DISALLOW_COPY_AND_ASSIGN(StyleIterator); |
137 }; | 137 }; |
138 | 138 |
139 // Line segments are slices of the layout text to be rendered on a single line. | 139 // Line segments are slices of the layout text to be rendered on a single line. |
msw
2015/02/13 05:53:34
nit: s/layout/display/
oshima
2015/02/13 21:03:09
Done.
| |
140 struct LineSegment { | 140 struct LineSegment { |
141 LineSegment(); | 141 LineSegment(); |
142 ~LineSegment(); | 142 ~LineSegment(); |
143 | 143 |
144 // X coordinates of this line segment in text space. | 144 // X coordinates of this line segment in text space. |
145 Range x_range; | 145 Range x_range; |
146 | 146 |
147 // The character range this segment corresponds to. | 147 // The character range this segment corresponds to. |
148 Range char_range; | 148 Range char_range; |
149 | 149 |
150 // The width of this line segment in text space. This could be slightly | 150 // The width of this line segment in text space. This could be slightly |
151 // different from x_range.length(). | 151 // different from x_range.length(). |
152 // TODO(mukai): Fix Range to support float values and merge it into x_range. | 152 // TODO(mukai): Fix Range to support float values and merge it into x_range. |
153 float width; | 153 float width; |
154 | 154 |
155 // Index of the text run that generated this segment. | 155 // Index of the text run that generated this segment. |
156 size_t run; | 156 size_t run; |
157 }; | 157 }; |
158 | 158 |
159 // A line of layout text, comprised of a line segment list and some metrics. | 159 // A line of layout text, comprised of a line segment list and some metrics. |
msw
2015/02/13 05:53:34
nit: s/layout/display/
oshima
2015/02/13 21:03:09
Done.
| |
160 struct Line { | 160 struct Line { |
161 Line(); | 161 Line(); |
162 ~Line(); | 162 ~Line(); |
163 | 163 |
164 // Segments that make up this line in visual order. | 164 // Segments that make up this line in visual order. |
165 std::vector<LineSegment> segments; | 165 std::vector<LineSegment> segments; |
166 | 166 |
167 // The sum of segment widths and the maximum of segment heights. | 167 // The sum of segment widths and the maximum of segment heights. |
168 SizeF size; | 168 SizeF size; |
169 | 169 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 // TODO(ckocagil): Add vertical alignment and line spacing support instead. | 262 // TODO(ckocagil): Add vertical alignment and line spacing support instead. |
263 int min_line_height() const { return min_line_height_; } | 263 int min_line_height() const { return min_line_height_; } |
264 void SetMinLineHeight(int line_height); | 264 void SetMinLineHeight(int line_height); |
265 | 265 |
266 // Set the maximum length of the displayed layout text, not the actual text. | 266 // Set the maximum length of the displayed layout text, not the actual text. |
267 // A |length| of 0 forgoes a hard limit, but does not guarantee proper | 267 // A |length| of 0 forgoes a hard limit, but does not guarantee proper |
268 // functionality of very long strings. Applies to subsequent SetText calls. | 268 // functionality of very long strings. Applies to subsequent SetText calls. |
269 // WARNING: Only use this for system limits, it lacks complex text support. | 269 // WARNING: Only use this for system limits, it lacks complex text support. |
270 void set_truncate_length(size_t length) { truncate_length_ = length; } | 270 void set_truncate_length(size_t length) { truncate_length_ = length; } |
271 | 271 |
272 // The layout text will be elided to fit |display_rect| using this behavior. | 272 // The layout text will be elided to fit |display_rect| using this behavior. |
msw
2015/02/13 05:53:35
nit: s/layout/display/
oshima
2015/02/13 21:03:09
This should layout text because the display text i
msw
2015/02/13 21:49:23
That's fair, the comment is ambiguous about where
| |
273 // The layout text may be shortened further by the truncate length. | 273 // The layout text may be shortened further by the truncate length. |
oshima
2015/02/13 21:03:09
I remove this line because it's not correct.
msw
2015/02/13 21:49:22
It could say something like "Note that eliding is
| |
274 void SetElideBehavior(ElideBehavior elide_behavior); | 274 void SetElideBehavior(ElideBehavior elide_behavior); |
275 ElideBehavior elide_behavior() const { return elide_behavior_; } | 275 ElideBehavior elide_behavior() const { return elide_behavior_; } |
276 | 276 |
277 const base::string16& layout_text() const { return layout_text_; } | |
278 | |
279 const Rect& display_rect() const { return display_rect_; } | 277 const Rect& display_rect() const { return display_rect_; } |
280 void SetDisplayRect(const Rect& r); | 278 void SetDisplayRect(const Rect& r); |
281 | 279 |
282 bool background_is_transparent() const { return background_is_transparent_; } | 280 bool background_is_transparent() const { return background_is_transparent_; } |
283 void set_background_is_transparent(bool transparent) { | 281 void set_background_is_transparent(bool transparent) { |
284 background_is_transparent_ = transparent; | 282 background_is_transparent_ = transparent; |
285 } | 283 } |
286 | 284 |
287 const SelectionModel& selection_model() const { return selection_model_; } | 285 const SelectionModel& selection_model() const { return selection_model_; } |
288 | 286 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 DirectionalityMode directionality_mode() const { | 349 DirectionalityMode directionality_mode() const { |
352 return directionality_mode_; | 350 return directionality_mode_; |
353 } | 351 } |
354 base::i18n::TextDirection GetTextDirection(); | 352 base::i18n::TextDirection GetTextDirection(); |
355 | 353 |
356 // Returns the visual movement direction corresponding to the logical end | 354 // Returns the visual movement direction corresponding to the logical end |
357 // of the text, considering only the dominant direction returned by | 355 // of the text, considering only the dominant direction returned by |
358 // |GetTextDirection()|, not the direction of a particular run. | 356 // |GetTextDirection()|, not the direction of a particular run. |
359 VisualCursorDirection GetVisualDirectionOfLogicalEnd(); | 357 VisualCursorDirection GetVisualDirectionOfLogicalEnd(); |
360 | 358 |
359 // Returns the text used for layout, which may be obscured, | |
msw
2015/02/13 05:53:35
nit: s/layout/display
oshima
2015/02/13 21:03:10
Done.
| |
360 // truncated or elided. The subclass may compute elided text on the fly, | |
361 // or use precomputed the elided text. | |
362 virtual const base::string16& GetLayoutText() = 0; | |
msw
2015/02/13 05:53:35
I think this should be renamed GetDisplayText().
oshima
2015/02/13 21:03:09
Done.
| |
363 | |
361 // Returns the size required to display the current string (which is the | 364 // Returns the size required to display the current string (which is the |
362 // wrapped size in multiline mode). The returned size does not include space | 365 // wrapped size in multiline mode). The returned size does not include space |
363 // reserved for the cursor or the offset text shadows. | 366 // reserved for the cursor or the offset text shadows. |
364 virtual Size GetStringSize() = 0; | 367 virtual Size GetStringSize() = 0; |
365 | 368 |
366 // This is same as GetStringSize except that fractional size is returned. | 369 // This is same as GetStringSize except that fractional size is returned. |
367 // The default implementation is same as GetStringSize. Certain platforms that | 370 // The default implementation is same as GetStringSize. Certain platforms that |
368 // compute the text size as floating-point values, like Mac, will override | 371 // compute the text size as floating-point values, like Mac, will override |
369 // this method. | 372 // this method. |
370 // See comment in Canvas::GetStringWidthF for its usage. | 373 // See comment in Canvas::GetStringWidthF for its usage. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 // Range will have is_reversed() true. (This does not return a Rect because a | 444 // Range will have is_reversed() true. (This does not return a Rect because a |
442 // Rect can't have a negative width.) | 445 // Rect can't have a negative width.) |
443 virtual Range GetGlyphBounds(size_t index) = 0; | 446 virtual Range GetGlyphBounds(size_t index) = 0; |
444 | 447 |
445 const Vector2d& GetUpdatedDisplayOffset(); | 448 const Vector2d& GetUpdatedDisplayOffset(); |
446 void SetDisplayOffset(int horizontal_offset); | 449 void SetDisplayOffset(int horizontal_offset); |
447 | 450 |
448 protected: | 451 protected: |
449 RenderText(); | 452 RenderText(); |
450 | 453 |
454 const base::string16& layout_text() const { return layout_text_; } | |
455 const base::string16& display_text() const { return display_text_; } | |
456 bool text_elided() const { return text_elided_; } | |
457 | |
451 const BreakList<SkColor>& colors() const { return colors_; } | 458 const BreakList<SkColor>& colors() const { return colors_; } |
452 const std::vector<BreakList<bool> >& styles() const { return styles_; } | 459 const std::vector<BreakList<bool> >& styles() const { return styles_; } |
453 | 460 |
454 const std::vector<internal::Line>& lines() const { return lines_; } | 461 const std::vector<internal::Line>& lines() const { return lines_; } |
455 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } | 462 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } |
456 | 463 |
457 // Returns the baseline of the current text. The return value depends on | 464 // Returns the baseline of the current text. The return value depends on |
458 // the text and its layout while the return value of GetBaseline() doesn't. | 465 // the text and its layout while the return value of GetBaseline() doesn't. |
459 // GetAlignmentOffset() takes into account the difference between them. | 466 // GetAlignmentOffset() takes into account the difference between them. |
460 // | 467 // |
461 // We'd like a RenderText to show the text always on the same baseline | 468 // We'd like a RenderText to show the text always on the same baseline |
462 // regardless of the text, so the text does not jump up or down depending | 469 // regardless of the text, so the text does not jump up or down depending |
463 // on the text. However, underlying layout engines return different baselines | 470 // on the text. However, underlying layout engines return different baselines |
464 // depending on the text. In general, layout engines determine the minimum | 471 // depending on the text. In general, layout engines determine the minimum |
465 // bounding box for the text and return the baseline from the top of the | 472 // bounding box for the text and return the baseline from the top of the |
466 // bounding box. So the baseline changes depending on font metrics used to | 473 // bounding box. So the baseline changes depending on font metrics used to |
467 // layout the text. | 474 // layout the text. |
468 // | 475 // |
469 // For example, suppose there are FontA and FontB and the baseline of FontA | 476 // For example, suppose there are FontA and FontB and the baseline of FontA |
470 // is smaller than the one of FontB. If the text is laid out only with FontA, | 477 // is smaller than the one of FontB. If the text is laid out only with FontA, |
471 // then the baseline of FontA may be returned. If the text includes some | 478 // then the baseline of FontA may be returned. If the text includes some |
472 // characters which are laid out with FontB, then the baseline of FontB may | 479 // characters which are laid out with FontB, then the baseline of FontB may |
473 // be returned. | 480 // be returned. |
474 // | 481 // |
475 // GetBaseline() returns the fixed baseline regardless of the text. | 482 // GetBaseline() returns the fixed baseline regardless of the text. |
476 // GetLayoutTextBaseline() returns the baseline determined by the underlying | 483 // GetLayoutTextBaseline() returns the baseline determined by the underlying |
477 // layout engine, and it changes depending on the text. GetAlignmentOffset() | 484 // layout engine, and it changes depending on the text. GetAlignmentOffset() |
478 // returns the difference between them. | 485 // returns the difference between them. |
479 virtual int GetLayoutTextBaseline() = 0; | 486 virtual int GetLayoutTextBaseline() = 0; |
msw
2015/02/13 05:53:34
nit: Rename this as GetDisplayTextBaseLine or mayb
oshima
2015/02/13 21:03:09
Chagned to GetDisplayTextBaseLine.
| |
480 | 487 |
481 void set_cached_bounds_and_offset_valid(bool valid) { | 488 void set_cached_bounds_and_offset_valid(bool valid) { |
482 cached_bounds_and_offset_valid_ = valid; | 489 cached_bounds_and_offset_valid_ = valid; |
483 } | 490 } |
484 | 491 |
485 // Get the selection model that visually neighbors |position| by |break_type|. | 492 // Get the selection model that visually neighbors |position| by |break_type|. |
486 // The returned value represents a cursor/caret position without a selection. | 493 // The returned value represents a cursor/caret position without a selection. |
487 SelectionModel GetAdjacentSelectionModel(const SelectionModel& current, | 494 SelectionModel GetAdjacentSelectionModel(const SelectionModel& current, |
488 BreakType break_type, | 495 BreakType break_type, |
489 VisualCursorDirection direction); | 496 VisualCursorDirection direction); |
(...skipping 18 matching lines...) Expand all Loading... | |
508 virtual void SetSelectionModel(const SelectionModel& model); | 515 virtual void SetSelectionModel(const SelectionModel& model); |
509 | 516 |
510 // Get the visual bounds containing the logical substring within the |range|. | 517 // Get the visual bounds containing the logical substring within the |range|. |
511 // If |range| is empty, the result is empty. These bounds could be visually | 518 // If |range| is empty, the result is empty. These bounds could be visually |
512 // discontinuous if the substring is split by a LTR/RTL level change. | 519 // discontinuous if the substring is split by a LTR/RTL level change. |
513 // These bounds are in local coordinates, but may be outside the visible | 520 // These bounds are in local coordinates, but may be outside the visible |
514 // region if the text is longer than the textfield. Subsequent text, cursor, | 521 // region if the text is longer than the textfield. Subsequent text, cursor, |
515 // or bounds changes may invalidate returned values. | 522 // or bounds changes may invalidate returned values. |
516 virtual std::vector<Rect> GetSubstringBounds(const Range& range) = 0; | 523 virtual std::vector<Rect> GetSubstringBounds(const Range& range) = 0; |
517 | 524 |
518 // Convert between indices into |text_| and indices into |obscured_text_|, | 525 // Convert between indices into |text_| and indices into |
519 // which differ when the text is obscured. Regardless of whether or not the | 526 // GetLayoutText(), which differ when the text is obscured, |
msw
2015/02/13 05:53:34
nit: GetDisplayText()
oshima
2015/02/13 21:03:09
Done.
| |
520 // text is obscured, the character (code point) offsets always match. | 527 // truncated or elided. Regardless of whether or not the text is |
521 virtual size_t TextIndexToLayoutIndex(size_t index) const = 0; | 528 // obscured, the character (code point) offsets always match. |
522 virtual size_t LayoutIndexToTextIndex(size_t index) const = 0; | 529 virtual size_t TextIndexToLayoutIndex(size_t index) = 0; |
msw
2015/02/13 05:53:35
nit: Rename these TextIndexToDisplayIndex and Disp
oshima
2015/02/13 21:03:09
Done.
| |
530 virtual size_t LayoutIndexToTextIndex(size_t index) = 0; | |
523 | 531 |
524 // Reset the layout to be invalid. | 532 // Notifies that layout text, or attributes that affect the layout text |
525 virtual void ResetLayout() = 0; | 533 // shape have changed. |text_changed| is true if the content of the |
534 // |layout_text_| has changed, not just attributes. | |
535 virtual void OnLayoutTextAttributeChanged(bool text_changed) = 0; | |
536 | |
537 // Notifies that attributes that affect the display text shape have changed. | |
538 virtual void OnDisplayTextAttributeChanged() = 0; | |
526 | 539 |
527 // Ensure the text is laid out, lines are computed, and |lines_| is valid. | 540 // Ensure the text is laid out, lines are computed, and |lines_| is valid. |
528 virtual void EnsureLayout() = 0; | 541 virtual void EnsureLayout() = 0; |
529 | 542 |
530 // Draw the text. | 543 // Draw the text. |
531 virtual void DrawVisualText(Canvas* canvas) = 0; | 544 virtual void DrawVisualText(Canvas* canvas) = 0; |
532 | 545 |
533 // Returns the text used for layout, which may be obscured or truncated. | 546 // Update the display text. |
534 const base::string16& GetLayoutText() const; | 547 void UpdateDisplayText(float text_width); |
535 | 548 |
536 // Returns layout text positions that are suitable for breaking lines. | 549 // Returns layout text positions that are suitable for breaking lines. |
msw
2015/02/13 05:53:34
nit: s/layout/display/
oshima
2015/02/13 21:03:09
Done.
| |
537 const BreakList<size_t>& GetLineBreaks(); | 550 const BreakList<size_t>& GetLineBreaks(); |
538 | 551 |
539 // Apply (and undo) temporary composition underlines and selection colors. | 552 // Apply (and undo) temporary composition underlines and selection colors. |
540 void ApplyCompositionAndSelectionStyles(); | 553 void ApplyCompositionAndSelectionStyles(); |
541 void UndoCompositionAndSelectionStyles(); | 554 void UndoCompositionAndSelectionStyles(); |
542 | 555 |
543 // Returns the line offset from the origin after applying the text alignment | 556 // Returns the line offset from the origin after applying the text alignment |
544 // and the display offset. | 557 // and the display offset. |
545 Vector2d GetLineOffset(size_t line_number); | 558 Vector2d GetLineOffset(size_t line_number); |
546 | 559 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); | 614 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); |
602 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); | 615 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); |
603 | 616 |
604 // Set the cursor to |position|, with the caret trailing the previous | 617 // Set the cursor to |position|, with the caret trailing the previous |
605 // grapheme, or if there is no previous grapheme, leading the cursor position. | 618 // grapheme, or if there is no previous grapheme, leading the cursor position. |
606 // If |select| is false, the selection start is moved to the same position. | 619 // If |select| is false, the selection start is moved to the same position. |
607 // If the |position| is not a cursorable position (not on grapheme boundary), | 620 // If the |position| is not a cursorable position (not on grapheme boundary), |
608 // it is a NO-OP. | 621 // it is a NO-OP. |
609 void MoveCursorTo(size_t position, bool select); | 622 void MoveCursorTo(size_t position, bool select); |
610 | 623 |
611 // Updates |layout_text_| if the text is obscured or truncated. | 624 // Updates |layout_text_| and |display_text_| as needed. |
msw
2015/02/13 05:53:34
nit: maybe this should say "as needed (or marks th
oshima
2015/02/13 21:03:09
Done.
| |
612 void UpdateLayoutText(); | 625 void OnTextAttributeChanged(); |
613 | 626 |
614 // Elides |text| as needed to fit in the |available_width| using |behavior|. | 627 // Elides |text| as needed to fit in the |available_width| using |behavior|. |
628 // |text_width| is the pre-calculated width of the text shaped by this render | |
629 // text, or pass 0 if the width is unknown. | |
615 base::string16 Elide(const base::string16& text, | 630 base::string16 Elide(const base::string16& text, |
631 float text_width, | |
616 float available_width, | 632 float available_width, |
617 ElideBehavior behavior); | 633 ElideBehavior behavior); |
618 | 634 |
619 // Elides |email| as needed to fit the |available_width|. | 635 // Elides |email| as needed to fit the |available_width|. |
620 base::string16 ElideEmail(const base::string16& email, float available_width); | 636 base::string16 ElideEmail(const base::string16& email, float available_width); |
621 | 637 |
622 // Update the cached bounds and display offset to ensure that the current | 638 // Update the cached bounds and display offset to ensure that the current |
623 // cursor is within the visible display area. | 639 // cursor is within the visible display area. |
624 void UpdateCachedBoundsAndOffset(); | 640 void UpdateCachedBoundsAndOffset(); |
625 | 641 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 // The background color used for drawing the selection when focused. | 682 // The background color used for drawing the selection when focused. |
667 SkColor selection_background_focused_color_; | 683 SkColor selection_background_focused_color_; |
668 | 684 |
669 // The focus state of the text. | 685 // The focus state of the text. |
670 bool focused_; | 686 bool focused_; |
671 | 687 |
672 // Composition text range. | 688 // Composition text range. |
673 Range composition_range_; | 689 Range composition_range_; |
674 | 690 |
675 // Color and style breaks, used to color and stylize ranges of text. | 691 // Color and style breaks, used to color and stylize ranges of text. |
676 // BreakList positions are stored with text indices, not layout indices. | 692 // BreakList positions are stored with text indices, not layout indices. |
msw
2015/02/13 05:53:34
nit: s/layout/display/
oshima
2015/02/13 21:03:10
Done.
| |
677 // TODO(msw): Expand to support cursor, selection, background, etc. colors. | 693 // TODO(msw): Expand to support cursor, selection, background, etc. colors. |
678 BreakList<SkColor> colors_; | 694 BreakList<SkColor> colors_; |
679 std::vector<BreakList<bool> > styles_; | 695 std::vector<BreakList<bool> > styles_; |
680 | 696 |
681 // Breaks saved without temporary composition and selection styling. | 697 // Breaks saved without temporary composition and selection styling. |
682 BreakList<SkColor> saved_colors_; | 698 BreakList<SkColor> saved_colors_; |
683 BreakList<bool> saved_underlines_; | 699 BreakList<bool> saved_underlines_; |
684 bool composition_and_selection_styles_applied_; | 700 bool composition_and_selection_styles_applied_; |
685 | 701 |
686 // A flag to obscure actual text with asterisks for password fields. | 702 // A flag to obscure actual text with asterisks for password fields. |
687 bool obscured_; | 703 bool obscured_; |
688 // The index at which the char should be revealed in the obscured text. | 704 // The index at which the char should be revealed in the obscured text. |
689 int obscured_reveal_index_; | 705 int obscured_reveal_index_; |
690 | 706 |
691 // The maximum length of text to display, 0 forgoes a hard limit. | 707 // The maximum length of text to display, 0 forgoes a hard limit. |
692 size_t truncate_length_; | 708 size_t truncate_length_; |
693 | 709 |
710 // The obscured and/or truncated text used to layout the text to display. | |
711 base::string16 layout_text_; | |
712 | |
713 // The elided text displayed visually. This is empty if the text | |
714 // does not have to be elided, or became empty as a result of eliding. | |
715 base::string16 display_text_; | |
msw
2015/02/13 05:53:34
It's a little unfortunate that we need to keep an
oshima
2015/02/13 21:03:10
Because just drawing text requires only display in
msw
2015/02/13 22:19:05
True, but then any display attribute changes would
oshima
2015/02/13 23:24:11
It's rare to apply style change after text has bee
msw
2015/02/14 00:11:26
Good point. Agreed that measurements would help.
| |
716 | |
694 // The behavior for eliding, fading, or truncating. | 717 // The behavior for eliding, fading, or truncating. |
695 ElideBehavior elide_behavior_; | 718 ElideBehavior elide_behavior_; |
696 | 719 |
697 // The obscured and/or truncated text that will be displayed. | 720 // True if the text is elided given the current behavior and display area. |
698 base::string16 layout_text_; | 721 bool text_elided_; |
msw
2015/02/13 05:53:34
This is nearly equivalent to display_text_.empty()
oshima
2015/02/13 21:03:09
Yep, I tried it and reverted thanks to broken test
| |
699 | 722 |
700 // Whether newline characters should be replaced with newline symbols. | 723 // Whether newline characters should be replaced with newline symbols. |
701 bool replace_newline_chars_with_symbols_; | 724 bool replace_newline_chars_with_symbols_; |
msw
2015/02/13 05:53:34
You can remove this, SetReplaceNewlineCharsWithSym
oshima
2015/02/13 21:03:09
Done.
| |
702 | 725 |
703 // The minimum height a line should have. | 726 // The minimum height a line should have. |
704 int min_line_height_; | 727 int min_line_height_; |
705 | 728 |
706 // Whether the text should be broken into multiple lines. Uses the width of | 729 // Whether the text should be broken into multiple lines. Uses the width of |
707 // |display_rect_| as the width cap. | 730 // |display_rect_| as the width cap. |
708 bool multiline_; | 731 bool multiline_; |
709 | 732 |
710 // Is the background transparent (either partially or fully)? | 733 // Is the background transparent (either partially or fully)? |
711 bool background_is_transparent_; | 734 bool background_is_transparent_; |
(...skipping 16 matching lines...) Expand all Loading... | |
728 // centered. | 751 // centered. |
729 int baseline_; | 752 int baseline_; |
730 | 753 |
731 // The cached bounds and offset are invalidated by changes to the cursor, | 754 // The cached bounds and offset are invalidated by changes to the cursor, |
732 // selection, font, and other operations that adjust the visible text bounds. | 755 // selection, font, and other operations that adjust the visible text bounds. |
733 bool cached_bounds_and_offset_valid_; | 756 bool cached_bounds_and_offset_valid_; |
734 | 757 |
735 // Text shadows to be drawn. | 758 // Text shadows to be drawn. |
736 ShadowValues shadows_; | 759 ShadowValues shadows_; |
737 | 760 |
738 // A list of valid layout text line break positions. | 761 // A list of valid layout text line break positions. |
msw
2015/02/13 05:53:34
nit: s/layout/display/
oshima
2015/02/13 21:03:10
Done.
| |
739 BreakList<size_t> line_breaks_; | 762 BreakList<size_t> line_breaks_; |
740 | 763 |
741 // Lines computed by EnsureLayout. These should be invalidated with | 764 // Lines computed by EnsureLayout. These should be invalidated upon |
742 // ResetLayout and on |display_rect_| changes. | 765 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged call. |
msw
2015/02/13 05:53:34
nit: "calls"
oshima
2015/02/13 21:03:09
Done.
| |
743 std::vector<internal::Line> lines_; | 766 std::vector<internal::Line> lines_; |
744 | 767 |
745 DISALLOW_COPY_AND_ASSIGN(RenderText); | 768 DISALLOW_COPY_AND_ASSIGN(RenderText); |
746 }; | 769 }; |
747 | 770 |
748 } // namespace gfx | 771 } // namespace gfx |
749 | 772 |
750 #endif // UI_GFX_RENDER_TEXT_H_ | 773 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |