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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 static_cast<uint32_t>(FindValidBoundaryBefore(text_, end_pos))); | 467 static_cast<uint32_t>(FindValidBoundaryBefore(text_, end_pos))); |
468 if (end_pos != valid_end_pos) { | 468 if (end_pos != valid_end_pos) { |
469 end_pos = valid_end_pos; | 469 end_pos = valid_end_pos; |
470 width = run.GetGlyphWidthForCharRange( | 470 width = run.GetGlyphWidthForCharRange( |
471 Range(segment.char_range.start(), end_pos)); | 471 Range(segment.char_range.start(), end_pos)); |
472 } | 472 } |
473 | 473 |
474 // |max_width_| might be smaller than a single character. In this case we | 474 // |max_width_| might be smaller than a single character. In this case we |
475 // need to put at least one character in the line. Note that, we should | 475 // need to put at least one character in the line. Note that, we should |
476 // not separate surrogate pair or combining characters. | 476 // not separate surrogate pair or combining characters. |
477 // See RenderTextTest.Multiline_MinWidth for an example. | 477 // See RenderTextHarfBuzzTest.Multiline_MinWidth for an example. |
478 if (width == 0 && available_width_ == max_width_) { | 478 if (width == 0 && available_width_ == max_width_) { |
479 end_pos = std::min( | 479 end_pos = std::min( |
480 segment.char_range.end(), | 480 segment.char_range.end(), |
481 static_cast<uint32_t>(FindValidBoundaryAfter(text_, end_pos + 1))); | 481 static_cast<uint32_t>(FindValidBoundaryAfter(text_, end_pos + 1))); |
482 } | 482 } |
483 | 483 |
484 return end_pos; | 484 return end_pos; |
485 } | 485 } |
486 | 486 |
487 // Gets the glyph width for |word_range|, and splits the |word| into different | 487 // Gets the glyph width for |word_range|, and splits the |word| into different |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 DCHECK(!update_layout_run_list_); | 1584 DCHECK(!update_layout_run_list_); |
1585 DCHECK(!update_display_run_list_); | 1585 DCHECK(!update_display_run_list_); |
1586 return text_elided() ? display_run_list_.get() : &layout_run_list_; | 1586 return text_elided() ? display_run_list_.get() : &layout_run_list_; |
1587 } | 1587 } |
1588 | 1588 |
1589 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { | 1589 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { |
1590 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); | 1590 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); |
1591 } | 1591 } |
1592 | 1592 |
1593 } // namespace gfx | 1593 } // namespace gfx |
OLD | NEW |