Make sure to call DoneCreatingElement/DoneAddingChildren on the relevant HTML

nodes in XML so that form state restoration works.  Bug 206695, r+sr=peterv
This commit is contained in:
bzbarsky@mit.edu
2004-12-01 22:41:20 +00:00
parent 625f0cd8c4
commit 87d0e51e3a

View File

@@ -528,10 +528,19 @@ nsXMLContentSink::CloseElement(nsIContent* aContent, PRBool* aAppendContent)
nsINodeInfo* nodeInfo = aContent->GetNodeInfo();
// Some HTML nodes need DoneAddingChildren() called to initialize
// properly (eg form state restoration).
if ((nodeInfo->NamespaceID() == kNameSpaceID_XHTML &&
(nodeInfo->NameAtom() == nsHTMLAtoms::select ||
nodeInfo->NameAtom() == nsHTMLAtoms::textarea ||
nodeInfo->NameAtom() == nsHTMLAtoms::object ||
nodeInfo->NameAtom() == nsHTMLAtoms::applet))
#ifdef MOZ_XTF
if (nodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin)
aContent->DoneAddingChildren();
|| nodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin
#endif
) {
aContent->DoneAddingChildren();
}
if (!nodeInfo->NamespaceEquals(kNameSpaceID_XHTML) &&
!nodeInfo->NamespaceEquals(kNameSpaceID_SVG)) {
@@ -1070,6 +1079,14 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
content->BeginAddingChildren();
#endif
// Some HTML nodes need DoneCreatingElement() called to initialize
// properly (eg form state restoration).
if (nodeInfo->NamespaceID() == kNameSpaceID_XHTML &&
(nodeInfo->NameAtom() == nsHTMLAtoms::input ||
nodeInfo->NameAtom() == nsHTMLAtoms::button)) {
content->DoneCreatingElement();
}
return result;
}