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 "platform/text/ICUError.h" | 7 #include "platform/text/ICUError.h" |
8 #include "wtf/Threading.h" | 8 #include "wtf/Threading.h" |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (it->ch == target) { | 193 if (it->ch == target) { |
194 // Have a match, use open paren's resolved script. | 194 // Have a match, use open paren's resolved script. |
195 UScriptCode script = it->script; | 195 UScriptCode script = it->script; |
196 m_nextSet.clear(); | 196 m_nextSet.clear(); |
197 m_nextSet.push_back(script); | 197 m_nextSet.push_back(script); |
198 | 198 |
199 // And pop stack to this point. | 199 // And pop stack to this point. |
200 int numPopped = std::distance(m_brackets.rbegin(), it); | 200 int numPopped = std::distance(m_brackets.rbegin(), it); |
201 // TODO: No resize operation in WTF::Deque? | 201 // TODO: No resize operation in WTF::Deque? |
202 for (int i = 0; i < numPopped; ++i) | 202 for (int i = 0; i < numPopped; ++i) |
203 m_brackets.removeLast(); | 203 m_brackets.pop_back(); |
204 m_bracketsFixupDepth = | 204 m_bracketsFixupDepth = |
205 std::max(static_cast<size_t>(0), m_bracketsFixupDepth - numPopped); | 205 std::max(static_cast<size_t>(0), m_bracketsFixupDepth - numPopped); |
206 return; | 206 return; |
207 } | 207 } |
208 } | 208 } |
209 } | 209 } |
210 // leave stack alone, no match | 210 // leave stack alone, no match |
211 } | 211 } |
212 | 212 |
213 // Keep items in m_currentSet that are in m_nextSet. | 213 // Keep items in m_currentSet that are in m_nextSet. |
(...skipping 141 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 |