diff --git a/editor/libeditor/nsHTMLEditor.cpp b/editor/libeditor/nsHTMLEditor.cpp
index 31a399ebcad..ef25637e6b1 100644
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -817,7 +817,7 @@ nsHTMLEditor::SetDocumentTitle(const nsAString &aTitle)
///////////////////////////////////////////////////////////////////////////
// GetBlockNodeParent: returns enclosing block level ancestor, if any
//
-already_AddRefed
+Element*
nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
{
MOZ_ASSERT(aNode);
@@ -826,7 +826,7 @@ nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
while (p) {
if (NodeIsBlockStatic(p)) {
- return p.forget().downcast();
+ return p->AsElement();
}
p = p->GetParentNode();
}
@@ -834,7 +834,7 @@ nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
return nullptr;
}
-already_AddRefed
+nsIDOMNode*
nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)
{
nsCOMPtr node = do_QueryInterface(aNode);
@@ -844,9 +844,7 @@ nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)
return nullptr;
}
- nsCOMPtr ret =
- dont_AddRef(GetAsDOMNode(GetBlockNodeParent(node).take()));
- return ret.forget();
+ return GetAsDOMNode(GetBlockNodeParent(node));
}
static const char16_t nbsp = 160;
@@ -1065,7 +1063,7 @@ nsHTMLEditor::TabInTable(bool inIsShift, bool* outHandled)
node = iter->GetCurrentNode();
if (node && nsHTMLEditUtils::IsTableCell(node) &&
- nsCOMPtr(GetEnclosingTable(node)) == table) {
+ GetEnclosingTable(node) == table) {
CollapseSelectionToDeepestNonTableFirstChild(nullptr, node);
*outHandled = true;
return NS_OK;
@@ -3656,7 +3654,7 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
///////////////////////////////////////////////////////////////////////////
// GetEnclosingTable: find ancestor who is a table, if any
//
-already_AddRefed
+Element*
nsHTMLEditor::GetEnclosingTable(nsINode* aNode)
{
MOZ_ASSERT(aNode);
@@ -3665,13 +3663,13 @@ nsHTMLEditor::GetEnclosingTable(nsINode* aNode)
block;
block = GetBlockNodeParent(block)) {
if (nsHTMLEditUtils::IsTable(block)) {
- return block.forget();
+ return block;
}
}
return nullptr;
}
-nsCOMPtr
+nsIDOMNode*
nsHTMLEditor::GetEnclosingTable(nsIDOMNode *aNode)
{
NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::GetEnclosingTable");
diff --git a/editor/libeditor/nsHTMLEditor.h b/editor/libeditor/nsHTMLEditor.h
index 48440d91503..6d636ecea69 100644
--- a/editor/libeditor/nsHTMLEditor.h
+++ b/editor/libeditor/nsHTMLEditor.h
@@ -231,8 +231,8 @@ public:
nsresult SetHTMLBackgroundColor(const nsAString& aColor);
/* ------------ Block methods moved from nsEditor -------------- */
- static already_AddRefed GetBlockNodeParent(nsINode* aNode);
- static already_AddRefed GetBlockNodeParent(nsIDOMNode *aNode);
+ static mozilla::dom::Element* GetBlockNodeParent(nsINode* aNode);
+ static nsIDOMNode* GetBlockNodeParent(nsIDOMNode* aNode);
void IsNextCharInNodeWhitespace(nsIContent* aContent,
int32_t aOffset,
@@ -495,9 +495,8 @@ protected:
// End of Table Editing utilities
- static already_AddRefed
- GetEnclosingTable(nsINode* aNode);
- static nsCOMPtr GetEnclosingTable(nsIDOMNode *aNode);
+ static mozilla::dom::Element* GetEnclosingTable(nsINode* aNode);
+ static nsIDOMNode* GetEnclosingTable(nsIDOMNode *aNode);
/** content-based query returns true if effects aNode
* If contains aNode,