Bug 709083 - Call DoneCreatingElement before children have been appended to the element. r=bzbarsky.

This commit is contained in:
Henri Sivonen
2012-02-03 15:32:31 +02:00
parent 7c31d5ca8e
commit daa268e2f4
3 changed files with 48 additions and 23 deletions

View File

@@ -473,6 +473,23 @@ nsHtml5TreeBuilder::elementPushed(PRInt32 aNamespace, nsIAtom* aName, nsIContent
treeOp->Init(eTreeOpStartLayout);
return;
}
if (aName == nsHtml5Atoms::input ||
aName == nsHtml5Atoms::button) {
if (!formPointer) {
// If form inputs don't belong to a form, their state preservation
// won't work right without an append notification flush at this
// point. See bug 497861.
mOpQueue.AppendElement()->Init(eTreeOpFlushPendingAppendNotifications);
}
mOpQueue.AppendElement()->Init(eTreeOpDoneCreatingElement, aElement);
return;
}
if (aName == nsHtml5Atoms::audio ||
aName == nsHtml5Atoms::video ||
aName == nsHtml5Atoms::menuitem) {
mOpQueue.AppendElement()->Init(eTreeOpDoneCreatingElement, aElement);
return;
}
}
void
@@ -550,35 +567,12 @@ nsHtml5TreeBuilder::elementPopped(PRInt32 aNamespace, nsIAtom* aName, nsIContent
treeOp->Init(eTreeOpDoneAddingChildren, aElement);
return;
}
if (aName == nsHtml5Atoms::input ||
aName == nsHtml5Atoms::button ||
aName == nsHtml5Atoms::menuitem) {
if (!formPointer) {
// If form inputs don't belong to a form, their state preservation
// won't work right without an append notification flush at this
// point. See bug 497861.
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(eTreeOpFlushPendingAppendNotifications);
}
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(eTreeOpDoneCreatingElement, aElement);
return;
}
if (aName == nsHtml5Atoms::meta && !fragment) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(eTreeOpProcessMeta, aElement);
return;
}
if (aName == nsHtml5Atoms::audio || aName == nsHtml5Atoms::video) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(eTreeOpDoneCreatingElement, aElement);
return;
}
return;
}