Fix bug #8465 by starting at the parent of the node which is about to be inserted when looking for the "ignore" attribute. Also, save the "id" of the template node used to create node... in preparation for getting onAssert() and onUnassert() working fully with templates.
git-svn-id: svn://10.0.0.236/trunk@35970 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -653,7 +653,7 @@ RDFGenericBuilderImpl::CreateElement(PRInt32 aNameSpaceID,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResource *res)
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res)
|
||||
{
|
||||
// get all arcs out, and if not a containment property, set attribute
|
||||
nsresult rv = NS_OK;
|
||||
@@ -680,7 +680,8 @@ RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResour
|
||||
}
|
||||
|
||||
// Ignore any properties set in ignore attribute
|
||||
if (IsIgnoredProperty(aNode, property))
|
||||
// Note: since node isn't in the content model yet, start with its parent
|
||||
if (IsIgnoredProperty(aParentNode, property))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -951,8 +952,14 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeGrandchild, aValue)))
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeChildren,
|
||||
treeGrandchild, aValue)))
|
||||
continue;
|
||||
|
||||
// save a reference (its ID) to the template node that was used
|
||||
nsAutoString templateID("");
|
||||
aTemplateKid->GetAttribute(kNameSpaceID_None, kIdAtom, templateID);
|
||||
treeGrandchild->SetAttribute(kNameSpaceID_None, kTreeTemplateAtom, templateID, PR_FALSE);
|
||||
}
|
||||
else if ((tag.get() == kTextAtom) && (nameSpaceID == kNameSpaceID_XUL))
|
||||
{
|
||||
|
||||
@@ -653,7 +653,7 @@ RDFGenericBuilderImpl::CreateElement(PRInt32 aNameSpaceID,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResource *res)
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res)
|
||||
{
|
||||
// get all arcs out, and if not a containment property, set attribute
|
||||
nsresult rv = NS_OK;
|
||||
@@ -680,7 +680,8 @@ RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResour
|
||||
}
|
||||
|
||||
// Ignore any properties set in ignore attribute
|
||||
if (IsIgnoredProperty(aNode, property))
|
||||
// Note: since node isn't in the content model yet, start with its parent
|
||||
if (IsIgnoredProperty(aParentNode, property))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -951,8 +952,14 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeGrandchild, aValue)))
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeChildren,
|
||||
treeGrandchild, aValue)))
|
||||
continue;
|
||||
|
||||
// save a reference (its ID) to the template node that was used
|
||||
nsAutoString templateID("");
|
||||
aTemplateKid->GetAttribute(kNameSpaceID_None, kIdAtom, templateID);
|
||||
treeGrandchild->SetAttribute(kNameSpaceID_None, kTreeTemplateAtom, templateID, PR_FALSE);
|
||||
}
|
||||
else if ((tag.get() == kTextAtom) && (nameSpaceID == kNameSpaceID_XUL))
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult);
|
||||
|
||||
NS_IMETHOD SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResource *res);
|
||||
NS_IMETHOD SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res);
|
||||
NS_IMETHOD FindTemplateForResource(nsIRDFResource *aNode, nsIContent **theTemplate);
|
||||
NS_IMETHOD IsTemplateRuleMatch(nsIRDFResource *aNode, nsIContent *aRule, PRBool *matchingRuleFound);
|
||||
NS_IMETHOD PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIContent *aTemplate,
|
||||
|
||||
@@ -653,7 +653,7 @@ RDFGenericBuilderImpl::CreateElement(PRInt32 aNameSpaceID,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResource *res)
|
||||
RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res)
|
||||
{
|
||||
// get all arcs out, and if not a containment property, set attribute
|
||||
nsresult rv = NS_OK;
|
||||
@@ -680,7 +680,8 @@ RDFGenericBuilderImpl::SetAllAttributesOnElement(nsIContent *aNode, nsIRDFResour
|
||||
}
|
||||
|
||||
// Ignore any properties set in ignore attribute
|
||||
if (IsIgnoredProperty(aNode, property))
|
||||
// Note: since node isn't in the content model yet, start with its parent
|
||||
if (IsIgnoredProperty(aParentNode, property))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -951,8 +952,14 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeGrandchild, aValue)))
|
||||
if (NS_FAILED(rv = SetAllAttributesOnElement(treeChildren,
|
||||
treeGrandchild, aValue)))
|
||||
continue;
|
||||
|
||||
// save a reference (its ID) to the template node that was used
|
||||
nsAutoString templateID("");
|
||||
aTemplateKid->GetAttribute(kNameSpaceID_None, kIdAtom, templateID);
|
||||
treeGrandchild->SetAttribute(kNameSpaceID_None, kTreeTemplateAtom, templateID, PR_FALSE);
|
||||
}
|
||||
else if ((tag.get() == kTextAtom) && (nameSpaceID == kNameSpaceID_XUL))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user