Bug 74304 - [Win] When copying a table row from other browsers, Safari and Chrome paste the content as text rather than within a table structure
Summary: [Win] When copying a table row from other browsers, Safari and Chrome paste t...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-12 09:00 PST by monahant
Modified: 2012-05-02 22:59 PDT (History)
7 users (show)

See Also:


Attachments
Test case to reproduce the issue (389 bytes, text/html)
2011-12-12 09:01 PST, monahant
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description monahant 2011-12-12 09:00:14 PST
To reproduce, open the attached html file in Firefox or IE.
Select the first table row by dragging the mouse across all content in the row and use Ctrl+C to copy the content.
Open the same html file in Safari or Chrome and click into one of the table cells. 
Use Ctrl+V to paste the content.
Problem: The table content is pasted as text, rather than within a table.

Using a clipboard inspector, the table structure is correctly represented in the HTML format on the clipboard as shown below. It seems like Webkit is using the Text format from the clipboard instead of the HTML format.

Clipboard HTML format in Firefox:
Version:0.9
StartHTML:00000181
EndHTML:00000296
StartFragment:00000215
EndFragment:00000260
SourceURL:file:///C:/Documents%20and%20Settings/Teresa%20Monahan/Desktop/test.html
<html><body>
<!--StartFragment--><tr><td>
				ccc</td><td>
				ddd</td></tr><!--EndFragment-->
</body>
</html>


Clipboard HTML format in Internet Explorer:
Version:1.0
StartHTML:000000235
EndHTML:000000545
StartFragment:000000448
EndFragment:000000474
StartSelection:000000448
EndSelection:000000469
SourceURL:file:///C:/Documents%20and%20Settings/Teresa%20Monahan/Desktop/test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD></HEAD>

<BODY>

<DIV id=myId contentEditable=true>

<TABLE style="WIDTH: 500px" border=1>

<TBODY>

<TR><!--StartFragment--><TD>ccc</TD>
<TD>ddd</TD><!--EndFragment--></TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</HTML>
Comment 1 monahant 2011-12-12 09:01:17 PST
Created attachment 118804 [details]
Test case to reproduce the issue
Comment 2 Ryosuke Niwa 2012-05-01 22:51:10 PDT
dcheng, do we still need to fix this for Windows port?
Comment 3 Daniel Cheng 2012-05-02 11:54:44 PDT
This was fixed in Chrome 16, but I believe it's still present in Safari since it doesn't pass in the entire string + fragment indices.
Comment 4 Ryosuke Niwa 2012-05-02 22:58:10 PDT
This is specific to Apple's Windows port now.
Comment 5 Ryosuke Niwa 2012-05-02 22:59:27 PDT
Note dcheng has added createFragmentFromMarkupWithContext to markup.cpp. It's just a matter of calling that function in ClipboardWin.cpp and related files.