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 "ScriptRunIterator.h" | 5 #include "ScriptRunIterator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "platform/text/ICUError.h" | 8 #include "platform/text/ICUError.h" |
9 #include "platform/wtf/Threading.h" | 9 #include "platform/wtf/Threading.h" |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 size_t length, | 117 size_t length, |
118 const ScriptData* data) | 118 const ScriptData* data) |
119 : text_(text), | 119 : text_(text), |
120 length_(length), | 120 length_(length), |
121 brackets_fixup_depth_(0), | 121 brackets_fixup_depth_(0), |
122 // The initial value of m_aheadCharacter is not used. | 122 // The initial value of m_aheadCharacter is not used. |
123 ahead_character_(0), | 123 ahead_character_(0), |
124 ahead_pos_(0), | 124 ahead_pos_(0), |
125 common_preferred_(USCRIPT_COMMON), | 125 common_preferred_(USCRIPT_COMMON), |
126 script_data_(data) { | 126 script_data_(data) { |
127 ASSERT(text); | 127 DCHECK(text); |
128 ASSERT(data); | 128 DCHECK(data); |
129 | 129 |
130 if (ahead_pos_ < length_) { | 130 if (ahead_pos_ < length_) { |
131 current_set_.Clear(); | 131 current_set_.Clear(); |
132 // Priming the m_currentSet with USCRIPT_COMMON here so that the first | 132 // Priming the m_currentSet with USCRIPT_COMMON here so that the first |
133 // resolution between m_currentSet and m_nextSet in mergeSets() leads to | 133 // resolution between m_currentSet and m_nextSet in mergeSets() leads to |
134 // chosing the script of the first consumed character. | 134 // chosing the script of the first consumed character. |
135 current_set_.push_back(USCRIPT_COMMON); | 135 current_set_.push_back(USCRIPT_COMMON); |
136 U16_NEXT(text_, ahead_pos_, length_, ahead_character_); | 136 U16_NEXT(text_, ahead_pos_, length_, ahead_character_); |
137 script_data_->GetScripts(ahead_character_, ahead_set_); | 137 script_data_->GetScripts(ahead_character_, ahead_set_); |
138 } | 138 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 356 } |
357 return true; | 357 return true; |
358 } | 358 } |
359 | 359 |
360 UScriptCode ScriptRunIterator::ResolveCurrentScript() const { | 360 UScriptCode ScriptRunIterator::ResolveCurrentScript() const { |
361 UScriptCode result = current_set_.at(0); | 361 UScriptCode result = current_set_.at(0); |
362 return result == USCRIPT_COMMON ? common_preferred_ : result; | 362 return result == USCRIPT_COMMON ? common_preferred_ : result; |
363 } | 363 } |
364 | 364 |
365 } // namespace blink | 365 } // namespace blink |
OLD | NEW |