| 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 "OrientationIterator.h" | 5 #include "OrientationIterator.h" |
| 6 | 6 |
| 7 #include "wtf/PtrUtil.h" | 7 #include "wtf/PtrUtil.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 OrientationIterator::OrientationIterator(const UChar* buffer, | 11 OrientationIterator::OrientationIterator(const UChar* buffer, |
| 12 unsigned bufferSize, | 12 unsigned bufferSize, |
| 13 FontOrientation runOrientation) | 13 FontOrientation runOrientation) |
| 14 : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))), | 14 : m_utf16Iterator(makeUnique<UTF16TextIterator>(buffer, bufferSize)), |
| 15 m_bufferSize(bufferSize), | 15 m_bufferSize(bufferSize), |
| 16 m_atEnd(bufferSize == 0) { | 16 m_atEnd(bufferSize == 0) { |
| 17 // There's not much point in segmenting by isUprightInVertical if the text | 17 // There's not much point in segmenting by isUprightInVertical if the text |
| 18 // orientation is not "mixed". | 18 // orientation is not "mixed". |
| 19 ASSERT(runOrientation == FontOrientation::VerticalMixed); | 19 ASSERT(runOrientation == FontOrientation::VerticalMixed); |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool OrientationIterator::consume(unsigned* orientationLimit, | 22 bool OrientationIterator::consume(unsigned* orientationLimit, |
| 23 RenderOrientation* renderOrientation) { | 23 RenderOrientation* renderOrientation) { |
| 24 if (m_atEnd) | 24 if (m_atEnd) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 } | 43 } |
| 44 m_utf16Iterator->advance(); | 44 m_utf16Iterator->advance(); |
| 45 } | 45 } |
| 46 *orientationLimit = m_bufferSize; | 46 *orientationLimit = m_bufferSize; |
| 47 *renderOrientation = currentRenderOrientation; | 47 *renderOrientation = currentRenderOrientation; |
| 48 m_atEnd = true; | 48 m_atEnd = true; |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |