diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp
index c481567cd33..1e5a7a711c3 100644
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -1146,8 +1146,7 @@ nsHTMLEditRules::AppendInnerFormatNodes(nsCOMArray& aArray,
child;
child = child->GetNextSibling()) {
bool isBlock = IsBlockNode(child->AsDOMNode());
- bool isFormat = child->IsElement() &&
- nsHTMLEditUtils::IsFormatNode(child->AsElement());
+ bool isFormat = nsHTMLEditUtils::IsFormatNode(child);
if (isBlock && !isFormat) {
// if it's a div, etc, recurse
AppendInnerFormatNodes(aArray, child);
@@ -2813,8 +2812,7 @@ nsresult
nsHTMLEditRules::DeleteNonTableElements(nsINode* aNode)
{
MOZ_ASSERT(aNode);
- if (!aNode->IsElement() ||
- !nsHTMLEditUtils::IsTableElementButNotTable(aNode->AsElement())) {
+ if (!nsHTMLEditUtils::IsTableElementButNotTable(aNode)) {
return mHTMLEditor->DeleteNode(aNode->AsDOMNode());
}
@@ -5839,7 +5837,7 @@ nsHTMLEditRules::LookInsideDivBQandList(nsCOMArray& aNodeArray)
while (curNode->IsElement() &&
(curNode->AsElement()->IsHTML(nsGkAtoms::div) ||
- nsHTMLEditUtils::IsList(curNode->AsElement()) ||
+ nsHTMLEditUtils::IsList(curNode) ||
curNode->AsElement()->IsHTML(nsGkAtoms::blockquote))) {
// dive as long as there is only one child, and it is a list, div, blockquote
PRUint32 numChildren = mHTMLEditor->CountEditableChildren(curNode);
@@ -6205,15 +6203,14 @@ nsINode*
nsHTMLEditRules::IsInListItem(nsINode* aNode)
{
NS_ENSURE_TRUE(aNode, nullptr);
- if (aNode->IsElement() && nsHTMLEditUtils::IsListItem(aNode->AsElement())) {
+ if (nsHTMLEditUtils::IsListItem(aNode)) {
return aNode;
}
nsINode* parent = aNode->GetNodeParent();
while (parent && mHTMLEditor->IsDescendantOfEditorRoot(parent) &&
- !(parent->IsElement() &&
- nsHTMLEditUtils::IsTableElement(parent->AsElement()))) {
- if (nsHTMLEditUtils::IsListItem(parent->AsElement())) {
+ !nsHTMLEditUtils::IsTableElement(parent)) {
+ if (nsHTMLEditUtils::IsListItem(parent)) {
return parent;
}
parent = parent->GetNodeParent();
diff --git a/editor/libeditor/html/nsHTMLEditUtils.cpp b/editor/libeditor/html/nsHTMLEditUtils.cpp
index 54e1c1e1df7..d4c05d74533 100644
--- a/editor/libeditor/html/nsHTMLEditUtils.cpp
+++ b/editor/libeditor/html/nsHTMLEditUtils.cpp
@@ -6,7 +6,7 @@
#include "./../../mozilla-config.h" // for MOZ_MEDIA
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Util.h" // for ArrayLength
-#include "mozilla/dom/Element.h" // for Element
+#include "mozilla/dom/Element.h" // for Element, nsINode
#include "nsAString.h" // for nsAString_internal::IsEmpty
#include "nsCOMPtr.h" // for nsCOMPtr, operator==, etc
#include "nsCaseTreatment.h"
@@ -30,9 +30,9 @@ using namespace mozilla;
///////////////////////////////////////////////////////////////////////////
//
bool
-nsHTMLEditUtils::IsBig(nsIDOMNode *node)
+nsHTMLEditUtils::IsBig(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::big);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::big);
}
@@ -40,18 +40,18 @@ nsHTMLEditUtils::IsBig(nsIDOMNode *node)
// IsInlineStyle true if node is an inline style
//
bool
-nsHTMLEditUtils::IsInlineStyle(nsIDOMNode *node)
+nsHTMLEditUtils::IsInlineStyle(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsInlineStyle");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsInlineStyle(element);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsInlineStyle");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsInlineStyle(node);
}
bool
-nsHTMLEditUtils::IsInlineStyle(dom::Element* aElement)
+nsHTMLEditUtils::IsInlineStyle(nsINode* aNode)
{
- MOZ_ASSERT(aElement);
- nsIAtom* nodeAtom = aElement->Tag();
+ MOZ_ASSERT(aNode);
+ nsIAtom* nodeAtom = aNode->Tag();
return (nodeAtom == nsEditProperty::b)
|| (nodeAtom == nsEditProperty::i)
|| (nodeAtom == nsEditProperty::u)
@@ -70,18 +70,18 @@ nsHTMLEditUtils::IsInlineStyle(dom::Element* aElement)
// IsFormatNode true if node is a format node
//
bool
-nsHTMLEditUtils::IsFormatNode(nsIDOMNode *node)
+nsHTMLEditUtils::IsFormatNode(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsFormatNode");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsFormatNode(element);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsFormatNode");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsFormatNode(node);
}
bool
-nsHTMLEditUtils::IsFormatNode(dom::Element* aElement)
+nsHTMLEditUtils::IsFormatNode(nsINode* aNode)
{
- MOZ_ASSERT(aElement);
- nsIAtom* nodeAtom = aElement->Tag();
+ MOZ_ASSERT(aNode);
+ nsIAtom* nodeAtom = aNode->Tag();
return (nodeAtom == nsEditProperty::p)
|| (nodeAtom == nsEditProperty::pre)
|| (nodeAtom == nsEditProperty::h1)
@@ -97,10 +97,10 @@ nsHTMLEditUtils::IsFormatNode(dom::Element* aElement)
// IsNodeThatCanOutdent true if node is a list, list item, or blockquote
//
bool
-nsHTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode *node)
+nsHTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsNodeThatCanOutdent");
- nsCOMPtr nodeAtom = nsEditor::GetTag(node);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsNodeThatCanOutdent");
+ nsCOMPtr nodeAtom = nsEditor::GetTag(aNode);
return (nodeAtom == nsEditProperty::ul)
|| (nodeAtom == nsEditProperty::ol)
|| (nodeAtom == nsEditProperty::dl)
@@ -113,9 +113,9 @@ nsHTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode *node)
///////////////////////////////////////////////////////////////////////////
//
bool
-nsHTMLEditUtils::IsSmall(nsIDOMNode *node)
+nsHTMLEditUtils::IsSmall(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::small);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::small);
}
@@ -127,10 +127,10 @@ nsHTMLEditUtils::IsSmall(nsIDOMNode *node)
// IsHeader: true if node an html header
//
bool
-nsHTMLEditUtils::IsHeader(nsIDOMNode *node)
+nsHTMLEditUtils::IsHeader(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsHeader");
- nsCOMPtr nodeAtom = nsEditor::GetTag(node);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsHeader");
+ nsCOMPtr nodeAtom = nsEditor::GetTag(aNode);
return (nodeAtom == nsEditProperty::h1)
|| (nodeAtom == nsEditProperty::h2)
|| (nodeAtom == nsEditProperty::h3)
@@ -144,9 +144,9 @@ nsHTMLEditUtils::IsHeader(nsIDOMNode *node)
// IsParagraph: true if node an html paragraph
//
bool
-nsHTMLEditUtils::IsParagraph(nsIDOMNode *node)
+nsHTMLEditUtils::IsParagraph(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::p);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::p);
}
@@ -154,9 +154,9 @@ nsHTMLEditUtils::IsParagraph(nsIDOMNode *node)
// IsHR: true if node an horizontal rule
//
bool
-nsHTMLEditUtils::IsHR(nsIDOMNode *node)
+nsHTMLEditUtils::IsHR(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::hr);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::hr);
}
@@ -164,15 +164,15 @@ nsHTMLEditUtils::IsHR(nsIDOMNode *node)
// IsListItem: true if node an html list item
//
bool
-nsHTMLEditUtils::IsListItem(nsIDOMNode *node)
+nsHTMLEditUtils::IsListItem(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsListItem");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsListItem(element);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsListItem");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsListItem(node);
}
bool
-nsHTMLEditUtils::IsListItem(dom::Element* node)
+nsHTMLEditUtils::IsListItem(nsINode* node)
{
MOZ_ASSERT(node);
nsCOMPtr nodeAtom = node->Tag();
@@ -186,15 +186,15 @@ nsHTMLEditUtils::IsListItem(dom::Element* node)
// IsTableElement: true if node an html table, td, tr, ...
//
bool
-nsHTMLEditUtils::IsTableElement(nsIDOMNode *node)
+nsHTMLEditUtils::IsTableElement(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null node passed to nsHTMLEditor::IsTableElement");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsTableElement(element);
+ NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::IsTableElement");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsTableElement(node);
}
bool
-nsHTMLEditUtils::IsTableElement(dom::Element* node)
+nsHTMLEditUtils::IsTableElement(nsINode* node)
{
MOZ_ASSERT(node);
nsCOMPtr nodeAtom = node->Tag();
@@ -212,15 +212,15 @@ nsHTMLEditUtils::IsTableElement(dom::Element* node)
// IsTableElementButNotTable: true if node an html td, tr, ... (doesn't include table)
//
bool
-nsHTMLEditUtils::IsTableElementButNotTable(nsIDOMNode *node)
+nsHTMLEditUtils::IsTableElementButNotTable(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null node passed to nsHTMLEditor::IsTableElementButNotTable");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsTableElementButNotTable(element);
+ NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::IsTableElementButNotTable");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsTableElementButNotTable(node);
}
bool
-nsHTMLEditUtils::IsTableElementButNotTable(dom::Element* aNode)
+nsHTMLEditUtils::IsTableElementButNotTable(nsINode* aNode)
{
MOZ_ASSERT(aNode);
nsCOMPtr nodeAtom = aNode->Tag();
@@ -237,18 +237,18 @@ nsHTMLEditUtils::IsTableElementButNotTable(dom::Element* aNode)
// IsTable: true if node an html table
//
bool
-nsHTMLEditUtils::IsTable(nsIDOMNode *node)
+nsHTMLEditUtils::IsTable(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::table);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::table);
}
///////////////////////////////////////////////////////////////////////////
// IsTableRow: true if node an html tr
//
bool
-nsHTMLEditUtils::IsTableRow(nsIDOMNode *node)
+nsHTMLEditUtils::IsTableRow(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::tr);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::tr);
}
@@ -256,15 +256,15 @@ nsHTMLEditUtils::IsTableRow(nsIDOMNode *node)
// IsTableCell: true if node an html td or th
//
bool
-nsHTMLEditUtils::IsTableCell(nsIDOMNode *node)
+nsHTMLEditUtils::IsTableCell(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsTableCell");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsTableCell(element);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsTableCell");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsTableCell(node);
}
bool
-nsHTMLEditUtils::IsTableCell(dom::Element* node)
+nsHTMLEditUtils::IsTableCell(nsINode* node)
{
MOZ_ASSERT(node);
nsCOMPtr nodeAtom = node->Tag();
@@ -277,10 +277,10 @@ nsHTMLEditUtils::IsTableCell(dom::Element* node)
// IsTableCell: true if node an html td or th
//
bool
-nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode *node)
+nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsTableCell");
- nsCOMPtr nodeAtom = nsEditor::GetTag(node);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsTableCell");
+ nsCOMPtr nodeAtom = nsEditor::GetTag(aNode);
return (nodeAtom == nsEditProperty::td)
|| (nodeAtom == nsEditProperty::th)
|| (nodeAtom == nsEditProperty::caption);
@@ -291,15 +291,15 @@ nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode *node)
// IsList: true if node an html list
//
bool
-nsHTMLEditUtils::IsList(nsIDOMNode *node)
+nsHTMLEditUtils::IsList(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::IsList");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsList(element);
+ NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsList");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsList(node);
}
bool
-nsHTMLEditUtils::IsList(dom::Element* node)
+nsHTMLEditUtils::IsList(nsINode* node)
{
MOZ_ASSERT(node);
nsCOMPtr nodeAtom = node->Tag();
@@ -313,9 +313,9 @@ nsHTMLEditUtils::IsList(dom::Element* node)
// IsOrderedList: true if node an html ordered list
//
bool
-nsHTMLEditUtils::IsOrderedList(nsIDOMNode *node)
+nsHTMLEditUtils::IsOrderedList(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::ol);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::ol);
}
@@ -323,9 +323,9 @@ nsHTMLEditUtils::IsOrderedList(nsIDOMNode *node)
// IsUnorderedList: true if node an html unordered list
//
bool
-nsHTMLEditUtils::IsUnorderedList(nsIDOMNode *node)
+nsHTMLEditUtils::IsUnorderedList(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::ul);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::ul);
}
@@ -333,9 +333,9 @@ nsHTMLEditUtils::IsUnorderedList(nsIDOMNode *node)
// IsBlockquote: true if node an html blockquote node
//
bool
-nsHTMLEditUtils::IsBlockquote(nsIDOMNode *node)
+nsHTMLEditUtils::IsBlockquote(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::blockquote);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::blockquote);
}
@@ -343,9 +343,9 @@ nsHTMLEditUtils::IsBlockquote(nsIDOMNode *node)
// IsPre: true if node an html pre node
//
bool
-nsHTMLEditUtils::IsPre(nsIDOMNode *node)
+nsHTMLEditUtils::IsPre(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::pre);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::pre);
}
@@ -353,9 +353,9 @@ nsHTMLEditUtils::IsPre(nsIDOMNode *node)
// IsImage: true if node an html image node
//
bool
-nsHTMLEditUtils::IsImage(nsIDOMNode *node)
+nsHTMLEditUtils::IsImage(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::img);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::img);
}
bool
@@ -375,21 +375,21 @@ nsHTMLEditUtils::IsLink(nsIDOMNode *aNode)
bool
nsHTMLEditUtils::IsNamedAnchor(nsIDOMNode *aNode)
{
- nsCOMPtr element = do_QueryInterface(aNode);
- return element && IsNamedAnchor(element);
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsNamedAnchor(node);
}
bool
-nsHTMLEditUtils::IsNamedAnchor(dom::Element* aNode)
+nsHTMLEditUtils::IsNamedAnchor(nsINode* aNode)
{
MOZ_ASSERT(aNode);
- if (!aNode->IsHTML(nsGkAtoms::a)) {
+ if (!aNode->IsElement() || !aNode->AsElement()->IsHTML(nsGkAtoms::a)) {
return false;
}
nsAutoString text;
- return aNode->GetAttr(kNameSpaceID_None, nsGkAtoms::name, text) &&
- !text.IsEmpty();
+ return aNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
+ text) && !text.IsEmpty();
}
@@ -397,9 +397,9 @@ nsHTMLEditUtils::IsNamedAnchor(dom::Element* aNode)
// IsDiv: true if node an html div node
//
bool
-nsHTMLEditUtils::IsDiv(nsIDOMNode *node)
+nsHTMLEditUtils::IsDiv(nsIDOMNode* aNode)
{
- return nsEditor::NodeIsType(node, nsEditProperty::div);
+ return nsEditor::NodeIsType(aNode, nsEditProperty::div);
}
@@ -407,9 +407,9 @@ nsHTMLEditUtils::IsDiv(nsIDOMNode *node)
// IsMozDiv: true if node an html div node with type = _moz
//
bool
-nsHTMLEditUtils::IsMozDiv(nsIDOMNode *node)
+nsHTMLEditUtils::IsMozDiv(nsIDOMNode* aNode)
{
- if (IsDiv(node) && nsTextEditUtils::HasMozAttr(node)) return true;
+ if (IsDiv(aNode) && nsTextEditUtils::HasMozAttr(aNode)) return true;
return false;
}
@@ -422,24 +422,28 @@ bool
nsHTMLEditUtils::IsMailCite(nsIDOMNode* aNode)
{
NS_PRECONDITION(aNode, "null parent passed to nsHTMLEditUtils::IsMailCite");
- nsCOMPtr element = do_QueryInterface(aNode);
- return element && IsMailCite(element);
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsMailCite(node);
}
bool
-nsHTMLEditUtils::IsMailCite(dom::Element* aElement)
+nsHTMLEditUtils::IsMailCite(nsINode* aNode)
{
- MOZ_ASSERT(aElement);
+ MOZ_ASSERT(aNode);
// don't ask me why, but our html mailcites are id'd by "type=cite"...
- if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
- NS_LITERAL_STRING("cite"), eIgnoreCase)) {
+ if (aNode->IsElement() &&
+ aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+ NS_LITERAL_STRING("cite"),
+ eIgnoreCase)) {
return true;
}
// ... but our plaintext mailcites by "_moz_quote=true". go figure.
- if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
- NS_LITERAL_STRING("true"), eIgnoreCase)) {
+ if (aNode->IsElement() &&
+ aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
+ NS_LITERAL_STRING("true"),
+ eIgnoreCase)) {
return true;
}
@@ -451,18 +455,18 @@ nsHTMLEditUtils::IsMailCite(dom::Element* aElement)
// IsFormWidget: true if node is a form widget of some kind
//
bool
-nsHTMLEditUtils::IsFormWidget(nsIDOMNode *node)
+nsHTMLEditUtils::IsFormWidget(nsIDOMNode* aNode)
{
- NS_PRECONDITION(node, "null node passed to nsHTMLEditUtils::IsFormWidget");
- nsCOMPtr element = do_QueryInterface(node);
- return element && IsFormWidget(element);
+ NS_PRECONDITION(aNode, "null node passed to nsHTMLEditUtils::IsFormWidget");
+ nsCOMPtr node = do_QueryInterface(aNode);
+ return node && IsFormWidget(node);
}
bool
-nsHTMLEditUtils::IsFormWidget(dom::Element* node)
+nsHTMLEditUtils::IsFormWidget(nsINode* aNode)
{
- MOZ_ASSERT(node);
- nsCOMPtr nodeAtom = node->Tag();
+ MOZ_ASSERT(aNode);
+ nsCOMPtr nodeAtom = aNode->Tag();
return (nodeAtom == nsEditProperty::textarea)
|| (nodeAtom == nsEditProperty::select)
|| (nodeAtom == nsEditProperty::button)
@@ -474,7 +478,7 @@ nsHTMLEditUtils::IsFormWidget(dom::Element* node)
}
bool
-nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode * aNode)
+nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode* aNode)
{
NS_PRECONDITION(aNode, "null node passed to nsHTMLEditUtils::SupportsAlignAttr");
nsCOMPtr nodeAtom = nsEditor::GetTag(aNode);
diff --git a/editor/libeditor/html/nsHTMLEditUtils.h b/editor/libeditor/html/nsHTMLEditUtils.h
index ab6356b81a6..dc02c8afc6b 100644
--- a/editor/libeditor/html/nsHTMLEditUtils.h
+++ b/editor/libeditor/html/nsHTMLEditUtils.h
@@ -8,13 +8,8 @@
#include "prtypes.h" // for PRInt32
-namespace mozilla {
-namespace dom {
-class Element;
-} // namespace dom
-} // namespace mozilla
-
class nsIDOMNode;
+class nsINode;
class nsHTMLEditUtils
{
@@ -24,26 +19,26 @@ public:
static bool IsSmall(nsIDOMNode *aNode);
// from nsHTMLEditRules:
- static bool IsInlineStyle(mozilla::dom::Element* aNode);
+ static bool IsInlineStyle(nsINode* aNode);
static bool IsInlineStyle(nsIDOMNode *aNode);
- static bool IsFormatNode(mozilla::dom::Element* aNode);
+ static bool IsFormatNode(nsINode* aNode);
static bool IsFormatNode(nsIDOMNode *aNode);
static bool IsNodeThatCanOutdent(nsIDOMNode *aNode);
static bool IsHeader(nsIDOMNode *aNode);
static bool IsParagraph(nsIDOMNode *aNode);
static bool IsHR(nsIDOMNode *aNode);
- static bool IsListItem(mozilla::dom::Element* aNode);
+ static bool IsListItem(nsINode* aNode);
static bool IsListItem(nsIDOMNode *aNode);
static bool IsTable(nsIDOMNode *aNode);
static bool IsTableRow(nsIDOMNode *aNode);
- static bool IsTableElement(mozilla::dom::Element* aNode);
+ static bool IsTableElement(nsINode* aNode);
static bool IsTableElement(nsIDOMNode *aNode);
- static bool IsTableElementButNotTable(mozilla::dom::Element* aNode);
+ static bool IsTableElementButNotTable(nsINode* aNode);
static bool IsTableElementButNotTable(nsIDOMNode *aNode);
- static bool IsTableCell(mozilla::dom::Element* node);
+ static bool IsTableCell(nsINode* node);
static bool IsTableCell(nsIDOMNode *aNode);
static bool IsTableCellOrCaption(nsIDOMNode *aNode);
- static bool IsList(mozilla::dom::Element* aNode);
+ static bool IsList(nsINode* aNode);
static bool IsList(nsIDOMNode *aNode);
static bool IsOrderedList(nsIDOMNode *aNode);
static bool IsUnorderedList(nsIDOMNode *aNode);
@@ -52,13 +47,13 @@ public:
static bool IsAnchor(nsIDOMNode *aNode);
static bool IsImage(nsIDOMNode *aNode);
static bool IsLink(nsIDOMNode *aNode);
- static bool IsNamedAnchor(mozilla::dom::Element* aNode);
+ static bool IsNamedAnchor(nsINode* aNode);
static bool IsNamedAnchor(nsIDOMNode *aNode);
static bool IsDiv(nsIDOMNode *aNode);
static bool IsMozDiv(nsIDOMNode *aNode);
- static bool IsMailCite(mozilla::dom::Element* aNode);
+ static bool IsMailCite(nsINode* aNode);
static bool IsMailCite(nsIDOMNode *aNode);
- static bool IsFormWidget(mozilla::dom::Element* aNode);
+ static bool IsFormWidget(nsINode* aNode);
static bool IsFormWidget(nsIDOMNode *aNode);
static bool SupportsAlignAttr(nsIDOMNode *aNode);
static bool CanContain(PRInt32 aParent, PRInt32 aChild);
diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp
index cc8af7c1c0e..cad15f57c31 100644
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -4465,20 +4465,18 @@ nsHTMLEditor::IsEmptyNodeImpl(nsINode* aNode,
// 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()) ||
- (aNode->IsElement() &&
- (nsHTMLEditUtils::IsNamedAnchor(aNode->AsElement()) ||
- nsHTMLEditUtils::IsFormWidget(aNode->AsElement()) ||
- (aListOrCellNotEmpty &&
- (nsHTMLEditUtils::IsListItem(aNode->AsElement()) ||
- nsHTMLEditUtils::IsTableCell(aNode->AsElement())))))) {
+ (nsHTMLEditUtils::IsNamedAnchor(aNode) ||
+ nsHTMLEditUtils::IsFormWidget(aNode) ||
+ (aListOrCellNotEmpty &&
+ (nsHTMLEditUtils::IsListItem(aNode) ||
+ nsHTMLEditUtils::IsTableCell(aNode))))) {
*outIsEmptyNode = false;
return NS_OK;
}
// need this for later
- bool isListItemOrCell = aNode->IsElement() &&
- (nsHTMLEditUtils::IsListItem(aNode->AsElement()) ||
- nsHTMLEditUtils::IsTableCell(aNode->AsElement()));
+ bool isListItemOrCell = nsHTMLEditUtils::IsListItem(aNode) ||
+ nsHTMLEditUtils::IsTableCell(aNode);
// loop over children of node. if no children, or all children are either
// empty text nodes or non-editable, then node qualifies as empty
@@ -4510,12 +4508,13 @@ nsHTMLEditor::IsEmptyNodeImpl(nsINode* aNode,
// if they contain other lists or tables
if (child->IsElement()) {
if (isListItemOrCell) {
- if (nsHTMLEditUtils::IsList(child->AsElement()) || child->IsHTML(nsGkAtoms::table)) {
+ if (nsHTMLEditUtils::IsList(child) ||
+ child->IsHTML(nsGkAtoms::table)) {
// break out if we find we aren't empty
*outIsEmptyNode = false;
return NS_OK;
}
- } else if (nsHTMLEditUtils::IsFormWidget(child->AsElement())) {
+ } else if (nsHTMLEditUtils::IsFormWidget(child)) {
// is it a form widget?
// break out if we find we aren't empty
*outIsEmptyNode = false;