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

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

Issue 867003002: Cache gfx::RenderText instances in views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup / re-upload Created 5 years, 10 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 <algorithm> 8 #include <algorithm>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // is cleared and only the last set index will be revealed. If |index| is -1 249 // is cleared and only the last set index will be revealed. If |index| is -1
250 // or out of range, no char will be revealed. The revealed index is also 250 // or out of range, no char will be revealed. The revealed index is also
251 // cleared when SetText or SetObscured is called. 251 // cleared when SetText or SetObscured is called.
252 void SetObscuredRevealIndex(int index); 252 void SetObscuredRevealIndex(int index);
253 253
254 // TODO(ckocagil): Multiline text rendering is currently only supported on 254 // TODO(ckocagil): Multiline text rendering is currently only supported on
255 // Windows. Support other platforms. 255 // Windows. Support other platforms.
256 bool multiline() const { return multiline_; } 256 bool multiline() const { return multiline_; }
257 void SetMultiline(bool multiline); 257 void SetMultiline(bool multiline);
258 258
259 // Returns true if this supports multiline rendering.
msw 2015/02/20 01:55:53 nit: "this instance"
Jun Mukai 2015/02/25 21:15:40 Done.
260 virtual bool MultilineSupported() const = 0;
261
259 // TODO(ckocagil): Add vertical alignment and line spacing support instead. 262 // TODO(ckocagil): Add vertical alignment and line spacing support instead.
260 int min_line_height() const { return min_line_height_; } 263 int min_line_height() const { return min_line_height_; }
261 void SetMinLineHeight(int line_height); 264 void SetMinLineHeight(int line_height);
262 265
263 // Set the maximum length of the layout text, not the actual text. 266 // Set the maximum length of the layout text, not the actual text.
264 // A |length| of 0 forgoes a hard limit, but does not guarantee proper 267 // A |length| of 0 forgoes a hard limit, but does not guarantee proper
265 // functionality of very long strings. Applies to subsequent SetText calls. 268 // functionality of very long strings. Applies to subsequent SetText calls.
266 // WARNING: Only use this for system limits, it lacks complex text support. 269 // WARNING: Only use this for system limits, it lacks complex text support.
267 void set_truncate_length(size_t length) { truncate_length_ = length; } 270 void set_truncate_length(size_t length) { truncate_length_ = length; }
268 271
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // supplied index is already at the boundary of the string. 424 // supplied index is already at the boundary of the string.
422 size_t IndexOfAdjacentGrapheme(size_t index, 425 size_t IndexOfAdjacentGrapheme(size_t index,
423 LogicalCursorDirection direction); 426 LogicalCursorDirection direction);
424 427
425 // Return a SelectionModel with the cursor at the current selection's start. 428 // Return a SelectionModel with the cursor at the current selection's start.
426 // The returned value represents a cursor/caret position without a selection. 429 // The returned value represents a cursor/caret position without a selection.
427 SelectionModel GetSelectionModelForSelectionStart(); 430 SelectionModel GetSelectionModelForSelectionStart();
428 431
429 // Sets shadows to drawn with text. 432 // Sets shadows to drawn with text.
430 void set_shadows(const ShadowValues& shadows) { shadows_ = shadows; } 433 void set_shadows(const ShadowValues& shadows) { shadows_ = shadows; }
431 const ShadowValues& shadows() { return shadows_; } 434 const ShadowValues& shadows() const { return shadows_; }
432 435
433 typedef std::pair<Font, Range> FontSpan; 436 typedef std::pair<Font, Range> FontSpan;
434 // For testing purposes, returns which fonts were chosen for which parts of 437 // For testing purposes, returns which fonts were chosen for which parts of
435 // the text by returning a vector of Font and Range pairs, where each range 438 // the text by returning a vector of Font and Range pairs, where each range
436 // specifies the character range for which the corresponding font has been 439 // specifies the character range for which the corresponding font has been
437 // chosen. 440 // chosen.
438 virtual std::vector<FontSpan> GetFontSpansForTesting() = 0; 441 virtual std::vector<FontSpan> GetFontSpansForTesting() = 0;
439 442
440 // Gets the horizontal bounds (relative to the left of the text, not the view) 443 // Gets the horizontal bounds (relative to the left of the text, not the view)
441 // of the glyph starting at |index|. If the glyph is RTL then the returned 444 // of the glyph starting at |index|. If the glyph is RTL then the returned
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // Lines computed by EnsureLayout. These should be invalidated upon 772 // Lines computed by EnsureLayout. These should be invalidated upon
770 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 773 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
771 std::vector<internal::Line> lines_; 774 std::vector<internal::Line> lines_;
772 775
773 DISALLOW_COPY_AND_ASSIGN(RenderText); 776 DISALLOW_COPY_AND_ASSIGN(RenderText);
774 }; 777 };
775 778
776 } // namespace gfx 779 } // namespace gfx
777 780
778 #endif // UI_GFX_RENDER_TEXT_H_ 781 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698