undo/redo doesn't work after copy/pasting a table [contenteditable]

RESOLVED FIXED in Firefox 47

Status

()

defect
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: cyril.auburtin, Assigned: wchen)

Tracking

47 Branch
mozilla47
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox47 fixed)

Details

(Whiteboard: dom-triaged)

Attachments

(1 attachment, 1 obsolete attachment)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36

Steps to reproduce:

in http://output.jsbin.com/cacarew/5 select the whole first table with the mouse, ten copy it (ctrl+c), then place the cursor after the 3 dots, and paste it (ctrl+v)

after that undo (ctrl+z) will remove the second row of the pasted table, the first row remains, redo (ctrl+y) won't work

it actually corrupt/lose the whole undo history after pasting the table

possibly related: https://bugzilla.mozilla.org/show_bug.cgi?id=1015433


Actual results:

pasted <table> isn't undo-able, undo history is lost


Expected results:

it should have worked like any other html content pasted, being undo/redo-able
Component: Untriaged → Editor
Product: Firefox → Core
In nsHTMLEditor::ReplaceOrphanedStructure, we loop over |aNodeArray| removing nodes and checking if it is a descendant of the replacement node. If it is not, then the loop breaks but we continue to append the replacement node onto the list. I don't understand the overall picture of what this code is trying to do but that part looks wrong. It results in the same element being in |aNodeArray| twice (the replacement node is one of the nodes in the list). This results in creating multiple InsertNodeTxn for the same node. When we undo, the first transaction for the node will succeed, but the next one will fail (because the node is no longer a child).
Whiteboard: dom-triaged
Attachment #8718628 - Flags: review?(ehsan)
Comment on attachment 8718628 [details] [diff] [review]
Only replace nodes in nsHTMLEditor::ReplaceOrphanedStructure if all nodes in node list are descendants of replacement node

Review of attachment 8718628 [details] [diff] [review]:
-----------------------------------------------------------------

Please add a test too.  Thanks!
Attachment #8718628 - Flags: review?(ehsan) → review+
Added test
Assignee: nobody → wchen
Attachment #8718628 - Attachment is obsolete: true
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
https://hg.mozilla.org/mozilla-central/rev/542d4cda794b
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1306532
You need to log in before you can comment on or make changes to this bug.