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

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

Issue 2325553002: Restore a collapsed leading space of text used for line break (Closed)
Patch Set: Remove the additional space when restoring the leading space for getting plain text Created 4 years, 3 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 | « third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy.html ('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/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 62273a380a729eed99f1835c90cbe03d65a22026..dfc13920a857131231f77c5600eb95b8daa306d6 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -619,11 +619,12 @@ void TextIteratorAlgorithm<Strategy>::handleTextBox()
++subrunEnd;
}
// For leading space.
- if (m_textBox->root().prevRootBox() && m_textBox->root().firstChild() == m_textBox) {
+ if (!(m_behavior & TextIteratorEmitsImageAltText) && !(m_behavior & TextIteratorDoesNotBreakAtReplacedElement) && !(m_behavior & TextIteratorForInnerText)
yosin_UTC9 2016/09/13 02:00:30 Could you use |emitsImageAltText()| and introduce
joone 2016/09/14 04:04:35 Done.
+ && m_textBox->root().prevRootBox() && m_textBox->root().firstChild() == m_textBox) {
InlineBox* lastChildOfPrevRoot = m_textBox->root().prevRootBox()->lastChild();
- if (!lastChildOfPrevRoot->isText() && !lastChildOfPrevRoot->getLineLayoutItem().isBR()
+ if (m_textBox->getLineLayoutItem() != lastChildOfPrevRoot->getLineLayoutItem() && !lastChildOfPrevRoot->getLineLayoutItem().isBR()
&& !lastChildOfPrevRoot->isInlineFlowBox()) {
- if (runStart > 0 && str[0] == ' ')
+ if (runStart > 0 && str[0] == ' ' && str[1] != ' ')
--runStart;
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698