diff --git a/editor/libeditor/nsHTMLEditor.h b/editor/libeditor/nsHTMLEditor.h index 0477a04ca423..e757e3ebe1db 100644 --- a/editor/libeditor/nsHTMLEditor.h +++ b/editor/libeditor/nsHTMLEditor.h @@ -677,7 +677,7 @@ protected: nsresult RemoveInlinePropertyImpl(nsIAtom* aProperty, const nsAString* aAttribute); - bool NodeIsProperty(nsIDOMNode *aNode); + bool NodeIsProperty(nsINode& aNode); bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset); bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset); bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute); diff --git a/editor/libeditor/nsHTMLEditorStyle.cpp b/editor/libeditor/nsHTMLEditorStyle.cpp index 7c0a62278b61..49db81528d7d 100644 --- a/editor/libeditor/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/nsHTMLEditorStyle.cpp @@ -586,7 +586,7 @@ nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr* aNode, // node is href - test if really * aNode, int32_t* aOffset, return NS_OK; } -bool nsHTMLEditor::NodeIsProperty(nsIDOMNode *aNode) +bool +nsHTMLEditor::NodeIsProperty(nsINode& aNode) { - NS_ENSURE_TRUE(aNode, false); - if (!IsContainer(aNode)) return false; - if (!IsEditable(aNode)) return false; - if (IsBlockNode(aNode)) return false; - if (NodeIsType(aNode, nsGkAtoms::a)) { - return false; - } - return true; + return IsContainer(&aNode) && IsEditable(&aNode) && !IsBlockNode(&aNode) && + !aNode.IsHTMLElement(nsGkAtoms::a); } nsresult nsHTMLEditor::ApplyDefaultProperties() @@ -740,7 +735,7 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode, // and for named anchors (aProperty == nsGkAtoms::name && nsHTMLEditUtils::IsNamedAnchor(&aNode)) || // or node is any prop and we asked for that - (!aProperty && NodeIsProperty(aNode.AsDOMNode())) + (!aProperty && NodeIsProperty(aNode)) ) ) { nsresult res;