From 095615e6619673606e76903fa9e100d9f7b5e1d7 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 7 Jul 2000 23:01:14 +0000 Subject: [PATCH] Bug 37621. Add necessary logic to retract and fire rules in nsXULTemplateBuilder::OnChange(). I lost these when I re-wrote this method :-(. r=rjc --- .../xul/templates/src/nsXULTemplateBuilder.cpp | 18 ++++++++++++++++++ rdf/content/src/nsXULTemplateBuilder.cpp | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index 511a39058030..2aa897e85cb5 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -4620,7 +4620,25 @@ nsXULTemplateBuilder::OnChange(nsIRDFResource* aSource, nsresult rv; + LOG("onchange", aSource, aProperty, aNewTarget); + if (aOldTarget) { + // Pull any old rules that were relying on aOldTarget + rv = Retract(aSource, aProperty, aOldTarget); + if (NS_FAILED(rv)) return rv; + } + + if (aNewTarget) { + // Fire any new rules that are activated by aNewTarget + ClusterKeySet newkeys; + rv = Propogate(aSource, aProperty, aNewTarget, newkeys); + if (NS_FAILED(rv)) return rv; + + rv = FireNewlyMatchedRules(newkeys); + if (NS_FAILED(rv)) return rv; + } + + // Synchronize any of the content model that may have changed. rv = SynchronizeAll(aSource, aProperty, aOldTarget, aNewTarget); if (NS_FAILED(rv)) return rv; diff --git a/rdf/content/src/nsXULTemplateBuilder.cpp b/rdf/content/src/nsXULTemplateBuilder.cpp index 511a39058030..2aa897e85cb5 100644 --- a/rdf/content/src/nsXULTemplateBuilder.cpp +++ b/rdf/content/src/nsXULTemplateBuilder.cpp @@ -4620,7 +4620,25 @@ nsXULTemplateBuilder::OnChange(nsIRDFResource* aSource, nsresult rv; + LOG("onchange", aSource, aProperty, aNewTarget); + if (aOldTarget) { + // Pull any old rules that were relying on aOldTarget + rv = Retract(aSource, aProperty, aOldTarget); + if (NS_FAILED(rv)) return rv; + } + + if (aNewTarget) { + // Fire any new rules that are activated by aNewTarget + ClusterKeySet newkeys; + rv = Propogate(aSource, aProperty, aNewTarget, newkeys); + if (NS_FAILED(rv)) return rv; + + rv = FireNewlyMatchedRules(newkeys); + if (NS_FAILED(rv)) return rv; + } + + // Synchronize any of the content model that may have changed. rv = SynchronizeAll(aSource, aProperty, aOldTarget, aNewTarget); if (NS_FAILED(rv)) return rv;