| 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 <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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |