Changeset 102527 in webkit
- Timestamp:
- Dec 10, 2011 1:35:06 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102526 r102527 1 2011-12-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 There should be a way to count the number of nodes held by undo stack 4 https://bugs.webkit.org/show_bug.cgi?id=74099 5 6 Reviewed by Enrica Casucci. 7 8 Add getNodesInCommand to all SimpleEditCommands and EditCommandComposition in debug builds. 9 We can easily aggregate the number of nodes held by the undo stack by calling 10 this function on each item in the undo stack. 11 12 * editing/AppendNodeCommand.cpp: 13 (WebCore::AppendNodeCommand::getNodesInCommand): 14 * editing/AppendNodeCommand.h: 15 * editing/CompositeEditCommand.cpp: 16 (WebCore::EditCommandComposition::getNodesInCommand): 17 * editing/CompositeEditCommand.h: 18 * editing/DeleteFromTextNodeCommand.cpp: 19 (WebCore::DeleteFromTextNodeCommand::getNodesInCommand): 20 * editing/DeleteFromTextNodeCommand.h: 21 * editing/EditCommand.cpp: 22 (WebCore::SimpleEditCommand::addNodeAndDescedents): 23 * editing/EditCommand.h: 24 * editing/Editor.cpp: 25 (WebCore::Editor::appliedEditing): 26 * editing/InsertIntoTextNodeCommand.cpp: 27 (WebCore::InsertIntoTextNodeCommand::getNodesInCommand): 28 * editing/InsertIntoTextNodeCommand.h: 29 * editing/InsertNodeBeforeCommand.cpp: 30 (WebCore::InsertNodeBeforeCommand::getNodesInCommand): 31 * editing/InsertNodeBeforeCommand.h: 32 * editing/MergeIdenticalElementsCommand.cpp: 33 (WebCore::MergeIdenticalElementsCommand::getNodesInCommand): 34 * editing/MergeIdenticalElementsCommand.h: 35 * editing/RemoveCSSPropertyCommand.cpp: 36 (WebCore::RemoveCSSPropertyCommand::getNodesInCommand): 37 * editing/RemoveCSSPropertyCommand.h: 38 * editing/RemoveNodeCommand.cpp: 39 (WebCore::RemoveNodeCommand::getNodesInCommand): 40 * editing/RemoveNodeCommand.h: 41 * editing/ReplaceNodeWithSpanCommand.cpp: 42 (WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand): 43 * editing/ReplaceNodeWithSpanCommand.h: 44 * editing/SetNodeAttributeCommand.cpp: 45 (WebCore::SetNodeAttributeCommand::getNodesInCommand): 46 * editing/SetNodeAttributeCommand.h: 47 * editing/SetSelectionCommand.h: 48 * editing/SplitElementCommand.cpp: 49 (WebCore::SplitElementCommand::getNodesInCommand): 50 * editing/SplitElementCommand.h: 51 * editing/SplitTextNodeCommand.cpp: 52 (WebCore::SplitTextNodeCommand::getNodesInCommand): 53 * editing/SplitTextNodeCommand.h: 54 * editing/WrapContentsInDummySpanCommand.cpp: 55 (WebCore::WrapContentsInDummySpanCommand::getNodesInCommand): 56 * editing/WrapContentsInDummySpanCommand.h: 57 1 58 2011-11-09 Robert Hogan <robert@webkit.org> 2 59 -
trunk/Source/WebCore/editing/AppendNodeCommand.cpp
r101349 r102527 80 80 } 81 81 82 #ifndef NDEBUG 83 void AppendNodeCommand::getNodesInCommand(HashSet<Node*>& nodes) 84 { 85 addNodeAndDescendants(m_parent.get(), nodes); 86 addNodeAndDescendants(m_node.get(), nodes); 87 } 88 #endif 89 82 90 } // namespace WebCore -
trunk/Source/WebCore/editing/AppendNodeCommand.h
r81185 r102527 41 41 AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>); 42 42 43 virtual void doApply(); 44 virtual void doUnapply(); 43 virtual void doApply() OVERRIDE; 44 virtual void doUnapply() OVERRIDE; 45 46 #ifndef NDEBUG 47 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 48 #endif 45 49 46 50 RefPtr<ContainerNode> m_parent; -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r102357 r102527 101 101 } 102 102 103 #ifndef NDEBUG 104 void EditCommandComposition::getNodesInCommand(HashSet<Node*>& nodes) 105 { 106 size_t size = m_commands.size(); 107 for (size_t i = 0; i < size; ++i) 108 m_commands[i]->getNodesInCommand(nodes); 109 } 110 #endif 111 103 112 CompositeEditCommand::CompositeEditCommand(Document *document) 104 113 : EditCommand(document) -
trunk/Source/WebCore/editing/CompositeEditCommand.h
r102357 r102527 46 46 virtual void doReapply() OVERRIDE; 47 47 void append(SimpleEditCommand*); 48 49 #ifndef NDEBUG 50 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 51 #endif 48 52 49 53 private: -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
r101349 r102527 77 77 } 78 78 79 #ifndef NDEBUG 80 void DeleteFromTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes) 81 { 82 addNodeAndDescendants(m_node.get(), nodes); 83 } 84 #endif 85 79 86 } // namespace WebCore -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h
r39456 r102527 43 43 DeleteFromTextNodeCommand(PassRefPtr<Text>, unsigned offset, unsigned count); 44 44 45 virtual void doApply(); 46 virtual void doUnapply(); 47 45 virtual void doApply() OVERRIDE; 46 virtual void doUnapply() OVERRIDE; 47 48 #ifndef NDEBUG 49 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 50 #endif 51 48 52 RefPtr<Text> m_node; 49 53 unsigned m_offset; -
trunk/Source/WebCore/editing/EditCommand.cpp
r102357 r102527 252 252 } 253 253 254 #ifndef NDEBUG 255 void SimpleEditCommand::addNodeAndDescendants(Node* startNode, HashSet<Node*>& nodes) 256 { 257 for (Node* node = startNode; node; node = node->traverseNextNode(startNode)) 258 nodes.add(node); 259 } 260 #endif 261 254 262 void applyCommand(PassRefPtr<EditCommand> command) 255 263 { -
trunk/Source/WebCore/editing/EditCommand.h
r102413 r102527 29 29 #include "EditAction.h" 30 30 #include "VisibleSelection.h" 31 32 #ifndef NDEBUG 33 #include <wtf/HashSet.h> 34 #endif 31 35 32 36 namespace WebCore { … … 96 100 97 101 class SimpleEditCommand : public EditCommand { 102 public: 103 104 #ifndef NDEBUG 105 virtual void getNodesInCommand(HashSet<Node*>&) = 0; 106 #endif 107 98 108 protected: 99 109 SimpleEditCommand(Document* document) : EditCommand(document) { } 110 111 #ifndef NDEBUG 112 void addNodeAndDescendants(Node*, HashSet<Node*>&); 113 #endif 114 100 115 private: 101 116 virtual bool isSimpleEditCommand() const OVERRIDE { return true; } -
trunk/Source/WebCore/editing/Editor.cpp
r102357 r102527 891 891 client()->registerCommandForUndo(toCompositeEditCommand(m_lastEditCommand.get())->ensureComposition()); 892 892 } 893 893 894 respondToChangedContents(newSelection); 894 895 } -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
r101349 r102527 77 77 } 78 78 79 #ifndef NDEBUG 80 void InsertIntoTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes) 81 { 82 addNodeAndDescendants(m_node.get(), nodes); 83 } 84 #endif 85 79 86 } // namespace WebCore -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h
r39456 r102527 43 43 InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text); 44 44 45 virtual void doApply(); 46 virtual void doUnapply(); 47 45 virtual void doApply() OVERRIDE; 46 virtual void doUnapply() OVERRIDE; 47 48 #ifndef NDEBUG 49 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 50 #endif 51 48 52 RefPtr<Text> m_node; 49 53 unsigned m_offset; -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
r101349 r102527 72 72 } 73 73 74 #ifndef NDEBUG 75 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes) 76 { 77 addNodeAndDescendants(m_insertChild.get(), nodes); 78 addNodeAndDescendants(m_refChild.get(), nodes); 74 79 } 80 #endif 81 82 } -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h
r34536 r102527 41 41 InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore); 42 42 43 virtual void doApply(); 44 virtual void doUnapply(); 45 43 virtual void doApply() OVERRIDE; 44 virtual void doUnapply() OVERRIDE; 45 46 #ifndef NDEBUG 47 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 48 #endif 49 46 50 RefPtr<Node> m_insertChild; 47 51 RefPtr<Node> m_refChild; -
trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp
r81965 r102527 87 87 } 88 88 89 #ifndef NDEBUG 90 void MergeIdenticalElementsCommand::getNodesInCommand(HashSet<Node*>& nodes) 91 { 92 addNodeAndDescendants(m_element1.get(), nodes); 93 addNodeAndDescendants(m_element2.get(), nodes); 94 } 95 #endif 96 89 97 } // namespace WebCore -
trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.h
r34536 r102527 41 41 MergeIdenticalElementsCommand(PassRefPtr<Element>, PassRefPtr<Element>); 42 42 43 virtual void doApply(); 44 virtual void doUnapply(); 45 43 virtual void doApply() OVERRIDE; 44 virtual void doUnapply() OVERRIDE; 45 46 #ifndef NDEBUG 47 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 48 #endif 49 46 50 RefPtr<Element> m_element1; 47 51 RefPtr<Element> m_element2; -
trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp
r65014 r102527 55 55 } 56 56 57 #ifndef NDEBUG 58 void RemoveCSSPropertyCommand::getNodesInCommand(HashSet<Node*>& nodes) 59 { 60 addNodeAndDescendants(m_element.get(), nodes); 61 } 62 #endif 63 57 64 } // namespace WebCore -
trunk/Source/WebCore/editing/RemoveCSSPropertyCommand.h
r79976 r102527 43 43 RemoveCSSPropertyCommand(Document*, PassRefPtr<StyledElement>, CSSPropertyID property); 44 44 45 virtual void doApply(); 46 virtual void doUnapply(); 47 45 virtual void doApply() OVERRIDE; 46 virtual void doUnapply() OVERRIDE; 47 48 #ifndef NDEBUG 49 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 50 #endif 51 48 52 RefPtr<StyledElement> m_element; 49 53 CSSPropertyID m_property; -
trunk/Source/WebCore/editing/RemoveNodeCommand.cpp
r81965 r102527 64 64 } 65 65 66 #ifndef NDEBUG 67 void RemoveNodeCommand::getNodesInCommand(HashSet<Node*>& nodes) 68 { 69 addNodeAndDescendants(m_parent.get(), nodes); 70 addNodeAndDescendants(m_refChild.get(), nodes); 71 addNodeAndDescendants(m_node.get(), nodes); 66 72 } 73 #endif 74 75 } -
trunk/Source/WebCore/editing/RemoveNodeCommand.h
r69868 r102527 41 41 RemoveNodeCommand(PassRefPtr<Node>); 42 42 43 virtual void doApply(); 44 virtual void doUnapply(); 43 virtual void doApply() OVERRIDE; 44 virtual void doUnapply() OVERRIDE; 45 46 #ifndef NDEBUG 47 void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 48 #endif 45 49 46 50 RefPtr<Node> m_node; -
trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
r98796 r102527 86 86 } 87 87 88 #ifndef NDEBUG 89 void ReplaceNodeWithSpanCommand::getNodesInCommand(HashSet<Node*>& nodes) 90 { 91 addNodeAndDescendants(m_elementToReplace.get(), nodes); 92 addNodeAndDescendants(m_spanElement.get(), nodes); 93 } 94 #endif 95 88 96 } // namespace WebCore -
trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h
r95901 r102527 51 51 ReplaceNodeWithSpanCommand(PassRefPtr<HTMLElement>); 52 52 53 virtual void doApply(); 54 virtual void doUnapply(); 53 virtual void doApply() OVERRIDE; 54 virtual void doUnapply() OVERRIDE; 55 56 #ifndef NDEBUG 57 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 58 #endif 55 59 56 60 RefPtr<HTMLElement> m_elementToReplace; -
trunk/Source/WebCore/editing/SetNodeAttributeCommand.cpp
r39456 r102527 55 55 } 56 56 57 #ifndef NDEBUG 58 void SetNodeAttributeCommand::getNodesInCommand(HashSet<Node*>& nodes) 59 { 60 addNodeAndDescendants(m_element.get(), nodes); 61 } 62 #endif 63 57 64 } // namespace WebCore -
trunk/Source/WebCore/editing/SetNodeAttributeCommand.h
r86135 r102527 42 42 SetNodeAttributeCommand(PassRefPtr<Element>, const QualifiedName& attribute, const AtomicString& value); 43 43 44 virtual void doApply(); 45 virtual void doUnapply(); 44 virtual void doApply() OVERRIDE; 45 virtual void doUnapply() OVERRIDE; 46 47 #ifndef NDEBUG 48 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 49 #endif 46 50 47 51 RefPtr<Element> m_element; -
trunk/Source/WebCore/editing/SetSelectionCommand.h
r85864 r102527 41 41 private: 42 42 SetSelectionCommand(const VisibleSelection&, FrameSelection::SetSelectionOptions); 43 virtual void doApply(); 44 virtual void doUnapply(); 43 44 virtual void doApply() OVERRIDE; 45 virtual void doUnapply() OVERRIDE; 46 47 #ifndef NDEBUG 48 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE { } 49 #endif 45 50 46 51 FrameSelection::SetSelectionOptions m_options; -
trunk/Source/WebCore/editing/SplitElementCommand.cpp
r94427 r102527 108 108 executeApply(); 109 109 } 110 111 #ifndef NDEBUG 112 void SplitElementCommand::getNodesInCommand(HashSet<Node*>& nodes) 113 { 114 addNodeAndDescendants(m_element1.get(), nodes); 115 addNodeAndDescendants(m_element2.get(), nodes); 116 addNodeAndDescendants(m_atChild.get(), nodes); 117 } 118 #endif 110 119 111 120 } // namespace WebCore -
trunk/Source/WebCore/editing/SplitElementCommand.h
r50310 r102527 41 41 SplitElementCommand(PassRefPtr<Element>, PassRefPtr<Node> splitPointChild); 42 42 43 virtual void doApply() ;44 virtual void doUnapply() ;45 virtual void doReapply() ;43 virtual void doApply() OVERRIDE; 44 virtual void doUnapply() OVERRIDE; 45 virtual void doReapply() OVERRIDE; 46 46 void executeApply(); 47 48 #ifndef NDEBUG 49 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 50 #endif 47 51 48 52 RefPtr<Element> m_element1; -
trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp
r81965 r102527 104 104 m_text2->deleteData(0, m_offset, ec); 105 105 } 106 107 #ifndef NDEBUG 108 void SplitTextNodeCommand::getNodesInCommand(HashSet<Node*>& nodes) 109 { 110 addNodeAndDescendants(m_text1.get(), nodes); 111 addNodeAndDescendants(m_text2.get(), nodes); 112 } 113 #endif 106 114 107 115 } // namespace WebCore -
trunk/Source/WebCore/editing/SplitTextNodeCommand.h
r64034 r102527 43 43 SplitTextNodeCommand(PassRefPtr<Text>, int offset); 44 44 45 virtual void doApply() ;46 virtual void doUnapply() ;47 virtual void doReapply() ;45 virtual void doApply() OVERRIDE; 46 virtual void doUnapply() OVERRIDE; 47 virtual void doReapply() OVERRIDE; 48 48 void insertText1AndTrimText2(); 49 50 #ifndef NDEBUG 51 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 52 #endif 49 53 50 54 RefPtr<Text> m_text1; -
trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp
r81965 r102527 90 90 executeApply(); 91 91 } 92 93 #ifndef NDEBUG 94 void WrapContentsInDummySpanCommand::getNodesInCommand(HashSet<Node*>& nodes) 95 { 96 addNodeAndDescendants(m_element.get(), nodes); 97 addNodeAndDescendants(m_dummySpan.get(), nodes); 98 } 99 #endif 92 100 93 101 } // namespace WebCore -
trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.h
r50310 r102527 43 43 WrapContentsInDummySpanCommand(PassRefPtr<Element>); 44 44 45 virtual void doApply() ;46 virtual void doUnapply() ;47 virtual void doReapply() ;45 virtual void doApply() OVERRIDE; 46 virtual void doUnapply() OVERRIDE; 47 virtual void doReapply() OVERRIDE; 48 48 void executeApply(); 49 50 #ifndef NDEBUG 51 virtual void getNodesInCommand(HashSet<Node*>&) OVERRIDE; 52 #endif 49 53 50 54 RefPtr<Element> m_element;
Note: See TracChangeset
for help on using the changeset viewer.