This commit is contained in:
hyatt%netscape.com 2000-07-24 22:42:34 +00:00
Родитель 34d904f3a6
Коммит 398a91d272
3 изменённых файлов: 63 добавлений и 27 удалений

Просмотреть файл

@ -4457,15 +4457,27 @@ nsXULTemplateBuilder::FireNewlyMatchedRules(const ClusterKeySet& aNewKeys)
nsCOMPtr<nsIContent> tmpl;
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
PR_TRUE, bestmatch, nsnull, nsnull);
PRBool contentsGenerated = PR_TRUE;
nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(content);
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
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
// Figure out the upper bound so we'll know when we're done.
nsCOMPtr<nsIRDFNode> nextValNode;
rv = mDataSource->GetTarget(mContainer, kRDF_nextVal, PR_TRUE, getter_AddRefs(nextValNode));
// Figure out the upper bound so we'll know when we're done. Since it's
// possible that we're targeting a composite datasource, we'll need to
// "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 (rv != NS_OK)
return NS_ERROR_UNEXPECTED;
while (1) {
PRBool hasmore;
targets->HasMoreElements(&hasmore);
if (! hasmore)
break;
nsCOMPtr<nsIRDFLiteral> nextVal = do_QueryInterface(nextValNode);
if (! nextVal)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsISupports> isupports;
targets->GetNext(getter_AddRefs(isupports));
nsXPIDLString nextValStr;
rv = nextVal->GetValue(getter_Copies(nextValStr));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFLiteral> nextValLiteral = do_QueryInterface(isupports);
if (! nextValLiteral)
continue;
PRInt32 err;
PRInt32 count = nsAutoString(nextValStr).ToInteger(&err);
if (NS_FAILED(err))
return NS_ERROR_UNEXPECTED;
nsXPIDLString nextValStr;
nextValLiteral->GetValue(getter_Copies(nextValStr));
PRInt32 err;
PRInt32 nextVal = nsAutoString(nextValStr).ToInteger(&err);
if (nextVal > count)
count = nextVal;
}
// Now iterate through each index.
while (mNextIndex < count) {

Просмотреть файл

@ -4457,15 +4457,27 @@ nsXULTemplateBuilder::FireNewlyMatchedRules(const ClusterKeySet& aNewKeys)
nsCOMPtr<nsIContent> tmpl;
bestmatch->mRule->GetContent(getter_AddRefs(tmpl));
BuildContentFromTemplate(tmpl, content, content, PR_TRUE,
VALUE_TO_IRDFRESOURCE(key->mMemberValue),
PR_TRUE, bestmatch, nsnull, nsnull);
PRBool contentsGenerated = PR_TRUE;
nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(content);
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
SetContainerAttrs(content, bestmatch);
// Remember the best match as the new "last" match
matches->SetLastMatch(bestmatch);
}
}