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

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: Add apple rdar in comment. 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
Index: ui/gfx/text_constants.h
diff --git a/ui/gfx/text_constants.h b/ui/gfx/text_constants.h
index b09081dd8a0b51fd955f319e665a2ced94634503..655c93cc30467484c6f0a31ccb7f75da206272ac 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,
karandeepb 2016/08/16 10:24:52 This needs a better name, maybe?
msw 2016/08/16 18:37:58 I think it's okay, it retains the start position.
karandeepb 2016/08/17 04:37:22 Acknowledged.
+
+ // Use for move-and-select commands which want the existing selection to be
msw 2016/08/16 18:37:58 nit: s/which/that/
karandeepb 2016/08/17 04:37:22 Done.
+ // 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 which want the existing selection to
msw 2016/08/16 18:37:58 nit: s/which/that/
karandeepb 2016/08/17 04:37:22 Done.
+ // 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, which don't want to cause a
msw 2016/08/16 18:37:58 nit: s/which/that/ and remove the comma after comm
karandeepb 2016/08/17 04:37:22 Done.
+ // selection.
msw 2016/08/16 18:37:58 nit: "selection, and which want to collapse any pr
karandeepb 2016/08/17 04:37:22 Done.
+ 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:

Powered by Google App Engine
This is Rietveld 408576698