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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void advance(); | 196 void advance(); |
197 | 197 |
198 int length() const { return m_textLength; } | 198 int length() const { return m_textLength; } |
199 const UChar* characters() const { return m_textCharacters; } | 199 const UChar* characters() const { return m_textCharacters; } |
200 | 200 |
201 PassRefPtr<Range> range() const; | 201 PassRefPtr<Range> range() const; |
202 | 202 |
203 private: | 203 private: |
204 void exitNode(); | 204 void exitNode(); |
205 bool handleTextNode(); | 205 bool handleTextNode(); |
| 206 RenderText* handleFirstLetter(int& startOffset, int& offsetInNode); |
206 bool handleReplacedElement(); | 207 bool handleReplacedElement(); |
207 bool handleNonTextNode(); | 208 bool handleNonTextNode(); |
208 void emitCharacter(UChar, Node*, int startOffset, int endOffset); | 209 void emitCharacter(UChar, Node*, int startOffset, int endOffset); |
209 bool advanceRespectingRange(Node*); | 210 bool advanceRespectingRange(Node*); |
210 | 211 |
211 TextIteratorBehavior m_behavior; | 212 TextIteratorBehavior m_behavior; |
212 // Current position, not necessarily of the text being returned, but positio
n | 213 // Current position, not necessarily of the text being returned, but positio
n |
213 // as we walk through the DOM tree. | 214 // as we walk through the DOM tree. |
214 Node* m_node; | 215 Node* m_node; |
215 int m_offset; | 216 int m_offset; |
(...skipping 17 matching lines...) Expand all Loading... |
233 | 234 |
234 // Used to do the whitespace logic. | 235 // Used to do the whitespace logic. |
235 Node* m_lastTextNode; | 236 Node* m_lastTextNode; |
236 UChar m_lastCharacter; | 237 UChar m_lastCharacter; |
237 | 238 |
238 // Used for whitespace characters that aren't in the DOM, so we can point at
them. | 239 // Used for whitespace characters that aren't in the DOM, so we can point at
them. |
239 UChar m_singleCharacterBuffer; | 240 UChar m_singleCharacterBuffer; |
240 | 241 |
241 // Whether m_node has advanced beyond the iteration range (i.e. m_startNode)
. | 242 // Whether m_node has advanced beyond the iteration range (i.e. m_startNode)
. |
242 bool m_havePassedStartNode; | 243 bool m_havePassedStartNode; |
| 244 |
| 245 // Should handle first-letter renderer in the next call to handleTextNode. |
| 246 bool m_shouldHandleFirstLetter; |
243 }; | 247 }; |
244 | 248 |
245 // Builds on the text iterator, adding a character position so we can walk one | 249 // Builds on the text iterator, adding a character position so we can walk one |
246 // character at a time, or faster, as needed. Useful for searching. | 250 // character at a time, or faster, as needed. Useful for searching. |
247 class CharacterIterator { | 251 class CharacterIterator { |
248 public: | 252 public: |
249 CharacterIterator(); | 253 CharacterIterator(); |
250 explicit CharacterIterator(const Range*, TextIteratorBehavior = TextIterator
DefaultBehavior); | 254 explicit CharacterIterator(const Range*, TextIteratorBehavior = TextIterator
DefaultBehavior); |
251 | 255 |
252 void advance(int numCharacters); | 256 void advance(int numCharacters); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 bool m_didLookAhead; | 322 bool m_didLookAhead; |
319 | 323 |
320 RefPtr<Range> m_range; | 324 RefPtr<Range> m_range; |
321 | 325 |
322 TextIterator m_textIterator; | 326 TextIterator m_textIterator; |
323 }; | 327 }; |
324 | 328 |
325 } | 329 } |
326 | 330 |
327 #endif | 331 #endif |
OLD | NEW |