Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h

Issue 2913673004: Change how iteration range is passed to TextIteratorTextNodeHandler (Closed)
Patch Set: Thu Jun 1 08:33:52 PDT 2017 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h
index adcd9ec1205e15802da3fca112f5ec89e8a9f3e3..9d89fe31d0864e71987578c32b976664ed21cc3a 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h
@@ -26,15 +26,6 @@ class TextIteratorTextNodeHandler final {
TextIteratorTextNodeHandler(const TextIteratorBehavior&,
TextIteratorTextState*);
- // Initializes the full iteration range of the TextIterator. This function
- // should be called only once from TextIterator::Initialize.
- // TODO(xiaochengh): TextNodeHandler doesn't need to know the full iteration
- // range; The offset range in the current node suffices. Remove this function.
- void Initialize(Node* start_container,
- int start_offset,
- Node* end_container,
- int end_offset);
-
Text* GetNode() const { return text_node_; }
// Returns true if more text is emitted without traversing to the next node.
@@ -45,7 +36,13 @@ class TextIteratorTextNodeHandler final {
void ResetCollapsedWhiteSpaceFixup();
- void HandleTextNode(Text*);
+ // Emit plain text from the given text node.
+ void HandleTextNodeWhole(Text*);
+
+ // Variants that emit plain text within the given DOM offset range.
+ void HandleTextNodeStartFrom(Text*, int start_offset);
+ void HandleTextNodeEndAt(Text*, int end_offset);
+ void HandleTextNodeInRange(Text*, int start_offset, int end_offset);
private:
void HandlePreFormattedTextNode();
@@ -72,15 +69,10 @@ class TextIteratorTextNodeHandler final {
int text_start_offset,
int text_end_offset);
- // The range.
- Member<Node> start_container_;
- int start_offset_ = 0;
- Member<Node> end_container_;
- int end_offset_ = 0;
-
- // The current text node and offset, from which text is being emitted.
+ // The current text node and offset range, from which text should be emitted.
Member<Text> text_node_;
int offset_ = 0;
+ int end_offset_ = 0;
InlineTextBox* text_box_ = nullptr;

Powered by Google App Engine
This is Rietveld 408576698