| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 PassRefPtrWillBeRawPtr<Range> findPlainText(const Range*, const String&, FindOpt
ions); | 45 PassRefPtrWillBeRawPtr<Range> findPlainText(const Range*, const String&, FindOpt
ions); |
| 46 void findPlainText(const Position& inputStart, const Position& inputEnd, const S
tring&, FindOptions, Position& resultStart, Position& resultEnd); | 46 void findPlainText(const Position& inputStart, const Position& inputEnd, const S
tring&, FindOptions, Position& resultStart, Position& resultEnd); |
| 47 | 47 |
| 48 // Iterates through the DOM range, returning all the text, and 0-length boundari
es | 48 // Iterates through the DOM range, returning all the text, and 0-length boundari
es |
| 49 // at points where replaced elements break up the text flow. The text comes bac
k in | 49 // at points where replaced elements break up the text flow. The text comes bac
k in |
| 50 // chunks so as to optimize for performance of the iteration. | 50 // chunks so as to optimize for performance of the iteration. |
| 51 | 51 |
| 52 class CORE_EXPORT TextIterator { | 52 class CORE_EXPORT TextIterator { |
| 53 STACK_ALLOCATED(); | 53 STACK_ALLOCATED(); |
| 54 public: | 54 public: |
| 55 explicit TextIterator(const Range*, TextIteratorBehaviorFlags = TextIterator
DefaultBehavior); | |
| 56 // [start, end] indicates the document range that the iteration should take
place within (both ends inclusive). | 55 // [start, end] indicates the document range that the iteration should take
place within (both ends inclusive). |
| 57 TextIterator(const Position& start, const Position& end, TextIteratorBehavio
rFlags = TextIteratorDefaultBehavior); | 56 TextIterator(const Position& start, const Position& end, TextIteratorBehavio
rFlags = TextIteratorDefaultBehavior); |
| 58 ~TextIterator(); | 57 ~TextIterator(); |
| 59 | 58 |
| 60 bool atEnd() const { return !m_positionNode || m_shouldStop; } | 59 bool atEnd() const { return !m_positionNode || m_shouldStop; } |
| 61 void advance(); | 60 void advance(); |
| 62 bool isInsideReplacedElement() const; | 61 bool isInsideReplacedElement() const; |
| 63 | 62 |
| 64 int length() const { return m_textLength; } | 63 int length() const { return m_textLength; } |
| 65 UChar characterAt(unsigned index) const; | 64 UChar characterAt(unsigned index) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 93 Position startPosition() const; | 92 Position startPosition() const; |
| 94 Position endPosition() const; | 93 Position endPosition() const; |
| 95 | 94 |
| 96 bool breaksAtReplacedElement() { return m_breaksAtReplacedElement; } | 95 bool breaksAtReplacedElement() { return m_breaksAtReplacedElement; } |
| 97 | 96 |
| 98 // Computes the length of the given range using a text iterator. The default | 97 // Computes the length of the given range using a text iterator. The default |
| 99 // iteration behavior is to always emit object replacement characters for | 98 // iteration behavior is to always emit object replacement characters for |
| 100 // replaced elements. When |forSelectionPreservation| is set to true, it | 99 // replaced elements. When |forSelectionPreservation| is set to true, it |
| 101 // also emits spaces for other non-text nodes using the | 100 // also emits spaces for other non-text nodes using the |
| 102 // |TextIteratorEmitsCharactersBetweenAllVisiblePosition| mode. | 101 // |TextIteratorEmitsCharactersBetweenAllVisiblePosition| mode. |
| 103 static int rangeLength(const Range*, bool forSelectionPreservation = false); | |
| 104 static int rangeLength(const Position& start, const Position& end, bool forS
electionPreservation = false); | 102 static int rangeLength(const Position& start, const Position& end, bool forS
electionPreservation = false); |
| 105 static PassRefPtrWillBeRawPtr<Range> subrange(Range* entireRange, int charac
terOffset, int characterCount); | 103 static PassRefPtrWillBeRawPtr<Range> subrange(Range* entireRange, int charac
terOffset, int characterCount); |
| 106 static void subrange(Position& start, Position& end, int characterOffset, in
t characterCount); | 104 static void subrange(Position& start, Position& end, int characterOffset, in
t characterCount); |
| 107 | 105 |
| 108 static bool shouldEmitTabBeforeNode(Node*); | 106 static bool shouldEmitTabBeforeNode(Node*); |
| 109 static bool shouldEmitNewlineBeforeNode(Node&); | 107 static bool shouldEmitNewlineBeforeNode(Node&); |
| 110 static bool shouldEmitNewlineAfterNode(Node&); | 108 static bool shouldEmitNewlineAfterNode(Node&); |
| 111 static bool shouldEmitNewlineForNode(Node*, bool emitsOriginalText); | 109 static bool shouldEmitNewlineForNode(Node*, bool emitsOriginalText); |
| 112 | 110 |
| 113 static bool supportsAltText(Node*); | 111 static bool supportsAltText(Node*); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool m_entersOpenShadowRoots; | 209 bool m_entersOpenShadowRoots; |
| 212 | 210 |
| 213 bool m_emitsObjectReplacementCharacter; | 211 bool m_emitsObjectReplacementCharacter; |
| 214 | 212 |
| 215 bool m_breaksAtReplacedElement; | 213 bool m_breaksAtReplacedElement; |
| 216 }; | 214 }; |
| 217 | 215 |
| 218 } // namespace blink | 216 } // namespace blink |
| 219 | 217 |
| 220 #endif // TextIterator_h | 218 #endif // TextIterator_h |
| OLD | NEW |