Bug 1426318 - Get rid of EditorBase::IsContainer(nsIDOMNode*) r?m_kato
The only caller is HTMLEditor::IsEmptyNodeImpl(). So, we can get rid of it.
MozReview-Commit-ID: GTJiXwSCrwM
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -3833,22 +3833,16 @@ EditorBase::IsDescendantOfEditorRoot(nsI
bool
EditorBase::IsContainer(nsINode* aNode)
{
return aNode ? true : false;
}
bool
-EditorBase::IsContainer(nsIDOMNode* aNode)
-{
- return aNode ? true : false;
-}
-
-bool
EditorBase::IsEditable(nsIDOMNode* aNode)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
return IsEditable(content);
}
uint32_t
EditorBase::CountEditableChildren(nsINode* aNode)
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -953,17 +953,16 @@ public:
bool IsDescendantOfRoot(nsIDOMNode* inNode);
bool IsDescendantOfRoot(nsINode* inNode);
bool IsDescendantOfEditorRoot(nsINode* aNode);
/**
* Returns true if aNode is a container.
*/
virtual bool IsContainer(nsINode* aNode);
- virtual bool IsContainer(nsIDOMNode* aNode);
/**
* returns true if aNode is an editable node.
*/
bool IsEditable(nsIDOMNode* aNode);
bool IsEditable(nsINode* aNode)
{
NS_ENSURE_TRUE(aNode, false);
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -3458,27 +3458,16 @@ HTMLEditor::IsContainer(nsINode* aNode)
tagEnum = eHTMLTag_text;
} else {
tagEnum = nsHTMLTags::StringTagToId(aNode->NodeName());
}
return HTMLEditUtils::IsContainer(tagEnum);
}
-bool
-HTMLEditor::IsContainer(nsIDOMNode* aNode)
-{
- nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
- if (!node) {
- return false;
- }
- return IsContainer(node);
-}
-
-
nsresult
HTMLEditor::SelectEntireDocument(Selection* aSelection)
{
if (!aSelection || !mRules) {
return NS_ERROR_NULL_POINTER;
}
// Protect the edit rules object from dying
@@ -4040,17 +4029,17 @@ HTMLEditor::IsEmptyNodeImpl(nsINode* aNo
}
// if it's not a text node (handled above) and it's not a container,
// then we don't call it empty (it's an <hr>, or <br>, etc.).
// Also, if it's an anchor then don't treat it as empty - even though
// anchors are containers, named anchors are "empty" but we don't
// want to treat them as such. Also, don't call ListItems or table
// cells empty if caller desires. Form Widgets not empty.
- if (!IsContainer(aNode->AsDOMNode()) ||
+ if (!IsContainer(aNode) ||
(HTMLEditUtils::IsNamedAnchor(aNode) ||
HTMLEditUtils::IsFormWidget(aNode) ||
(aListOrCellNotEmpty &&
(HTMLEditUtils::IsListItem(aNode) ||
HTMLEditUtils::IsTableCell(aNode))))) {
*outIsEmptyNode = false;
return NS_OK;
}
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -294,17 +294,16 @@ public:
*/
virtual bool TagCanContainTag(nsAtom& aParentTag,
nsAtom& aChildTag) const override;
/**
* Returns true if aNode is a container.
*/
virtual bool IsContainer(nsINode* aNode) override;
- virtual bool IsContainer(nsIDOMNode* aNode) override;
/**
* Make the given selection span the entire document.
*/
virtual nsresult SelectEntireDocument(Selection* aSelection) override;
/**
* Join together any adjacent editable text nodes in the range.