Chromium Code Reviews| Index: ui/gfx/render_text_harfbuzz.cc |
| diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc |
| index d0b3dd7200278cbaadb91c086ddda01ec5a6638b..2b86469f34b309ca74390ff37d44391920c0dfbd 100644 |
| --- a/ui/gfx/render_text_harfbuzz.cc |
| +++ b/ui/gfx/render_text_harfbuzz.cc |
| @@ -1590,4 +1590,37 @@ const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { |
| return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); |
| } |
| +bool RenderTextHarfBuzz::GetDecoratedTextForRange( |
| + const Range& range, |
| + DecoratedText* decorated_text) const { |
| + if (obscured()) |
| + return false; |
| + |
| + decorated_text->attributes.clear(); |
| + decorated_text->text = GetTextFromRange(range); |
| + |
| + const internal::TextRunList* run_list = GetRunList(); |
| + for (size_t i = 0; i < run_list->size(); i++) { |
|
tapted
2016/09/26 02:02:31
What would be necessary to put this on the RenderT
karandeepb
2016/09/26 07:00:08
Yeah this seems plausible and may allow us to move
tapted
2016/09/26 08:07:26
DecoratedText could allow someone to apply multipl
karandeepb
2016/09/26 09:22:07
Oh ok, so basically providing a way for RenderText
|
| + const internal::TextRunHarfBuzz& run = *run_list->runs()[i]; |
| + |
| + const Range intersection = range.Intersect(run.range); |
| + DCHECK(!intersection.is_reversed()); |
| + |
| + if (!intersection.is_empty()) { |
| + // Get range relative to the decorated text. |
| + DecoratedText::RangedAttribute attribute( |
| + gfx::Range(intersection.start() - range.GetMin(), |
| + intersection.end() - range.GetMin()), |
| + run.font); |
| + attribute.weight = run.weight; |
| + attribute.underline = run.underline; |
| + attribute.italic = run.italic; |
| + attribute.strike = run.strike; |
| + attribute.diagonal_strike = run.diagonal_strike; |
| + decorated_text->attributes.push_back(attribute); |
| + } |
| + } |
| + return true; |
| +} |
| + |
| } // namespace gfx |