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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void ApplyDefaultStyle(); | 239 void ApplyDefaultStyle(); |
240 | 240 |
241 // Returns the dominant direction of the current text. | 241 // Returns the dominant direction of the current text. |
242 virtual base::i18n::TextDirection GetTextDirection() = 0; | 242 virtual base::i18n::TextDirection GetTextDirection() = 0; |
243 | 243 |
244 // Returns the visual movement direction corresponding to the logical end | 244 // Returns the visual movement direction corresponding to the logical end |
245 // of the text, considering only the dominant direction returned by | 245 // of the text, considering only the dominant direction returned by |
246 // |GetTextDirection()|, not the direction of a particular run. | 246 // |GetTextDirection()|, not the direction of a particular run. |
247 VisualCursorDirection GetVisualDirectionOfLogicalEnd(); | 247 VisualCursorDirection GetVisualDirectionOfLogicalEnd(); |
248 | 248 |
249 // Get the size in pixels of the entire string. For the height, this will | 249 // Returns the size in pixels of the entire string. For the height, this will |
250 // return the maximum height among the different fonts in the text runs. | 250 // return the maximum height among the different fonts in the text runs. |
251 // Note that this returns the raw size of the string, which does not include | 251 // Note that this returns the raw size of the string, which does not include |
252 // the margin area of text shadows. | 252 // the margin area of text shadows. |
253 virtual Size GetStringSize() = 0; | 253 virtual Size GetStringSize() = 0; |
254 | 254 |
| 255 // Returns the common baseline of the text. The returned value is the vertical |
| 256 // offset from the top of |display_rect| to the text baseline, in pixels. |
| 257 virtual int GetBaseline() = 0; |
| 258 |
255 void Draw(Canvas* canvas); | 259 void Draw(Canvas* canvas); |
256 | 260 |
257 // Gets the SelectionModel from a visual point in local coordinates. | 261 // Gets the SelectionModel from a visual point in local coordinates. |
258 virtual SelectionModel FindCursorPosition(const Point& point) = 0; | 262 virtual SelectionModel FindCursorPosition(const Point& point) = 0; |
259 | 263 |
260 // Get the visual bounds of a cursor at |selection|. These bounds typically | 264 // Get the visual bounds of a cursor at |selection|. These bounds typically |
261 // represent a vertical line, but if |insert_mode| is true they contain the | 265 // represent a vertical line, but if |insert_mode| is true they contain the |
262 // bounds of the associated glyph. These bounds are in local coordinates, but | 266 // bounds of the associated glyph. These bounds are in local coordinates, but |
263 // may be outside the visible region if the text is longer than the textfield. | 267 // may be outside the visible region if the text is longer than the textfield. |
264 // Subsequent text, cursor, or bounds changes may invalidate returned values. | 268 // Subsequent text, cursor, or bounds changes may invalidate returned values. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 494 |
491 // Text shadows to be drawn. | 495 // Text shadows to be drawn. |
492 ShadowValues text_shadows_; | 496 ShadowValues text_shadows_; |
493 | 497 |
494 DISALLOW_COPY_AND_ASSIGN(RenderText); | 498 DISALLOW_COPY_AND_ASSIGN(RenderText); |
495 }; | 499 }; |
496 | 500 |
497 } // namespace gfx | 501 } // namespace gfx |
498 | 502 |
499 #endif // UI_GFX_RENDER_TEXT_H_ | 503 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |