| 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 #ifndef RunSegmenter_h | 5 #ifndef RunSegmenter_h |
| 6 #define RunSegmenter_h | 6 #define RunSegmenter_h |
| 7 | 7 |
| 8 #include "platform/fonts/FontOrientation.h" | 8 #include "platform/fonts/FontOrientation.h" |
| 9 #include "platform/fonts/FontTraits.h" | 9 #include "platform/fonts/FontTraits.h" |
| 10 #include "platform/fonts/OrientationIterator.h" | 10 #include "platform/fonts/OrientationIterator.h" |
| 11 #include "platform/fonts/ScriptRunIterator.h" | 11 #include "platform/fonts/ScriptRunIterator.h" |
| 12 #include "platform/fonts/SmallCapsIterator.h" | 12 #include "platform/fonts/SmallCapsIterator.h" |
| 13 #include "platform/fonts/SymbolsIterator.h" |
| 13 #include "platform/fonts/UTF16TextIterator.h" | 14 #include "platform/fonts/UTF16TextIterator.h" |
| 14 #include "wtf/Allocator.h" | 15 #include "wtf/Allocator.h" |
| 15 #include "wtf/Noncopyable.h" | 16 #include "wtf/Noncopyable.h" |
| 16 | 17 |
| 17 #include <unicode/uscript.h> | 18 #include <unicode/uscript.h> |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 | 21 |
| 21 // A tool for segmenting runs prior to shaping, combining ScriptIterator, | 22 // A tool for segmenting runs prior to shaping, combining ScriptIterator, |
| 22 // OrientationIterator and SmallCapsIterator, depending on orientaton and | 23 // OrientationIterator and SmallCapsIterator, depending on orientaton and |
| 23 // font-variant of the text run. | 24 // font-variant of the text run. |
| 24 class PLATFORM_EXPORT RunSegmenter { | 25 class PLATFORM_EXPORT RunSegmenter { |
| 25 STACK_ALLOCATED(); | 26 STACK_ALLOCATED(); |
| 26 WTF_MAKE_NONCOPYABLE(RunSegmenter); | 27 WTF_MAKE_NONCOPYABLE(RunSegmenter); |
| 27 public: | 28 public: |
| 28 | 29 |
| 29 // Indices into the UTF-16 buffer that is passed in | 30 // Indices into the UTF-16 buffer that is passed in |
| 30 struct RunSegmenterRange { | 31 struct RunSegmenterRange { |
| 31 DISALLOW_NEW(); | 32 DISALLOW_NEW(); |
| 32 unsigned start; | 33 unsigned start; |
| 33 unsigned end; | 34 unsigned end; |
| 34 UScriptCode script; | 35 UScriptCode script; |
| 35 OrientationIterator::RenderOrientation renderOrientation; | 36 OrientationIterator::RenderOrientation renderOrientation; |
| 36 SmallCapsIterator::SmallCapsBehavior smallCapsBehavior; | 37 SmallCapsIterator::SmallCapsBehavior smallCapsBehavior; |
| 38 FontFallbackPriority fontFallbackPriority; |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrientation, Font
Variant); | 41 RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrientation, Font
Variant); |
| 40 | 42 |
| 41 bool consume(RunSegmenterRange*); | 43 bool consume(RunSegmenterRange*); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 | 46 |
| 45 void consumeOrientationIteratorPastLastSplit(); | 47 void consumeOrientationIteratorPastLastSplit(); |
| 46 void consumeSmallCapsIteratorPastLastSplit(); | 48 void consumeSmallCapsIteratorPastLastSplit(); |
| 47 void consumeScriptIteratorPastLastSplit(); | 49 void consumeScriptIteratorPastLastSplit(); |
| 50 void consumeSymbolsIteratorPastLastSplit(); |
| 48 | 51 |
| 49 unsigned m_bufferSize; | 52 unsigned m_bufferSize; |
| 50 RunSegmenterRange m_candidateRange; | 53 RunSegmenterRange m_candidateRange; |
| 51 OwnPtr<ScriptRunIterator> m_scriptRunIterator; | 54 OwnPtr<ScriptRunIterator> m_scriptRunIterator; |
| 52 OwnPtr<OrientationIterator> m_orientationIterator; | 55 OwnPtr<OrientationIterator> m_orientationIterator; |
| 53 OwnPtr<SmallCapsIterator> m_smallCapsIterator; | 56 OwnPtr<SmallCapsIterator> m_smallCapsIterator; |
| 57 OwnPtr<SymbolsIterator> m_symbolsIterator; |
| 54 unsigned m_lastSplit; | 58 unsigned m_lastSplit; |
| 55 unsigned m_scriptRunIteratorPosition; | 59 unsigned m_scriptRunIteratorPosition; |
| 56 unsigned m_orientationIteratorPosition; | 60 unsigned m_orientationIteratorPosition; |
| 57 unsigned m_smallCapsIteratorPosition; | 61 unsigned m_smallCapsIteratorPosition; |
| 62 unsigned m_symbolsIteratorPosition; |
| 58 bool m_atEnd; | 63 bool m_atEnd; |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace blink | 66 } // namespace blink |
| 62 | 67 |
| 63 #endif | 68 #endif |
| OLD | NEW |