OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/editing/iterators/BackwardsTextBuffer.h" | 30 #include "core/editing/iterators/BackwardsTextBuffer.h" |
31 #include "core/editing/iterators/FullyClippedStateStack.h" | 31 #include "core/editing/iterators/FullyClippedStateStack.h" |
32 #include "core/editing/iterators/TextIteratorFlags.h" | 32 #include "core/editing/iterators/TextIteratorFlags.h" |
33 #include "platform/heap/Heap.h" | 33 #include "platform/heap/Heap.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 class LayoutText; | 37 class LayoutText; |
38 class LayoutTextFragment; | 38 class LayoutTextFragment; |
39 | 39 |
40 // Iterates through the DOM range, returning all the text, and 0-length boundari
es | 40 // Iterates through the DOM range, returning all the text, and 0-length |
41 // at points where replaced elements break up the text flow. The text comes back
in | 41 // boundaries at points where replaced elements break up the text flow. The text |
42 // chunks so as to optimize for performance of the iteration. | 42 // comes back in chunks so as to optimize for performance of the iteration. |
43 template <typename Strategy> | 43 template <typename Strategy> |
44 class CORE_TEMPLATE_CLASS_EXPORT SimplifiedBackwardsTextIteratorAlgorithm { | 44 class CORE_TEMPLATE_CLASS_EXPORT SimplifiedBackwardsTextIteratorAlgorithm { |
45 STACK_ALLOCATED(); | 45 STACK_ALLOCATED(); |
46 | 46 |
47 public: | 47 public: |
48 SimplifiedBackwardsTextIteratorAlgorithm( | 48 SimplifiedBackwardsTextIteratorAlgorithm( |
49 const PositionTemplate<Strategy>& start, | 49 const PositionTemplate<Strategy>& start, |
50 const PositionTemplate<Strategy>& end, | 50 const PositionTemplate<Strategy>& end, |
51 TextIteratorBehaviorFlags = TextIteratorDefaultBehavior); | 51 TextIteratorBehaviorFlags = TextIteratorDefaultBehavior); |
52 | 52 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool m_handledChildren; | 105 bool m_handledChildren; |
106 FullyClippedStateStackAlgorithm<Strategy> m_fullyClippedStack; | 106 FullyClippedStateStackAlgorithm<Strategy> m_fullyClippedStack; |
107 | 107 |
108 // End of the range. | 108 // End of the range. |
109 Member<Node> m_startNode; | 109 Member<Node> m_startNode; |
110 int m_startOffset; | 110 int m_startOffset; |
111 // Start of the range. | 111 // Start of the range. |
112 Member<Node> m_endNode; | 112 Member<Node> m_endNode; |
113 int m_endOffset; | 113 int m_endOffset; |
114 | 114 |
115 // The current text and its position, in the form to be returned from the iter
ator. | 115 // The current text and its position, in the form to be returned from the |
| 116 // iterator. |
116 Member<Node> m_positionNode; | 117 Member<Node> m_positionNode; |
117 int m_positionStartOffset; | 118 int m_positionStartOffset; |
118 int m_positionEndOffset; | 119 int m_positionEndOffset; |
119 | 120 |
120 String | 121 // We're interested in the range [m_textOffset, m_textOffset + m_textLength) |
121 m_textContainer; // We're interested in the range [m_textOffset, m_textOf
fset + m_textLength) of m_textContainer. | 122 // of m_textContainer. |
| 123 String m_textContainer; |
122 int m_textOffset; | 124 int m_textOffset; |
123 int m_textLength; | 125 int m_textLength; |
124 | 126 |
125 // Used for whitespace characters that aren't in the DOM, so we can point at t
hem. | 127 // Used for whitespace characters that aren't in the DOM, so we can point at |
| 128 // them. |
126 UChar m_singleCharacterBuffer; | 129 UChar m_singleCharacterBuffer; |
127 | 130 |
128 // Whether m_node has advanced beyond the iteration range (i.e. m_startNode). | 131 // Whether m_node has advanced beyond the iteration range (i.e. m_startNode). |
129 bool m_havePassedStartNode; | 132 bool m_havePassedStartNode; |
130 | 133 |
131 // Should handle first-letter layoutObject in the next call to handleTextNode. | 134 // Should handle first-letter layoutObject in the next call to handleTextNode. |
132 bool m_shouldHandleFirstLetter; | 135 bool m_shouldHandleFirstLetter; |
133 | 136 |
134 // Used when the iteration should stop if form controls are reached. | 137 // Used when the iteration should stop if form controls are reached. |
135 bool m_stopsOnFormControls; | 138 bool m_stopsOnFormControls; |
136 | 139 |
137 // Used when m_stopsOnFormControls is set to determine if the iterator should
keep advancing. | 140 // Used when m_stopsOnFormControls is set to determine if the iterator should |
| 141 // keep advancing. |
138 bool m_shouldStop; | 142 bool m_shouldStop; |
139 | 143 |
140 // Used in pasting inside password field. | 144 // Used in pasting inside password field. |
141 bool m_emitsOriginalText; | 145 bool m_emitsOriginalText; |
142 }; | 146 }; |
143 | 147 |
144 extern template class CORE_EXTERN_TEMPLATE_EXPORT | 148 extern template class CORE_EXTERN_TEMPLATE_EXPORT |
145 SimplifiedBackwardsTextIteratorAlgorithm<EditingStrategy>; | 149 SimplifiedBackwardsTextIteratorAlgorithm<EditingStrategy>; |
146 extern template class CORE_EXTERN_TEMPLATE_EXPORT | 150 extern template class CORE_EXTERN_TEMPLATE_EXPORT |
147 SimplifiedBackwardsTextIteratorAlgorithm<EditingInFlatTreeStrategy>; | 151 SimplifiedBackwardsTextIteratorAlgorithm<EditingInFlatTreeStrategy>; |
148 | 152 |
149 using SimplifiedBackwardsTextIterator = | 153 using SimplifiedBackwardsTextIterator = |
150 SimplifiedBackwardsTextIteratorAlgorithm<EditingStrategy>; | 154 SimplifiedBackwardsTextIteratorAlgorithm<EditingStrategy>; |
151 | 155 |
152 } // namespace blink | 156 } // namespace blink |
153 | 157 |
154 #endif // SimplifiedBackwardsTextIterator_h | 158 #endif // SimplifiedBackwardsTextIterator_h |
OLD | NEW |