diff --git a/content/base/public/nsINodeInfo.h b/content/base/public/nsINodeInfo.h index b8194b04d5c..981e368b3b2 100644 --- a/content/base/public/nsINodeInfo.h +++ b/content/base/public/nsINodeInfo.h @@ -120,15 +120,6 @@ public: return mQualifiedName; } - /* - * As above, but return the qualified name in corrected case as - * needed. For example, for HTML elements in HTML documents, this - * will return an ASCII-uppercased version of the qualified name. - */ - const nsString& QualifiedNameCorrectedCase() const { - return mQualifiedNameCorrectedCase; - } - /* * Returns the node's nodeName as defined in DOM Core */ @@ -381,10 +372,6 @@ protected: // Qualified name nsString mQualifiedName; - // Qualified name in "corrected case"; this will depend on our - // document and on mNamespaceID. - nsString mQualifiedNameCorrectedCase; - // nodeName for the node. nsString mNodeName; diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index ce403f1ca24..9d5d182b741 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -205,7 +205,7 @@ nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument) NS_IMETHODIMP nsDOMAttribute::GetName(nsAString& aName) { - aName = mNodeInfo->QualifiedName(); + aName = NodeName(); return NS_OK; } diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 18ab891ff6e..17f8e24041a 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -817,8 +817,11 @@ nsINode::IsEqualTo(nsINode* aOther) if (nodeType != node2->NodeType()) { return PR_FALSE; } - - if (!node1->mNodeInfo->Equals(node2->mNodeInfo)) { + + nsINodeInfo* nodeInfo1 = node1->mNodeInfo; + nsINodeInfo* nodeInfo2 = node2->mNodeInfo; + if (!nodeInfo1->Equals(nodeInfo2) || + nodeInfo1->GetExtraName() != nodeInfo2->GetExtraName()) { return PR_FALSE; } @@ -867,16 +870,6 @@ nsINode::IsEqualTo(nsINode* aOther) return PR_FALSE; } - if (nodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) { - nsCOMPtr domNode1 = do_QueryInterface(node1); - nsCOMPtr domNode2 = do_QueryInterface(node2); - domNode1->GetNodeName(string1); - domNode2->GetNodeName(string2); - if (!string1.Equals(string2)) { - return PR_FALSE; - } - } - break; } case nsIDOMNode::DOCUMENT_NODE: @@ -904,13 +897,6 @@ nsINode::IsEqualTo(nsINode* aOther) NS_ASSERTION(docType1 && docType2, "Why don't we have a document type node?"); - // Node name - docType1->GetNodeName(string1); - docType2->GetNodeName(string2); - if (!string1.Equals(string2)) { - return PR_FALSE; - } - // Public ID docType1->GetPublicId(string1); docType2->GetPublicId(string2); @@ -2410,7 +2396,7 @@ nsGenericElement::HasChildNodes(PRBool* aReturn) NS_IMETHODIMP nsGenericElement::GetTagName(nsAString& aTagName) { - aTagName = mNodeInfo->QualifiedNameCorrectedCase(); + aTagName = NodeName(); return NS_OK; } diff --git a/content/base/src/nsNodeInfo.cpp b/content/base/src/nsNodeInfo.cpp index 4246c1a8ecd..8004e51915b 100644 --- a/content/base/src/nsNodeInfo.cpp +++ b/content/base/src/nsNodeInfo.cpp @@ -132,18 +132,17 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, mInner.mName->ToString(mQualifiedName); } - // Qualified name in corrected case - if (aNamespaceID == kNameSpaceID_XHTML && GetDocument() && - GetDocument()->IsHTML()) { - nsContentUtils::ASCIIToUpper(mQualifiedName, mQualifiedNameCorrectedCase); - } else { - mQualifiedNameCorrectedCase = mQualifiedName; - } - switch (aNodeType) { case nsIDOMNode::ELEMENT_NODE: case nsIDOMNode::ATTRIBUTE_NODE: - mNodeName = mQualifiedNameCorrectedCase; + // Correct the case for HTML + if (aNodeType == nsIDOMNode::ELEMENT_NODE && + aNamespaceID == kNameSpaceID_XHTML && GetDocument() && + GetDocument()->IsHTML()) { + nsContentUtils::ASCIIToUpper(mQualifiedName, mNodeName); + } else { + mNodeName = mQualifiedName; + } mInner.mName->ToString(mLocalName); break; case nsIDOMNode::TEXT_NODE: diff --git a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp index 1612474262d..5d22c302e14 100644 --- a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp +++ b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp @@ -467,16 +467,11 @@ txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName) } if (aNode.isContent()) { - if (aNode.mNode->IsElement()) { - aName = aNode.Content()->NodeInfo()->QualifiedNameCorrectedCase(); - return; - } - - if (aNode.mNode->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) { - // PIs don't have a nodeinfo but do have a name - nsCOMPtr node = do_QueryInterface(aNode.mNode); - node->GetNodeName(aName); - + // Elements and PIs have a name + if (aNode.mNode->IsElement() || + aNode.mNode->NodeType() == + nsIDOMNode::PROCESSING_INSTRUCTION_NODE) { + aName = aNode.Content()->NodeName(); return; } @@ -486,11 +481,6 @@ txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName) } aNode.Content()->GetAttrNameAt(aNode.mIndex)->GetQualifiedName(aName); - - // Check for html - if (aNode.Content()->IsHTML()) { - ToUpperCase(aName); - } } /* static */ diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index 931667da0d5..25eb1d8d857 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -866,6 +866,11 @@ customMethodCalls = { 'nsIDOMElement_': { 'thisType': 'nsGenericElement' }, + 'nsIDOMElement_GetTagName': { + 'thisType': 'nsINode', + 'code': 'nsString result = self->NodeName();', + 'canFail': False + }, 'nsIDOMDocument_CreateElement': { 'thisType': 'nsDocument', 'code': ' nsCOMPtr result;\n'