Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: ui/gfx/render_text_harfbuzz.h

Issue 1070223004: Stop combining text runs which are connected by 'COMMON' blocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small glitches Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Initialize the index mapping. 108 // Initialize the index mapping.
109 void InitIndexMap(); 109 void InitIndexMap();
110 110
111 // Precomputes the offsets for all runs. 111 // Precomputes the offsets for all runs.
112 void ComputePrecedingRunWidths(); 112 void ComputePrecedingRunWidths();
113 113
114 // Get the total width of runs, as if they were shown on one line. 114 // Get the total width of runs, as if they were shown on one line.
115 // Do not use this when multiline is enabled. 115 // Do not use this when multiline is enabled.
116 float width() const { return width_; } 116 float width() const { return width_; }
117 117
118 // Get the run index applicable to |position| (at or preceeding |position|).
119 size_t GetRunIndexAt(size_t position) const;
120
118 private: 121 private:
119 // Text runs in logical order. 122 // Text runs in logical order.
120 ScopedVector<TextRunHarfBuzz> runs_; 123 ScopedVector<TextRunHarfBuzz> runs_;
121 124
122 // Maps visual run indices to logical run indices and vice versa. 125 // Maps visual run indices to logical run indices and vice versa.
123 std::vector<int32_t> visual_to_logical_; 126 std::vector<int32_t> visual_to_logical_;
124 std::vector<int32_t> logical_to_visual_; 127 std::vector<int32_t> logical_to_visual_;
125 128
126 float width_; 129 float width_;
127 130
(...skipping 30 matching lines...) Expand all
158 size_t TextIndexToDisplayIndex(size_t index) override; 161 size_t TextIndexToDisplayIndex(size_t index) override;
159 size_t DisplayIndexToTextIndex(size_t index) override; 162 size_t DisplayIndexToTextIndex(size_t index) override;
160 bool IsValidCursorIndex(size_t index) override; 163 bool IsValidCursorIndex(size_t index) override;
161 void OnLayoutTextAttributeChanged(bool text_changed) override; 164 void OnLayoutTextAttributeChanged(bool text_changed) override;
162 void OnDisplayTextAttributeChanged() override; 165 void OnDisplayTextAttributeChanged() override;
163 void EnsureLayout() override; 166 void EnsureLayout() override;
164 void DrawVisualText(Canvas* canvas) override; 167 void DrawVisualText(Canvas* canvas) override;
165 168
166 private: 169 private:
167 friend class RenderTextTest; 170 friend class RenderTextTest;
171 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_LineBreakerBehavior);
168 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_HorizontalAlignment); 172 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_HorizontalAlignment);
169 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); 173 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth);
170 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_WordWrapBehavior); 174 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_WordWrapBehavior);
171 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection); 175 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection);
172 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_HorizontalPositions); 176 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_HorizontalPositions);
173 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, 177 FRIEND_TEST_ALL_PREFIXES(RenderTextTest,
174 HarfBuzz_TextPositionWithFractionalSize); 178 HarfBuzz_TextPositionWithFractionalSize);
175 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks); 179 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks);
176 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji); 180 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji);
177 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemeCases); 181 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemeCases);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 267
264 // Fixed width of glyphs. This should only be set in test environments. 268 // Fixed width of glyphs. This should only be set in test environments.
265 float glyph_width_for_test_; 269 float glyph_width_for_test_;
266 270
267 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); 271 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
268 }; 272 };
269 273
270 } // namespace gfx 274 } // namespace gfx
271 275
272 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 276 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698