OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/render_text_harfbuzz.h" | 5 #include "ui/gfx/render_text_harfbuzz.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/i18n/bidi_line_iterator.h" | 10 #include "base/i18n/bidi_line_iterator.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 pos = begin; | 624 pos = begin; |
625 break; | 625 break; |
626 } | 626 } |
627 pos = iter.pos() - iter.GetString().length(); | 627 pos = iter.pos() - iter.GetString().length(); |
628 } | 628 } |
629 } | 629 } |
630 } | 630 } |
631 return SelectionModel(pos, CURSOR_FORWARD); | 631 return SelectionModel(pos, CURSOR_FORWARD); |
632 } | 632 } |
633 | 633 |
634 Range RenderTextHarfBuzz::GetGlyphBounds(size_t index) { | 634 Range RenderTextHarfBuzz::GetGlyphBounds(size_t index) { |
msw
2014/07/26 02:54:14
nit: reorder this definition to match its declarat
ckocagil
2014/07/26 03:55:59
Done.
| |
635 EnsureLayout(); | |
635 const size_t run_index = | 636 const size_t run_index = |
636 GetRunContainingCaret(SelectionModel(index, CURSOR_FORWARD)); | 637 GetRunContainingCaret(SelectionModel(index, CURSOR_FORWARD)); |
637 // Return edge bounds if the index is invalid or beyond the layout text size. | 638 // Return edge bounds if the index is invalid or beyond the layout text size. |
638 if (run_index >= runs_.size()) | 639 if (run_index >= runs_.size()) |
639 return Range(GetStringSize().width()); | 640 return Range(GetStringSize().width()); |
640 const size_t layout_index = TextIndexToLayoutIndex(index); | 641 const size_t layout_index = TextIndexToLayoutIndex(index); |
641 return Range(runs_[run_index]->GetGlyphXBoundary(layout_index, false), | 642 return Range(runs_[run_index]->GetGlyphXBoundary(layout_index, false), |
642 runs_[run_index]->GetGlyphXBoundary(layout_index, true)); | 643 runs_[run_index]->GetGlyphXBoundary(layout_index, true)); |
643 } | 644 } |
644 | 645 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 run->positions[i].set(run->width + x_offset, -y_offset); | 1038 run->positions[i].set(run->width + x_offset, -y_offset); |
1038 run->width += | 1039 run->width += |
1039 SkScalarRoundToInt(SkFixedToScalar(hb_positions[i].x_advance)); | 1040 SkScalarRoundToInt(SkFixedToScalar(hb_positions[i].x_advance)); |
1040 } | 1041 } |
1041 | 1042 |
1042 hb_buffer_destroy(buffer); | 1043 hb_buffer_destroy(buffer); |
1043 hb_font_destroy(harfbuzz_font); | 1044 hb_font_destroy(harfbuzz_font); |
1044 } | 1045 } |
1045 | 1046 |
1046 } // namespace gfx | 1047 } // namespace gfx |
OLD | NEW |