From fcfd672bbad0c9862d4d844ceda960585ce107b3 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 22 Apr 2015 14:27:18 +0300 Subject: [PATCH] Bug 1154701 part 14 - Remove unused nsCOMArray cruft; r=ehsan --- editor/libeditor/nsEditorUtils.cpp | 15 ------------ editor/libeditor/nsEditorUtils.h | 11 ++------- editor/libeditor/nsHTMLEditRules.cpp | 30 +++++++++--------------- editor/libeditor/nsHTMLEditRules.h | 1 - editor/libeditor/nsHTMLEditor.cpp | 2 -- editor/libeditor/nsHTMLObjectResizer.cpp | 1 - 6 files changed, 13 insertions(+), 47 deletions(-) diff --git a/editor/libeditor/nsEditorUtils.cpp b/editor/libeditor/nsEditorUtils.cpp index 64e1be3b67b4..4b268ac44455 100644 --- a/editor/libeditor/nsEditorUtils.cpp +++ b/editor/libeditor/nsEditorUtils.cpp @@ -7,7 +7,6 @@ #include "mozilla/dom/OwningNonNull.h" #include "mozilla/dom/Selection.h" -#include "nsCOMArray.h" #include "nsComponentManagerUtils.h" #include "nsError.h" #include "nsIClipboardDragDropHookList.h" @@ -104,20 +103,6 @@ nsDOMIterator::AppendList(const nsBoolDomIterFunctor& functor, } } -void -nsDOMIterator::AppendList(const nsBoolDomIterFunctor& functor, - nsCOMArray& arrayOfNodes) const -{ - // iterate through dom and build list - for (; !mIter->IsDone(); mIter->Next()) { - nsCOMPtr node = mIter->GetCurrentNode()->AsDOMNode(); - - if (functor(node)) { - arrayOfNodes.AppendObject(node); - } - } -} - nsDOMSubtreeIterator::nsDOMSubtreeIterator(nsRange& aRange) { mIter = NS_NewContentSubtreeIterator(); diff --git a/editor/libeditor/nsEditorUtils.h b/editor/libeditor/nsEditorUtils.h index 82eb266a75db..7e4e44ac82a6 100644 --- a/editor/libeditor/nsEditorUtils.h +++ b/editor/libeditor/nsEditorUtils.h @@ -19,7 +19,6 @@ class nsIAtom; class nsIContentIterator; class nsIDOMDocument; class nsRange; -template class nsCOMArray; namespace mozilla { namespace dom { template class OwningNonNull; @@ -168,11 +167,7 @@ class MOZ_STACK_CLASS nsAutoUpdateViewBatch class nsBoolDomIterFunctor { public: - virtual bool operator()(nsIDOMNode* aNode) const = 0; - bool operator()(nsINode* aNode) const - { - return operator()(GetAsDOMNode(aNode)); - } + virtual bool operator()(nsINode* aNode) const = 0; }; class MOZ_STACK_CLASS nsDOMIterator @@ -184,8 +179,6 @@ class MOZ_STACK_CLASS nsDOMIterator void AppendList(const nsBoolDomIterFunctor& functor, nsTArray>& arrayOfNodes) const; - void AppendList(const nsBoolDomIterFunctor& functor, - nsCOMArray& arrayOfNodes) const; protected: nsCOMPtr mIter; @@ -204,7 +197,7 @@ class nsTrivialFunctor : public nsBoolDomIterFunctor { public: // Used to build list of all nodes iterator covers - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { return true; } diff --git a/editor/libeditor/nsHTMLEditRules.cpp b/editor/libeditor/nsHTMLEditRules.cpp index a70ea5fe1581..51dcdc22cb02 100644 --- a/editor/libeditor/nsHTMLEditRules.cpp +++ b/editor/libeditor/nsHTMLEditRules.cpp @@ -107,7 +107,7 @@ class nsTableCellAndListItemFunctor : public nsBoolDomIterFunctor { public: // Used to build list of all li's, td's & th's iterator covers - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { if (nsHTMLEditUtils::IsTableCell(aNode)) return true; if (nsHTMLEditUtils::IsListItem(aNode)) return true; @@ -118,9 +118,11 @@ class nsTableCellAndListItemFunctor : public nsBoolDomIterFunctor class nsBRNodeFunctor : public nsBoolDomIterFunctor { public: - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { - if (nsTextEditUtils::IsBreak(aNode)) return true; + if (aNode->IsHTMLElement(nsGkAtoms::br)) { + return true; + } return false; } }; @@ -129,12 +131,11 @@ class nsEmptyEditableFunctor : public nsBoolDomIterFunctor { public: explicit nsEmptyEditableFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {} - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { if (mHTMLEditor->IsEditable(aNode) && - (nsHTMLEditUtils::IsListItem(aNode) || - nsHTMLEditUtils::IsTableCellOrCaption(aNode))) - { + (nsHTMLEditUtils::IsListItem(aNode) || + nsHTMLEditUtils::IsTableCellOrCaption(GetAsDOMNode(aNode)))) { bool bIsEmptyNode; nsresult res = mHTMLEditor->IsEmptyNode(aNode, &bIsEmptyNode, false, false); NS_ENSURE_SUCCESS(res, false); @@ -151,7 +152,7 @@ class nsEditableTextFunctor : public nsBoolDomIterFunctor { public: explicit nsEditableTextFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {} - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { if (nsEditor::IsTextNode(aNode) && mHTMLEditor->IsEditable(aNode)) { @@ -5718,15 +5719,6 @@ nsHTMLEditRules::PromoteRange(nsRange& aRange, EditAction aOperationType) MOZ_ASSERT(NS_SUCCEEDED(res)); } -class NodeComparator -{ - public: - bool Equals(const nsINode* node, const nsIDOMNode* domNode) const - { - return domNode == GetAsDOMNode(const_cast(node)); - } -}; - class nsUniqueFunctor : public nsBoolDomIterFunctor { public: @@ -5734,9 +5726,9 @@ public: { } // used to build list of all nodes iterator covers - virtual bool operator()(nsIDOMNode* aNode) const + virtual bool operator()(nsINode* aNode) const { - return !mArray.Contains(aNode, NodeComparator()); + return !mArray.Contains(aNode); } private: diff --git a/editor/libeditor/nsHTMLEditRules.h b/editor/libeditor/nsHTMLEditRules.h index 585ca49a07ca..0d8f841f9743 100644 --- a/editor/libeditor/nsHTMLEditRules.h +++ b/editor/libeditor/nsHTMLEditRules.h @@ -37,7 +37,6 @@ class Selection; } // namespace dom } // namespace mozilla struct DOMPoint; -template class nsCOMArray; struct StyleCache : public PropItem { diff --git a/editor/libeditor/nsHTMLEditor.cpp b/editor/libeditor/nsHTMLEditor.cpp index 35813ca23d84..04cd9444ac7e 100644 --- a/editor/libeditor/nsHTMLEditor.cpp +++ b/editor/libeditor/nsHTMLEditor.cpp @@ -2988,8 +2988,6 @@ nsHTMLEditor::GetURLForStyleSheet(CSSStyleSheet* aStyleSheet, int32_t foundIndex = mStyleSheets.IndexOf(aStyleSheet); // Don't fail if we don't find it in our list - // Note: mStyleSheets is nsCOMArray, so its IndexOf() method - // returns -1 on failure. if (foundIndex == -1) return NS_OK; diff --git a/editor/libeditor/nsHTMLObjectResizer.cpp b/editor/libeditor/nsHTMLObjectResizer.cpp index 3948aec4d3aa..f0123fe49512 100644 --- a/editor/libeditor/nsHTMLObjectResizer.cpp +++ b/editor/libeditor/nsHTMLObjectResizer.cpp @@ -13,7 +13,6 @@ #include "nsAString.h" #include "nsAlgorithm.h" #include "nsAutoPtr.h" -#include "nsCOMArray.h" #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsEditorUtils.h"