[Webkit-unassigned] [Bug 91812] Implement UndoManager's automatic DOM transactions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 20 20:54:21 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=91812





--- Comment #11 from Ryosuke Niwa <rniwa at webkit.org>  2012-08-20 20:54:50 PST ---
(From update of attachment 159588)
View in context: https://bugs.webkit.org/attachment.cgi?id=159588&action=review

> Source/WebCore/bindings/v8/DOMTransaction.cpp:57
> +        UndoManager::setRecordingDOMTransaction(this);
> +        callFunction("executeAutomatic");
> +        UndoManager::setRecordingDOMTransaction(0);

These calls to setRecordingDOMTransaction should be done a RAII object.

> Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:62
> +            AtomicString oldValue = m_mutationRecipients->isOldValueRequested() ? s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr) : nullAtom;

getAttribute is an expensive operation. We should probably not compute it twice for mutation observers & undo manager.
Instead, share the code that it's only computed once.

> Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:69
> +        if (!s_currentDecl->parentElement())
> +            return;

We already have this early exit in lines 58-59

> Source/WebCore/dom/ContainerNode.cpp:353
> +#if ENABLE(UNDO_MANAGER)
> +    bool isRecordingAutomaticTransaction = UndoManager::isRecordingAutomaticTransaction(container);
> +#endif

What's the point of this local variable? I'm pretty certain the value of isRecordingAutomaticTransaction could change.
e.g. its undo manager can get disconnected in the middle of a DOM transaction.

> Source/WebCore/dom/Document.cpp:6162
> +PassRefPtr<UndoManager> Document::getUndoManager(Node* node)

We prefix a function name with "get" when the function has an out argument.
Since we don't have an out argument, we shouldn't prefix it with "get".
How about undoManagerForNode?

> Source/WebCore/editing/UndoManager.cpp:219
> +    if (!s_recordingDOMTransaction || !s_recordingDOMTransaction->undoManager())

I don't think we can ever have a recording DOM transaction and then its undo manager being null.
We should assert that condition instead.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list