Bug 569538 - Make aFromParser distinguish network, document.write and fragments in the HTML case. r=Olli.Pettay.

This commit is contained in:
Henri Sivonen
2010-06-09 09:44:25 +03:00
parent 5a397eccee
commit 0dd4c83505
36 changed files with 89 additions and 62 deletions

View File

@@ -107,7 +107,8 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation()
case eTreeOpAddAttributes:
delete mTwo.attributes;
break;
case eTreeOpCreateElement:
case eTreeOpCreateElementNetwork:
case eTreeOpCreateElementNotNetwork:
delete mThree.attributes;
break;
case eTreeOpAppendDoctypeToDocument:
@@ -362,7 +363,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
return rv;
}
case eTreeOpCreateElement: {
case eTreeOpCreateElementNetwork:
case eTreeOpCreateElementNotNetwork: {
nsIContent** target = mOne.node;
PRInt32 ns = mInt;
nsCOMPtr<nsIAtom> name = Reget(mTwo.atom);
@@ -376,7 +378,14 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsCOMPtr<nsIContent> newContent;
nsCOMPtr<nsINodeInfo> nodeInfo = aBuilder->GetNodeInfoManager()->GetNodeInfo(name, nsnull, ns);
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
NS_NewElement(getter_AddRefs(newContent), nodeInfo->NamespaceID(), nodeInfo, PR_TRUE);
NS_NewElement(getter_AddRefs(newContent),
nodeInfo->NamespaceID(),
nodeInfo,
(mOpCode == eTreeOpCreateElementNetwork ?
NS_FROM_PARSER_NETWORK
: (aBuilder->IsFragmentMode() ?
NS_FROM_PARSER_FRAGMENT :
NS_FROM_PARSER_DOCUMENT_WRITE)));
NS_ASSERTION(newContent, "Element creation created null pointer.");
aBuilder->HoldElement(*target = newContent);