| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 // specifies the character range for which the corresponding font has been | 414 // specifies the character range for which the corresponding font has been |
| 415 // chosen. | 415 // chosen. |
| 416 virtual std::vector<FontSpan> GetFontSpansForTesting() = 0; | 416 virtual std::vector<FontSpan> GetFontSpansForTesting() = 0; |
| 417 | 417 |
| 418 // Gets the horizontal bounds (relative to the left of the text, not the view) | 418 // Gets the horizontal bounds (relative to the left of the text, not the view) |
| 419 // of the glyph starting at |index|. If the glyph is RTL then the returned | 419 // of the glyph starting at |index|. If the glyph is RTL then the returned |
| 420 // Range will have is_reversed() true. (This does not return a Rect because a | 420 // Range will have is_reversed() true. (This does not return a Rect because a |
| 421 // Rect can't have a negative width.) | 421 // Rect can't have a negative width.) |
| 422 virtual Range GetGlyphBounds(size_t index) = 0; | 422 virtual Range GetGlyphBounds(size_t index) = 0; |
| 423 | 423 |
| 424 const Vector2d& GetUpdatedDisplayOffset(); |
| 425 void SetDisplayOffset(const Vector2d& offset); |
| 426 |
| 424 protected: | 427 protected: |
| 425 RenderText(); | 428 RenderText(); |
| 426 | 429 |
| 427 const BreakList<SkColor>& colors() const { return colors_; } | 430 const BreakList<SkColor>& colors() const { return colors_; } |
| 428 const std::vector<BreakList<bool> >& styles() const { return styles_; } | 431 const std::vector<BreakList<bool> >& styles() const { return styles_; } |
| 429 | 432 |
| 430 const std::vector<internal::Line>& lines() const { return lines_; } | 433 const std::vector<internal::Line>& lines() const { return lines_; } |
| 431 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } | 434 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } |
| 432 | 435 |
| 433 // Returns the baseline of the current text. The return value depends on | 436 // Returns the baseline of the current text. The return value depends on |
| (...skipping 13 matching lines...) Expand all Loading... |
| 447 // then the baseline of FontA may be returned. If the text includes some | 450 // then the baseline of FontA may be returned. If the text includes some |
| 448 // characters which are laid out with FontB, then the baseline of FontB may | 451 // characters which are laid out with FontB, then the baseline of FontB may |
| 449 // be returned. | 452 // be returned. |
| 450 // | 453 // |
| 451 // GetBaseline() returns the fixed baseline regardless of the text. | 454 // GetBaseline() returns the fixed baseline regardless of the text. |
| 452 // GetLayoutTextBaseline() returns the baseline determined by the underlying | 455 // GetLayoutTextBaseline() returns the baseline determined by the underlying |
| 453 // layout engine, and it changes depending on the text. GetAlignmentOffset() | 456 // layout engine, and it changes depending on the text. GetAlignmentOffset() |
| 454 // returns the difference between them. | 457 // returns the difference between them. |
| 455 virtual int GetLayoutTextBaseline() = 0; | 458 virtual int GetLayoutTextBaseline() = 0; |
| 456 | 459 |
| 457 const Vector2d& GetUpdatedDisplayOffset(); | |
| 458 | |
| 459 void set_cached_bounds_and_offset_valid(bool valid) { | 460 void set_cached_bounds_and_offset_valid(bool valid) { |
| 460 cached_bounds_and_offset_valid_ = valid; | 461 cached_bounds_and_offset_valid_ = valid; |
| 461 } | 462 } |
| 462 | 463 |
| 463 // Get the selection model that visually neighbors |position| by |break_type|. | 464 // Get the selection model that visually neighbors |position| by |break_type|. |
| 464 // The returned value represents a cursor/caret position without a selection. | 465 // The returned value represents a cursor/caret position without a selection. |
| 465 SelectionModel GetAdjacentSelectionModel(const SelectionModel& current, | 466 SelectionModel GetAdjacentSelectionModel(const SelectionModel& current, |
| 466 BreakType break_type, | 467 BreakType break_type, |
| 467 VisualCursorDirection direction); | 468 VisualCursorDirection direction); |
| 468 | 469 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 // Lines computed by EnsureLayout. These should be invalidated with | 701 // Lines computed by EnsureLayout. These should be invalidated with |
| 701 // ResetLayout and on |display_rect_| changes. | 702 // ResetLayout and on |display_rect_| changes. |
| 702 std::vector<internal::Line> lines_; | 703 std::vector<internal::Line> lines_; |
| 703 | 704 |
| 704 DISALLOW_COPY_AND_ASSIGN(RenderText); | 705 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 705 }; | 706 }; |
| 706 | 707 |
| 707 } // namespace gfx | 708 } // namespace gfx |
| 708 | 709 |
| 709 #endif // UI_GFX_RENDER_TEXT_H_ | 710 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |