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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2896023003: Reorganize the maintenance of several text node related members in TextIterator (Closed)
Patch Set: Thu May 25 15:15:18 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index b547830fcd3edeb6811468e835bd884b3235fef4..d86addb74f3f406732c0a85e53015abddc29352c 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -229,7 +229,6 @@ void TextIteratorAlgorithm<Strategy>::Initialize(Node* start_container,
return;
fully_clipped_stack_.SetUpFullyClippedStack(node_);
- offset_ = node_ == start_container_ ? start_offset_ : 0;
iteration_progress_ = kHandledNone;
// Calculate first out of bounds node.
@@ -405,7 +404,6 @@ void TextIteratorAlgorithm<Strategy>::Advance() {
iteration_progress_ < kHandledChildren && !isHTMLImageElement(*node_)
? Strategy::FirstChild(*node_)
: nullptr;
- offset_ = 0;
if (!next) {
// 2. If we've already iterated children or they are not available, go to
// the next sibling node.
@@ -472,8 +470,6 @@ void TextIteratorAlgorithm<Strategy>::Advance() {
--shadow_depth_;
fully_clipped_stack_.Pop();
}
- handled_first_letter_ = false;
- first_letter_text_ = nullptr;
continue;
}
}
@@ -485,8 +481,6 @@ void TextIteratorAlgorithm<Strategy>::Advance() {
if (node_)
fully_clipped_stack_.PushFullyClippedState(node_);
iteration_progress_ = kHandledNone;
- handled_first_letter_ = false;
- first_letter_text_ = nullptr;
// how would this ever be?
if (text_state_.PositionNode())
@@ -595,6 +589,10 @@ bool TextIteratorAlgorithm<Strategy>::HandleTextNode() {
DCHECK_NE(last_text_node_, node_)
<< "We should never call HandleTextNode on the same node twice";
+ offset_ = node_ == start_container_ ? start_offset_ : 0;
+ handled_first_letter_ = false;
+ first_letter_text_ = nullptr;
+
Text* text_node = ToText(node_);
LayoutText* layout_object = text_node->GetLayoutObject();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698