Fixing bug 282217. SVG <title> doesn't have the same effect as <html:title>. r+sr=bzbarsky@mit.edu

This commit is contained in:
jwatt%jwatt.org 2005-09-06 02:17:22 +00:00
parent 0cfd6a71ca
commit db8d96505a

View File

@ -448,6 +448,16 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
mInTitle = PR_TRUE; // The first title wins
}
}
#ifdef MOZ_SVG
else if (aNodeInfo->Equals(nsSVGAtoms::title, kNameSpaceID_SVG)) {
nsIContent* parent = GetCurrentContent();
if (mDocument && mDocument->GetDocumentTitle().IsVoid() &&
parent && parent == mDocElement &&
parent->GetNodeInfo()->Equals(nsSVGAtoms::svg, kNameSpaceID_SVG)) {
mInTitle = PR_TRUE; // The first title wins
}
}
#endif // MOZ_SVG
else if (aNodeInfo->Equals(nsHTMLAtoms::link, kNameSpaceID_XHTML) ||
aNodeInfo->Equals(nsHTMLAtoms::style, kNameSpaceID_XHTML) ||
aNodeInfo->Equals(nsHTMLAtoms::style, kNameSpaceID_SVG)) {
@ -508,8 +518,11 @@ nsXMLContentSink::CloseElement(nsIContent* aContent, nsIContent* aParent,
return rv;
}
if (nodeInfo->Equals(nsHTMLAtoms::title, kNameSpaceID_XHTML) &&
mInTitle) {
if ((nodeInfo->Equals(nsHTMLAtoms::title, kNameSpaceID_XHTML)
#ifdef MOZ_SVG
|| nodeInfo->Equals(nsSVGAtoms::title, kNameSpaceID_SVG)
#endif // MOZ_SVG
) && mInTitle) {
NS_ASSERTION(mDocument, "How did mInTitle get to be true if mDocument is null?");
// The first title wins
nsCOMPtr<nsIDOMNSDocument> dom_doc(do_QueryInterface(mDocument));