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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 419753002: Prepare to enable RenderTextHarfBuzz by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reorder definition Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/render_text_harfbuzz.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « ui/gfx/render_text_harfbuzz.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698