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 15 matching lines...) Expand all Loading... |
26 #ifndef SimplifiedBackwardsTextIterator_h | 26 #ifndef SimplifiedBackwardsTextIterator_h |
27 #define SimplifiedBackwardsTextIterator_h | 27 #define SimplifiedBackwardsTextIterator_h |
28 | 28 |
29 #include "core/dom/Range.h" | 29 #include "core/dom/Range.h" |
30 #include "core/editing/iterators/BitStack.h" | 30 #include "core/editing/iterators/BitStack.h" |
31 #include "core/editing/iterators/TextIteratorFlags.h" | 31 #include "core/editing/iterators/TextIteratorFlags.h" |
32 #include "platform/heap/Heap.h" | 32 #include "platform/heap/Heap.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class RenderText; | 36 class LayoutText; |
37 class RenderTextFragment; | 37 class LayoutTextFragment; |
38 | 38 |
39 // Iterates through the DOM range, returning all the text, and 0-length boundari
es | 39 // Iterates through the DOM range, returning all the text, and 0-length boundari
es |
40 // at points where replaced elements break up the text flow. The text comes back
in | 40 // at points where replaced elements break up the text flow. The text comes back
in |
41 // chunks so as to optimize for performance of the iteration. | 41 // chunks so as to optimize for performance of the iteration. |
42 class SimplifiedBackwardsTextIterator { | 42 class SimplifiedBackwardsTextIterator { |
43 STACK_ALLOCATED(); | 43 STACK_ALLOCATED(); |
44 public: | 44 public: |
45 explicit SimplifiedBackwardsTextIterator(const Range*, TextIteratorBehaviorF
lags = TextIteratorDefaultBehavior); | 45 explicit SimplifiedBackwardsTextIterator(const Range*, TextIteratorBehaviorF
lags = TextIteratorDefaultBehavior); |
46 SimplifiedBackwardsTextIterator(const Position& start, const Position& end,
TextIteratorBehaviorFlags = TextIteratorDefaultBehavior); | 46 SimplifiedBackwardsTextIterator(const Position& start, const Position& end,
TextIteratorBehaviorFlags = TextIteratorDefaultBehavior); |
47 | 47 |
(...skipping 17 matching lines...) Expand all Loading... |
65 | 65 |
66 Node* startContainer() const; | 66 Node* startContainer() const; |
67 int endOffset() const; | 67 int endOffset() const; |
68 Position startPosition() const; | 68 Position startPosition() const; |
69 Position endPosition() const; | 69 Position endPosition() const; |
70 | 70 |
71 private: | 71 private: |
72 void init(Node* startNode, Node* endNode, int startOffset, int endOffset); | 72 void init(Node* startNode, Node* endNode, int startOffset, int endOffset); |
73 void exitNode(); | 73 void exitNode(); |
74 bool handleTextNode(); | 74 bool handleTextNode(); |
75 RenderText* handleFirstLetter(int& startOffset, int& offsetInNode); | 75 LayoutText* handleFirstLetter(int& startOffset, int& offsetInNode); |
76 bool handleReplacedElement(); | 76 bool handleReplacedElement(); |
77 bool handleNonTextNode(); | 77 bool handleNonTextNode(); |
78 void emitCharacter(UChar, Node*, int startOffset, int endOffset); | 78 void emitCharacter(UChar, Node*, int startOffset, int endOffset); |
79 bool advanceRespectingRange(Node*); | 79 bool advanceRespectingRange(Node*); |
80 | 80 |
81 // Current position, not necessarily of the text being returned, but positio
n | 81 // Current position, not necessarily of the text being returned, but positio
n |
82 // as we walk through the DOM tree. | 82 // as we walk through the DOM tree. |
83 RawPtrWillBeMember<Node> m_node; | 83 RawPtrWillBeMember<Node> m_node; |
84 int m_offset; | 84 int m_offset; |
85 bool m_handledNode; | 85 bool m_handledNode; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Used when m_stopsOnFormControls is set to determine if the iterator shoul
d keep advancing. | 117 // Used when m_stopsOnFormControls is set to determine if the iterator shoul
d keep advancing. |
118 bool m_shouldStop; | 118 bool m_shouldStop; |
119 | 119 |
120 // Used in pasting inside password field. | 120 // Used in pasting inside password field. |
121 bool m_emitsOriginalText; | 121 bool m_emitsOriginalText; |
122 }; | 122 }; |
123 | 123 |
124 } // namespace blink | 124 } // namespace blink |
125 | 125 |
126 #endif // SimplifiedBackwardsTextIterator_h | 126 #endif // SimplifiedBackwardsTextIterator_h |
OLD | NEW |