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(nullRange()), |
22 OrientationIterator::OrientationKeep, | |
23 FontFallbackPriority::Text}), | |
24 m_scriptRunIterator( | 22 m_scriptRunIterator( |
25 WTF::makeUnique<ScriptRunIterator>(buffer, bufferSize)), | 23 WTF::makeUnique<ScriptRunIterator>(buffer, bufferSize)), |
26 m_orientationIterator( | 24 m_orientationIterator( |
27 runOrientation == FontOrientation::VerticalMixed | 25 runOrientation == FontOrientation::VerticalMixed |
28 ? WTF::wrapUnique( | 26 ? WTF::wrapUnique( |
29 new OrientationIterator(buffer, bufferSize, runOrientation)) | 27 new OrientationIterator(buffer, bufferSize, runOrientation)) |
30 : nullptr), | 28 : nullptr), |
31 m_symbolsIterator(WTF::makeUnique<SymbolsIterator>(buffer, bufferSize)), | 29 m_symbolsIterator(WTF::makeUnique<SymbolsIterator>(buffer, bufferSize)), |
32 m_lastSplit(0), | 30 m_lastSplit(0), |
33 m_scriptRunIteratorPosition(0), | 31 m_scriptRunIteratorPosition(0), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 94 |
97 m_candidateRange.start = m_candidateRange.end; | 95 m_candidateRange.start = m_candidateRange.end; |
98 m_candidateRange.end = m_lastSplit; | 96 m_candidateRange.end = m_lastSplit; |
99 *nextRange = m_candidateRange; | 97 *nextRange = m_candidateRange; |
100 | 98 |
101 m_atEnd = m_lastSplit == m_bufferSize; | 99 m_atEnd = m_lastSplit == m_bufferSize; |
102 return true; | 100 return true; |
103 } | 101 } |
104 | 102 |
105 } // namespace blink | 103 } // namespace blink |
OLD | NEW |