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

Unified Diff: Source/core/editing/TextIterator.cpp

Issue 753573003: Copy and paste sometimes removes spaces between words. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « Source/core/editing/TextIterator.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 7baf1c49df1e8a5c28764f5c2bc76f7cf5a144de..2d2dd979cc985ea40a61249737e1a13488499c89 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -268,6 +268,7 @@ TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio
, m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots)
, m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplacementCharacter)
, m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedElement))
+ , m_hasNodesFollowing(behavior & TextIteratorBehavesAsIfNodesFollowing)
yosin_UTC9 2015/01/14 01:46:20 Do we need to have new behavior? It seems the issu
c.shu 2015/01/14 21:13:41 The bug is not a general issue. It only shows up w
{
if (range)
initialize(range->startPosition(), range->endPosition());
@@ -744,6 +745,13 @@ void TextIterator::handleTextBox()
if (nextRunStart > runEnd)
m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
+ // Don't advance if last spaces, excluding '\n', are collapsed by next non-text box.
+ if (m_lastTextNodeEndedWithCollapsedSpace && !nextTextBox && m_hasNodesFollowing) {
yosin_UTC9 2015/01/14 01:46:20 Sorry, I'm not sure why newline character is a spe
c.shu 2015/01/14 21:13:41 We don't want to restore the space for newline as
+ // None of the collapsed spaces should be '\n' but check the last one is enough.
+ if (str[str.length() -1] != '\n')
+ return;
+ }
+
m_textBox = nextTextBox;
if (renderer->containsReversedText())
++m_sortedTextBoxesPosition;
« no previous file with comments | « Source/core/editing/TextIterator.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698