Bug 64414

Summary: CompositeEditCommand should not be kept alive for undo and redo
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, enrica, eric, gregsimon, justin.garcia, leviw, sullivan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 64416, 73984    
Bug Blocks: 74059, 74249    
Attachments:
Description Flags
outdated work in progress patch
none
cleanup
none
Updated for ToT enrica: review+

Ryosuke Niwa
Reported 2011-07-12 17:32:36 PDT
As discussed on webkit-dev, we should make CompositeEditCommand a temporary object that exits only to execute a command. To reduce the memory footage and to support persistent positions, we should not keep it for undo and redo purposes. We can instead generate a EditCommandComposition that outlives CompositeEditCommand to implement undo and redo.
Attachments
outdated work in progress patch (6.04 KB, patch)
2011-07-13 16:37 PDT, Ryosuke Niwa
no flags
cleanup (20.93 KB, patch)
2011-12-08 02:03 PST, Ryosuke Niwa
no flags
Updated for ToT (20.90 KB, patch)
2011-12-08 02:11 PST, Ryosuke Niwa
enrica: review+
Ryosuke Niwa
Comment 1 2011-07-13 16:37:25 PDT
Created attachment 100729 [details] outdated work in progress patch
Ryosuke Niwa
Comment 2 2011-12-08 02:03:53 PST
Ryosuke Niwa
Comment 3 2011-12-08 02:07:39 PST
My current plan: 1. Land this patch 2. Change the argument type of registerCommandForUndo, registerCommandForRedo, and clearUndoRedoOperations from EditCommand* to EditCommandComposition* (perhaps a better name like DOMTransaction). 3. Make CompositeEditCommand not inherit from EditCommand.
Ryosuke Niwa
Comment 4 2011-12-08 02:11:39 PST
Created attachment 118352 [details] Updated for ToT
Ryosuke Niwa
Comment 5 2011-12-08 09:10:43 PST
Ping reviewers.
Enrica Casucci
Comment 6 2011-12-08 10:08:41 PST
Comment on attachment 118352 [details] Updated for ToT View in context: https://bugs.webkit.org/attachment.cgi?id=118352&action=review > Source/WebCore/editing/CompositeEditCommand.cpp:138 > + RefPtr<EditCommand> command = prpCommand; Why do you need this assignment? Do you need to keep a reference while executing the code below? Can apply() change something? > Source/WebCore/editing/CompositeEditCommand.cpp:150 > + RefPtr<CompositeEditCommand> command = prpCommand; Ditto. (Here I don't see the need for the reference at all). > Source/WebCore/editing/CompositeEditCommand.h:154 > +{ Should we at least assert the command is not null? > Source/WebCore/editing/CompositeEditCommand.h:159 > +inline CompositeEditCommand* toCompositeEditCommand(EditCommand* command) Ditto. > Source/WebCore/editing/EditCommand.h:104 > +{ I would add an ASSERT that command is not null.
Ryosuke Niwa
Comment 7 2011-12-08 10:43:36 PST
(In reply to comment #6) > (From update of attachment 118352 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=118352&action=review > > > Source/WebCore/editing/CompositeEditCommand.cpp:138 > > + RefPtr<EditCommand> command = prpCommand; > > Why do you need this assignment? Do you need to keep a reference while executing the code below? Can apply() change something? prpCommand is a pass ref ptr so calling composition()->append or m_command.append will clear prpCommand :( I could call get() but that seemed ugly. > > Source/WebCore/editing/CompositeEditCommand.cpp:150 > > + RefPtr<CompositeEditCommand> command = prpCommand; > > Ditto. (Here I don't see the need for the reference at all). Ditto. > > Source/WebCore/editing/CompositeEditCommand.h:154 > > +{ > > Should we at least assert the command is not null? > > > Source/WebCore/editing/CompositeEditCommand.h:159 > > +inline CompositeEditCommand* toCompositeEditCommand(EditCommand* command) > > Ditto. > > > Source/WebCore/editing/EditCommand.h:104 > > +{ > > I would add an ASSERT that command is not null. Sure. Will do.
Enrica Casucci
Comment 8 2011-12-08 10:59:47 PST
Comment on attachment 118352 [details] Updated for ToT thanks for the clarification. R=me with the additional ASSERT.
Ryosuke Niwa
Comment 9 2011-12-08 11:32:22 PST
Note You need to log in before you can comment on or make changes to this bug.