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 : m_text(text), | 119 : m_text(text), |
120 m_length(length), | 120 m_length(length), |
121 m_bracketsFixupDepth(0), | 121 m_bracketsFixupDepth(0), |
122 // The initial value of m_aheadCharacter is not used. | 122 // The initial value of m_aheadCharacter is not used. |
123 m_aheadCharacter(0), | 123 m_aheadCharacter(0), |
124 m_aheadPos(0), | 124 m_aheadPos(0), |
125 m_commonPreferred(USCRIPT_COMMON), | 125 m_commonPreferred(USCRIPT_COMMON), |
126 m_scriptData(data) { | 126 m_scriptData(data) { |
127 ASSERT(text); | 127 DCHECK(text); |
128 ASSERT(data); | 128 DCHECK(data); |
129 | 129 |
130 if (m_aheadPos < m_length) { | 130 if (m_aheadPos < m_length) { |
131 m_currentSet.clear(); | 131 m_currentSet.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 m_currentSet.push_back(USCRIPT_COMMON); | 135 m_currentSet.push_back(USCRIPT_COMMON); |
136 U16_NEXT(m_text, m_aheadPos, m_length, m_aheadCharacter); | 136 U16_NEXT(m_text, m_aheadPos, m_length, m_aheadCharacter); |
137 m_scriptData->getScripts(m_aheadCharacter, m_aheadSet); | 137 m_scriptData->getScripts(m_aheadCharacter, m_aheadSet); |
138 } | 138 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 return true; | 356 return true; |
357 } | 357 } |
358 | 358 |
359 UScriptCode ScriptRunIterator::resolveCurrentScript() const { | 359 UScriptCode ScriptRunIterator::resolveCurrentScript() const { |
360 UScriptCode result = m_currentSet.at(0); | 360 UScriptCode result = m_currentSet.at(0); |
361 return result == USCRIPT_COMMON ? m_commonPreferred : result; | 361 return result == USCRIPT_COMMON ? m_commonPreferred : result; |
362 } | 362 } |
363 | 363 |
364 } // namespace blink | 364 } // namespace blink |
OLD | NEW |