Bug 1134280 - Get rid of Tag() - patch 2.2 - /editor - Fix all the occurrences, m=smaug, r=surkov

This commit is contained in:
Andrea Marchesini 2015-03-03 11:08:59 +00:00
parent 431587e94f
commit dec2760ae9
10 changed files with 225 additions and 225 deletions

View File

@ -28,13 +28,12 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
// their type is "cite"
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
if (content) {
nsIAtom *tag = content->Tag();
if (tag == nsGkAtoms::blockquote) {
if (content->IsHTMLElement(nsGkAtoms::blockquote)) {
if (mIsForMail) {
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::cite, eIgnoreCase);
}
} else if (tag == nsGkAtoms::span) {
} else if (content->IsHTMLElement(nsGkAtoms::span)) {
if (mIsForMail) {
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
nsGkAtoms::_true, eIgnoreCase);
@ -43,12 +42,12 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
nsGkAtoms::mozsignature, eCaseMatters);
}
}
} else if (tag == nsGkAtoms::script ||
tag == nsGkAtoms::textarea ||
tag == nsGkAtoms::select ||
tag == nsGkAtoms::map) {
} else if (content->IsAnyOfHTMLElements(nsGkAtoms::script,
nsGkAtoms::textarea,
nsGkAtoms::select,
nsGkAtoms::map)) {
*_retval = true;
} else if (tag == nsGkAtoms::table) {
} else if (content->IsHTMLElement(nsGkAtoms::table)) {
if (mIsForMail) {
*_retval =
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,

View File

@ -3137,7 +3137,7 @@ nsEditor::CanContain(nsINode& aParent, nsIContent& aChild)
switch (aParent.NodeType()) {
case nsIDOMNode::ELEMENT_NODE:
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
return TagCanContain(*aParent.Tag(), aChild);
return TagCanContain(*aParent.NodeInfo()->NameAtom(), aChild);
}
return false;
}
@ -3148,7 +3148,7 @@ nsEditor::CanContainTag(nsINode& aParent, nsIAtom& aChildTag)
switch (aParent.NodeType()) {
case nsIDOMNode::ELEMENT_NODE:
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
return TagCanContainTag(*aParent.Tag(), aChildTag);
return TagCanContainTag(*aParent.NodeInfo()->NameAtom(), aChildTag);
}
return false;
}
@ -3160,7 +3160,7 @@ nsEditor::TagCanContain(nsIAtom& aParentTag, nsIContent& aChild)
case nsIDOMNode::TEXT_NODE:
case nsIDOMNode::ELEMENT_NODE:
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
return TagCanContainTag(aParentTag, *aChild.Tag());
return TagCanContainTag(aParentTag, *aChild.NodeInfo()->NameAtom());
}
return false;
}
@ -3410,12 +3410,12 @@ nsEditor::GetTag(nsIDOMNode *aNode)
if (!content)
{
NS_ASSERTION(aNode, "null node passed to nsEditor::Tag()");
NS_ASSERTION(aNode, "null node passed to nsEditor::GetTag()");
return nullptr;
}
return content->Tag();
return content->NodeInfo()->NameAtom();
}
@ -3427,7 +3427,7 @@ nsEditor::GetTagString(nsIDOMNode *aNode, nsAString& outString)
{
if (!aNode)
{
NS_NOTREACHED("null node passed to nsEditor::GetTag()");
NS_NOTREACHED("null node passed to nsEditor::GetTagString()");
return NS_ERROR_NULL_POINTER;
}
@ -3468,7 +3468,7 @@ nsEditor::AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
{
MOZ_ASSERT(aNode1);
MOZ_ASSERT(aNode2);
return aNode1->Tag() == aNode2->Tag();
return aNode1->NodeInfo()->NameAtom() == aNode2->NodeInfo()->NameAtom();
}

View File

@ -326,9 +326,6 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
NS_ENSURE_TRUE(content, false);
}
nsIAtom *tagName = content->Tag();
// brade: shouldn't some of the above go below the next block?
// html inline styles B I TT U STRIKE and COLOR/FACE on FONT
if (nsGkAtoms::b == aProperty ||
nsGkAtoms::i == aProperty ||
@ -343,41 +340,43 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
// ALIGN attribute on elements supporting it
if (aAttribute && (aAttribute->EqualsLiteral("align")) &&
(nsGkAtoms::div == tagName ||
nsGkAtoms::p == tagName ||
nsGkAtoms::h1 == tagName ||
nsGkAtoms::h2 == tagName ||
nsGkAtoms::h3 == tagName ||
nsGkAtoms::h4 == tagName ||
nsGkAtoms::h5 == tagName ||
nsGkAtoms::h6 == tagName ||
nsGkAtoms::td == tagName ||
nsGkAtoms::th == tagName ||
nsGkAtoms::table == tagName ||
nsGkAtoms::hr == tagName ||
// brade: for the above, why not use nsHTMLEditUtils::SupportsAlignAttr
// brade: but it also checks for tbody, tfoot, thead
// Let's add the following elements here even if ALIGN has not
// the same meaning for them
nsGkAtoms::legend == tagName ||
nsGkAtoms::caption == tagName)) {
content->IsAnyOfHTMLElements(nsGkAtoms::div,
nsGkAtoms::p ,
nsGkAtoms::h1,
nsGkAtoms::h2,
nsGkAtoms::h3,
nsGkAtoms::h4,
nsGkAtoms::h5,
nsGkAtoms::h6,
nsGkAtoms::td,
nsGkAtoms::th,
nsGkAtoms::table,
nsGkAtoms::hr,
// brade: for the above, why not use
// nsHTMLEditUtils::SupportsAlignAttr
// brade: but it also checks for tbody,
// tfoot, thead Let's add the following
// elements here even if ALIGN has not the
// same meaning for them
nsGkAtoms::legend,
nsGkAtoms::caption)) {
return true;
}
if (aAttribute && (aAttribute->EqualsLiteral("valign")) &&
(nsGkAtoms::col == tagName ||
nsGkAtoms::colgroup == tagName ||
nsGkAtoms::tbody == tagName ||
nsGkAtoms::td == tagName ||
nsGkAtoms::th == tagName ||
nsGkAtoms::tfoot == tagName ||
nsGkAtoms::thead == tagName ||
nsGkAtoms::tr == tagName)) {
content->IsAnyOfHTMLElements(nsGkAtoms::col,
nsGkAtoms::colgroup,
nsGkAtoms::tbody,
nsGkAtoms::td,
nsGkAtoms::th,
nsGkAtoms::tfoot,
nsGkAtoms::thead,
nsGkAtoms::tr)) {
return true;
}
// attributes TEXT, BACKGROUND and BGCOLOR on BODY
if (aAttribute && nsGkAtoms::body == tagName &&
if (aAttribute && content->IsHTMLElement(nsGkAtoms::body) &&
(aAttribute->EqualsLiteral("text")
|| aAttribute->EqualsLiteral("background")
|| aAttribute->EqualsLiteral("bgcolor"))) {
@ -390,7 +389,8 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
}
// attributes HEIGHT, WIDTH and NOWRAP on TD and TH
if (aAttribute && (nsGkAtoms::td == tagName || nsGkAtoms::th == tagName) &&
if (aAttribute &&
content->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th) &&
(aAttribute->EqualsLiteral("height")
|| aAttribute->EqualsLiteral("width")
|| aAttribute->EqualsLiteral("nowrap"))) {
@ -398,14 +398,14 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
}
// attributes HEIGHT and WIDTH on TABLE
if (aAttribute && nsGkAtoms::table == tagName &&
if (aAttribute && content->IsHTMLElement(nsGkAtoms::table) &&
(aAttribute->EqualsLiteral("height")
|| aAttribute->EqualsLiteral("width"))) {
return true;
}
// attributes SIZE and WIDTH on HR
if (aAttribute && nsGkAtoms::hr == tagName &&
if (aAttribute && content->IsHTMLElement(nsGkAtoms::hr) &&
(aAttribute->EqualsLiteral("size")
|| aAttribute->EqualsLiteral("width"))) {
return true;
@ -413,12 +413,13 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
// attribute TYPE on OL UL LI
if (aAttribute &&
(nsGkAtoms::ol == tagName || nsGkAtoms::ul == tagName ||
nsGkAtoms::li == tagName) && aAttribute->EqualsLiteral("type")) {
content->IsAnyOfHTMLElements(nsGkAtoms::ol, nsGkAtoms::ul,
nsGkAtoms::li) &&
aAttribute->EqualsLiteral("type")) {
return true;
}
if (aAttribute && nsGkAtoms::img == tagName &&
if (aAttribute && content->IsHTMLElement(nsGkAtoms::img) &&
(aAttribute->EqualsLiteral("border")
|| aAttribute->EqualsLiteral("width")
|| aAttribute->EqualsLiteral("height"))) {
@ -428,15 +429,15 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
// other elements that we can align using CSS even if they
// can't carry the html ALIGN attribute
if (aAttribute && aAttribute->EqualsLiteral("align") &&
(nsGkAtoms::ul == tagName ||
nsGkAtoms::ol == tagName ||
nsGkAtoms::dl == tagName ||
nsGkAtoms::li == tagName ||
nsGkAtoms::dd == tagName ||
nsGkAtoms::dt == tagName ||
nsGkAtoms::address == tagName ||
nsGkAtoms::pre == tagName ||
nsGkAtoms::ul == tagName)) {
content->IsAnyOfHTMLElements(nsGkAtoms::ul,
nsGkAtoms::ol,
nsGkAtoms::dl,
nsGkAtoms::li,
nsGkAtoms::dd,
nsGkAtoms::dt,
nsGkAtoms::address,
nsGkAtoms::pre,
nsGkAtoms::ul)) {
return true;
}
@ -810,7 +811,6 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(dom::Element* aElement,
bool aGetOrRemoveRequest)
{
MOZ_ASSERT(aElement);
nsIAtom* tagName = aElement->Tag();
const nsHTMLCSSUtils::CSSEquivTable* equivTable = nullptr;
if (nsGkAtoms::b == aHTMLProperty) {
@ -839,12 +839,12 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(dom::Element* aElement,
} else if (aAttribute->EqualsLiteral("border")) {
equivTable = borderEquivTable;
} else if (aAttribute->EqualsLiteral("align")) {
if (nsGkAtoms::table == tagName) {
if (aElement->IsHTMLElement(nsGkAtoms::table)) {
equivTable = tableAlignEquivTable;
} else if (nsGkAtoms::hr == tagName) {
} else if (aElement->IsHTMLElement(nsGkAtoms::hr)) {
equivTable = hrAlignEquivTable;
} else if (nsGkAtoms::legend == tagName ||
nsGkAtoms::caption == tagName) {
} else if (aElement->IsAnyOfHTMLElements(nsGkAtoms::legend,
nsGkAtoms::caption)) {
equivTable = captionAlignEquivTable;
} else {
equivTable = textAlignEquivTable;
@ -856,13 +856,13 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(dom::Element* aElement,
} else if (aAttribute->EqualsLiteral("width")) {
equivTable = widthEquivTable;
} else if (aAttribute->EqualsLiteral("height") ||
(nsGkAtoms::hr == tagName &&
(aElement->IsHTMLElement(nsGkAtoms::hr) &&
aAttribute->EqualsLiteral("size"))) {
equivTable = heightEquivTable;
} else if (aAttribute->EqualsLiteral("type") &&
(nsGkAtoms::ol == tagName ||
nsGkAtoms::ul == tagName ||
nsGkAtoms::li == tagName)) {
aElement->IsAnyOfHTMLElements(nsGkAtoms::ol,
nsGkAtoms::ul,
nsGkAtoms::li)) {
equivTable = listStyleTypeEquivTable;
}
}

View File

@ -2070,8 +2070,8 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
// create fragment for pasted html
nsIAtom* contextAtom;
if (contextLeafAsContent) {
contextAtom = contextLeafAsContent->Tag();
if (contextAtom == nsGkAtoms::html) {
contextAtom = contextLeafAsContent->NodeInfo()->NameAtom();
if (contextLeafAsContent->IsHTMLElement(nsGkAtoms::html)) {
contextAtom = nsGkAtoms::body;
}
} else {

View File

@ -826,7 +826,7 @@ nsHTMLEditRules::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
{
// if we are in a text node, then that is the node of interest
nodeToExamine = GetAsDOMNode(parent);
} else if (parent->Tag() == nsGkAtoms::html && offset == rootOffset) {
} else if (parent->IsHTMLElement(nsGkAtoms::html) && offset == rootOffset) {
// if we have selected the body, let's look at the first editable node
NS_ENSURE_STATE(mHTMLEditor);
nodeToExamine =
@ -2055,9 +2055,9 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
}
if (wsType == WSType::special || wsType == WSType::br ||
visNode->Tag() == nsGkAtoms::hr) {
visNode->IsHTMLElement(nsGkAtoms::hr)) {
// Short circuit for invisible breaks. delete them and recurse.
if (visNode->Tag() == nsGkAtoms::br &&
if (visNode->IsHTMLElement(nsGkAtoms::br) &&
(!mHTMLEditor || !mHTMLEditor->IsVisBreak(visNode))) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->DeleteNode(visNode);
@ -2067,7 +2067,8 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
}
// Special handling for backspace when positioned after <hr>
if (aAction == nsIEditor::ePrevious && visNode->Tag() == nsGkAtoms::hr) {
if (aAction == nsIEditor::ePrevious &&
visNode->IsHTMLElement(nsGkAtoms::hr)) {
// Only if the caret is positioned at the end-of-hr-line position, we
// want to delete the <hr>.
//
@ -2210,7 +2211,7 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
rightNode = leafNode;
}
if (otherNode->Tag() == nsGkAtoms::br) {
if (otherNode->IsHTMLElement(nsGkAtoms::br)) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->DeleteNode(otherNode);
NS_ENSURE_SUCCESS(res, res);
@ -2390,7 +2391,7 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
if (leftBlockParent == rightBlockParent &&
mHTMLEditor->NodesSameType(GetAsDOMNode(leftParent),
GetAsDOMNode(rightParent))) {
if (leftParent->Tag() == nsGkAtoms::p) {
if (leftParent->IsHTMLElement(nsGkAtoms::p)) {
// First delete the selection
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
@ -2576,7 +2577,8 @@ nsHTMLEditRules::GetGoodSelPointForNode(nsINode& aNode,
ret.node = aNode.GetParentNode();
ret.offset = ret.node ? ret.node->IndexOf(&aNode) : -1;
NS_ENSURE_TRUE(mHTMLEditor, ::DOMPoint());
if ((aNode.Tag() != nsGkAtoms::br || mHTMLEditor->IsVisBreak(&aNode)) &&
if ((!aNode.IsHTMLElement(nsGkAtoms::br) ||
mHTMLEditor->IsVisBreak(&aNode)) &&
aAction == nsIEditor::ePrevious) {
ret.offset++;
}
@ -3220,7 +3222,7 @@ nsHTMLEditRules::WillMakeList(Selection* aSelection,
if (nsHTMLEditUtils::IsListItem(curNode)) {
NS_ENSURE_STATE(mHTMLEditor);
if (curParent->Tag() != listType) {
if (!curParent->IsHTMLElement(listType)) {
// list item is in wrong type of list. if we don't have a curList,
// split the old list and make a new list of correct type.
if (!curList || nsEditorUtils::IsDescendantOf(curNode, curList)) {
@ -3241,7 +3243,7 @@ nsHTMLEditRules::WillMakeList(Selection* aSelection,
NS_ENSURE_SUCCESS(res, res);
// convert list item type if needed
NS_ENSURE_STATE(mHTMLEditor);
if (curNode->Tag() != itemType) {
if (!curNode->IsHTMLElement(itemType)) {
NS_ENSURE_STATE(mHTMLEditor);
newBlock = dont_AddRef(GetAsDOMNode(
mHTMLEditor->ReplaceContainer(curNode->AsElement(),
@ -3260,7 +3262,7 @@ nsHTMLEditRules::WillMakeList(Selection* aSelection,
NS_ENSURE_SUCCESS(res, res);
}
NS_ENSURE_STATE(mHTMLEditor);
if (curNode->Tag() != itemType) {
if (!curNode->IsHTMLElement(itemType)) {
NS_ENSURE_STATE(mHTMLEditor);
newBlock = dont_AddRef(GetAsDOMNode(
mHTMLEditor->ReplaceContainer(curNode->AsElement(),
@ -3283,7 +3285,7 @@ nsHTMLEditRules::WillMakeList(Selection* aSelection,
// if we hit a div clear our prevListItem, insert divs contents
// into our node array, and remove the div
if (curNode->Tag() == nsGkAtoms::div) {
if (curNode->IsHTMLElement(nsGkAtoms::div)) {
prevListItem = nullptr;
int32_t j = i + 1;
res = GetInnerContent(curNode->AsDOMNode(), arrayOfNodes, &j);
@ -3319,7 +3321,7 @@ nsHTMLEditRules::WillMakeList(Selection* aSelection,
NS_ENSURE_SUCCESS(res, res);
} else {
// don't wrap li around a paragraph. instead replace paragraph with li
if (curNode->Tag() == nsGkAtoms::p) {
if (curNode->IsHTMLElement(nsGkAtoms::p)) {
NS_ENSURE_STATE(mHTMLEditor);
listItem = mHTMLEditor->ReplaceContainer(curNode->AsElement(),
itemType);
@ -3746,7 +3748,8 @@ nsHTMLEditRules::WillCSSIndent(Selection* aSelection,
sibling = mHTMLEditor->GetNextHTMLSibling(curNode);
if (sibling && nsHTMLEditUtils::IsList(sibling))
{
if (curParent->Tag() == sibling->Tag()) {
if (curParent->NodeInfo()->NameAtom() == sibling->NodeInfo()->NameAtom() &&
curParent->NodeInfo()->NamespaceID() == sibling->NodeInfo()->NamespaceID()) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->MoveNode(curNode, sibling, 0);
NS_ENSURE_SUCCESS(res, res);
@ -3760,7 +3763,8 @@ nsHTMLEditRules::WillCSSIndent(Selection* aSelection,
sibling = mHTMLEditor->GetPriorHTMLSibling(curNode);
if (sibling && nsHTMLEditUtils::IsList(sibling))
{
if (curParent->Tag() == sibling->Tag()) {
if (curParent->NodeInfo()->NameAtom() == sibling->NodeInfo()->NameAtom() &&
curParent->NodeInfo()->NamespaceID() == sibling->NodeInfo()->NamespaceID()) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->MoveNode(curNode, sibling, -1);
NS_ENSURE_SUCCESS(res, res);
@ -3778,10 +3782,12 @@ nsHTMLEditRules::WillCSSIndent(Selection* aSelection,
if (!curList || (sibling && sibling != curList)) {
// create a new nested list of correct type
res = SplitAsNeeded(*curParent->Tag(), curParent, offset);
res = SplitAsNeeded(*curParent->NodeInfo()->NameAtom(), curParent,
offset);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_STATE(mHTMLEditor);
curList = mHTMLEditor->CreateNode(curParent->Tag(), curParent, offset);
curList = mHTMLEditor->CreateNode(curParent->NodeInfo()->NameAtom(),
curParent, offset);
NS_ENSURE_STATE(curList);
// curList is now the correct thing to put curNode in
// remember our new block for postprocessing
@ -3928,7 +3934,8 @@ nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
NS_ENSURE_STATE(mHTMLEditor);
sibling = mHTMLEditor->GetNextHTMLSibling(curNode);
if (sibling && nsHTMLEditUtils::IsList(sibling) &&
curParent->Tag() == sibling->Tag()) {
curParent->NodeInfo()->NameAtom() == sibling->NodeInfo()->NameAtom() &&
curParent->NodeInfo()->NamespaceID() == sibling->NodeInfo()->NamespaceID()) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->MoveNode(curNode, sibling, 0);
NS_ENSURE_SUCCESS(res, res);
@ -3941,7 +3948,8 @@ nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
NS_ENSURE_STATE(mHTMLEditor);
sibling = mHTMLEditor->GetPriorHTMLSibling(curNode);
if (sibling && nsHTMLEditUtils::IsList(sibling) &&
curParent->Tag() == sibling->Tag()) {
curParent->NodeInfo()->NameAtom() == sibling->NodeInfo()->NameAtom() &&
curParent->NodeInfo()->NamespaceID() == sibling->NodeInfo()->NamespaceID()) {
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->MoveNode(curNode, sibling, -1);
NS_ENSURE_SUCCESS(res, res);
@ -3960,10 +3968,12 @@ nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
if (!curList || (sibling && sibling != curList) )
{
// create a new nested list of correct type
res = SplitAsNeeded(*curParent->Tag(), curParent, offset);
res = SplitAsNeeded(*curParent->NodeInfo()->NameAtom(), curParent,
offset);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_STATE(mHTMLEditor);
curList = mHTMLEditor->CreateNode(curParent->Tag(), curParent, offset);
curList = mHTMLEditor->CreateNode(curParent->NodeInfo()->NameAtom(),
curParent, offset);
NS_ENSURE_STATE(curList);
// curList is now the correct thing to put curNode in
// remember our new block for postprocessing
@ -4005,11 +4015,12 @@ nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
if (!curList || (sibling && sibling != curList) )
{
// create a new nested list of correct type
res = SplitAsNeeded(*curParent->Tag(), curParent, offset);
res = SplitAsNeeded(*curParent->NodeInfo()->NameAtom(), curParent,
offset);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_STATE(mHTMLEditor);
curList = mHTMLEditor->CreateNode(curParent->Tag(), curParent,
offset);
curList = mHTMLEditor->CreateNode(curParent->NodeInfo()->NameAtom(),
curParent, offset);
NS_ENSURE_STATE(curList);
}
NS_ENSURE_STATE(mHTMLEditor);
@ -4959,7 +4970,8 @@ nsHTMLEditRules::AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignTyp
if (!firstChild)
{
// this cell has no content, nothing to align
} else if (firstChild == lastChild && firstChild->Tag() == nsGkAtoms::div) {
} else if (firstChild == lastChild &&
firstChild->IsHTMLElement(nsGkAtoms::div)) {
// the cell already has a div containing all of its content: just
// act on this div.
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(firstChild);
@ -5599,14 +5611,14 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
NS_ENSURE_TRUE(mHTMLEditor, /* void */);
nsCOMPtr<nsIContent> nearNode =
mHTMLEditor->GetPriorHTMLNode(node, offset, true);
while (!nearNode && node->Tag() != nsGkAtoms::body &&
while (!nearNode && !node->IsHTMLElement(nsGkAtoms::body) &&
node->GetParentNode()) {
// some cutoffs are here: we don't need to also include them in the
// aWhere == kEnd case. as long as they are in one or the other it will
// work. special case for outdent: don't keep looking up if we have
// found a blockquote element to act on
if (actionID == EditAction::outdent &&
node->Tag() == nsGkAtoms::blockquote) {
node->IsHTMLElement(nsGkAtoms::blockquote)) {
break;
}
@ -5675,7 +5687,7 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
NS_ENSURE_TRUE(mHTMLEditor, /* void */);
nsCOMPtr<nsIContent> nearNode =
mHTMLEditor->GetNextHTMLNode(node, offset, true);
while (!nearNode && node->Tag() != nsGkAtoms::body &&
while (!nearNode && !node->IsHTMLElement(nsGkAtoms::body) &&
node->GetParentNode()) {
int32_t parentOffset = node->GetParentNode()->IndexOf(node);
nsCOMPtr<nsINode> parent = node->GetParentNode();
@ -7209,7 +7221,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsA
curParent = curNode->GetParentNode();
offset = curParent ? curParent->IndexOf(curNode) : -1;
nsAutoString curNodeTag;
curNode->Tag()->ToString(curNodeTag);
curNode->NodeInfo()->NameAtom()->ToString(curNodeTag);
ToLowerCase(curNodeTag);
// is it already the right kind of block?
@ -7239,8 +7251,8 @@ nsHTMLEditRules::ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsA
(curNodeTag.EqualsLiteral("td")) ||
nsHTMLEditUtils::IsList(curNode) ||
(curNodeTag.EqualsLiteral("li")) ||
curNode->Tag() == nsGkAtoms::blockquote ||
curNode->Tag() == nsGkAtoms::div) {
curNode->IsAnyOfHTMLElements(nsGkAtoms::blockquote,
nsGkAtoms::div)) {
curBlock = 0; // forget any previous block used for previous inline nodes
// recursion time
nsCOMArray<nsIDOMNode> childArray;
@ -7454,11 +7466,11 @@ nsHTMLEditRules::GetTopEnclosingMailCite(nsINode& aNode)
nsCOMPtr<Element> ret;
for (nsCOMPtr<nsINode> node = &aNode; node; node = node->GetParentNode()) {
if ((IsPlaintextEditor() && node->Tag() == nsGkAtoms::pre) ||
if ((IsPlaintextEditor() && node->IsHTMLElement(nsGkAtoms::pre)) ||
nsHTMLEditUtils::IsMailCite(node)) {
ret = node->AsElement();
}
if (node->Tag() == nsGkAtoms::body) {
if (node->IsHTMLElement(nsGkAtoms::body)) {
break;
}
}
@ -7878,7 +7890,7 @@ nsHTMLEditRules::AdjustSelection(Selection* aSelection,
if (nearNode && (nsTextEditUtils::IsBreak(nearNode) ||
nsEditor::IsTextNode(nearNode) ||
nsHTMLEditUtils::IsImage(nearNode) ||
nearNode->Tag() == nsGkAtoms::hr)) {
nearNode->IsHTMLElement(nsGkAtoms::hr))) {
// this is a good place for the caret to be
return NS_OK;
}
@ -7886,8 +7898,8 @@ nsHTMLEditRules::AdjustSelection(Selection* aSelection,
nearNode = mHTMLEditor->GetNextHTMLNode(selNode, selOffset, true);
if (nearNode && (nsTextEditUtils::IsBreak(nearNode) ||
nsEditor::IsTextNode(nearNode) ||
nearNode->Tag() == nsGkAtoms::img ||
nearNode->Tag() == nsGkAtoms::hr)) {
nearNode->IsAnyOfHTMLElements(nsGkAtoms::img,
nsGkAtoms::hr))) {
return NS_OK; // this is a good place for the caret to be
}
@ -9136,7 +9148,8 @@ nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
if (!curList || (sibling && sibling != GetAsDOMNode(curList))) {
// create a new nested list of correct type
res = SplitAsNeeded(*curParent->Tag(), curParent, offset);
res = SplitAsNeeded(*curParent->NodeInfo()->NameAtom(), curParent,
offset);
NS_ENSURE_SUCCESS(res, res);
if (!curPositionedDiv) {
nsCOMPtr<nsINode> curParentParent = curParent->GetParentNode();
@ -9148,8 +9161,8 @@ nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
mNewBlock = GetAsDOMNode(curPositionedDiv);
}
NS_ENSURE_STATE(mHTMLEditor);
curList = mHTMLEditor->CreateNode(curParent->Tag(), curPositionedDiv,
-1);
curList = mHTMLEditor->CreateNode(curParent->NodeInfo()->NameAtom(),
curPositionedDiv, -1);
NS_ENSURE_STATE(curList);
// curList is now the correct thing to put curNode in
// remember our new block for postprocessing
@ -9189,7 +9202,8 @@ nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
if (!curList || (sibling && sibling != GetAsDOMNode(curList))) {
// create a new nested list of correct type
res = SplitAsNeeded(*curParent->Tag(), curParent, offset);
res = SplitAsNeeded(*curParent->NodeInfo()->NameAtom(), curParent,
offset);
NS_ENSURE_SUCCESS(res, res);
if (!curPositionedDiv) {
nsCOMPtr<nsINode> curParentParent = curParent->GetParentNode();
@ -9202,8 +9216,8 @@ nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
mNewBlock = GetAsDOMNode(curPositionedDiv);
}
NS_ENSURE_STATE(mHTMLEditor);
curList = mHTMLEditor->CreateNode(curParent->Tag(), curPositionedDiv,
-1);
curList = mHTMLEditor->CreateNode(curParent->NodeInfo()->NameAtom(),
curPositionedDiv, -1);
NS_ENSURE_STATE(curList);
}
NS_ENSURE_STATE(mHTMLEditor);
@ -9219,7 +9233,7 @@ nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
if (!curPositionedDiv)
{
if (curNode->Tag() == nsGkAtoms::div) {
if (curNode->IsHTMLElement(nsGkAtoms::div)) {
curPositionedDiv = curNode->AsElement();
mNewBlock = GetAsDOMNode(curPositionedDiv);
curList = nullptr;

View File

@ -50,18 +50,17 @@ bool
nsHTMLEditUtils::IsInlineStyle(nsINode* aNode)
{
MOZ_ASSERT(aNode);
nsIAtom* nodeAtom = aNode->Tag();
return (nodeAtom == nsGkAtoms::b)
|| (nodeAtom == nsGkAtoms::i)
|| (nodeAtom == nsGkAtoms::u)
|| (nodeAtom == nsGkAtoms::tt)
|| (nodeAtom == nsGkAtoms::s)
|| (nodeAtom == nsGkAtoms::strike)
|| (nodeAtom == nsGkAtoms::big)
|| (nodeAtom == nsGkAtoms::small)
|| (nodeAtom == nsGkAtoms::sub)
|| (nodeAtom == nsGkAtoms::sup)
|| (nodeAtom == nsGkAtoms::font);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::b,
nsGkAtoms::i,
nsGkAtoms::u,
nsGkAtoms::tt,
nsGkAtoms::s,
nsGkAtoms::strike,
nsGkAtoms::big,
nsGkAtoms::small,
nsGkAtoms::sub,
nsGkAtoms::sup,
nsGkAtoms::font);
}
///////////////////////////////////////////////////////////////////////////
@ -79,16 +78,15 @@ bool
nsHTMLEditUtils::IsFormatNode(nsINode* aNode)
{
MOZ_ASSERT(aNode);
nsIAtom* nodeAtom = aNode->Tag();
return (nodeAtom == nsGkAtoms::p)
|| (nodeAtom == nsGkAtoms::pre)
|| (nodeAtom == nsGkAtoms::h1)
|| (nodeAtom == nsGkAtoms::h2)
|| (nodeAtom == nsGkAtoms::h3)
|| (nodeAtom == nsGkAtoms::h4)
|| (nodeAtom == nsGkAtoms::h5)
|| (nodeAtom == nsGkAtoms::h6)
|| (nodeAtom == nsGkAtoms::address);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::p,
nsGkAtoms::pre,
nsGkAtoms::h1,
nsGkAtoms::h2,
nsGkAtoms::h3,
nsGkAtoms::h4,
nsGkAtoms::h5,
nsGkAtoms::h6,
nsGkAtoms::address);
}
///////////////////////////////////////////////////////////////////////////
@ -127,13 +125,12 @@ nsHTMLEditUtils::IsSmall(nsIDOMNode* aNode)
bool
nsHTMLEditUtils::IsHeader(nsINode& aNode)
{
nsCOMPtr<nsIAtom> nodeAtom = aNode.Tag();
return (nodeAtom == nsGkAtoms::h1)
|| (nodeAtom == nsGkAtoms::h2)
|| (nodeAtom == nsGkAtoms::h3)
|| (nodeAtom == nsGkAtoms::h4)
|| (nodeAtom == nsGkAtoms::h5)
|| (nodeAtom == nsGkAtoms::h6);
return aNode.IsAnyOfHTMLElements(nsGkAtoms::h1,
nsGkAtoms::h2,
nsGkAtoms::h3,
nsGkAtoms::h4,
nsGkAtoms::h5,
nsGkAtoms::h6);
}
bool
@ -177,13 +174,12 @@ nsHTMLEditUtils::IsListItem(nsIDOMNode* aNode)
}
bool
nsHTMLEditUtils::IsListItem(nsINode* node)
nsHTMLEditUtils::IsListItem(nsINode* aNode)
{
MOZ_ASSERT(node);
nsCOMPtr<nsIAtom> nodeAtom = node->Tag();
return (nodeAtom == nsGkAtoms::li)
|| (nodeAtom == nsGkAtoms::dd)
|| (nodeAtom == nsGkAtoms::dt);
MOZ_ASSERT(aNode);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::li,
nsGkAtoms::dd,
nsGkAtoms::dt);
}
@ -199,18 +195,17 @@ nsHTMLEditUtils::IsTableElement(nsIDOMNode* aNode)
}
bool
nsHTMLEditUtils::IsTableElement(nsINode* node)
nsHTMLEditUtils::IsTableElement(nsINode* aNode)
{
MOZ_ASSERT(node);
nsCOMPtr<nsIAtom> nodeAtom = node->Tag();
return (nodeAtom == nsGkAtoms::table)
|| (nodeAtom == nsGkAtoms::tr)
|| (nodeAtom == nsGkAtoms::td)
|| (nodeAtom == nsGkAtoms::th)
|| (nodeAtom == nsGkAtoms::thead)
|| (nodeAtom == nsGkAtoms::tfoot)
|| (nodeAtom == nsGkAtoms::tbody)
|| (nodeAtom == nsGkAtoms::caption);
MOZ_ASSERT(aNode);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::table,
nsGkAtoms::tr,
nsGkAtoms::td,
nsGkAtoms::th,
nsGkAtoms::thead,
nsGkAtoms::tfoot,
nsGkAtoms::tbody,
nsGkAtoms::caption);
}
///////////////////////////////////////////////////////////////////////////
@ -228,14 +223,13 @@ bool
nsHTMLEditUtils::IsTableElementButNotTable(nsINode* aNode)
{
MOZ_ASSERT(aNode);
nsCOMPtr<nsIAtom> nodeAtom = aNode->Tag();
return (nodeAtom == nsGkAtoms::tr)
|| (nodeAtom == nsGkAtoms::td)
|| (nodeAtom == nsGkAtoms::th)
|| (nodeAtom == nsGkAtoms::thead)
|| (nodeAtom == nsGkAtoms::tfoot)
|| (nodeAtom == nsGkAtoms::tbody)
|| (nodeAtom == nsGkAtoms::caption);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::tr,
nsGkAtoms::td,
nsGkAtoms::th,
nsGkAtoms::thead,
nsGkAtoms::tfoot,
nsGkAtoms::tbody,
nsGkAtoms::caption);
}
///////////////////////////////////////////////////////////////////////////
@ -250,7 +244,7 @@ nsHTMLEditUtils::IsTable(nsIDOMNode* aNode)
bool
nsHTMLEditUtils::IsTable(nsINode* aNode)
{
return aNode && aNode->IsElement() && aNode->Tag() == nsGkAtoms::table;
return aNode && aNode->IsHTMLElement(nsGkAtoms::table);
}
///////////////////////////////////////////////////////////////////////////
@ -275,12 +269,10 @@ nsHTMLEditUtils::IsTableCell(nsIDOMNode* aNode)
}
bool
nsHTMLEditUtils::IsTableCell(nsINode* node)
nsHTMLEditUtils::IsTableCell(nsINode* aNode)
{
MOZ_ASSERT(node);
nsCOMPtr<nsIAtom> nodeAtom = node->Tag();
return (nodeAtom == nsGkAtoms::td)
|| (nodeAtom == nsGkAtoms::th);
MOZ_ASSERT(aNode);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th);
}
@ -310,13 +302,12 @@ nsHTMLEditUtils::IsList(nsIDOMNode* aNode)
}
bool
nsHTMLEditUtils::IsList(nsINode* node)
nsHTMLEditUtils::IsList(nsINode* aNode)
{
MOZ_ASSERT(node);
nsCOMPtr<nsIAtom> nodeAtom = node->Tag();
return (nodeAtom == nsGkAtoms::ul)
|| (nodeAtom == nsGkAtoms::ol)
|| (nodeAtom == nsGkAtoms::dl);
MOZ_ASSERT(aNode);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::ul,
nsGkAtoms::ol,
nsGkAtoms::dl);
}
@ -366,7 +357,7 @@ nsHTMLEditUtils::IsPre(nsIDOMNode* aNode)
bool
nsHTMLEditUtils::IsImage(nsINode* aNode)
{
return aNode && aNode->Tag() == nsGkAtoms::img;
return aNode && aNode->IsHTMLElement(nsGkAtoms::img);
}
bool
@ -443,7 +434,7 @@ bool
nsHTMLEditUtils::IsMozDiv(nsINode* aNode)
{
MOZ_ASSERT(aNode);
return aNode->Tag() == nsGkAtoms::div &&
return aNode->IsHTMLElement(nsGkAtoms::div) &&
nsTextEditUtils::HasMozAttr(GetAsDOMNode(aNode));
}
@ -499,15 +490,14 @@ bool
nsHTMLEditUtils::IsFormWidget(nsINode* aNode)
{
MOZ_ASSERT(aNode);
nsCOMPtr<nsIAtom> nodeAtom = aNode->Tag();
return (nodeAtom == nsGkAtoms::textarea)
|| (nodeAtom == nsGkAtoms::select)
|| (nodeAtom == nsGkAtoms::button)
|| (nodeAtom == nsGkAtoms::output)
|| (nodeAtom == nsGkAtoms::keygen)
|| (nodeAtom == nsGkAtoms::progress)
|| (nodeAtom == nsGkAtoms::meter)
|| (nodeAtom == nsGkAtoms::input);
return aNode->IsAnyOfHTMLElements(nsGkAtoms::textarea,
nsGkAtoms::select,
nsGkAtoms::button,
nsGkAtoms::output,
nsGkAtoms::keygen,
nsGkAtoms::progress,
nsGkAtoms::meter,
nsGkAtoms::input);
}
bool

View File

@ -743,23 +743,20 @@ nsHTMLEditor::NodeIsBlockStatic(const dom::Element* aElement)
{
MOZ_ASSERT(aElement);
nsIAtom* tagAtom = aElement->Tag();
MOZ_ASSERT(tagAtom);
// Nodes we know we want to treat as block
// even though the parser says they're not:
if (tagAtom == nsGkAtoms::body ||
tagAtom == nsGkAtoms::head ||
tagAtom == nsGkAtoms::tbody ||
tagAtom == nsGkAtoms::thead ||
tagAtom == nsGkAtoms::tfoot ||
tagAtom == nsGkAtoms::tr ||
tagAtom == nsGkAtoms::th ||
tagAtom == nsGkAtoms::td ||
tagAtom == nsGkAtoms::li ||
tagAtom == nsGkAtoms::dt ||
tagAtom == nsGkAtoms::dd ||
tagAtom == nsGkAtoms::pre) {
if (aElement->IsAnyOfHTMLElements(nsGkAtoms::body,
nsGkAtoms::head,
nsGkAtoms::tbody,
nsGkAtoms::thead,
nsGkAtoms::tfoot,
nsGkAtoms::tr,
nsGkAtoms::th,
nsGkAtoms::td,
nsGkAtoms::li,
nsGkAtoms::dt,
nsGkAtoms::dd,
nsGkAtoms::pre)) {
return true;
}
@ -769,11 +766,12 @@ nsHTMLEditor::NodeIsBlockStatic(const dom::Element* aElement)
nsresult rv =
#endif
nsContentUtils::GetParserService()->
IsBlock(nsContentUtils::GetParserService()->HTMLAtomTagToId(tagAtom),
IsBlock(nsContentUtils::GetParserService()->HTMLAtomTagToId(
aElement->NodeInfo()->NameAtom()),
isBlock);
MOZ_ASSERT(rv == NS_OK);
AssertParserServiceIsCorrect(tagAtom, isBlock);
AssertParserServiceIsCorrect(aElement->NodeInfo()->NameAtom(), isBlock);
return isBlock;
}
@ -1594,7 +1592,7 @@ nsHTMLEditor::InsertNodeAtPoint(nsIDOMNode *aNode,
while (!CanContain(*parent, *node)) {
// If the current parent is a root (body or table element)
// then go no further - we can't insert
if (parent->Tag() == nsGkAtoms::body ||
if (parent->IsHTMLElement(nsGkAtoms::body) ||
nsHTMLEditUtils::IsTableElement(parent)) {
return NS_ERROR_FAILURE;
}
@ -2295,7 +2293,7 @@ nsHTMLEditor::GetElementOrParentByTagName(const nsAString& aTagName,
// stop at table cells, but that's too messy when you are trying to find
// the parent table
if (current->GetParentElement() &&
current->GetParentElement()->Tag() == nsGkAtoms::body) {
current->GetParentElement()->IsHTMLElement(nsGkAtoms::body)) {
break;
}
}
@ -4742,7 +4740,7 @@ nsHTMLEditor::AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
MOZ_ASSERT(aNode1);
MOZ_ASSERT(aNode2);
if (aNode1->Tag() != aNode2->Tag()) {
if (aNode1->NodeInfo()->NameAtom() != aNode2->NodeInfo()->NameAtom()) {
return false;
}
@ -4796,13 +4794,14 @@ nsHTMLEditor::CopyLastEditableChildStyles(nsIDOMNode * aPreviousBlock, nsIDOMNod
}
while (childElement && (childElement->AsDOMNode() != aPreviousBlock)) {
if (nsHTMLEditUtils::IsInlineStyle(childElement) ||
childElement->Tag() == nsGkAtoms::span) {
childElement->IsHTMLElement(nsGkAtoms::span)) {
if (newStyles) {
newStyles = InsertContainerAbove(newStyles, childElement->Tag());
newStyles = InsertContainerAbove(newStyles,
childElement->NodeInfo()->NameAtom());
NS_ENSURE_STATE(newStyles);
} else {
deepestStyle = newStyles = CreateNode(childElement->Tag(), newBlock,
0);
deepestStyle = newStyles =
CreateNode(childElement->NodeInfo()->NameAtom(), newBlock, 0);
NS_ENSURE_STATE(newStyles);
}
CloneAttributes(newStyles, childElement);

View File

@ -498,7 +498,7 @@ nsHTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent* aNode,
}
// is it already the right kind of node, but with wrong attribute?
if (aNode->Tag() == aProperty) {
if (aNode->IsHTMLElement(aProperty)) {
// Just set the attribute on it.
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(aNode);
return SetAttribute(elem, *aAttribute, *aValue);
@ -650,7 +650,7 @@ nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
aProperty, aAttribute, isSet, firstValue, nsHTMLCSSUtils::eSpecified);
}
if (// node is the correct inline prop
(aProperty && node->Tag() == aProperty) ||
(aProperty && node->IsHTMLElement(aProperty)) ||
// node is href - test if really <a href=...
(aProperty == nsGkAtoms::href && nsHTMLEditUtils::IsLink(node)) ||
// or node is any prop, and we asked to split them all
@ -1689,13 +1689,13 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( int32_t aSizeChange,
// look for siblings that are correct type of node
nsIAtom* nodeType = aSizeChange == 1 ? nsGkAtoms::big : nsGkAtoms::small;
nsCOMPtr<nsIContent> sibling = GetPriorHTMLSibling(node);
if (sibling && sibling->Tag() == nodeType) {
if (sibling && sibling->IsHTMLElement(nodeType)) {
// previous sib is already right kind of inline node; slide this over into it
res = MoveNode(node, sibling, -1);
return res;
}
sibling = GetNextHTMLSibling(node);
if (sibling && sibling->Tag() == nodeType) {
if (sibling && sibling->IsHTMLElement(nodeType)) {
// following sib is already right kind of inline node; slide this over into it
res = MoveNode(node, sibling, 0);
return res;

View File

@ -219,18 +219,16 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
nsCOMPtr<nsIContent> content = do_QueryInterface(tableChild);
if (content)
{
nsIAtom *atom = content->Tag();
if (atom == nsGkAtoms::tr) {
if (content->IsHTMLElement(nsGkAtoms::tr)) {
// Found a row directly under <table>
*aRowNode = tableChild;
NS_ADDREF(*aRowNode);
return NS_OK;
}
// Look for row in one of the row container elements
if (atom == nsGkAtoms::tbody ||
atom == nsGkAtoms::thead ||
atom == nsGkAtoms::tfoot) {
if (content->IsAnyOfHTMLElements(nsGkAtoms::tbody,
nsGkAtoms::thead,
nsGkAtoms::tfoot)) {
nsCOMPtr<nsIDOMNode> rowNode;
res = tableChild->GetFirstChild(getter_AddRefs(rowNode));
NS_ENSURE_SUCCESS(res, res);

View File

@ -2248,7 +2248,7 @@ nsTextServicesDocument::IsBlockNode(nsIContent *aContent)
return false;
}
nsIAtom *atom = aContent->Tag();
nsIAtom *atom = aContent->NodeInfo()->NameAtom();
return (sAAtom != atom &&
sAddressAtom != atom &&