OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HARFBUZZ_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "third_party/harfbuzz-ng/src/hb.h" | 10 #include "third_party/harfbuzz-ng/src/hb.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; | 85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; |
86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; | 86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; |
87 virtual bool IsValidCursorIndex(size_t index) OVERRIDE; | 87 virtual bool IsValidCursorIndex(size_t index) OVERRIDE; |
88 virtual void ResetLayout() OVERRIDE; | 88 virtual void ResetLayout() OVERRIDE; |
89 virtual void EnsureLayout() OVERRIDE; | 89 virtual void EnsureLayout() OVERRIDE; |
90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; | 90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; |
91 | 91 |
92 private: | 92 private: |
93 friend class RenderTextTest; | 93 friend class RenderTextTest; |
94 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection); | 94 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection); |
| 95 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks); |
95 | 96 |
96 // Return the run index that contains the argument; or the length of the | 97 // Return the run index that contains the argument; or the length of the |
97 // |runs_| vector if argument exceeds the text length or width. | 98 // |runs_| vector if argument exceeds the text length or width. |
98 size_t GetRunContainingCaret(const SelectionModel& caret) const; | 99 size_t GetRunContainingCaret(const SelectionModel& caret) const; |
99 size_t GetRunContainingXCoord(int x, int* offset) const; | 100 size_t GetRunContainingXCoord(int x, int* offset) const; |
100 | 101 |
101 // Given a |run|, returns the SelectionModel that contains the logical first | 102 // Given a |run|, returns the SelectionModel that contains the logical first |
102 // or last caret position inside (not at a boundary of) the run. | 103 // or last caret position inside (not at a boundary of) the run. |
103 // The returned value represents a cursor/caret position without a selection. | 104 // The returned value represents a cursor/caret position without a selection. |
104 SelectionModel FirstSelectionModelInsideRun( | 105 SelectionModel FirstSelectionModelInsideRun( |
(...skipping 15 matching lines...) Expand all Loading... |
120 std::vector<int32_t> logical_to_visual_; | 121 std::vector<int32_t> logical_to_visual_; |
121 | 122 |
122 bool needs_layout_; | 123 bool needs_layout_; |
123 | 124 |
124 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); | 125 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); |
125 }; | 126 }; |
126 | 127 |
127 } // namespace gfx | 128 } // namespace gfx |
128 | 129 |
129 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 130 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
OLD | NEW |