} while (tag.get() != nsXULAtoms::Template &&
} while (tag.get() != nsXULAtoms::templateAtom &&
nsXULTemplateBuilder::IsDirectlyContainedBy(nsIContent* aChild, nsIContent* aParent){    // This routine uses the <template> to determine if aChild is    // "directly contained by" aParent. It does so by walking up the    // template subtree in parallel with the generated subtree.    NS_PRECONDITION(aChild != nsnull, "null ptr");    if (! aChild)        return PR_FALSE;    // First, we need to find the template from which this element was    // generated.    nsCOMPtr<nsIContent> tmpl;    mTemplateMap.GetTemplateFor(aChild, getter_AddRefs(tmpl));    if (! tmpl)        return PR_FALSE;    // Now walk up the template subtree in parallel with the generated    // subtree.    nsCOMPtr<nsIAtom> tag;    nsCOMPtr<nsIContent> generated(aChild);    do {        // Walk up the generated tree        nsCOMPtr<nsIContent> generatedParent;        generated->GetParent(*getter_AddRefs(generatedParent));        if (! generatedParent)            return PR_FALSE;        generated = generatedParent;        // Walk up the template tree        nsCOMPtr<nsIContent> tmplParent;        tmpl->GetParent(*getter_AddRefs(tmplParent));        if (! tmplParent)            return PR_FALSE;        tmpl = tmplParent;        // The content within a template ends when we hit the        // <template> or <rule> element in the simple syntax, or the        // <action> element in the extended syntax.        tmpl->GetTag(*getter_AddRefs(tag));    } while (tag.get() != nsXULAtoms::Template &&             tag.get() != nsXULAtoms::rule &&             tag.get() != nsXULAtoms::action);    // Did we find the generated parent?    return PRBool(generated.get() == aParent);}