| 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 "wtf/Threading.h" | 7 #include "wtf/Threading.h" |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 DEFINE_THREAD_SAFE_STATIC_LOCAL(const ICUScriptData, icuScriptDataInstance, | 110 DEFINE_THREAD_SAFE_STATIC_LOCAL(const ICUScriptData, icuScriptDataInstance, |
| 111 (new ICUScriptData())); | 111 (new ICUScriptData())); |
| 112 return &icuScriptDataInstance; | 112 return &icuScriptDataInstance; |
| 113 } | 113 } |
| 114 | 114 |
| 115 ScriptRunIterator::ScriptRunIterator(const UChar* text, | 115 ScriptRunIterator::ScriptRunIterator(const UChar* text, |
| 116 size_t length, | 116 size_t length, |
| 117 const ScriptData* data) | 117 const ScriptData* data) |
| 118 : m_text(text), | 118 : m_text(text), |
| 119 m_length(length), | 119 m_length(length), |
| 120 m_bracketsFixupDepth(0) | 120 m_bracketsFixupDepth(0), |
| 121 // The initial value of m_aheadCharacter is not used. | 121 // The initial value of m_aheadCharacter is not used. |
| 122 , | |
| 123 m_aheadCharacter(0), | 122 m_aheadCharacter(0), |
| 124 m_aheadPos(0), | 123 m_aheadPos(0), |
| 125 m_commonPreferred(USCRIPT_COMMON), | 124 m_commonPreferred(USCRIPT_COMMON), |
| 126 m_scriptData(data) { | 125 m_scriptData(data) { |
| 127 ASSERT(text); | 126 ASSERT(text); |
| 128 ASSERT(data); | 127 ASSERT(data); |
| 129 | 128 |
| 130 if (m_aheadPos < m_length) { | 129 if (m_aheadPos < m_length) { |
| 131 m_currentSet.clear(); | 130 m_currentSet.clear(); |
| 132 // Priming the m_currentSet with USCRIPT_COMMON here so that the first | 131 // Priming the m_currentSet with USCRIPT_COMMON here so that the first |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 } | 354 } |
| 356 return true; | 355 return true; |
| 357 } | 356 } |
| 358 | 357 |
| 359 UScriptCode ScriptRunIterator::resolveCurrentScript() const { | 358 UScriptCode ScriptRunIterator::resolveCurrentScript() const { |
| 360 UScriptCode result = m_currentSet.at(0); | 359 UScriptCode result = m_currentSet.at(0); |
| 361 return result == USCRIPT_COMMON ? m_commonPreferred : result; | 360 return result == USCRIPT_COMMON ? m_commonPreferred : result; |
| 362 } | 361 } |
| 363 | 362 |
| 364 } // namespace blink | 363 } // namespace blink |
| OLD | NEW |