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

Side by Side Diff: ui/gfx/render_text.h

Issue 1015533016: Move allow_character_break property to RenderText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 bool obscured() const { return obscured_; } 249 bool obscured() const { return obscured_; }
250 void SetObscured(bool obscured); 250 void SetObscured(bool obscured);
251 251
252 // Makes a char in obscured text at |index| to be revealed. |index| should be 252 // Makes a char in obscured text at |index| to be revealed. |index| should be
253 // a UTF16 text index. If there is a previous revealed index, the previous one 253 // a UTF16 text index. If there is a previous revealed index, the previous one
254 // is cleared and only the last set index will be revealed. If |index| is -1 254 // is cleared and only the last set index will be revealed. If |index| is -1
255 // or out of range, no char will be revealed. The revealed index is also 255 // or out of range, no char will be revealed. The revealed index is also
256 // cleared when SetText or SetObscured is called. 256 // cleared when SetText or SetObscured is called.
257 void SetObscuredRevealIndex(int index); 257 void SetObscuredRevealIndex(int index);
258 258
259 // TODO(ckocagil): Multiline text rendering is currently only supported on 259 // TODO(ckocagil): Multiline text rendering is not supported on Mac.
260 // Windows. Support other platforms.
261 bool multiline() const { return multiline_; } 260 bool multiline() const { return multiline_; }
262 void SetMultiline(bool multiline); 261 void SetMultiline(bool multiline);
263 262
263 bool allow_character_break() const { return allow_character_break_; }
264 void SetAllowCharacterBreak(bool allow_character_break);
265
264 // Set whether newline characters should be replaced with newline symbols. 266 // Set whether newline characters should be replaced with newline symbols.
265 void SetReplaceNewlineCharsWithSymbols(bool replace); 267 void SetReplaceNewlineCharsWithSymbols(bool replace);
266 268
267 // Returns true if this instance supports multiline rendering. 269 // Returns true if this instance supports multiline rendering.
268 virtual bool MultilineSupported() const = 0; 270 virtual bool MultilineSupported() const = 0;
269 271
270 // TODO(ckocagil): Add vertical alignment and line spacing support instead. 272 // TODO(ckocagil): Add vertical alignment and line spacing support instead.
271 int min_line_height() const { return min_line_height_; } 273 int min_line_height() const { return min_line_height_; }
272 void SetMinLineHeight(int line_height); 274 void SetMinLineHeight(int line_height);
273 275
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText); 628 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText);
627 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions); 629 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
628 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, MinLineHeight); 630 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, MinLineHeight);
629 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, EdgeSelectionModels); 631 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, EdgeSelectionModels);
630 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffset); 632 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffset);
631 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffsetHorizontalDefaultInRTL); 633 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GetTextOffsetHorizontalDefaultInRTL);
632 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth); 634 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth);
633 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); 635 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth);
634 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_SufficientWidth); 636 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_SufficientWidth);
635 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_Newline); 637 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_Newline);
638 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_AllowCharacterBreak);
636 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, NewlineWithoutMultilineFlag); 639 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, NewlineWithoutMultilineFlag);
637 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GlyphBounds); 640 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GlyphBounds);
638 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_GlyphBounds); 641 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_GlyphBounds);
639 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, 642 FRIEND_TEST_ALL_PREFIXES(RenderTextTest,
640 MoveCursorLeftRight_MeiryoUILigatures); 643 MoveCursorLeftRight_MeiryoUILigatures);
641 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); 644 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters);
642 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SameFontForParentheses); 645 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SameFontForParentheses);
643 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks); 646 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks);
644 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes); 647 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes);
645 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth); 648 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // True if the text is elided given the current behavior and display area. 757 // True if the text is elided given the current behavior and display area.
755 bool text_elided_; 758 bool text_elided_;
756 759
757 // The minimum height a line should have. 760 // The minimum height a line should have.
758 int min_line_height_; 761 int min_line_height_;
759 762
760 // Whether the text should be broken into multiple lines. Uses the width of 763 // Whether the text should be broken into multiple lines. Uses the width of
761 // |display_rect_| as the width cap. 764 // |display_rect_| as the width cap.
762 bool multiline_; 765 bool multiline_;
763 766
767 // Whether the line breaker allows to break lines by character, not by word.
msw 2015/03/25 20:54:15 nit: clarify the actual behavior here (or use gfx:
Jun Mukai 2015/03/26 01:35:08 Using WordWrapBehavior
768 bool allow_character_break_;
msw 2015/03/25 20:54:15 nit: use gfx::WordWrapBehavior?
Jun Mukai 2015/03/26 01:35:08 Done.
769
764 // Whether newline characters should be replaced with newline symbols. 770 // Whether newline characters should be replaced with newline symbols.
765 bool replace_newline_chars_with_symbols_; 771 bool replace_newline_chars_with_symbols_;
766 772
767 // Set to true to suppress subpixel rendering due to non-font reasons (eg. 773 // Set to true to suppress subpixel rendering due to non-font reasons (eg.
768 // if the background is transparent). The default value is false. 774 // if the background is transparent). The default value is false.
769 bool subpixel_rendering_suppressed_; 775 bool subpixel_rendering_suppressed_;
770 776
771 // The local display area for rendering the text. 777 // The local display area for rendering the text.
772 Rect display_rect_; 778 Rect display_rect_;
773 779
(...skipping 25 matching lines...) Expand all
799 // Lines computed by EnsureLayout. These should be invalidated upon 805 // Lines computed by EnsureLayout. These should be invalidated upon
800 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 806 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
801 std::vector<internal::Line> lines_; 807 std::vector<internal::Line> lines_;
802 808
803 DISALLOW_COPY_AND_ASSIGN(RenderText); 809 DISALLOW_COPY_AND_ASSIGN(RenderText);
804 }; 810 };
805 811
806 } // namespace gfx 812 } // namespace gfx
807 813
808 #endif // UI_GFX_RENDER_TEXT_H_ 814 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698