| 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 <limits> | 7 #include <limits> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/i18n/bidi_line_iterator.h" | 10 #include "base/i18n/bidi_line_iterator.h" |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 } | 838 } |
| 839 if (offset < end) { | 839 if (offset < end) { |
| 840 return SelectionModel(DisplayIndexToTextIndex( | 840 return SelectionModel(DisplayIndexToTextIndex( |
| 841 run.glyph_to_char[i] + (run.is_rtl ? 0 : 1)), | 841 run.glyph_to_char[i] + (run.is_rtl ? 0 : 1)), |
| 842 (run.is_rtl ? CURSOR_FORWARD : CURSOR_BACKWARD)); | 842 (run.is_rtl ? CURSOR_FORWARD : CURSOR_BACKWARD)); |
| 843 } | 843 } |
| 844 } | 844 } |
| 845 return EdgeSelectionModel(CURSOR_RIGHT); | 845 return EdgeSelectionModel(CURSOR_RIGHT); |
| 846 } | 846 } |
| 847 | 847 |
| 848 bool RenderTextHarfBuzz::IsSelectionSupported() const { |
| 849 // Todo(karandeepb): Support multi-line text selection. |
| 850 return !multiline(); |
| 851 } |
| 852 |
| 848 std::vector<RenderText::FontSpan> RenderTextHarfBuzz::GetFontSpansForTesting() { | 853 std::vector<RenderText::FontSpan> RenderTextHarfBuzz::GetFontSpansForTesting() { |
| 849 EnsureLayout(); | 854 EnsureLayout(); |
| 850 | 855 |
| 851 internal::TextRunList* run_list = GetRunList(); | 856 internal::TextRunList* run_list = GetRunList(); |
| 852 std::vector<RenderText::FontSpan> spans; | 857 std::vector<RenderText::FontSpan> spans; |
| 853 for (auto* run : run_list->runs()) { | 858 for (auto* run : run_list->runs()) { |
| 854 spans.push_back(RenderText::FontSpan( | 859 spans.push_back(RenderText::FontSpan( |
| 855 run->font, Range(DisplayIndexToTextIndex(run->range.start()), | 860 run->font, Range(DisplayIndexToTextIndex(run->range.start()), |
| 856 DisplayIndexToTextIndex(run->range.end())))); | 861 DisplayIndexToTextIndex(run->range.end())))); |
| 857 } | 862 } |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 | 1626 |
| 1622 attribute.strike = run.strike; | 1627 attribute.strike = run.strike; |
| 1623 attribute.diagonal_strike = run.diagonal_strike; | 1628 attribute.diagonal_strike = run.diagonal_strike; |
| 1624 decorated_text->attributes.push_back(attribute); | 1629 decorated_text->attributes.push_back(attribute); |
| 1625 } | 1630 } |
| 1626 } | 1631 } |
| 1627 return true; | 1632 return true; |
| 1628 } | 1633 } |
| 1629 | 1634 |
| 1630 } // namespace gfx | 1635 } // namespace gfx |
| OLD | NEW |