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_TEXT_CONSTANTS_H_ | 5 #ifndef UI_GFX_TEXT_CONSTANTS_H_ |
6 #define UI_GFX_TEXT_CONSTANTS_H_ | 6 #define UI_GFX_TEXT_CONSTANTS_H_ |
7 | 7 |
8 namespace gfx { | 8 namespace gfx { |
9 | 9 |
10 // TODO(msw): Distinguish between logical character stops and glyph stops? | 10 // TODO(msw): Distinguish between logical character stops and glyph stops? |
11 // TODO(msw): Merge with base::i18n::BreakIterator::BreakType. | 11 // TODO(msw): Merge with base::i18n::BreakIterator::BreakType. |
12 enum BreakType { | 12 enum BreakType { |
13 CHARACTER_BREAK = 0, // Stop cursor movement on neighboring characters. | 13 CHARACTER_BREAK = 0, // Stop cursor movement on neighboring characters. |
14 WORD_BREAK, // Stop cursor movement on nearest word boundaries. | 14 WORD_BREAK, // Stop cursor movement on nearest word boundaries. |
15 LINE_BREAK, // Stop cursor movement on line ends as shown on screen. | 15 LINE_BREAK, // Stop cursor movement on line ends as shown on screen. |
16 }; | 16 }; |
17 | 17 |
18 // Specifies how a move and select command behaves if the selection direction | |
19 // is reversed. For example consider the state "ab|cd|e", i.e. cd is selected. | |
20 // Assume the selection direction is from left to right. If we move to the | |
21 // beginning of the line while modifying the selection, the resultant state is: | |
22 // "|ab|cde" for SELECTION_START_NEW, selection direction from right to left. | |
23 // "|abcd|e" for SELECTION_EXTEND, selection direction from right to left. | |
24 // "ab|cde" for SELECTION_CARET. | |
25 enum SelectionReversedBehavior { | |
tapted
2016/08/11 03:44:07
What about calling this just `SelectionBehavior` a
karandeepb
2016/08/16 10:24:52
Nice suggestion. Done.
| |
26 // Existing selection is deselected and a new selection is started in the | |
27 // opposite direction. Default. For example, this is the behavior of | |
28 // textfields on Mac for the command moveUpAndModifySelection (Shift + Up). | |
29 // Also this is the default behavior for text editing commands on Linux and | |
30 // Windows. | |
31 SELECTION_START_NEW, | |
32 | |
33 // The existing selection is extended in the opposite direction. For example, | |
34 // this is the behavior for textfields on Mac for the command | |
35 // moveToLeftEndOfLineAndModifySelection (Command + Shift + Left). | |
36 SELECTION_EXTEND, | |
37 | |
38 // The existing selection reduces to a caret. For example, this is the | |
39 // behavior for textfields on Mac for the command | |
40 // moveWordLeftAndModifySelection (Alt + Shift + Left). | |
41 SELECTION_CARET, | |
msw
2016/08/11 23:46:37
Why do we need explicit behavior for this? The exi
tapted
2016/08/12 00:12:00
Yeah this tripped me up too :). Karan can probably
karandeepb
2016/08/12 01:26:31
No we don't. As Trent said, this only comes into p
msw
2016/08/12 21:58:30
Ah, we need tests for this like TextfieldTest.Cont
karandeepb
2016/08/16 10:24:52
Added tests. Was planning to add them after the in
| |
42 | |
43 SELECTION_DEFAULT = SELECTION_START_NEW, | |
44 }; | |
45 | |
18 // Specifies the word wrapping behavior when a word would exceed the available | 46 // Specifies the word wrapping behavior when a word would exceed the available |
19 // display width. All words that are too wide will be put on a new line, and | 47 // display width. All words that are too wide will be put on a new line, and |
20 // then: | 48 // then: |
21 enum WordWrapBehavior { | 49 enum WordWrapBehavior { |
22 IGNORE_LONG_WORDS, // Overflowing word text is left on that line. | 50 IGNORE_LONG_WORDS, // Overflowing word text is left on that line. |
23 TRUNCATE_LONG_WORDS, // Overflowing word text is truncated. | 51 TRUNCATE_LONG_WORDS, // Overflowing word text is truncated. |
24 ELIDE_LONG_WORDS, // Overflowing word text is elided at the ellipsis. | 52 ELIDE_LONG_WORDS, // Overflowing word text is elided at the ellipsis. |
25 WRAP_LONG_WORDS, // Overflowing word text is wrapped over multiple lines. | 53 WRAP_LONG_WORDS, // Overflowing word text is wrapped over multiple lines. |
26 }; | 54 }; |
27 | 55 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 ELIDE_HEAD, // Add an ellipsis at the start of the string. | 105 ELIDE_HEAD, // Add an ellipsis at the start of the string. |
78 ELIDE_MIDDLE, // Add an ellipsis in the middle of the string. | 106 ELIDE_MIDDLE, // Add an ellipsis in the middle of the string. |
79 ELIDE_TAIL, // Add an ellipsis at the end of the string. | 107 ELIDE_TAIL, // Add an ellipsis at the end of the string. |
80 ELIDE_EMAIL, // Add ellipses to username and domain substrings. | 108 ELIDE_EMAIL, // Add ellipses to username and domain substrings. |
81 FADE_TAIL, // Fade the string's end opposite of its horizontal alignment. | 109 FADE_TAIL, // Fade the string's end opposite of its horizontal alignment. |
82 }; | 110 }; |
83 | 111 |
84 } // namespace gfx | 112 } // namespace gfx |
85 | 113 |
86 #endif // UI_GFX_TEXT_CONSTANTS_H_ | 114 #endif // UI_GFX_TEXT_CONSTANTS_H_ |
OLD | NEW |