Bug 75004 - Drag and drop text into table is pasting the text in the next <td> element
Summary: Drag and drop text into table is pasting the text in the next <td> element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2011-12-21 03:52 PST by satya
Modified: 2012-05-02 12:50 PDT (History)
7 users (show)

See Also:


Attachments
Table inside Body(contentEditable=true) (1.44 KB, text/html)
2011-12-21 03:52 PST, satya
no flags Details
reduction attempt (please modify path to dump-as-markup.js) (1.53 KB, text/html)
2012-05-01 12:06 PDT, Ryosuke Niwa
no flags Details
DRT test (modify path to dump-as-markup.js) (1.10 KB, text/html)
2012-05-01 12:43 PDT, Ryosuke Niwa
no flags Details
Fixes the bug (4.17 KB, patch)
2012-05-01 13:48 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description satya 2011-12-21 03:52:14 PST
Created attachment 120168 [details]
Table inside Body(contentEditable=true)

We are proving an online editor for text. In this we have an option to include a table. For this we made body as editable by putting contentEditable="true". While putting the table inside that body and drag drop any text is misplacing the text.

Reproducible Steps:
1. Open http://elrte.org/demo
2. Delete whole content in editable area
3. Add text "sample"
4. Insert a table of 3*3 size
5. Drag and drop text("sample") into column(0,0)

Expected behavior:
Should paste the content in the column(0,0)


What happen instead:
It is pasting in the next column

Please find the attached simple test page to reproduce the same
Comment 1 Ryosuke Niwa 2012-05-01 12:06:43 PDT
Created attachment 139655 [details]
reduction attempt (please modify path to dump-as-markup.js)

Here's my attempt to reproduce this bug in DRT. I can't get it to work unfortunately :(
Comment 2 Ryosuke Niwa 2012-05-01 12:43:09 PDT
Created attachment 139658 [details]
DRT test (modify path to dump-as-markup.js)

finally, this one works
Comment 3 Ryosuke Niwa 2012-05-01 13:48:30 PDT
Created attachment 139669 [details]
Fixes the bug
Comment 4 Darin Adler 2012-05-02 12:28:22 PDT
Comment on attachment 139669 [details]
Fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=139669&action=review

> Source/WebCore/editing/ReplaceSelectionCommand.cpp:892
> +    if (m_preventNesting && startBlock && !isTableCell(startBlock) && !startIsInsideMailBlockquote) {

What about text that’s inside a <tr> but not an actual table cell and other non-table-cell cases that are otherwise similar to table cells in this respect?
Comment 5 Ryosuke Niwa 2012-05-02 12:34:39 PDT
Comment on attachment 139669 [details]
Fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=139669&action=review

>> Source/WebCore/editing/ReplaceSelectionCommand.cpp:892
>> +    if (m_preventNesting && startBlock && !isTableCell(startBlock) && !startIsInsideMailBlockquote) {
> 
> What about text that’s inside a <tr> but not an actual table cell and other non-table-cell cases that are otherwise similar to table cells in this respect?

We can address those cases in a separate bug I suppose. Please file a bug if you have a specific case in mind. FWIW, isTableCell checks the renderer for table-cellness.
Comment 6 WebKit Review Bot 2012-05-02 12:49:50 PDT
Comment on attachment 139669 [details]
Fixes the bug

Clearing flags on attachment: 139669

Committed r115869: <http://trac.webkit.org/changeset/115869>
Comment 7 WebKit Review Bot 2012-05-02 12:50:12 PDT
All reviewed patches have been landed.  Closing bug.