Index: ui/gfx/render_text_harfbuzz.cc |
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc |
index 2fcf15711ff551377b09f42c903f9688eac29a5c..0e5f76f7215378303f1a537cf1fceaff3791c23e 100644 |
--- a/ui/gfx/render_text_harfbuzz.cc |
+++ b/ui/gfx/render_text_harfbuzz.cc |
@@ -536,6 +536,18 @@ std::vector<RenderText::FontSpan> RenderTextHarfBuzz::GetFontSpansForTesting() { |
return std::vector<RenderText::FontSpan>(); |
} |
+Range RenderTextHarfBuzz::GetGlyphBounds(size_t index) { |
+ EnsureLayout(); |
+ const size_t run_index = |
+ GetRunContainingCaret(SelectionModel(index, CURSOR_FORWARD)); |
+ // Return edge bounds if the index is invalid or beyond the layout text size. |
+ if (run_index >= runs_.size()) |
+ return Range(GetStringSize().width()); |
+ const size_t layout_index = TextIndexToLayoutIndex(index); |
+ return Range(runs_[run_index]->GetGlyphXBoundary(layout_index, false), |
+ runs_[run_index]->GetGlyphXBoundary(layout_index, true)); |
+} |
+ |
int RenderTextHarfBuzz::GetLayoutTextBaseline() { |
EnsureLayout(); |
return lines()[0].baseline; |
@@ -631,17 +643,6 @@ SelectionModel RenderTextHarfBuzz::AdjacentWordSelectionModel( |
return SelectionModel(pos, CURSOR_FORWARD); |
} |
-Range RenderTextHarfBuzz::GetGlyphBounds(size_t index) { |
- const size_t run_index = |
- GetRunContainingCaret(SelectionModel(index, CURSOR_FORWARD)); |
- // Return edge bounds if the index is invalid or beyond the layout text size. |
- if (run_index >= runs_.size()) |
- return Range(GetStringSize().width()); |
- const size_t layout_index = TextIndexToLayoutIndex(index); |
- return Range(runs_[run_index]->GetGlyphXBoundary(layout_index, false), |
- runs_[run_index]->GetGlyphXBoundary(layout_index, true)); |
-} |
- |
std::vector<Rect> RenderTextHarfBuzz::GetSubstringBounds(const Range& range) { |
DCHECK(!needs_layout_); |
DCHECK(Range(0, text().length()).Contains(range)); |