| 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" |
| 11 #include "platform/text/Character.h" | 11 #include "platform/text/Character.h" |
| 12 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
| 13 #include "wtf/PtrUtil.h" | 13 #include "wtf/PtrUtil.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 RunSegmenter::RunSegmenter(const UChar* buffer, | 17 RunSegmenter::RunSegmenter(const UChar* buffer, |
| 18 unsigned bufferSize, | 18 unsigned bufferSize, |
| 19 FontOrientation runOrientation) | 19 FontOrientation runOrientation) |
| 20 : m_bufferSize(bufferSize), | 20 : m_bufferSize(bufferSize), |
| 21 m_candidateRange({0, 0, USCRIPT_INVALID_CODE, | 21 m_candidateRange({0, 0, USCRIPT_INVALID_CODE, |
| 22 OrientationIterator::OrientationKeep, | 22 OrientationIterator::OrientationKeep, |
| 23 FontFallbackPriority::Text}), | 23 FontFallbackPriority::Text}), |
| 24 m_scriptRunIterator(makeUnique<ScriptRunIterator>(buffer, bufferSize)), | 24 m_scriptRunIterator( |
| 25 WTF::makeUnique<ScriptRunIterator>(buffer, bufferSize)), |
| 25 m_orientationIterator( | 26 m_orientationIterator( |
| 26 runOrientation == FontOrientation::VerticalMixed | 27 runOrientation == FontOrientation::VerticalMixed |
| 27 ? wrapUnique( | 28 ? WTF::wrapUnique( |
| 28 new OrientationIterator(buffer, bufferSize, runOrientation)) | 29 new OrientationIterator(buffer, bufferSize, runOrientation)) |
| 29 : nullptr), | 30 : nullptr), |
| 30 m_symbolsIterator(makeUnique<SymbolsIterator>(buffer, bufferSize)), | 31 m_symbolsIterator(WTF::makeUnique<SymbolsIterator>(buffer, bufferSize)), |
| 31 m_lastSplit(0), | 32 m_lastSplit(0), |
| 32 m_scriptRunIteratorPosition(0), | 33 m_scriptRunIteratorPosition(0), |
| 33 m_orientationIteratorPosition( | 34 m_orientationIteratorPosition( |
| 34 runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize), | 35 runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize), |
| 35 m_symbolsIteratorPosition(0), | 36 m_symbolsIteratorPosition(0), |
| 36 m_atEnd(false) {} | 37 m_atEnd(false) {} |
| 37 | 38 |
| 38 void RunSegmenter::consumeScriptIteratorPastLastSplit() { | 39 void RunSegmenter::consumeScriptIteratorPastLastSplit() { |
| 39 ASSERT(m_scriptRunIterator); | 40 ASSERT(m_scriptRunIterator); |
| 40 if (m_scriptRunIteratorPosition <= m_lastSplit && | 41 if (m_scriptRunIteratorPosition <= m_lastSplit && |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 m_candidateRange.start = m_candidateRange.end; | 97 m_candidateRange.start = m_candidateRange.end; |
| 97 m_candidateRange.end = m_lastSplit; | 98 m_candidateRange.end = m_lastSplit; |
| 98 *nextRange = m_candidateRange; | 99 *nextRange = m_candidateRange; |
| 99 | 100 |
| 100 m_atEnd = m_lastSplit == m_bufferSize; | 101 m_atEnd = m_lastSplit == m_bufferSize; |
| 101 return true; | 102 return true; |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |