diff options
author | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-26 16:20:29 +0000 |
---|---|---|
committer | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-26 16:20:29 +0000 |
commit | e79cec23720b7351ecba492b9bcad237cb13f17e (patch) | |
tree | 7b4f3233c26431a348666a7d8a985b52ace2a800 /ui/gfx/render_text_harfbuzz.cc | |
parent | 1889fa6d9f1519b73bc6c77d87f530754cb426e9 (diff) | |
download | chromium_src-e79cec23720b7351ecba492b9bcad237cb13f17e.zip chromium_src-e79cec23720b7351ecba492b9bcad237cb13f17e.tar.gz chromium_src-e79cec23720b7351ecba492b9bcad237cb13f17e.tar.bz2 |
Prepare to enable RenderTextHarfBuzz by default
- Fix and partially disable the RenderText unit tests to make sure RenderTextHarfBuzz passes the tests. Call EnsureLayout() in GetGlyphBounds() since it has been made public by r252873.
- Add a "--disable-harfbuzz-rendertext" switch to make enabling RTHB by default easier.
BUG=321868
NOTRY=true
Review URL: https://codereview.chromium.org/419753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_harfbuzz.cc')
-rw-r--r-- | ui/gfx/render_text_harfbuzz.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index 2fcf157..0e5f76f 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)); |