зеркало из https://github.com/mozilla/pjs.git
Bug 659539 Part 3: Use nsINode::NodeName where possible. Remove the now unused mQualifiedNameCorrectedCase. r=bz,peterv
This commit is contained in:
Родитель
731ebeb1d8
Коммит
e54aaec919
|
@ -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;
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument)
|
|||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetName(nsAString& aName)
|
||||
{
|
||||
aName = mNodeInfo->QualifiedName();
|
||||
aName = NodeName();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<nsIDOMNode> domNode1 = do_QueryInterface(node1);
|
||||
nsCOMPtr<nsIDOMNode> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<nsIDOMNode> 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 */
|
||||
|
|
|
@ -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<nsIContent> result;\n'
|
||||
|
|
Загрузка…
Ссылка в новой задаче