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

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

Issue 7607018: Remove PREVIOUS_GRAPHEME_TRAILING. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // "abcFED|". 83 // "abcFED|".
84 // So, besides the logical selection start point and end point, we need extra 84 // So, besides the logical selection start point and end point, we need extra
85 // information to specify to which character and on which edge of the character 85 // information to specify to which character and on which edge of the character
86 // the visual cursor is bound to. For example, the visual cursor is bound to 86 // the visual cursor is bound to. For example, the visual cursor is bound to
87 // the trailing side of the 2nd character 'c' when pointing to right half of 87 // the trailing side of the 2nd character 'c' when pointing to right half of
88 // 'c'. And it is bound to the leading edge of the 3rd character 'D' when 88 // 'c'. And it is bound to the leading edge of the 3rd character 'D' when
89 // pointing to right of 'D'. 89 // pointing to right of 'D'.
90 class UI_EXPORT SelectionModel { 90 class UI_EXPORT SelectionModel {
91 public: 91 public:
92 enum CaretPlacement { 92 enum CaretPlacement {
93 // PREVIOUS_GRAPHEME_TRAILING means cursor is visually attached to the
94 // trailing edge of previous grapheme.
95 PREVIOUS_GRAPHEME_TRAILING,
96 LEADING, 93 LEADING,
97 TRAILING, 94 TRAILING,
98 }; 95 };
99 96
100 SelectionModel(); 97 SelectionModel();
101 explicit SelectionModel(size_t pos); 98 explicit SelectionModel(size_t pos);
99 SelectionModel(size_t start, size_t end);
102 SelectionModel(size_t end, size_t pos, CaretPlacement status); 100 SelectionModel(size_t end, size_t pos, CaretPlacement status);
103 SelectionModel(size_t start, size_t end, size_t pos, CaretPlacement status); 101 SelectionModel(size_t start, size_t end, size_t pos, CaretPlacement status);
104 102
105 virtual ~SelectionModel(); 103 virtual ~SelectionModel();
106 104
107 size_t selection_start() const { return selection_start_; } 105 size_t selection_start() const { return selection_start_; }
108 void set_selection_start(size_t pos) { selection_start_ = pos; } 106 void set_selection_start(size_t pos) { selection_start_ = pos; }
109 107
110 size_t selection_end() const { return selection_end_; } 108 size_t selection_end() const { return selection_end_; }
111 void set_selection_end(size_t pos) { selection_end_ = pos; } 109 void set_selection_end(size_t pos) { selection_end_ = pos; }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const StyleRanges& style_ranges() const { return style_ranges_; } 262 const StyleRanges& style_ranges() const { return style_ranges_; }
265 263
266 // Get the selection model that visually neighbors |position| by |break_type|. 264 // Get the selection model that visually neighbors |position| by |break_type|.
267 // The returned value represents a cursor/caret position without a selection. 265 // The returned value represents a cursor/caret position without a selection.
268 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, 266 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current,
269 BreakType break_type); 267 BreakType break_type);
270 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, 268 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current,
271 BreakType break_type); 269 BreakType break_type);
272 270
273 // Get the logical index of the grapheme preceeding the argument |position|. 271 // Get the logical index of the grapheme preceeding the argument |position|.
274 virtual size_t GetIndexOfPreviousGrapheme(size_t position) const; 272 virtual size_t GetIndexOfPreviousGrapheme(size_t position);
275 273
276 // Apply composition style (underline) to composition range and selection 274 // Apply composition style (underline) to composition range and selection
277 // style (foreground) to selection range. 275 // style (foreground) to selection range.
278 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; 276 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const;
279 277
280 private: 278 private:
281 friend class RenderTextTest; 279 friend class RenderTextTest;
282 280
283 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle); 281 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle);
284 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, CustomDefaultStyle); 282 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, CustomDefaultStyle);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 Rect display_rect_; 322 Rect display_rect_;
325 // The offset for the text to be drawn, relative to the display area. 323 // The offset for the text to be drawn, relative to the display area.
326 Point display_offset_; 324 Point display_offset_;
327 325
328 DISALLOW_COPY_AND_ASSIGN(RenderText); 326 DISALLOW_COPY_AND_ASSIGN(RenderText);
329 }; 327 };
330 328
331 } // namespace gfx 329 } // namespace gfx
332 330
333 #endif // UI_GFX_RENDER_TEXT_H_ 331 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | views/controls/textfield/textfield_views_model_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698