зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug #45951. r=waterson.
This commit is contained in:
Родитель
34d904f3a6
Коммит
398a91d272
|
@ -4457,15 +4457,27 @@ nsXULTemplateBuilder::FireNewlyMatchedRules(const ClusterKeySet& aNewKeys)
|
||||||
nsCOMPtr<nsIContent> tmpl;
|
nsCOMPtr<nsIContent> tmpl;
|
||||||
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
|
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
|
||||||
|
|
||||||
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
|
PRBool contentsGenerated = PR_TRUE;
|
||||||
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
|
nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(content);
|
||||||
PR_TRUE, bestmatch, nsnull, nsnull);
|
if (xulcontent)
|
||||||
|
xulcontent->GetLazyState(nsIXULContent::eContainerContentsBuilt, contentsGenerated);
|
||||||
|
|
||||||
|
if (contentsGenerated) {
|
||||||
|
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
|
||||||
|
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
|
||||||
|
PR_TRUE, bestmatch, nsnull, nsnull);
|
||||||
|
|
||||||
|
// Remember the best match as the new "last" match
|
||||||
|
matches->SetLastMatch(bestmatch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If we don't build the content, then pretend we
|
||||||
|
// never saw this match.
|
||||||
|
matches->Remove(bestmatch);
|
||||||
|
}
|
||||||
|
|
||||||
// Update the 'empty' attribute
|
// Update the 'empty' attribute
|
||||||
SetContainerAttrs(content, bestmatch);
|
SetContainerAttrs(content, bestmatch);
|
||||||
|
|
||||||
// Remember the best match as the new "last" match
|
|
||||||
matches->SetLastMatch(bestmatch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,26 +146,38 @@ ContainerEnumeratorImpl::HasMoreElements(PRBool* aResult)
|
||||||
|
|
||||||
// Otherwise, we need to grovel
|
// Otherwise, we need to grovel
|
||||||
|
|
||||||
// Figure out the upper bound so we'll know when we're done.
|
// Figure out the upper bound so we'll know when we're done. Since it's
|
||||||
nsCOMPtr<nsIRDFNode> nextValNode;
|
// possible that we're targeting a composite datasource, we'll need to
|
||||||
rv = mDataSource->GetTarget(mContainer, kRDF_nextVal, PR_TRUE, getter_AddRefs(nextValNode));
|
// "GetTargets()" and take the maximum value of "nextVal" to know the
|
||||||
|
// upper bound.
|
||||||
|
PRInt32 count = 0;
|
||||||
|
|
||||||
|
nsCOMPtr<nsISimpleEnumerator> targets;
|
||||||
|
rv = mDataSource->GetTargets(mContainer, kRDF_nextVal, PR_TRUE, getter_AddRefs(targets));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (rv != NS_OK)
|
while (1) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
PRBool hasmore;
|
||||||
|
targets->HasMoreElements(&hasmore);
|
||||||
|
if (! hasmore)
|
||||||
|
break;
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFLiteral> nextVal = do_QueryInterface(nextValNode);
|
nsCOMPtr<nsISupports> isupports;
|
||||||
if (! nextVal)
|
targets->GetNext(getter_AddRefs(isupports));
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
|
|
||||||
nsXPIDLString nextValStr;
|
nsCOMPtr<nsIRDFLiteral> nextValLiteral = do_QueryInterface(isupports);
|
||||||
rv = nextVal->GetValue(getter_Copies(nextValStr));
|
if (! nextValLiteral)
|
||||||
if (NS_FAILED(rv)) return rv;
|
continue;
|
||||||
|
|
||||||
PRInt32 err;
|
nsXPIDLString nextValStr;
|
||||||
PRInt32 count = nsAutoString(nextValStr).ToInteger(&err);
|
nextValLiteral->GetValue(getter_Copies(nextValStr));
|
||||||
if (NS_FAILED(err))
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
PRInt32 err;
|
||||||
|
PRInt32 nextVal = nsAutoString(nextValStr).ToInteger(&err);
|
||||||
|
|
||||||
|
if (nextVal > count)
|
||||||
|
count = nextVal;
|
||||||
|
}
|
||||||
|
|
||||||
// Now iterate through each index.
|
// Now iterate through each index.
|
||||||
while (mNextIndex < count) {
|
while (mNextIndex < count) {
|
||||||
|
|
|
@ -4457,15 +4457,27 @@ nsXULTemplateBuilder::FireNewlyMatchedRules(const ClusterKeySet& aNewKeys)
|
||||||
nsCOMPtr<nsIContent> tmpl;
|
nsCOMPtr<nsIContent> tmpl;
|
||||||
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
|
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
|
||||||
|
|
||||||
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
|
PRBool contentsGenerated = PR_TRUE;
|
||||||
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
|
nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(content);
|
||||||
PR_TRUE, bestmatch, nsnull, nsnull);
|
if (xulcontent)
|
||||||
|
xulcontent->GetLazyState(nsIXULContent::eContainerContentsBuilt, contentsGenerated);
|
||||||
|
|
||||||
|
if (contentsGenerated) {
|
||||||
|
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
|
||||||
|
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
|
||||||
|
PR_TRUE, bestmatch, nsnull, nsnull);
|
||||||
|
|
||||||
|
// Remember the best match as the new "last" match
|
||||||
|
matches->SetLastMatch(bestmatch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If we don't build the content, then pretend we
|
||||||
|
// never saw this match.
|
||||||
|
matches->Remove(bestmatch);
|
||||||
|
}
|
||||||
|
|
||||||
// Update the 'empty' attribute
|
// Update the 'empty' attribute
|
||||||
SetContainerAttrs(content, bestmatch);
|
SetContainerAttrs(content, bestmatch);
|
||||||
|
|
||||||
// Remember the best match as the new "last" match
|
|
||||||
matches->SetLastMatch(bestmatch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче