| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 case ' ': | 56 case ' ': |
| 57 case '\n': | 57 case '\n': |
| 58 return true; | 58 return true; |
| 59 default: | 59 default: |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 String plainText(const Range*, TextIteratorBehaviorFlags = TextIteratorDefaultBe
havior); | 64 String plainText(const Range*, TextIteratorBehaviorFlags = TextIteratorDefaultBe
havior); |
| 65 PassRefPtr<Range> findPlainText(const Range*, const String&, FindOptions); | 65 PassRefPtr<Range> findPlainText(const Range*, const String&, FindOptions); |
| 66 PassRefPtr<Range> findPlainText(const Position& start, const Position& end, cons
t String&, FindOptions); |
| 66 | 67 |
| 67 class BitStack { | 68 class BitStack { |
| 68 public: | 69 public: |
| 69 BitStack(); | 70 BitStack(); |
| 70 ~BitStack(); | 71 ~BitStack(); |
| 71 | 72 |
| 72 void push(bool); | 73 void push(bool); |
| 73 void pop(); | 74 void pop(); |
| 74 | 75 |
| 75 bool top() const; | 76 bool top() const; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 302 |
| 302 // Used in pasting inside password field. | 303 // Used in pasting inside password field. |
| 303 bool m_emitsOriginalText; | 304 bool m_emitsOriginalText; |
| 304 }; | 305 }; |
| 305 | 306 |
| 306 // Builds on the text iterator, adding a character position so we can walk one | 307 // Builds on the text iterator, adding a character position so we can walk one |
| 307 // character at a time, or faster, as needed. Useful for searching. | 308 // character at a time, or faster, as needed. Useful for searching. |
| 308 class CharacterIterator { | 309 class CharacterIterator { |
| 309 public: | 310 public: |
| 310 explicit CharacterIterator(const Range*, TextIteratorBehaviorFlags = TextIte
ratorDefaultBehavior); | 311 explicit CharacterIterator(const Range*, TextIteratorBehaviorFlags = TextIte
ratorDefaultBehavior); |
| 312 CharacterIterator(const Position& start, const Position& end, TextIteratorBe
haviorFlags = TextIteratorDefaultBehavior); |
| 311 | 313 |
| 312 void advance(int numCharacters); | 314 void advance(int numCharacters); |
| 313 | 315 |
| 314 bool atBreak() const { return m_atBreak; } | 316 bool atBreak() const { return m_atBreak; } |
| 315 bool atEnd() const { return m_textIterator.atEnd(); } | 317 bool atEnd() const { return m_textIterator.atEnd(); } |
| 316 | 318 |
| 317 int length() const { return m_textIterator.length() - m_runOffset; } | 319 int length() const { return m_textIterator.length() - m_runOffset; } |
| 318 UChar characterAt(unsigned index) const { return m_textIterator.characterAt(
m_runOffset + index); } | 320 UChar characterAt(unsigned index) const { return m_textIterator.characterAt(
m_runOffset + index); } |
| 319 | 321 |
| 320 template<typename BufferType> | 322 template<typename BufferType> |
| 321 void appendTextTo(BufferType& output) { m_textIterator.appendTextTo(output,
m_runOffset); } | 323 void appendTextTo(BufferType& output) { m_textIterator.appendTextTo(output,
m_runOffset); } |
| 322 | 324 |
| 323 int characterOffset() const { return m_offset; } | 325 int characterOffset() const { return m_offset; } |
| 324 PassRefPtr<Range> range() const; | 326 PassRefPtr<Range> range() const; |
| 325 | 327 |
| 326 private: | 328 private: |
| 329 void initialize(); |
| 330 |
| 327 int m_offset; | 331 int m_offset; |
| 328 int m_runOffset; | 332 int m_runOffset; |
| 329 bool m_atBreak; | 333 bool m_atBreak; |
| 330 | 334 |
| 331 TextIterator m_textIterator; | 335 TextIterator m_textIterator; |
| 332 }; | 336 }; |
| 333 | 337 |
| 334 class BackwardsCharacterIterator { | 338 class BackwardsCharacterIterator { |
| 335 public: | 339 public: |
| 336 explicit BackwardsCharacterIterator(const Range*, TextIteratorBehaviorFlags
= TextIteratorDefaultBehavior); | 340 explicit BackwardsCharacterIterator(const Range*, TextIteratorBehaviorFlags
= TextIteratorDefaultBehavior); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 367 Vector<UChar> m_buffer; | 371 Vector<UChar> m_buffer; |
| 368 // Did we have to look ahead in the textIterator to confirm the current chun
k? | 372 // Did we have to look ahead in the textIterator to confirm the current chun
k? |
| 369 bool m_didLookAhead; | 373 bool m_didLookAhead; |
| 370 RefPtr<Range> m_range; | 374 RefPtr<Range> m_range; |
| 371 TextIterator m_textIterator; | 375 TextIterator m_textIterator; |
| 372 }; | 376 }; |
| 373 | 377 |
| 374 } | 378 } |
| 375 | 379 |
| 376 #endif | 380 #endif |
| OLD | NEW |