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

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

Issue 8819001: Revert 113075 (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (request... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // render the text and its attributes. 227 // render the text and its attributes.
228 virtual void UpdateLayout() = 0; 228 virtual void UpdateLayout() = 0;
229 229
230 // Ensure the text is laid out. 230 // Ensure the text is laid out.
231 virtual void EnsureLayout() = 0; 231 virtual void EnsureLayout() = 0;
232 232
233 // Draw the text. 233 // Draw the text.
234 virtual void DrawVisualText(Canvas* canvas) = 0; 234 virtual void DrawVisualText(Canvas* canvas) = 0;
235 235
236 // Get the logical index of the grapheme preceding the argument |position|. 236 // Get the logical index of the grapheme preceding the argument |position|.
237 // If |IsCursorablePosition(position)| is true, the result will be the start
238 // of the previous grapheme, if any. Otherwise, the result will be the start
239 // of the grapheme containing |position|.
240 size_t GetIndexOfPreviousGrapheme(size_t position); 237 size_t GetIndexOfPreviousGrapheme(size_t position);
241 238
242 // Apply composition style (underline) to composition range and selection 239 // Apply composition style (underline) to composition range and selection
243 // style (foreground) to selection range. 240 // style (foreground) to selection range.
244 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; 241 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const;
245 242
246 // Convert points from the text space to the view space and back. 243 // Convert points from the text space to the view space and back.
247 // Handles the display area, display offset, and the application LTR/RTL mode. 244 // Handles the display area, display offset, and the application LTR/RTL mode.
248 Point ToTextPoint(const Point& point); 245 Point ToTextPoint(const Point& point);
249 Point ToViewPoint(const Point& point); 246 Point ToViewPoint(const Point& point);
250 247
251 private: 248 private:
252 friend class RenderTextTest; 249 friend class RenderTextTest;
253 250
254 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle); 251 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, DefaultStyle);
255 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, CustomDefaultStyle); 252 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, CustomDefaultStyle);
256 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ApplyStyleRange); 253 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ApplyStyleRange);
257 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StyleRangesAdjust); 254 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StyleRangesAdjust);
258 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
259 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SelectionModels);
260 255
261 // Return an index belonging to the |next| or previous logical grapheme. 256 // Return an index belonging to the |next| or previous logical grapheme.
262 // If |next| is false and |IsCursorablePosition(index)| is true, the result
263 // will be the start of the previous grapheme, if any. Otherwise, the result
264 // will be the start of the grapheme containing |index|.
265 // The return value is bounded by 0 and the text length, inclusive. 257 // The return value is bounded by 0 and the text length, inclusive.
266 virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) = 0; 258 virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) = 0;
267 259
268 // Set the cursor to |position|, with the caret trailing the previous 260 // Set the cursor to |position|, with the caret trailing the previous
269 // grapheme, or if there is no previous grapheme, leading the cursor position. 261 // grapheme, or if there is no previous grapheme, leading the cursor position.
270 // If |select| is false, the selection start is moved to the same position. 262 // If |select| is false, the selection start is moved to the same position.
271 // If the |position| is not a cursorable position (not on grapheme boundary), 263 // If the |position| is not a cursorable position (not on grapheme boundary),
272 // it is a NO-OP. 264 // it is a NO-OP.
273 void MoveCursorTo(size_t position, bool select); 265 void MoveCursorTo(size_t position, bool select);
274 266
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // The cached bounds and offset are invalidated by changes to the cursor, 305 // The cached bounds and offset are invalidated by changes to the cursor,
314 // selection, font, and other operations that adjust the visible text bounds. 306 // selection, font, and other operations that adjust the visible text bounds.
315 bool cached_bounds_and_offset_valid_; 307 bool cached_bounds_and_offset_valid_;
316 308
317 DISALLOW_COPY_AND_ASSIGN(RenderText); 309 DISALLOW_COPY_AND_ASSIGN(RenderText);
318 }; 310 };
319 311
320 } // namespace gfx 312 } // namespace gfx
321 313
322 #endif // UI_GFX_RENDER_TEXT_H_ 314 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698