diff --git a/editor/libeditor/HTMLEditUtils.cpp b/editor/libeditor/HTMLEditUtils.cpp index bf46ac7e5086..516e62abad41 100644 --- a/editor/libeditor/HTMLEditUtils.cpp +++ b/editor/libeditor/HTMLEditUtils.cpp @@ -202,12 +202,6 @@ HTMLEditUtils::IsTableElementButNotTable(nsINode* aNode) /** * IsTable() returns true if aNode is an html table. */ -bool -HTMLEditUtils::IsTable(nsIDOMNode* aNode) -{ - return EditorBase::NodeIsType(aNode, nsGkAtoms::table); -} - bool HTMLEditUtils::IsTable(nsINode* aNode) { @@ -354,13 +348,6 @@ HTMLEditUtils::IsLink(nsINode* aNode) return !tmpText.IsEmpty(); } -bool -HTMLEditUtils::IsNamedAnchor(nsIDOMNode *aNode) -{ - nsCOMPtr node = do_QueryInterface(aNode); - return node && IsNamedAnchor(node); -} - bool HTMLEditUtils::IsNamedAnchor(nsINode* aNode) { diff --git a/editor/libeditor/HTMLEditUtils.h b/editor/libeditor/HTMLEditUtils.h index e4b770ccd583..a9538a9cad45 100644 --- a/editor/libeditor/HTMLEditUtils.h +++ b/editor/libeditor/HTMLEditUtils.h @@ -26,7 +26,6 @@ public: static bool IsParagraph(nsIDOMNode* aNode); static bool IsListItem(nsINode* aNode); static bool IsListItem(nsIDOMNode* aNode); - static bool IsTable(nsIDOMNode* aNode); static bool IsTable(nsINode* aNode); static bool IsTableRow(nsIDOMNode* aNode); static bool IsTableRow(nsINode* aNode); @@ -49,7 +48,6 @@ public: static bool IsImage(nsIDOMNode* aNode); static bool IsLink(nsINode* aNode); static bool IsNamedAnchor(nsINode* aNode); - static bool IsNamedAnchor(nsIDOMNode* aNode); static bool IsDiv(nsIDOMNode* aNode); static bool IsMozDiv(nsINode* aNode); static bool IsMozDiv(nsIDOMNode* aNode); diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 90286c037462..23bbb91815f5 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -1430,8 +1430,6 @@ HTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, nsCOMPtr element = do_QueryInterface(aElement); NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER); - nsCOMPtr node = do_QueryInterface(aElement); - CommitComposition(); AutoPlaceholderBatch beginBatching(this); AutoRules beginRulesSniffing(this, EditAction::insertElement, @@ -1471,7 +1469,7 @@ HTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, // Named Anchor is a special case, // We collapse to insert element BEFORE the selection // For all other tags, we insert AFTER the selection - if (HTMLEditUtils::IsNamedAnchor(node)) { + if (HTMLEditUtils::IsNamedAnchor(element)) { selection->CollapseToStart(); } else { selection->CollapseToEnd(); @@ -1501,7 +1499,7 @@ HTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, } // check for inserting a whole table at the end of a block. If so insert // a br after it. - if (HTMLEditUtils::IsTable(node) && + if (HTMLEditUtils::IsTable(element) && IsLastEditableChild(element)) { DebugOnly advanced = insertedPoint.AdvanceOffset(); NS_WARNING_ASSERTION(advanced,