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

Unified Diff: ui/gfx/text_constants.h

Issue 2228833002: MacViews: Fix behavior of move and select commands when selection direction changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_text_commands
Patch Set: Address review comments. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/render_text_unittest.cc ('k') | ui/views/cocoa/bridged_content_view.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/text_constants.h
diff --git a/ui/gfx/text_constants.h b/ui/gfx/text_constants.h
index b09081dd8a0b51fd955f319e665a2ced94634503..b63a05da75e27976edc7f9d7ac2cdc41c1ebb001 100644
--- a/ui/gfx/text_constants.h
+++ b/ui/gfx/text_constants.h
@@ -15,6 +15,37 @@ enum BreakType {
LINE_BREAK, // Stop cursor movement on line ends as shown on screen.
};
+// Specifies the selection behavior for a move/move-and-select command. For
+// example consider the state "ab|cd|e", i.e. cd is selected. Assume the
+// selection direction is from left to right. If we move to the beginning of the
+// line (LINE_BREAK, CURSOR_LEFT), the resultant state is:
+// "|ab|cde" for SELECTION_RETAIN, selection direction from right to left.
+// "|abcd|e" for SELECTION_EXTEND, selection direction from right to left.
+// "ab|cde" for SELECTION_CARET.
+// "|abcde" for SELECTION_NONE.
+enum SelectionBehavior {
+ // Default behavior for a move-and-select command. The selection start point
+ // remains the same. For example, this is the behavior of textfields on Mac
+ // for the command moveUpAndModifySelection (Shift + Up).
+ SELECTION_RETAIN,
+
+ // Use for move-and-select commands that want the existing selection to be
+ // extended in the opposite direction, when the selection direction is
+ // reversed. For example, this is the behavior for textfields on Mac for the
+ // command moveToLeftEndOfLineAndModifySelection (Command + Shift + Left).
+ SELECTION_EXTEND,
+
+ // Use for move-and-select commands that want the existing selection to reduce
+ // to a caret, when the selection direction is reversed. For example, this is
+ // the behavior for textfields on Mac for the command
+ // moveWordLeftAndModifySelection (Alt + Shift + Left).
+ SELECTION_CARET,
+
+ // No selection. To be used for move commands that don't want to cause a
+ // selection, and that want to collapse any pre-existing selection.
+ SELECTION_NONE,
+};
+
// Specifies the word wrapping behavior when a word would exceed the available
// display width. All words that are too wide will be put on a new line, and
// then:
« no previous file with comments | « ui/gfx/render_text_unittest.cc ('k') | ui/views/cocoa/bridged_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698