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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 const Vector2d& GetUpdatedDisplayOffset(); | 520 const Vector2d& GetUpdatedDisplayOffset(); |
521 void SetDisplayOffset(int horizontal_offset); | 521 void SetDisplayOffset(int horizontal_offset); |
522 | 522 |
523 // Returns the line offset from the origin after applying the text alignment | 523 // Returns the line offset from the origin after applying the text alignment |
524 // and the display offset. | 524 // and the display offset. |
525 Vector2d GetLineOffset(size_t line_number); | 525 Vector2d GetLineOffset(size_t line_number); |
526 | 526 |
527 // Retrieves the word displayed at the given |point| along with its styling | 527 // Retrieves the word displayed at the given |point| along with its styling |
528 // information. |point| is in the view's coordinates. If no word is displayed | 528 // information. |point| is in the view's coordinates. If no word is displayed |
529 // at the point, returns a nearby word. |baseline_point| should correspond to | 529 // at the point, returns a nearby word. |baseline_point| should correspond to |
530 // the baseline point of the leftmost glyph of the |word| in the view's | 530 // the baseline point of the leftmost glyph of the word in the view's |
531 // coordinates. Returns false, if no word can be retrieved. | 531 // coordinates. Returns false, if no word can be retrieved. |
532 bool GetDecoratedWordAtPoint(const Point& point, | 532 bool GetDecoratedWordAndBaselineAtPoint(const Point& point, |
533 DecoratedText* decorated_word, | 533 DecoratedText* decorated_word, |
534 Point* baseline_point); | 534 Point* baseline_point); |
| 535 |
| 536 // Retrieves the text at |range| along with its styling information. |
| 537 // |baseline_point| should correspond to the baseline point of |
| 538 // the leftmost glyph of the word in the view's coordinates. Returns |
| 539 // false, if no word can be retrieved. |
| 540 bool GetDecoratedTextAndBaselineForRange(const Range& range, |
| 541 DecoratedText* decorated_text, |
| 542 Point* baseline_point); |
535 | 543 |
536 // Retrieves the text in the given |range|. | 544 // Retrieves the text in the given |range|. |
537 base::string16 GetTextFromRange(const Range& range) const; | 545 base::string16 GetTextFromRange(const Range& range) const; |
538 | 546 |
539 protected: | 547 protected: |
540 RenderText(); | 548 RenderText(); |
541 | 549 |
542 // NOTE: The value of these accessors may be stale. Please make sure | 550 // NOTE: The value of these accessors may be stale. Please make sure |
543 // that these fields are up to date before accessing them. | 551 // that these fields are up to date before accessing them. |
544 const base::string16& layout_text() const { return layout_text_; } | 552 const base::string16& layout_text() const { return layout_text_; } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 // Lines computed by EnsureLayout. These should be invalidated upon | 883 // Lines computed by EnsureLayout. These should be invalidated upon |
876 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 884 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
877 std::vector<internal::Line> lines_; | 885 std::vector<internal::Line> lines_; |
878 | 886 |
879 DISALLOW_COPY_AND_ASSIGN(RenderText); | 887 DISALLOW_COPY_AND_ASSIGN(RenderText); |
880 }; | 888 }; |
881 | 889 |
882 } // namespace gfx | 890 } // namespace gfx |
883 | 891 |
884 #endif // UI_GFX_RENDER_TEXT_H_ | 892 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |