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

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

Issue 2639493002: MacViews: Enable word lookup for selectable views::Labels and multi-line text. (Closed)
Patch Set: Address nits. Created 3 years, 11 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
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // platform-dependent and environment-dependent. Otherwise multiline test 190 // platform-dependent and environment-dependent. Otherwise multiline test
191 // will become really flaky. 191 // will become really flaky.
192 void set_glyph_width_for_test(float test_width) { 192 void set_glyph_width_for_test(float test_width) {
193 glyph_width_for_test_ = test_width; 193 glyph_width_for_test_ = test_width;
194 } 194 }
195 195
196 // Return the run index that contains the argument; or the length of the 196 // Return the run index that contains the argument; or the length of the
197 // |runs_| vector if argument exceeds the text length or width. 197 // |runs_| vector if argument exceeds the text length or width.
198 size_t GetRunContainingCaret(const SelectionModel& caret); 198 size_t GetRunContainingCaret(const SelectionModel& caret);
199 199
200 // Returns the line index for the given argument. |text_y| is relative to
201 // the text bounds. Returns -1 if |text_y| is above the text and
202 // lines().size() if |text_y| is below it.
203 int GetLineContainingYCoord(float text_y);
204
205 // Returns the line segment index for the |line|, |text_x| pair. |text_x| is
206 // relative to text in the given line. Returns -1 if |text_x| is to the left
207 // of text in the line and |line|.segments.size() if it's to the right.
208 // |offset_relative_segment| will contain the offset of |text_x| relative to
209 // the start of the segment it is contained in.
210 int GetLineSegmentContainingXCoord(const internal::Line& line,
211 float text_x,
212 float* offset_relative_segment);
213
214 // Given a |run|, returns the SelectionModel that contains the logical first 200 // Given a |run|, returns the SelectionModel that contains the logical first
215 // or last caret position inside (not at a boundary of) the run. 201 // or last caret position inside (not at a boundary of) the run.
216 // The returned value represents a cursor/caret position without a selection. 202 // The returned value represents a cursor/caret position without a selection.
217 SelectionModel FirstSelectionModelInsideRun( 203 SelectionModel FirstSelectionModelInsideRun(
218 const internal::TextRunHarfBuzz* run); 204 const internal::TextRunHarfBuzz* run);
219 SelectionModel LastSelectionModelInsideRun( 205 SelectionModel LastSelectionModelInsideRun(
220 const internal::TextRunHarfBuzz* run); 206 const internal::TextRunHarfBuzz* run);
221 207
222 // Break the text into logical runs and populate the visual <-> logical maps 208 // Break the text into logical runs and populate the visual <-> logical maps
223 // into |run_list_out|. 209 // into |run_list_out|.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 266
281 // Fixed width of glyphs. This should only be set in test environments. 267 // Fixed width of glyphs. This should only be set in test environments.
282 float glyph_width_for_test_; 268 float glyph_width_for_test_;
283 269
284 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); 270 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
285 }; 271 };
286 272
287 } // namespace gfx 273 } // namespace gfx
288 274
289 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 275 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698