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

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

Issue 2541163003: Fix TextIterator's behavior with first-letter (Closed)
Patch Set: Mon Dec 5 18:00:48 JST 2016 Created 4 years 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 | « third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h ('k') | 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/TextIteratorTextState.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp
index 5e45a354e2b5a33de171bf796289b2a97aa7bf2d..06262fb3c1c295ddda943d6406850f37a6f6d2fe 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp
@@ -39,7 +39,8 @@ TextIteratorTextState::TextIteratorTextState(bool emitsOriginalText)
m_positionEndOffset(0),
m_hasEmitted(false),
m_lastCharacter(0),
- m_emitsOriginalText(emitsOriginalText) {}
+ m_emitsOriginalText(emitsOriginalText),
+ m_textStartOffset(0) {}
UChar TextIteratorTextState::characterAt(unsigned index) const {
SECURITY_DCHECK(index < static_cast<unsigned>(length()));
@@ -95,12 +96,14 @@ void TextIteratorTextState::updateForReplacedElement(Node* baseNode) {
m_textLength = 0;
m_lastCharacter = 0;
+ m_textStartOffset = 0;
}
void TextIteratorTextState::emitAltText(Node* node) {
m_text = toHTMLElement(node)->altText();
m_textLength = m_text.length();
m_lastCharacter = m_textLength ? m_text[m_textLength - 1] : 0;
+ m_textStartOffset = 0;
}
void TextIteratorTextState::flushPositionOffsets() const {
@@ -136,6 +139,7 @@ void TextIteratorTextState::spliceBuffer(UChar c,
// remember some iteration state
m_lastCharacter = c;
+ m_textStartOffset = 0;
}
void TextIteratorTextState::emitText(Node* textNode,
@@ -161,6 +165,7 @@ void TextIteratorTextState::emitText(Node* textNode,
m_lastCharacter = m_text[textEndOffset - 1];
m_hasEmitted = true;
+ m_textStartOffset = layoutObject->textStartOffset();
}
void TextIteratorTextState::appendTextTo(ForwardsTextBuffer* output,
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698