зеркало из https://github.com/mozilla/pjs.git
r=jst. Fixing refcounting of ID attribute atoms. Additional work to earlier checkin for fixing bug 10292. Also, added support for getElementByID() in XML documents.
This commit is contained in:
Родитель
8ac6fdd0bb
Коммит
e5752be50d
|
@ -196,6 +196,7 @@ nsNodeInfo::GetIDAttributeAtom(nsIAtom** aResult)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mInner.mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -899,6 +899,17 @@ MatchName(nsIContent *aContent, const nsAReadableString& aName)
|
|||
return aContent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIXMLContent> xmlContent = do_QueryInterface(aContent);
|
||||
nsCOMPtr<nsIAtom> IDValue;
|
||||
if (xmlContent && NS_SUCCEEDED(xmlContent->GetID(*getter_AddRefs(IDValue))) && IDValue) {
|
||||
const PRUnichar* IDValStr = nsnull;
|
||||
IDValue->GetUnicode(&IDValStr);
|
||||
if (aName.Equals(IDValStr)) {
|
||||
return aContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 i, count;
|
||||
aContent->ChildCount(count);
|
||||
|
|
|
@ -144,6 +144,7 @@ nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -400,6 +400,7 @@ nsCParserNode::GetIDAttributeAtom(nsIAtom** aResult) const
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -196,6 +196,7 @@ nsNodeInfo::GetIDAttributeAtom(nsIAtom** aResult)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mInner.mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -899,6 +899,17 @@ MatchName(nsIContent *aContent, const nsAReadableString& aName)
|
|||
return aContent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIXMLContent> xmlContent = do_QueryInterface(aContent);
|
||||
nsCOMPtr<nsIAtom> IDValue;
|
||||
if (xmlContent && NS_SUCCEEDED(xmlContent->GetID(*getter_AddRefs(IDValue))) && IDValue) {
|
||||
const PRUnichar* IDValStr = nsnull;
|
||||
IDValue->GetUnicode(&IDValStr);
|
||||
if (aName.Equals(IDValStr)) {
|
||||
return aContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 i, count;
|
||||
aContent->ChildCount(count);
|
||||
|
|
|
@ -144,6 +144,7 @@ nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -400,6 +400,7 @@ nsCParserNode::GetIDAttributeAtom(nsIAtom** aResult) const
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mIDAttributeAtom;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче