Chromium Code Reviews| Index: ui/gfx/render_text_harfbuzz.h |
| diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h |
| index d3495255547ec684033a34122ad4be3b34259f86..8d62dd71f0f5d7de771104b5aa351ec6b5ff0abf 100644 |
| --- a/ui/gfx/render_text_harfbuzz.h |
| +++ b/ui/gfx/render_text_harfbuzz.h |
| @@ -53,11 +53,17 @@ struct GFX_EXPORT TextRunHarfBuzz { |
| void GetClusterAt(size_t pos, Range* chars, Range* glyphs) const; |
| // Returns the grapheme bounds at |text_index|. Handles multi-grapheme glyphs. |
| - RangeF GetGraphemeBounds(RenderTextHarfBuzz* render_text, size_t text_index); |
| + RangeF GetGraphemeBounds(RenderTextHarfBuzz* render_text, |
| + size_t text_index) const; |
| // Returns whether the given shaped run contains any missing glyphs. |
| bool HasMissingGlyphs() const; |
| + // Returns the width of the given |char_range| handling grapheme boundaries |
|
msw
2016/12/19 22:27:43
nit: it'd be nice if this were adjacent to GetGrap
karandeepb
2016/12/21 14:23:44
Now they are adjacent. Removed HasMissingGlyphs wh
|
| + // within glyphs. |
| + float GetGraphemeWidthForCharRange(RenderTextHarfBuzz* render_text, |
| + const Range& char_range) const; |
| + |
| // Returns the glyph width for the given character range. |char_range| is in |
| // text-space (0 corresponds to |GetDisplayText()[0]|). |
| SkScalar GetGlyphWidthForCharRange(const Range& char_range) const; |
| @@ -193,7 +199,20 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText { |
| // Return the run index that contains the argument; or the length of the |
| // |runs_| vector if argument exceeds the text length or width. |
| size_t GetRunContainingCaret(const SelectionModel& caret); |
| - size_t GetRunContainingXCoord(float x, float* offset) const; |
| + |
| + // Returns the line index for the given argument. |text_y| is relative to |
| + // the text bounds. Returns -1 if |text_y| is above the text and |
| + // lines().size() if |text_y| is below it. |
| + int GetLineContainingYCoord(float text_y); |
| + |
| + // Returns the line segment index for the |line|, |text_x| pair. |text_x| is |
| + // relative to text in the given line. Returns -1 if |text_x| is to the left |
| + // of text in the line and |line|.segments.size() if it's to the right. |
| + // |offset_relative_segment| will contain the offset of |text_x| relative to |
| + // the start of the segment it is contained in. |
| + int GetLineSegmentContainingXCoord(const internal::Line& line, |
| + float text_x, |
| + float* offset_relative_segment); |
| // Given a |run|, returns the SelectionModel that contains the logical first |
| // or last caret position inside (not at a boundary of) the run. |