From 889117a431550c42c8fd1a1177f405b69bd49064 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Fri, 2 Sep 2005 21:30:20 +0000 Subject: [PATCH] Bug #285076 --> XUL Template Builder isn't working with Dynamic overlays nsXULContentBuilder::CreateContents should fire content appended notifications. sr=bz git-svn-id: svn://10.0.0.236/trunk@179577 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xul/templates/src/nsXULContentBuilder.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp b/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp index 88ffc01e044..89697d62c00 100644 --- a/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentBuilder.cpp @@ -1108,6 +1108,8 @@ nsXULContentBuilder::CreateTemplateAndContainerContents(nsIContent* aElement, nsIContent** aContainer, PRInt32* aNewIndexInContainer) { + NS_PRECONDITION(!aContainer == !aNewIndexInContainer, + "Must ask for either both or neither"); // Generate both 1) the template content for the current element, // and 2) recursive subcontent (if the current element refers to a // container resource in the RDF graph). @@ -1534,7 +1536,22 @@ nsXULContentBuilder::CreateContents(nsIContent* aElement) NS_ASSERTION(IsElementInBuilder(aElement, this), "element not managed by this template builder"); - return CreateTemplateAndContainerContents(aElement, nsnull /* don't care */, nsnull /* don't care */); + // Now, regenerate both the template- and container-generated + // contents for the current element... + nsCOMPtr container; + PRInt32 newIndex; + nsresult rv = CreateTemplateAndContainerContents(aElement, getter_AddRefs(container), &newIndex); + + if (container) { + nsIDocument * doc = mRoot->GetCurrentDoc(); + NS_ASSERTION(doc, "element has no document"); + if (! doc) + return NS_ERROR_UNEXPECTED; + + doc->ContentAppended(container, newIndex); + } + + return rv; } //----------------------------------------------------------------------