[webkit-dev] Adding Persistent Position
rniwa at webkit.org
Thu Jun 23 14:43:00 PDT 2011
I think we need a PersistentPosition that auto-corrects itself and survives
DOM mutations without being orphaned; similar to how Range is automatically
1. ReplaceSelectionCommand and DeleteSelectionCommand have wrapper for
removeNode, deleteTextFromNode, etc... to update Positions they maintain.
2. InsertListCommand and IndentOutdentCommand crash all the time because
Position get lost in moveParagraph, etc...
3. FrameSelection has a special function that gets called whenever Node
is removed to update its end points but VisibleSelection doesn't so
endingSelection() becomes stale very easily compared to FrameSelection.
On the other hand, adding this new class and instantiating them as member
variables of subclasses of CompositeEditCommand may impact performance
because CompositeEditCommand stays on the memory even after it's pushed into
undo stack. Also, maintaining a pointer (probably from Document) to stack
object (although member variables of CompositeEditCommand will end up living
in heap) seems like a dangerous design although we could make it ref-counted
To address the performance impact, we can modify CompositeEditCommand so
that it won't be added to the undo stack. Instead, CompositeEditCommand
will create an EditCommandComposition that stores a tree of
SimpleEditCommands that inherits from EditCommand and will be added to the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev