зеркало из https://github.com/mozilla/pjs.git
When building a subtree from a template, nodes are now unique until we find one with the "uri='...'" attribute set.
This commit is contained in:
Родитель
39dc776760
Коммит
ab02b90827
|
@ -912,7 +912,7 @@ RDFGenericBuilderImpl::FindTemplateForResource(nsIRDFResource *aNode, nsIContent
|
|||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIContent *aTemplate,
|
||||
nsIContent *treeChildren, nsIContent* aElement, nsIRDFResource* aProperty,
|
||||
nsIContent *treeChildren, nsIContent* aElement, PRBool isUnique, nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos)
|
||||
{
|
||||
PRInt32 count;
|
||||
|
@ -939,6 +939,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (idValue.EqualsIgnoreCase("..."))
|
||||
{
|
||||
isContainmentElement = PR_TRUE;
|
||||
isUnique=PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +948,13 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (NS_SUCCEEDED(rv = aTemplateKid->GetTag(*getter_AddRefs(tag))))
|
||||
{
|
||||
nsCOMPtr<nsIContent> treeGrandchild;
|
||||
if (isContainmentElement == PR_TRUE)
|
||||
if (isUnique == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = EnsureElementHasGenericChild(treeChildren,
|
||||
nameSpaceID, tag, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
}
|
||||
else if (isContainmentElement == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
|
@ -1154,7 +1161,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (numTemplateKids > 0)
|
||||
{
|
||||
rv = PopulateWidgetItemSubtree(aTemplateRoot, aTemplateKid, treeGrandchild,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
aElement, isUnique, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,8 +1251,8 @@ RDFGenericBuilderImpl::CreateWidgetItem(nsIContent *aElement, nsIRDFResource *aP
|
|||
}
|
||||
}
|
||||
}
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children, aElement,
|
||||
PR_TRUE, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -912,7 +912,7 @@ RDFGenericBuilderImpl::FindTemplateForResource(nsIRDFResource *aNode, nsIContent
|
|||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIContent *aTemplate,
|
||||
nsIContent *treeChildren, nsIContent* aElement, nsIRDFResource* aProperty,
|
||||
nsIContent *treeChildren, nsIContent* aElement, PRBool isUnique, nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos)
|
||||
{
|
||||
PRInt32 count;
|
||||
|
@ -939,6 +939,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (idValue.EqualsIgnoreCase("..."))
|
||||
{
|
||||
isContainmentElement = PR_TRUE;
|
||||
isUnique=PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +948,13 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (NS_SUCCEEDED(rv = aTemplateKid->GetTag(*getter_AddRefs(tag))))
|
||||
{
|
||||
nsCOMPtr<nsIContent> treeGrandchild;
|
||||
if (isContainmentElement == PR_TRUE)
|
||||
if (isUnique == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = EnsureElementHasGenericChild(treeChildren,
|
||||
nameSpaceID, tag, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
}
|
||||
else if (isContainmentElement == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
|
@ -1154,7 +1161,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (numTemplateKids > 0)
|
||||
{
|
||||
rv = PopulateWidgetItemSubtree(aTemplateRoot, aTemplateKid, treeGrandchild,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
aElement, isUnique, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,8 +1251,8 @@ RDFGenericBuilderImpl::CreateWidgetItem(nsIContent *aElement, nsIRDFResource *aP
|
|||
}
|
||||
}
|
||||
}
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children, aElement,
|
||||
PR_TRUE, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -70,8 +70,8 @@ public:
|
|||
NS_IMETHOD FindTemplateForResource(nsIRDFResource *aNode, nsIContent **theTemplate);
|
||||
NS_IMETHOD IsTemplateRuleMatch(nsIRDFResource *aNode, nsIContent *aRule, PRBool *matchingRuleFound);
|
||||
NS_IMETHOD PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIContent *aTemplate,
|
||||
nsIContent *treeCell, nsIContent* aElement, nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos);
|
||||
nsIContent *treeCell, nsIContent* aElement, PRBool isUnique,
|
||||
nsIRDFResource* aProperty, nsIRDFResource* aValue, PRInt32 aNaturalOrderPos);
|
||||
NS_IMETHOD CreateWidgetItem(nsIContent* aElement, nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos);
|
||||
|
||||
|
|
|
@ -912,7 +912,7 @@ RDFGenericBuilderImpl::FindTemplateForResource(nsIRDFResource *aNode, nsIContent
|
|||
|
||||
NS_IMETHODIMP
|
||||
RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIContent *aTemplate,
|
||||
nsIContent *treeChildren, nsIContent* aElement, nsIRDFResource* aProperty,
|
||||
nsIContent *treeChildren, nsIContent* aElement, PRBool isUnique, nsIRDFResource* aProperty,
|
||||
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos)
|
||||
{
|
||||
PRInt32 count;
|
||||
|
@ -939,6 +939,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (idValue.EqualsIgnoreCase("..."))
|
||||
{
|
||||
isContainmentElement = PR_TRUE;
|
||||
isUnique=PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +948,13 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (NS_SUCCEEDED(rv = aTemplateKid->GetTag(*getter_AddRefs(tag))))
|
||||
{
|
||||
nsCOMPtr<nsIContent> treeGrandchild;
|
||||
if (isContainmentElement == PR_TRUE)
|
||||
if (isUnique == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = EnsureElementHasGenericChild(treeChildren,
|
||||
nameSpaceID, tag, getter_AddRefs(treeGrandchild))))
|
||||
continue;
|
||||
}
|
||||
else if (isContainmentElement == PR_TRUE)
|
||||
{
|
||||
if (NS_FAILED(rv = CreateElement(nameSpaceID,
|
||||
tag, aValue, getter_AddRefs(treeGrandchild))))
|
||||
|
@ -1154,7 +1161,7 @@ RDFGenericBuilderImpl::PopulateWidgetItemSubtree(nsIContent *aTemplateRoot, nsIC
|
|||
if (numTemplateKids > 0)
|
||||
{
|
||||
rv = PopulateWidgetItemSubtree(aTemplateRoot, aTemplateKid, treeGrandchild,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
aElement, isUnique, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,8 +1251,8 @@ RDFGenericBuilderImpl::CreateWidgetItem(nsIContent *aElement, nsIRDFResource *aP
|
|||
}
|
||||
}
|
||||
}
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children,
|
||||
aElement, aProperty, aValue, aNaturalOrderPos);
|
||||
rv = PopulateWidgetItemSubtree(aTemplate, aTemplate, children, aElement,
|
||||
PR_TRUE, aProperty, aValue, aNaturalOrderPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче