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

Side by Side Diff: ui/gfx/render_text.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: Fix compile. 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 unified diff | Download patch
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 const SelectionModel& selection_model() const { return selection_model_; } 322 const SelectionModel& selection_model() const { return selection_model_; }
323 323
324 const Range& selection() const { return selection_model_.selection(); } 324 const Range& selection() const { return selection_model_.selection(); }
325 325
326 size_t cursor_position() const { return selection_model_.caret_pos(); } 326 size_t cursor_position() const { return selection_model_.caret_pos(); }
327 void SetCursorPosition(size_t position); 327 void SetCursorPosition(size_t position);
328 328
329 // Moves the cursor left or right. Cursor movement is visual, meaning that 329 // Moves the cursor left or right. Cursor movement is visual, meaning that
330 // left and right are relative to screen, not the directionality of the text. 330 // left and right are relative to screen, not the directionality of the text.
331 // If |select| is false, the selection start is moved to the same position. 331 // |selection_behavior| determines whether a selection is to be made and it's
332 // behavior.
332 void MoveCursor(BreakType break_type, 333 void MoveCursor(BreakType break_type,
333 VisualCursorDirection direction, 334 VisualCursorDirection direction,
334 bool select); 335 SelectionBehavior selection_behavior);
335 336
336 // Set the selection_model_ to the value of |selection|. 337 // Set the selection_model_ to the value of |selection|.
337 // 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.
338 // Returns true if the cursor position or selection range changed. 339 // Returns true if the cursor position or selection range changed.
339 // 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
340 // grapheme boundary), it is a no-op and returns false. 341 // grapheme boundary), it is a no-op and returns false.
341 bool MoveCursorTo(const SelectionModel& selection_model); 342 bool MoveCursorTo(const SelectionModel& selection_model);
342 343
343 // Set the selection_model_ based on |range|. 344 // Set the selection_model_ based on |range|.
344 // 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // Lines computed by EnsureLayout. These should be invalidated upon 850 // Lines computed by EnsureLayout. These should be invalidated upon
850 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 851 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
851 std::vector<internal::Line> lines_; 852 std::vector<internal::Line> lines_;
852 853
853 DISALLOW_COPY_AND_ASSIGN(RenderText); 854 DISALLOW_COPY_AND_ASSIGN(RenderText);
854 }; 855 };
855 856
856 } // namespace gfx 857 } // namespace gfx
857 858
858 #endif // UI_GFX_RENDER_TEXT_H_ 859 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698