[UndoManager] Disallowing live UndoManager on detached nodes

Greetings all,

We've been implementing undo manager in WebKit, and we've found out that
allowing live undo manager on a detached undo scope host is a terrible idea.

e.g. say you have a subtree like follows:

   - A
      - B
         - D
      - C

where A is the undo scope host. If we then detach B from A, and then insert
A under D, all automatic transactions in A's undo manager are broken and
may create a cyclic reference graph because nodes touched in automatic
transactions need to be kept alive for undo/redo.

If there is no objection, I'm changing the spec to disallow live undo
manager on detached nodes so that scripts can't move the host around inside
a document or between documents; i.e. when a undo scope host is removed
from its parent, its undo manager must be *disconnected* and a new undo
manager be created for the node.

Alternatively, we can turn all automatic transactions in the undo manager
into no-ops but I'd prefer disconnecting the undo manager altogether to
make the behavior simple.

Best,
Ryosuke Niwa
Software Engineer
Google Inc.

Received on Tuesday, 21 August 2012 04:53:28 UTC