| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/Range.h" | 29 #include "core/dom/Range.h" |
| 30 #include "core/editing/FindOptions.h" | 30 #include "core/editing/FindOptions.h" |
| 31 #include "core/editing/iterators/BitStack.h" | 31 #include "core/editing/iterators/BitStack.h" |
| 32 #include "core/editing/iterators/TextIteratorFlags.h" | 32 #include "core/editing/iterators/TextIteratorFlags.h" |
| 33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
| 34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class InlineTextBox; | 38 class InlineTextBox; |
| 39 class RenderText; | 39 class LayoutText; |
| 40 class RenderTextFragment; | 40 class LayoutTextFragment; |
| 41 | 41 |
| 42 String plainText(const Range*, TextIteratorBehaviorFlags = TextIteratorDefaultBe
havior); | 42 String plainText(const Range*, TextIteratorBehaviorFlags = TextIteratorDefaultBe
havior); |
| 43 String plainText(const Position& start, const Position& end, TextIteratorBehavio
rFlags = TextIteratorDefaultBehavior); | 43 String plainText(const Position& start, const Position& end, TextIteratorBehavio
rFlags = TextIteratorDefaultBehavior); |
| 44 PassRefPtrWillBeRawPtr<Range> findPlainText(const Range*, const String&, FindOpt
ions); | 44 PassRefPtrWillBeRawPtr<Range> findPlainText(const Range*, const String&, FindOpt
ions); |
| 45 void findPlainText(const Position& inputStart, const Position& inputEnd, const S
tring&, FindOptions, Position& resultStart, Position& resultEnd); | 45 void findPlainText(const Position& inputStart, const Position& inputEnd, const S
tring&, FindOptions, Position& resultStart, Position& resultEnd); |
| 46 | 46 |
| 47 // Iterates through the DOM range, returning all the text, and 0-length boundari
es | 47 // Iterates through the DOM range, returning all the text, and 0-length boundari
es |
| 48 // at points where replaced elements break up the text flow. The text comes bac
k in | 48 // at points where replaced elements break up the text flow. The text comes bac
k in |
| 49 // chunks so as to optimize for performance of the iteration. | 49 // chunks so as to optimize for performance of the iteration. |
| 50 | 50 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 int positionStartOffset() const { return m_positionStartOffset; } | 126 int positionStartOffset() const { return m_positionStartOffset; } |
| 127 const String& string() const { return m_text; } | 127 const String& string() const { return m_text; } |
| 128 void exitNode(); | 128 void exitNode(); |
| 129 bool shouldRepresentNodeOffsetZero(); | 129 bool shouldRepresentNodeOffsetZero(); |
| 130 bool shouldEmitSpaceBeforeAndAfterNode(Node*); | 130 bool shouldEmitSpaceBeforeAndAfterNode(Node*); |
| 131 void representNodeOffsetZero(); | 131 void representNodeOffsetZero(); |
| 132 bool handleTextNode(); | 132 bool handleTextNode(); |
| 133 bool handleReplacedElement(); | 133 bool handleReplacedElement(); |
| 134 bool handleNonTextNode(); | 134 bool handleNonTextNode(); |
| 135 void handleTextBox(); | 135 void handleTextBox(); |
| 136 void handleTextNodeFirstLetter(RenderTextFragment*); | 136 void handleTextNodeFirstLetter(LayoutTextFragment*); |
| 137 bool hasVisibleTextNode(RenderText*); | 137 bool hasVisibleTextNode(LayoutText*); |
| 138 void emitCharacter(UChar, Node* textNode, Node* offsetBaseNode, int textStar
tOffset, int textEndOffset); | 138 void emitCharacter(UChar, Node* textNode, Node* offsetBaseNode, int textStar
tOffset, int textEndOffset); |
| 139 void emitText(Node* textNode, RenderText* renderer, int textStartOffset, int
textEndOffset); | 139 void emitText(Node* textNode, LayoutText* renderer, int textStartOffset, int
textEndOffset); |
| 140 | 140 |
| 141 // Current position, not necessarily of the text being returned, but positio
n | 141 // Current position, not necessarily of the text being returned, but positio
n |
| 142 // as we walk through the DOM tree. | 142 // as we walk through the DOM tree. |
| 143 RawPtrWillBeMember<Node> m_node; | 143 RawPtrWillBeMember<Node> m_node; |
| 144 int m_offset; | 144 int m_offset; |
| 145 IterationProgress m_iterationProgress; | 145 IterationProgress m_iterationProgress; |
| 146 BitStack m_fullyClippedStack; | 146 BitStack m_fullyClippedStack; |
| 147 int m_shadowDepth; | 147 int m_shadowDepth; |
| 148 | 148 |
| 149 // The range. | 149 // The range. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 int m_textLength; | 161 int m_textLength; |
| 162 String m_text; | 162 String m_text; |
| 163 | 163 |
| 164 // Used when there is still some pending text from the current node; when th
ese | 164 // Used when there is still some pending text from the current node; when th
ese |
| 165 // are false and 0, we go back to normal iterating. | 165 // are false and 0, we go back to normal iterating. |
| 166 bool m_needsAnotherNewline; | 166 bool m_needsAnotherNewline; |
| 167 InlineTextBox* m_textBox; | 167 InlineTextBox* m_textBox; |
| 168 // Used when iteration over :first-letter text to save pointer to | 168 // Used when iteration over :first-letter text to save pointer to |
| 169 // remaining text box. | 169 // remaining text box. |
| 170 InlineTextBox* m_remainingTextBox; | 170 InlineTextBox* m_remainingTextBox; |
| 171 // Used to point to RenderText object for :first-letter. | 171 // Used to point to LayoutText object for :first-letter. |
| 172 RawPtrWillBeMember<RenderText> m_firstLetterText; | 172 RawPtrWillBeMember<LayoutText> m_firstLetterText; |
| 173 | 173 |
| 174 // Used to do the whitespace collapsing logic. | 174 // Used to do the whitespace collapsing logic. |
| 175 RawPtrWillBeMember<Text> m_lastTextNode; | 175 RawPtrWillBeMember<Text> m_lastTextNode; |
| 176 bool m_lastTextNodeEndedWithCollapsedSpace; | 176 bool m_lastTextNodeEndedWithCollapsedSpace; |
| 177 UChar m_lastCharacter; | 177 UChar m_lastCharacter; |
| 178 | 178 |
| 179 // Used for whitespace characters that aren't in the DOM, so we can point at
them. | 179 // Used for whitespace characters that aren't in the DOM, so we can point at
them. |
| 180 // If non-zero, overrides m_text. | 180 // If non-zero, overrides m_text. |
| 181 UChar m_singleCharacterBuffer; | 181 UChar m_singleCharacterBuffer; |
| 182 | 182 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 210 bool m_entersOpenShadowRoots; | 210 bool m_entersOpenShadowRoots; |
| 211 | 211 |
| 212 bool m_emitsObjectReplacementCharacter; | 212 bool m_emitsObjectReplacementCharacter; |
| 213 | 213 |
| 214 bool m_breaksAtReplacedElement; | 214 bool m_breaksAtReplacedElement; |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| 218 | 218 |
| 219 #endif // TextIterator_h | 219 #endif // TextIterator_h |
| OLD | NEW |