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

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

Issue 1989143002: MacViews: Correct behavior of move and select commands when selection direction changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_commands
Patch Set: Address review comments. Created 4 years, 7 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 const SelectionModel& selection_model() const { return selection_model_; } 314 const SelectionModel& selection_model() const { return selection_model_; }
315 315
316 const Range& selection() const { return selection_model_.selection(); } 316 const Range& selection() const { return selection_model_.selection(); }
317 317
318 size_t cursor_position() const { return selection_model_.caret_pos(); } 318 size_t cursor_position() const { return selection_model_.caret_pos(); }
319 void SetCursorPosition(size_t position); 319 void SetCursorPosition(size_t position);
320 320
321 // Moves the cursor left or right. Cursor movement is visual, meaning that 321 // Moves the cursor left or right. Cursor movement is visual, meaning that
322 // left and right are relative to screen, not the directionality of the text. 322 // left and right are relative to screen, not the directionality of the text.
323 // If |select| is false, the selection start is moved to the same position. 323 // If |select| is false, the selection start is moved to the same position.
324 // |select_behavior| specifies the selection behavior in case the selection
325 // direction is reversed.
324 void MoveCursor(BreakType break_type, 326 void MoveCursor(BreakType break_type,
325 VisualCursorDirection direction, 327 VisualCursorDirection direction,
326 bool select); 328 bool select,
329 SelectionReversedBehavior select_behavior);
330
331 void MoveCursor(BreakType break_type,
332 VisualCursorDirection direction,
333 bool select) {
334 MoveCursor(break_type, direction, select, SELECTION_DEFAULT);
335 }
327 336
328 // Set the selection_model_ to the value of |selection|. 337 // Set the selection_model_ to the value of |selection|.
329 // The selection range is clamped to text().length() if out of range. 338 // The selection range is clamped to text().length() if out of range.
330 // Returns true if the cursor position or selection range changed. 339 // Returns true if the cursor position or selection range changed.
331 // If any index in |selection_model| is not a cursorable position (not on a 340 // If any index in |selection_model| is not a cursorable position (not on a
332 // grapheme boundary), it is a no-op and returns false. 341 // grapheme boundary), it is a no-op and returns false.
333 bool MoveCursorTo(const SelectionModel& selection_model); 342 bool MoveCursorTo(const SelectionModel& selection_model);
334 343
335 // Set the selection_model_ based on |range|. 344 // Set the selection_model_ based on |range|.
336 // If the |range| start or end is greater than text length, it is modified 345 // If the |range| start or end is greater than text length, it is modified
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 // Lines computed by EnsureLayout. These should be invalidated upon 843 // Lines computed by EnsureLayout. These should be invalidated upon
835 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 844 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
836 std::vector<internal::Line> lines_; 845 std::vector<internal::Line> lines_;
837 846
838 DISALLOW_COPY_AND_ASSIGN(RenderText); 847 DISALLOW_COPY_AND_ASSIGN(RenderText);
839 }; 848 };
840 849
841 } // namespace gfx 850 } // namespace gfx
842 851
843 #endif // UI_GFX_RENDER_TEXT_H_ 852 #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