RESOLVED DUPLICATE of bug 19701 24789
Select all in an editable document and then delete should put editing back into the same state as a new message
https://bugs.webkit.org/show_bug.cgi?id=24789
Summary Select all in an editable document and then delete should put editing back in...
Adele Peterson
Reported 2009-03-24 16:15:30 PDT
Select all in an editable document and then delete should put editing back into the same state as a new message. Steps to reproduce: 1) Start composing a new rich email in GMail 2) In a separate window, open yahoo.com, select-all and copy 3) Paste the content into the GMail message 4) Select-all in the message and hit delete 5) observe that there is still formatting leftover. If you send the message to yourself now, and view the original source, you'll see a bunch of spans still in the document. <rdar://problem/6609509>
Attachments
experiment (1.06 KB, patch)
2009-03-24 16:20 PDT, Adele Peterson
no flags
Adele Peterson
Comment 1 2009-03-24 16:19:34 PDT
I did an experiment in DeleteSelectionCommand to detect if the selection to delete was the whole body, and then to also delete everything in the document. It worked pretty well, but I think it might be better to reuse some of the code that determined all that extra stuff needed to be copied, and then use the same range that would be copied to decide what to delete. I'll attach my experimental patch in case anyone's interested.
Adele Peterson
Comment 2 2009-03-24 16:20:01 PDT
Created attachment 28914 [details] experiment
Ojan Vafai
Comment 3 2009-03-24 16:32:50 PDT
This patch seems good to me. Although, it should look at the rootEditableElement, or whatever it's called, instead of the body element so that it also works for contentEditable nodes. In the long-term, we'll need to be careful that this test still works as we rewire VisiblePositions/Positions. As long as a layout test accompanies the fix though, I think we'd be good. Would be good to also have tests that test making a selection with the mouse/keyboard that selects all the content of an editable element, then deletes so that we can document that it's either the same or different than select all + delete. It's not clear to me whether it should be the same, but at the very least, we should know if it is and if that behavior changes in the future.
Adele Peterson
Comment 4 2009-03-24 16:45:22 PDT
ok, marking as a dupe of 19701 *** This bug has been marked as a duplicate of 19701 ***
Note You need to log in before you can comment on or make changes to this bug.