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.
Starred by 5 users
Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux, Windows, Mac
Pri: 2
Type: Bug



Sign in to add a comment
Formatting tags converted to spans with styles on cut/paste
Reported by aaron.na...@pearson.com, Aug 4 2016 Back to list
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

Steps to reproduce the problem:
1. Open the attached pasteTransform.html in Chrome. 
2. Look at the source of the document. Notice that the formatting has B elements. 
3. Select all the text in the contenteditable and cut it using Ctrl/Meta+A, Ctrl/Meta+X
4. Paste it back into the contenteditable using Ctrl/Meta+V
5. Look at the HTML now. Notice the B elements have been replaced with SPAN elements with styles.

What is the expected behavior?
The pasted HTML should be the same as the cut HTML.

What went wrong?
All formatting tags (B, I, U) are converted to SPAN elements with style attributes. The HTML should not be transformed in this manner.

Did this work before? N/A 

Chrome version: 52.0.2743.82  Channel: stable
OS Version: OS X 10.11.5
Flash Version: Shockwave Flash 22.0 r0

The HTML in my example file is what I get from using standard execCommand statements and typing. No special code was used to modify what Chrome created. 

Before I cut the HTML the contenteditable contains:

<div><b><br></b></div><b>aaaa</b>

After the cut/paste operation this is the result:

Mac: <br class="Apple-interchange-newline"><span style="font-weight: bold">aaaa</span>
Windows:  <div><br></div><div><span style="font-weight: bold;">aaaa</span><br></div>

The formatting tags shouldn't be transformed in this manner by a simple cut/paste operation.
 
pasteTransform.html
277 bytes View Download
Cc: msrchandra@chromium.org
Components: Blink>HTML
Labels: M-54 OS-Linux OS-Windows
Status: Untriaged
Able to reproduce the issue on Chrome Stable# 52.0.2743.116 on Windows, Mac and Linux.
This is a Non-Regression Issue existing from M30 Builds# 30.0.1599.101 (Official Build 227552) m.
Changing the status to Untriaged so that the issue would get addressed.
Thank You.
Components: Blink>Editing>Paste
Cc: yosin@chromium.org dominicc@chromium.org jsb...@chromium.org
Components: -Blink>HTML -Blink>Editing>Paste Blink>Editing
Status: Available
Yes, this is a bit surprising. From memory this is actually caused when the content is *cut*, not when it is pasted.
Project Member Comment 4 by bugdroid1@chromium.org, Aug 13 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f77d0eaedb2787483c147b973bcf7e7de82bf0f3

commit f77d0eaedb2787483c147b973bcf7e7de82bf0f3
Author: joone.hur <joone.hur@intel.com>
Date: Sat Aug 13 06:47:05 2016

Keep formatting tags included when it is cut or copied.

When we copy/cut a formatting tag without the highest node.
the formatting tag's text can be wrapped by <span> tag
instead of the formatting tag. This CL allows to keep
formatting tags included when it is cut or copied.

BUG= 634482 
TEST=editing/pasteboard/cut-paste-formatting-tag.html

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

[add] https://crrev.com/f77d0eaedb2787483c147b973bcf7e7de82bf0f3/third_party/WebKit/LayoutTests/editing/pasteboard/cut-paste-formatting-tag.html
[modify] https://crrev.com/f77d0eaedb2787483c147b973bcf7e7de82bf0f3/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
[modify] https://crrev.com/f77d0eaedb2787483c147b973bcf7e7de82bf0f3/third_party/WebKit/Source/core/editing/EditingUtilities.h
[modify] https://crrev.com/f77d0eaedb2787483c147b973bcf7e7de82bf0f3/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp
[modify] https://crrev.com/f77d0eaedb2787483c147b973bcf7e7de82bf0f3/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp

Comment 5 by joone....@intel.com, Oct 17 2016
Owner: joone....@intel.com
Status: Started
Comment 6 by joone....@intel.com, Oct 18 2016
Status: Fixed
Sign in to add a comment