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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 const FontList& font_list() const { return font_list_; } | 140 const FontList& font_list() const { return font_list_; } |
| 141 void SetFontList(const FontList& font_list); | 141 void SetFontList(const FontList& font_list); |
| 142 void SetFont(const Font& font); | 142 void SetFont(const Font& font); |
| 143 | 143 |
| 144 // Set the font size to |size| in pixels. | 144 // Set the font size to |size| in pixels. |
| 145 void SetFontSize(int size); | 145 void SetFontSize(int size); |
| 146 | 146 |
| 147 // Get the first font in |font_list_|. | 147 // Get the first font in |font_list_|. |
| 148 const Font& GetFont() const; | 148 const Font& GetFont() const; |
| 149 | 149 |
| 150 // Returns the common height and baseline of the fonts in the font list. | |
| 151 int GetFontListHeight() const { return font_list_height_; } | |
| 152 int GetFontListBaseline() const { return font_list_baseline_; } | |
| 153 | |
| 150 bool cursor_enabled() const { return cursor_enabled_; } | 154 bool cursor_enabled() const { return cursor_enabled_; } |
| 151 void SetCursorEnabled(bool cursor_enabled); | 155 void SetCursorEnabled(bool cursor_enabled); |
| 152 | 156 |
| 153 bool cursor_visible() const { return cursor_visible_; } | 157 bool cursor_visible() const { return cursor_visible_; } |
| 154 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } | 158 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } |
| 155 | 159 |
| 156 bool insert_mode() const { return insert_mode_; } | 160 bool insert_mode() const { return insert_mode_; } |
| 157 void ToggleInsertMode(); | 161 void ToggleInsertMode(); |
| 158 | 162 |
| 159 SkColor cursor_color() const { return cursor_color_; } | 163 SkColor cursor_color() const { return cursor_color_; } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 | 491 |
| 488 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. | 492 // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. |
| 489 DirectionalityMode directionality_mode_; | 493 DirectionalityMode directionality_mode_; |
| 490 | 494 |
| 491 // The cached text direction, potentially computed from the text or UI locale. | 495 // The cached text direction, potentially computed from the text or UI locale. |
| 492 // Use GetTextDirection(), do not use this potentially invalid value directly! | 496 // Use GetTextDirection(), do not use this potentially invalid value directly! |
| 493 base::i18n::TextDirection text_direction_; | 497 base::i18n::TextDirection text_direction_; |
| 494 | 498 |
| 495 // A list of fonts used to render |text_|. | 499 // A list of fonts used to render |text_|. |
| 496 FontList font_list_; | 500 FontList font_list_; |
| 501 // The common height and baseline of the fonts in the font list. | |
| 502 // We cache these values because they change iff |font_list_| changes, and | |
| 503 // we need to scan font metrics for all the fonts in |font_list_| in order to | |
| 504 // get these values. | |
| 505 int font_list_height_; | |
|
msw
2013/07/11 22:47:29
Can FontList cache these values itself?
Yuki
2013/07/12 08:25:53
Yes, I've moved these cache to FontList.
| |
| 506 int font_list_baseline_; | |
| 497 | 507 |
| 498 // Logical selection range and visual cursor position. | 508 // Logical selection range and visual cursor position. |
| 499 SelectionModel selection_model_; | 509 SelectionModel selection_model_; |
| 500 | 510 |
| 501 // The cached cursor bounds; get these bounds with GetUpdatedCursorBounds. | 511 // The cached cursor bounds; get these bounds with GetUpdatedCursorBounds. |
| 502 Rect cursor_bounds_; | 512 Rect cursor_bounds_; |
| 503 | 513 |
| 504 // Specifies whether the cursor is enabled. If disabled, no space is reserved | 514 // Specifies whether the cursor is enabled. If disabled, no space is reserved |
| 505 // for the cursor when positioning text. | 515 // for the cursor when positioning text. |
| 506 bool cursor_enabled_; | 516 bool cursor_enabled_; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 582 |
| 573 // Text shadows to be drawn. | 583 // Text shadows to be drawn. |
| 574 ShadowValues text_shadows_; | 584 ShadowValues text_shadows_; |
| 575 | 585 |
| 576 DISALLOW_COPY_AND_ASSIGN(RenderText); | 586 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 577 }; | 587 }; |
| 578 | 588 |
| 579 } // namespace gfx | 589 } // namespace gfx |
| 580 | 590 |
| 581 #endif // UI_GFX_RENDER_TEXT_H_ | 591 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |