Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Issue 318925 Copy and paste sometimes removes spaces between words
Starred by 18 users Reported by nicholas...@gmail.com, Nov 13 2013 Back to list
Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 463348



Sign in to add a comment
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.48 Safari/537.36

Example URL:
http://jsfiddle.net/Wu2Gy/1/

Steps to reproduce the problem:
1) Find a multiline text region where one line begins with a new tag.
2) Copy the text region
3) Paste the text into contenteditable

What is the expected behavior?
The text should paste with spaces between words intact

What went wrong?
The space between two words is removed, so the words run together

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 31.0.1650.48 (Official Build 233213) OSX

Chrome version: 31.0.1650.48  Channel: stable
OS Version: OS X 10.8.5
Flash Version: Shockwave Flash 11.9 r900

The attached JSFiddle should make it super-easy to repro; let me know if it's not immediately obvious and I will try to explain better.
 
Cc: tkonch...@chromium.org rponnada@chromium.org
Labels: Needs-Feedback
Tested this issue on MAC using:31.0.1650.48. No space between First line last word - Area & Second line first word - A. Please find the attached screenshot for reference. 

Please let us know, on which version of chrome it is working as intended. As per your issue, working fine & not working -- both the versions as mentioned as 31.0.1650.48. Please confirm.
Screen Shot 2013-11-14 at 7.23.11 PM.png
132 KB View Download
sorry, i was confused by the form.

I have confirmed the bug is reproducible on 31.0.1650.48/OSX and 30.0.1599.101/Windows7

The bug is not reproducible on Firefox or IE
Labels: -Needs-Feedback M-33
Status: Untriaged
Able to repro this issue on MAC using 31.0.1650.48.

This is non-regression, same behavior from M29. This is working fine FF.
Comment 4 by dxie@google.com, Nov 14 2013
Labels: -OS-Mac OS-All Cr-Blink
Comment 5 by tkent@chromium.org, Nov 15 2013
Labels: -Cr-Content Cr-Blink-Editing
Project Member Comment 6 by bugdroid1@chromium.org, Dec 17 2013
Labels: -M-33 MovedFrom-33 M-34
Moving all non essential bugs to the next Milestone.
Replicated bug in Chrome 33.0.1750.117 m under Windows XP.

This bug corrupts Wikipedia content whenever editors use rich text editors (such as the site's VisualEditor or the gadget wikEd). Desperate users have even offered money to get this bug fixed (see https://meta.wikimedia.org/wiki/WikiProject_Med/Tech#Spaces_going_missing)! Please make fixing this bug the highest priority possible!




Comment 8 by csh...@gmail.com, Mar 3 2014
I have the fix already for blink but it was under review for weeks.
https://codereview.chromium.org/165083002/
The same fix has been landed on WebKit already. Could you test the latest webkit or apply my patch on blink to see if the wiki page has been fixed?
Comment 9 by dxie@chromium.org, Mar 3 2014
Labels: -M-34 MovedFrom-34
This issue has already been moved once and is lower than Priority 1,therefore removing mstone.
Comment 10 by yosin@chromium.org, Aug 29 2014
Labels: Cr-Blink-Editing-Command
This is a serious bug as it breaks core CE functionality in a way that can't be avoided without completely overriding onCopy events.
Blocking: chromium:463348
Cc: l.gom...@samsung.com
Patch up for review - https://codereview.chromium.org/753573003/ 
Labels: -Cr-Blink
Comment 15 by yosin@chromium.org, Aug 11 2015
Status: Available
I have this issue using: Windows XP Professional and Google Chrome browser Version 46.0.2490.86 m (latest verstion).

This issue is very annoying.
Project Member Comment 17 by bugdroid1@chromium.org, Aug 22 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c

commit 6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c
Author: joone.hur <joone.hur@intel.com>
Date: Mon Aug 22 23:14:45 2016

Restore the collapsed spaces of the text when we copy it

When we copy a wrapped text(text + inline element), the trailing
spaces of the text are collapsed during layout. However, when
we copy the text, there is no space between the text and the
inline element such as <a>, <del>, <span>, and etc so we need
to restore the trailing space of the text.

Here are examples:
<p>My favorite browser is <del>ABC</del> <ins>Chrome</ins>!</p>
<p>Counter: <span id="counter"></span></p>
<dfn>world <kbd>Blink</kbd></dfn>
<div>Copy this area <a href="http://foo/">AVeryLongWordThatWillWrap</a></div>

BUG= 318925 
TEST=editing/pasteboard/preserve-trailing-space.html

Review-Url: https://codereview.chromium.org/2193033004
Cr-Commit-Position: refs/heads/master@{#413572}

[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/content/renderer/render_view_browsertest.cc
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/content/test/data/accessibility/html/frameset-expected-blink.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/content/test/data/accessibility/html/frameset-expected-mac.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/content/test/data/accessibility/html/frameset-expected-win.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/compositing/geometry/assert-marquee-timer-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/editing/execCommand/remove-format-multiple-elements-mac-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/remove-format-multiple-elements-mac.js
[add] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/editing/selection/caret-at-bidi-boundary-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/fast/dom/shadow/pseudo-not-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/fast/js/inc-bracket-assign-subscript-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/LayoutTests/fast/js/post-inc-assign-overwrites-expected.txt
[modify] https://crrev.com/6c91ec8582845dcaa0cc8a4b9232cd844f6bf57c/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Project Member Comment 18 by bugdroid1@chromium.org, Sep 7 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9b93a675c78452c27f1749ff243ab8f9449b1184

commit 9b93a675c78452c27f1749ff243ab8f9449b1184
Author: joone.hur <joone.hur@intel.com>
Date: Wed Sep 07 08:51:36 2016

Restore a collapsed trailing space of text used for line break

When a text is wrapped during layout, the trailing space of the
text can be collapsed and a line break is inserted instead of
the space. In this case, we need to restore the collapsed space
when we copy the text. This problem was fixed in the below CL:
https://codereview.chromium.org/2193033004/

However, the CL only deals with the case that the sibling of
the text is an inline element:
<p>My favorite browser is <del>ABC</del> <ins>Chrome</ins>!</p>
<p>Counter: <span id="counter">10</span></p>
<dfn>world <kbd>Blink</kbd></dfn>
<div>Copy this area <a href="http://foo/">AVeryLongWordThatWillWrap</a></div>

In addition, the previous fix has the unintended effect that the
trailing space can be restored even if there is no line break.

This CL can additionally handle the following case:
<div style="width: 2em;"><b><i>foo </i></b>bar</div>
It also removes the unintended effect.

BUG= 318925 
TEST=editing/pasteboard/preserve-trailing-space.html

Review-Url: https://codereview.chromium.org/2280513004
Cr-Commit-Position: refs/heads/master@{#416883}

[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/compositing/geometry/assert-marquee-timer-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/editing/execCommand/remove-format-multiple-elements-mac-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/remove-format-multiple-elements-mac.js
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/editing/selection/caret-at-bidi-boundary-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/fast/dom/shadow/pseudo-not-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/fast/js/inc-bracket-assign-subscript-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/LayoutTests/fast/js/post-inc-assign-overwrites-expected.txt
[modify] https://crrev.com/9b93a675c78452c27f1749ff243ab8f9449b1184/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Project Member Comment 20 by bugdroid1@chromium.org, Sep 8 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/362b0c753edcf2e994de8ec82d9000f18e2ed284

commit 362b0c753edcf2e994de8ec82d9000f18e2ed284
Author: joone.hur <joone.hur@intel.com>
Date: Thu Sep 08 01:41:54 2016

Restore a collapsed leading space of text used for line break

When a text is wrapped during layout, the leading space of the
text can be collapsed and a line break is inserted instead of
the space. In this case, we need to restore the collapsed space
when we copy the text.

This CL can handle the following case:
<div style="width: 2em;"><b><i>foo</i></b> bar</div>

BUG= 318925 
TEST=editing/pasteboard/restore-collapsed-space-for-copy.html

Review-Url: https://codereview.chromium.org/2320533002
Cr-Commit-Position: refs/heads/master@{#417155}

[rename] https://crrev.com/362b0c753edcf2e994de8ec82d9000f18e2ed284/third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy.html
[modify] https://crrev.com/362b0c753edcf2e994de8ec82d9000f18e2ed284/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Project Member Comment 21 by bugdroid1@chromium.org, Sep 8 2016
Labels: merge-merged-2854
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/362b0c753edcf2e994de8ec82d9000f18e2ed284

commit 362b0c753edcf2e994de8ec82d9000f18e2ed284
Author: joone.hur <joone.hur@intel.com>
Date: Thu Sep 08 01:41:54 2016

Restore a collapsed leading space of text used for line break

When a text is wrapped during layout, the leading space of the
text can be collapsed and a line break is inserted instead of
the space. In this case, we need to restore the collapsed space
when we copy the text.

This CL can handle the following case:
<div style="width: 2em;"><b><i>foo</i></b> bar</div>

BUG= 318925 
TEST=editing/pasteboard/restore-collapsed-space-for-copy.html

Review-Url: https://codereview.chromium.org/2320533002
Cr-Commit-Position: refs/heads/master@{#417155}

[rename] https://crrev.com/362b0c753edcf2e994de8ec82d9000f18e2ed284/third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy.html
[modify] https://crrev.com/362b0c753edcf2e994de8ec82d9000f18e2ed284/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Project Member Comment 22 by bugdroid1@chromium.org, Sep 14 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/131df048e7e445a03706078367285112e6b3467d

commit 131df048e7e445a03706078367285112e6b3467d
Author: joone.hur <joone.hur@intel.com>
Date: Wed Sep 14 14:33:08 2016

Restore a collapsed leading space of text used for line break

When a text is wrapped during layout, the leading space of the
text can be collapsed and a line break is inserted instead of
the space. In this case, we need to restore the collapsed space
when we copy the text.

This CL handles the case that the below CL didn't cover:
https://codereview.chromium.org/2320533002/

In addition, while iterating through the DOM range, the below
case with the TextIteratorBehavior flag don't need to restore
the leading space.

* Running DumpRenderTree : TextIteratorForInnerText
* Searching text : TextIteratorDoesNotBreakAtReplacedElement
* Getting a plain text for copy & paste: TextIteratorEmitsImageAltText

BUG= 318925 
TEST=editing/pasteboard/restore-collapsed-space-for-copy.html

Review-Url: https://codereview.chromium.org/2325553002
Cr-Commit-Position: refs/heads/master@{#418557}

[modify] https://crrev.com/131df048e7e445a03706078367285112e6b3467d/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
[modify] https://crrev.com/131df048e7e445a03706078367285112e6b3467d/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
[modify] https://crrev.com/131df048e7e445a03706078367285112e6b3467d/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Project Member Comment 23 by bugdroid1@chromium.org, Sep 27 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b52f205cb0cf1d448a59192f484a3c14a832bc5e

commit b52f205cb0cf1d448a59192f484a3c14a832bc5e
Author: joone.hur <joone.hur@intel.com>
Date: Tue Sep 27 07:13:13 2016

Restore only the collapsed leading space when copy text

When we need to restore the trailing space of a line and the
leading space of the next line together for copy operation,
we don't have to restore the trailing space in the first line.
Example: <div style="width: 2em;"><b><i>foo </i></b> bar</div>

BUG= 318925 
TEST=TextIteratorTest.PreserveOnlyLeadingSpace

Review-Url: https://codereview.chromium.org/2336043006
Cr-Commit-Position: refs/heads/master@{#421133}

[modify] https://crrev.com/b52f205cb0cf1d448a59192f484a3c14a832bc5e/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
[modify] https://crrev.com/b52f205cb0cf1d448a59192f484a3c14a832bc5e/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Owner: joone....@intel.com
Status: Started
Status: Fixed
Sign in to add a comment