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

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: Address Mukai's comments. 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 applicable to |position| (at or preceeding |position|).
119 typedef ScopedVector<TextRunHarfBuzz>::const_iterator TextRunHarfBuzzIter;
120 TextRunHarfBuzzIter GetRunAt(size_t position) const;
121
118 private: 122 private:
119 // Text runs in logical order. 123 // Text runs in logical order.
120 ScopedVector<TextRunHarfBuzz> runs_; 124 ScopedVector<TextRunHarfBuzz> runs_;
121 125
122 // Maps visual run indices to logical run indices and vice versa. 126 // Maps visual run indices to logical run indices and vice versa.
123 std::vector<int32_t> visual_to_logical_; 127 std::vector<int32_t> visual_to_logical_;
124 std::vector<int32_t> logical_to_visual_; 128 std::vector<int32_t> logical_to_visual_;
125 129
126 float width_; 130 float width_;
127 131
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void OnLayoutTextAttributeChanged(bool text_changed) override; 165 void OnLayoutTextAttributeChanged(bool text_changed) override;
162 void OnDisplayTextAttributeChanged() override; 166 void OnDisplayTextAttributeChanged() override;
163 void EnsureLayout() override; 167 void EnsureLayout() override;
164 void DrawVisualText(Canvas* canvas) override; 168 void DrawVisualText(Canvas* canvas) override;
165 169
166 private: 170 private:
167 friend class RenderTextTest; 171 friend class RenderTextTest;
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);
175 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_LineBreakerBehavior);
171 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection); 176 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection);
172 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_HorizontalPositions); 177 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_HorizontalPositions);
173 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, 178 FRIEND_TEST_ALL_PREFIXES(RenderTextTest,
174 HarfBuzz_TextPositionWithFractionalSize); 179 HarfBuzz_TextPositionWithFractionalSize);
175 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks); 180 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks);
176 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji); 181 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji);
177 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemeCases); 182 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemeCases);
178 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemePartition); 183 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemePartition);
179 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_NonExistentFont); 184 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_NonExistentFont);
180 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback); 185 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 268
264 // Fixed width of glyphs. This should only be set in test environments. 269 // Fixed width of glyphs. This should only be set in test environments.
265 float glyph_width_for_test_; 270 float glyph_width_for_test_;
266 271
267 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); 272 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
268 }; 273 };
269 274
270 } // namespace gfx 275 } // namespace gfx
271 276
272 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 277 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698