| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/fonts/shaping/RunSegmenter.h" | 5 #include "platform/fonts/shaping/RunSegmenter.h" |
| 6 | 6 |
| 7 #include "platform/fonts/ScriptRunIterator.h" | 7 #include "platform/fonts/ScriptRunIterator.h" |
| 8 #include "platform/fonts/SmallCapsIterator.h" | 8 #include "platform/fonts/SmallCapsIterator.h" |
| 9 #include "platform/fonts/SymbolsIterator.h" | 9 #include "platform/fonts/SymbolsIterator.h" |
| 10 #include "platform/fonts/UTF16TextIterator.h" | 10 #include "platform/fonts/UTF16TextIterator.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 symbols_iterator_(WTF::MakeUnique<SymbolsIterator>(buffer, buffer_size)), | 30 symbols_iterator_(WTF::MakeUnique<SymbolsIterator>(buffer, buffer_size)), |
| 31 last_split_(0), | 31 last_split_(0), |
| 32 script_run_iterator_position_(0), | 32 script_run_iterator_position_(0), |
| 33 orientation_iterator_position_( | 33 orientation_iterator_position_( |
| 34 run_orientation == FontOrientation::kVerticalMixed ? 0 | 34 run_orientation == FontOrientation::kVerticalMixed ? 0 |
| 35 : buffer_size_), | 35 : buffer_size_), |
| 36 symbols_iterator_position_(0), | 36 symbols_iterator_position_(0), |
| 37 at_end_(false) {} | 37 at_end_(false) {} |
| 38 | 38 |
| 39 void RunSegmenter::ConsumeScriptIteratorPastLastSplit() { | 39 void RunSegmenter::ConsumeScriptIteratorPastLastSplit() { |
| 40 ASSERT(script_run_iterator_); | 40 DCHECK(script_run_iterator_); |
| 41 if (script_run_iterator_position_ <= last_split_ && | 41 if (script_run_iterator_position_ <= last_split_ && |
| 42 script_run_iterator_position_ < buffer_size_) { | 42 script_run_iterator_position_ < buffer_size_) { |
| 43 while (script_run_iterator_->Consume(script_run_iterator_position_, | 43 while (script_run_iterator_->Consume(script_run_iterator_position_, |
| 44 candidate_range_.script)) { | 44 candidate_range_.script)) { |
| 45 if (script_run_iterator_position_ > last_split_) | 45 if (script_run_iterator_position_ > last_split_) |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void RunSegmenter::ConsumeOrientationIteratorPastLastSplit() { | 51 void RunSegmenter::ConsumeOrientationIteratorPastLastSplit() { |
| 52 if (orientation_iterator_ && orientation_iterator_position_ <= last_split_ && | 52 if (orientation_iterator_ && orientation_iterator_position_ <= last_split_ && |
| 53 orientation_iterator_position_ < buffer_size_) { | 53 orientation_iterator_position_ < buffer_size_) { |
| 54 while ( | 54 while ( |
| 55 orientation_iterator_->Consume(&orientation_iterator_position_, | 55 orientation_iterator_->Consume(&orientation_iterator_position_, |
| 56 &candidate_range_.render_orientation)) { | 56 &candidate_range_.render_orientation)) { |
| 57 if (orientation_iterator_position_ > last_split_) | 57 if (orientation_iterator_position_ > last_split_) |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void RunSegmenter::ConsumeSymbolsIteratorPastLastSplit() { | 63 void RunSegmenter::ConsumeSymbolsIteratorPastLastSplit() { |
| 64 ASSERT(symbols_iterator_); | 64 DCHECK(symbols_iterator_); |
| 65 if (symbols_iterator_position_ <= last_split_ && | 65 if (symbols_iterator_position_ <= last_split_ && |
| 66 symbols_iterator_position_ < buffer_size_) { | 66 symbols_iterator_position_ < buffer_size_) { |
| 67 while ( | 67 while ( |
| 68 symbols_iterator_->Consume(&symbols_iterator_position_, | 68 symbols_iterator_->Consume(&symbols_iterator_position_, |
| 69 &candidate_range_.font_fallback_priority)) { | 69 &candidate_range_.font_fallback_priority)) { |
| 70 if (symbols_iterator_position_ > last_split_) | 70 if (symbols_iterator_position_ > last_split_) |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 } | 74 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 98 | 98 |
| 99 candidate_range_.start = candidate_range_.end; | 99 candidate_range_.start = candidate_range_.end; |
| 100 candidate_range_.end = last_split_; | 100 candidate_range_.end = last_split_; |
| 101 *next_range = candidate_range_; | 101 *next_range = candidate_range_; |
| 102 | 102 |
| 103 at_end_ = last_split_ == buffer_size_; | 103 at_end_ = last_split_ == buffer_size_; |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |