Title: [102527] trunk/Source/WebCore
Revision
102527
Author
[email protected]
Date
2011-12-10 13:35:06 -0800 (Sat, 10 Dec 2011)

Log Message

There should be a way to count the number of nodes held by undo stack
https://bugs.webkit.org/show_bug.cgi?id=74099

Reviewed by Enrica Casucci.

Add getNodesInCommand to all SimpleEditCommands and EditCommandComposition in debug builds.
We can easily aggregate the number of nodes held by the undo stack by calling
this function on each item in the undo stack.

* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::getNodesInCommand):
* editing/AppendNodeCommand.h:
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::getNodesInCommand):
* editing/CompositeEditCommand.h:
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
* editing/DeleteFromTextNodeCommand.h:
* editing/EditCommand.cpp:
(WebCore::SimpleEditCommand::addNodeAndDescedents):
* editing/EditCommand.h:
* editing/Editor.cpp:
(WebCore::Editor::appliedEditing):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
* editing/InsertIntoTextNodeCommand.h:
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::getNodesInCommand):
* editing/InsertNodeBeforeCommand.h:
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
* editing/MergeIdenticalElementsCommand.h:
* editing/RemoveCSSPropertyCommand.cpp:
(WebCore::RemoveCSSPropertyCommand::getNodesInCommand):
* editing/RemoveCSSPropertyCommand.h:
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::getNodesInCommand):
* editing/RemoveNodeCommand.h:
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
* editing/ReplaceNodeWithSpanCommand.h:
* editing/SetNodeAttributeCommand.cpp:
(WebCore::SetNodeAttributeCommand::getNodesInCommand):
* editing/SetNodeAttributeCommand.h:
* editing/SetSelectionCommand.h:
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::getNodesInCommand):
* editing/SplitElementCommand.h:
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::getNodesInCommand):
* editing/SplitTextNodeCommand.h:
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
* editing/WrapContentsInDummySpanCommand.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102526 => 102527)


--- trunk/Source/WebCore/ChangeLog	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/ChangeLog	2011-12-10 21:35:06 UTC (rev 102527)
@@ -1,3 +1,60 @@
+2011-12-09  Ryosuke Niwa  <[email protected]>
+
+        There should be a way to count the number of nodes held by undo stack
+        https://bugs.webkit.org/show_bug.cgi?id=74099
+
+        Reviewed by Enrica Casucci.
+
+        Add getNodesInCommand to all SimpleEditCommands and EditCommandComposition in debug builds.
+        We can easily aggregate the number of nodes held by the undo stack by calling
+        this function on each item in the undo stack.
+
+        * editing/AppendNodeCommand.cpp:
+        (WebCore::AppendNodeCommand::getNodesInCommand):
+        * editing/AppendNodeCommand.h:
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::EditCommandComposition::getNodesInCommand):
+        * editing/CompositeEditCommand.h:
+        * editing/DeleteFromTextNodeCommand.cpp:
+        (WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
+        * editing/DeleteFromTextNodeCommand.h:
+        * editing/EditCommand.cpp:
+        (WebCore::SimpleEditCommand::addNodeAndDescedents):
+        * editing/EditCommand.h:
+        * editing/Editor.cpp:
+        (WebCore::Editor::appliedEditing):
+        * editing/InsertIntoTextNodeCommand.cpp:
+        (WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
+        * editing/InsertIntoTextNodeCommand.h:
+        * editing/InsertNodeBeforeCommand.cpp:
+        (WebCore::InsertNodeBeforeCommand::getNodesInCommand):
+        * editing/InsertNodeBeforeCommand.h:
+        * editing/MergeIdenticalElementsCommand.cpp:
+        (WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
+        * editing/MergeIdenticalElementsCommand.h:
+        * editing/RemoveCSSPropertyCommand.cpp:
+        (WebCore::RemoveCSSPropertyCommand::getNodesInCommand):
+        * editing/RemoveCSSPropertyCommand.h:
+        * editing/RemoveNodeCommand.cpp:
+        (WebCore::RemoveNodeCommand::getNodesInCommand):
+        * editing/RemoveNodeCommand.h:
+        * editing/ReplaceNodeWithSpanCommand.cpp:
+        (WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
+        * editing/ReplaceNodeWithSpanCommand.h:
+        * editing/SetNodeAttributeCommand.cpp:
+        (WebCore::SetNodeAttributeCommand::getNodesInCommand):
+        * editing/SetNodeAttributeCommand.h:
+        * editing/SetSelectionCommand.h:
+        * editing/SplitElementCommand.cpp:
+        (WebCore::SplitElementCommand::getNodesInCommand):
+        * editing/SplitElementCommand.h:
+        * editing/SplitTextNodeCommand.cpp:
+        (WebCore::SplitTextNodeCommand::getNodesInCommand):
+        * editing/SplitTextNodeCommand.h:
+        * editing/WrapContentsInDummySpanCommand.cpp:
+        (WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
+        * editing/WrapContentsInDummySpanCommand.h:
+
 2011-11-09  Robert Hogan  <[email protected]>
 
         CSS 2.1 failure: outline-color-* tests fail

Modified: trunk/Source/WebCore/editing/AppendNodeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/AppendNodeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/AppendNodeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -79,4 +79,12 @@
     m_node->remove(ec);
 }
 
+#ifndef NDEBUG
+void AppendNodeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_parent.get(), nodes);
+    addNodeAndDescendants(m_node.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/AppendNodeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/AppendNodeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/AppendNodeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,9 +40,13 @@
 private:
     AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>);
 
-    virtual void doApply();
-    virtual void doUnapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
 
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
     RefPtr<ContainerNode> m_parent;
     RefPtr<Node> m_node;
 };

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -100,6 +100,15 @@
     m_commands.append(command);
 }
 
+#ifndef NDEBUG
+void EditCommandComposition::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    size_t size = m_commands.size();
+    for (size_t i = 0; i < size; ++i)
+        m_commands[i]->getNodesInCommand(nodes);
+}
+#endif
+
 CompositeEditCommand::CompositeEditCommand(Document *document)
     : EditCommand(document)
 {

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/CompositeEditCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -46,6 +46,10 @@
     virtual void doReapply() OVERRIDE;
     void append(SimpleEditCommand*);
 
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
 private:
     EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection)
         : EditCommand(document, startingSelection, endingSelection)

Modified: trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -76,4 +76,11 @@
         document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextInserted, m_offset, m_text);
 }
 
+#ifndef NDEBUG
+void DeleteFromTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_node.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -42,9 +42,13 @@
 private:
     DeleteFromTextNodeCommand(PassRefPtr<Text>, unsigned offset, unsigned count);
 
-    virtual void doApply();
-    virtual void doUnapply();
-
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+    
     RefPtr<Text> m_node;
     unsigned m_offset;
     unsigned m_count;

Modified: trunk/Source/WebCore/editing/EditCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/EditCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/EditCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -251,6 +251,14 @@
     }
 }
 
+#ifndef NDEBUG
+void SimpleEditCommand::addNodeAndDescendants(Node* startNode, HashSet<Node*>& nodes)
+{
+    for (Node* node = startNode; node; node = node->traverseNextNode(startNode))
+        nodes.add(node);
+}
+#endif
+
 void applyCommand(PassRefPtr<EditCommand> command)
 {
     command->apply();

Modified: trunk/Source/WebCore/editing/EditCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/EditCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/EditCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -29,6 +29,10 @@
 #include "EditAction.h"
 #include "VisibleSelection.h"
 
+#ifndef NDEBUG
+#include <wtf/HashSet.h>
+#endif
+
 namespace WebCore {
 
 class CompositeEditCommand;
@@ -95,8 +99,19 @@
 };
 
 class SimpleEditCommand : public EditCommand {
+public:
+
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) = 0;
+#endif
+
 protected:
     SimpleEditCommand(Document* document) : EditCommand(document) { }
+
+#ifndef NDEBUG
+    void addNodeAndDescendants(Node*, HashSet<Node*>&);
+#endif
+
 private:
     virtual bool isSimpleEditCommand() const OVERRIDE { return true; }
 };

Modified: trunk/Source/WebCore/editing/Editor.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/Editor.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/Editor.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -890,6 +890,7 @@
         if (client())
             client()->registerCommandForUndo(toCompositeEditCommand(m_lastEditCommand.get())->ensureComposition());
     }
+
     respondToChangedContents(newSelection);
 }
 

Modified: trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -76,4 +76,11 @@
     m_node->deleteData(m_offset, m_text.length(), ec);
 }
 
+#ifndef NDEBUG
+void InsertIntoTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_node.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -42,9 +42,13 @@
 private:
     InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text);
 
-    virtual void doApply();
-    virtual void doUnapply();
-
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+    
     RefPtr<Text> m_node;
     unsigned m_offset;
     String m_text;

Modified: trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -71,4 +71,12 @@
     m_insertChild->remove(ec);
 }
 
+#ifndef NDEBUG
+void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_insertChild.get(), nodes);
+    addNodeAndDescendants(m_refChild.get(), nodes);
 }
+#endif
+
+}

Modified: trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,9 +40,13 @@
 private:
     InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore);
 
-    virtual void doApply();
-    virtual void doUnapply();
-
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+    
     RefPtr<Node> m_insertChild;
     RefPtr<Node> m_refChild; 
 };

Modified: trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -86,4 +86,12 @@
         m_element1->appendChild(children[i].release(), ec);
 }
 
+#ifndef NDEBUG
+void MergeIdenticalElementsCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_element1.get(), nodes);
+    addNodeAndDescendants(m_element2.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,9 +40,13 @@
 private:
     MergeIdenticalElementsCommand(PassRefPtr<Element>, PassRefPtr<Element>);
 
-    virtual void doApply();
-    virtual void doUnapply();
-
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+    
     RefPtr<Element> m_element1;
     RefPtr<Element> m_element2;
     RefPtr<Node> m_atChild;

Modified: trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -54,4 +54,11 @@
     style->setProperty(m_property, m_oldValue, m_important);
 }
 
+#ifndef NDEBUG
+void RemoveCSSPropertyCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_element.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -42,9 +42,13 @@
 private:
     RemoveCSSPropertyCommand(Document*, PassRefPtr<StyledElement>, CSSPropertyID property);
 
-    virtual void doApply();
-    virtual void doUnapply();
-
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+    
     RefPtr<StyledElement> m_element;
     CSSPropertyID m_property;
     String m_oldValue;

Modified: trunk/Source/WebCore/editing/RemoveNodeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/RemoveNodeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/RemoveNodeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -63,4 +63,13 @@
     parent->insertBefore(m_node.get(), refChild.get(), ec);
 }
 
+#ifndef NDEBUG
+void RemoveNodeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_parent.get(), nodes);
+    addNodeAndDescendants(m_refChild.get(), nodes);
+    addNodeAndDescendants(m_node.get(), nodes);
 }
+#endif
+
+}

Modified: trunk/Source/WebCore/editing/RemoveNodeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/RemoveNodeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/RemoveNodeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,9 +40,13 @@
 private:
     RemoveNodeCommand(PassRefPtr<Node>);
 
-    virtual void doApply();
-    virtual void doUnapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
 
+#ifndef NDEBUG
+    void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
     RefPtr<Node> m_node;
     RefPtr<ContainerNode> m_parent;
     RefPtr<Node> m_refChild;    

Modified: trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -85,4 +85,12 @@
     swapInNodePreservingAttributesAndChildren(m_elementToReplace.get(), m_spanElement.get());
 }
 
+#ifndef NDEBUG
+void ReplaceNodeWithSpanCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_elementToReplace.get(), nodes);
+    addNodeAndDescendants(m_spanElement.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -50,8 +50,12 @@
 private:
     ReplaceNodeWithSpanCommand(PassRefPtr<HTMLElement>);
 
-    virtual void doApply();
-    virtual void doUnapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
 
     RefPtr<HTMLElement> m_elementToReplace;
     RefPtr<HTMLElement> m_spanElement;

Modified: trunk/Source/WebCore/editing/SetNodeAttributeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/SetNodeAttributeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SetNodeAttributeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -54,4 +54,11 @@
     m_oldValue = nullString;
 }
 
+#ifndef NDEBUG
+void SetNodeAttributeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_element.get(), nodes);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/SetNodeAttributeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/SetNodeAttributeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SetNodeAttributeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -41,9 +41,13 @@
 private:
     SetNodeAttributeCommand(PassRefPtr<Element>, const QualifiedName& attribute, const AtomicString& value);
 
-    virtual void doApply();
-    virtual void doUnapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
 
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
     RefPtr<Element> m_element;
     QualifiedName m_attribute;
     AtomicString m_value;

Modified: trunk/Source/WebCore/editing/SetSelectionCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/SetSelectionCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SetSelectionCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,9 +40,14 @@
 
 private:
     SetSelectionCommand(const VisibleSelection&, FrameSelection::SetSelectionOptions);
-    virtual void doApply();
-    virtual void doUnapply();
 
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE { }
+#endif
+
     FrameSelection::SetSelectionOptions m_options;
     VisibleSelection m_selectionToSet;
 };

Modified: trunk/Source/WebCore/editing/SplitElementCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/SplitElementCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SplitElementCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -107,5 +107,14 @@
     
     executeApply();
 }
+
+#ifndef NDEBUG
+void SplitElementCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_element1.get(), nodes);
+    addNodeAndDescendants(m_element2.get(), nodes);
+    addNodeAndDescendants(m_atChild.get(), nodes);
+}
+#endif
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/SplitElementCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/SplitElementCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SplitElementCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -40,11 +40,15 @@
 private:
     SplitElementCommand(PassRefPtr<Element>, PassRefPtr<Node> splitPointChild);
 
-    virtual void doApply();
-    virtual void doUnapply();
-    virtual void doReapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    virtual void doReapply() OVERRIDE;
     void executeApply();
 
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
     RefPtr<Element> m_element1;
     RefPtr<Element> m_element2;
     RefPtr<Node> m_atChild;

Modified: trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -103,5 +103,13 @@
         return;
     m_text2->deleteData(0, m_offset, ec);
 }
+
+#ifndef NDEBUG
+void SplitTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_text1.get(), nodes);
+    addNodeAndDescendants(m_text2.get(), nodes);
+}
+#endif
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/SplitTextNodeCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/SplitTextNodeCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/SplitTextNodeCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -42,10 +42,14 @@
 private:
     SplitTextNodeCommand(PassRefPtr<Text>, int offset);
 
-    virtual void doApply();
-    virtual void doUnapply();
-    virtual void doReapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    virtual void doReapply() OVERRIDE;
     void insertText1AndTrimText2();
+    
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
 
     RefPtr<Text> m_text1;
     RefPtr<Text> m_text2;

Modified: trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp (102526 => 102527)


--- trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp	2011-12-10 21:35:06 UTC (rev 102527)
@@ -89,5 +89,13 @@
 
     executeApply();
 }
+
+#ifndef NDEBUG
+void WrapContentsInDummySpanCommand::getNodesInCommand(HashSet<Node*>& nodes)
+{
+    addNodeAndDescendants(m_element.get(), nodes);
+    addNodeAndDescendants(m_dummySpan.get(), nodes);
+}
+#endif
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.h (102526 => 102527)


--- trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.h	2011-12-10 20:30:35 UTC (rev 102526)
+++ trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.h	2011-12-10 21:35:06 UTC (rev 102527)
@@ -42,11 +42,15 @@
 private:
     WrapContentsInDummySpanCommand(PassRefPtr<Element>);
 
-    virtual void doApply();
-    virtual void doUnapply();
-    virtual void doReapply();
+    virtual void doApply() OVERRIDE;
+    virtual void doUnapply() OVERRIDE;
+    virtual void doReapply() OVERRIDE;
     void executeApply();
 
+#ifndef NDEBUG
+    virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE;
+#endif
+
     RefPtr<Element> m_element;
     RefPtr<HTMLElement> m_dummySpan;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to