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 c636b95df1b0f1364138f051ef8b7373683d0cbc..e2cb3402652f6f04ae84b4cd30117d7f3a144404 100644 |
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
@@ -609,8 +609,15 @@ void TextIteratorAlgorithm<Strategy>::handleTextBox() |
m_offset = runStart + 1; |
} else { |
size_t subrunEnd = str.find('\n', runStart); |
- if (subrunEnd == kNotFound || subrunEnd > runEnd) |
+ if (subrunEnd == kNotFound || subrunEnd > runEnd) { |
subrunEnd = runEnd; |
+ // Don't trim the space at the end of string because we need to |
+ // preserve it for copy & paste. See http://crbug.com/318925 |
+ if (m_node->nextSibling() && isInline(m_node->nextSibling())) { |
joone
2016/08/02 20:31:42
This problem happens if the text node's next sibli
yosin_UTC9
2016/08/03 01:16:23
How about this case?
<div><b><i>foo </i></b> bar</
joone
2016/08/03 21:50:59
Works fine. I added this case to the test file.
joone
2016/08/03 22:37:41
When we reduce the width, the same problem happens
|
+ if (str[str.length() - 1] == ' ' && subrunEnd == str.length() - 1 && str[subrunEnd-1] != ' ') |
yosin_UTC9
2016/08/03 01:16:23
nit: s/subrunEnd-1/subrunEnd - 1/
joone
2016/08/03 21:51:00
Done.
|
+ ++subrunEnd; |
+ } |
+ } |
m_offset = subrunEnd; |
emitText(m_node, layoutObject, runStart, subrunEnd); |