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

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

Issue 2746153008: Fix bug causing TextIterator to duplicate leading spaces (Closed)
Patch Set: Remove obsolete comment Created 3 years, 9 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/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 46272509a43b3f6ece191483ddad55c0f40050a0..78f429fc397dd910e4cda2bff9ad161c55914e37 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -681,27 +681,6 @@ size_t TextIteratorAlgorithm<Strategy>::restoreCollapsedTrailingSpace(
}
template <typename Strategy>
-unsigned TextIteratorAlgorithm<Strategy>::restoreCollapsedLeadingSpace(
- unsigned runStart) {
- if (emitsImageAltText() || doesNotBreakAtReplacedElement() ||
- forInnerText() || !m_textBox->root().prevRootBox() ||
- m_textBox->root().firstChild() != m_textBox)
- return runStart;
-
- const String& text = toLayoutText(m_node->layoutObject())->text();
- InlineBox* lastBoxOfPrevLine = m_textBox->root().prevRootBox()->lastChild();
- if (m_textBox->getLineLayoutItem() ==
- lastBoxOfPrevLine->getLineLayoutItem() ||
- lastBoxOfPrevLine->getLineLayoutItem().isBR() ||
- lastBoxOfPrevLine->isInlineFlowBox())
- return runStart;
- if (runStart > 0 && text.length() >= 2 && text[0] == ' ' && text[1] != ' ')
- return runStart - 1;
-
- return runStart;
-}
-
-template <typename Strategy>
void TextIteratorAlgorithm<Strategy>::handleTextBox() {
LayoutText* layoutObject = m_firstLetterText
? m_firstLetterText
@@ -785,7 +764,6 @@ void TextIteratorAlgorithm<Strategy>::handleTextBox() {
size_t subrunEnd = str.find('\n', runStart);
if (subrunEnd == kNotFound || subrunEnd > runEnd) {
subrunEnd = runEnd;
- runStart = restoreCollapsedLeadingSpace(runStart);
subrunEnd = restoreCollapsedTrailingSpace(nextTextBox, subrunEnd);
}

Powered by Google App Engine
This is Rietveld 408576698