Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 // RenderText represents an abstract model of styled text and its corresponding | 184 // RenderText represents an abstract model of styled text and its corresponding | 
| 185 // visual layout. Support is built in for a cursor, a selection, simple styling, | 185 // visual layout. Support is built in for a cursor, a selection, simple styling, | 
| 186 // complex scripts, and bi-directional text. Implementations provide mechanisms | 186 // complex scripts, and bi-directional text. Implementations provide mechanisms | 
| 187 // for rendering and translation between logical and visual data. | 187 // for rendering and translation between logical and visual data. | 
| 188 class GFX_EXPORT RenderText { | 188 class GFX_EXPORT RenderText { | 
| 189 public: | 189 public: | 
| 190 virtual ~RenderText(); | 190 virtual ~RenderText(); | 
| 191 | 191 | 
| 192 // Creates a platform-specific or cross-platform RenderText instance. | 192 // Creates a platform-specific or cross-platform RenderText instance. | 
| 193 static RenderText* CreateInstance(); | 193 static RenderText* CreateInstance(); | 
| 194 static RenderText* CreateInstanceForEditing(); | |
| 195 | |
| 196 // Creates another instance of the same concrete class. | |
| 197 virtual scoped_ptr<RenderText> NewInstance() const = 0; | |
| 
 
msw
2014/12/08 19:27:50
nit: CreateInstanceOfSameType?
 
Andre
2014/12/08 19:51:32
I thought about calling it Clone(), but it doesn't
 
msw
2014/12/08 19:57:52
Sure, I slightly prefer CreateInstanceForClone.
 
 | |
| 194 | 198 | 
| 195 const base::string16& text() const { return text_; } | 199 const base::string16& text() const { return text_; } | 
| 196 void SetText(const base::string16& text); | 200 void SetText(const base::string16& text); | 
| 197 | 201 | 
| 198 HorizontalAlignment horizontal_alignment() const { | 202 HorizontalAlignment horizontal_alignment() const { | 
| 199 return horizontal_alignment_; | 203 return horizontal_alignment_; | 
| 200 } | 204 } | 
| 201 void SetHorizontalAlignment(HorizontalAlignment alignment); | 205 void SetHorizontalAlignment(HorizontalAlignment alignment); | 
| 202 | 206 | 
| 203 const FontList& font_list() const { return font_list_; } | 207 const FontList& font_list() const { return font_list_; } | 
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 // Lines computed by EnsureLayout. These should be invalidated with | 727 // Lines computed by EnsureLayout. These should be invalidated with | 
| 724 // ResetLayout and on |display_rect_| changes. | 728 // ResetLayout and on |display_rect_| changes. | 
| 725 std::vector<internal::Line> lines_; | 729 std::vector<internal::Line> lines_; | 
| 726 | 730 | 
| 727 DISALLOW_COPY_AND_ASSIGN(RenderText); | 731 DISALLOW_COPY_AND_ASSIGN(RenderText); | 
| 728 }; | 732 }; | 
| 729 | 733 | 
| 730 } // namespace gfx | 734 } // namespace gfx | 
| 731 | 735 | 
| 732 #endif // UI_GFX_RENDER_TEXT_H_ | 736 #endif // UI_GFX_RENDER_TEXT_H_ | 
| OLD | NEW |