On WebKit TOT, copying & pasting table cells from Microsoft Excel result in table cells being pasted as plain text. This is due to the fact we're stripping tr, td, and other table cell elements when we're parsing the following HTML fragment (no table element): <col width=64 span=2 style='width:48pt'> <tr height=20 style='height:15.0pt'> <td height=20 class=xl65 width=64 style='height:15.0pt;width:48pt'>hello</span></td> <td class=xl65 width=64 style='border-left:none;width:48pt'>world</td> </tr> <tr height=20 style='height:15.0pt'> <td height=20 class=xl65 style='height:15.0pt;border-top:none'>webkit</td> <td class=xl65 style='border-top:none;border-left:none'> </td> </tr> http://crbug.com/19360
Unfortunately, nighties between this range crash on start an I cannot test the behavior. But I suspect that http://trac.webkit.org/changeset/65868 is the cause.
To reproduce this bug, insert the markup in comment #1 by execCommand('insertHTML'); WebKit should insert tr's and td's.
Created attachment 93111 [details] HTML content to be pasted in step 2 To reproduce the original bug, you must follow the lengthly steps below: Reproduction steps: 1. Download Windows Clipboard Viewer from http://www.peterbuettner.de/develop/tools/clipview/ 2. Launch the program and copy & paste the attached content 3. Type in "HTML Format" (without quotations) into a box right of "Push in Clip" 4. Press "Push in Clip" 5. Open http://www.mozilla.org/editor/midasdemo/ in WebKit Windows port. 6. Paste in the content editable region of the page Expected result: "hello", "world", and "WebKit" are in table cells Actual result: "hello world WebKit" is pasted as a plain text.
<rdar://problem/9420024>
Created attachment 93113 [details] test for bisection
Bisection indicates that r65868 is to blame, as suspected.
r65868 is "Use new HTML5 TreeBuilder for fragment parsing" (bug 44475).
What does firefox do? Should we not be using fragment parsing for copy/paste?
(In reply to comment #8) > What does firefox do? Should we not be using fragment parsing for copy/paste? They seem to have a special parsing algorithm just to deal with CF HTML :(
(In reply to comment #9) > (In reply to comment #8) > > What does firefox do? Should we not be using fragment parsing for copy/paste? > > They seem to have a special parsing algorithm just to deal with CF HTML :( Ryosuke and I were looking at the Moz code yesterday. He's saying there's a parsing algorithm that parses CF_HTML to generate HTML, which I assume gets passed to their HTML5 parser. WebKit has similar code for parsing CF_HTML into HTML, but it's very simplistic.
This has been fixed on Chromium Windows.