From 03459a1beeefa46fc935d918c11bc981fbcfe359 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Sat, 17 Jul 1999 02:24:13 +0000 Subject: [PATCH] XUL overlay work. git-svn-id: svn://10.0.0.236/trunk@39831 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/rdf/base/src/nsRDFContainerUtils.cpp | 10 ++++ .../rdf/datasource/src/nsXULContentSink.cpp | 52 ++++++++++++------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/mozilla/rdf/base/src/nsRDFContainerUtils.cpp b/mozilla/rdf/base/src/nsRDFContainerUtils.cpp index 73f30fbb8b5..1a604f40e8f 100644 --- a/mozilla/rdf/base/src/nsRDFContainerUtils.cpp +++ b/mozilla/rdf/base/src/nsRDFContainerUtils.cpp @@ -387,6 +387,16 @@ RDFContainerUtilsImpl::MakeContainer(nsIRDFDataSource* aDataSource, nsIRDFResour return NS_ERROR_NULL_POINTER; nsresult rv; + + // Check to see if somebody has already turned it into a container; if so + // don't try to do it again. + PRBool isContainer; + rv = IsContainer(aDataSource, aResource, &isContainer); + if (NS_FAILED(rv)) return rv; + + if (isContainer) + return NS_OK; + rv = aDataSource->Assert(aResource, kRDF_instanceOf, aType, PR_TRUE); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/rdf/datasource/src/nsXULContentSink.cpp b/mozilla/rdf/datasource/src/nsXULContentSink.cpp index 9c510db5e1c..5fef1ca3540 100644 --- a/mozilla/rdf/datasource/src/nsXULContentSink.cpp +++ b/mozilla/rdf/datasource/src/nsXULContentSink.cpp @@ -688,25 +688,25 @@ XULContentSinkImpl::CloseContainer(const nsIParserNode& aNode) PRInt32 nestLevel = mContextStack->Count(); if (nestLevel == 0) { - mState = eXULContentSinkState_InEpilog; - - // We're about to finish parsing. Now we want to kick off the processing - // of our child overlays. - PRInt32 count; - if (mOverlayArray && (count = mOverlayArray->Count())) { - nsString* href = (nsString*)mOverlayArray->ElementAt(0); - ProcessOverlay(*href); - - // Block the parser. It will only be unblocked after all - // of our child overlays have finished parsing. - rv = NS_ERROR_HTMLPARSER_BLOCK; - } - - // Unblock the next sibling overlay. If there is no next sibling - // overlay, unblock our parent. - if (mParentContentSink) { - mParentContentSink->UnblockNextOverlay(); - } + mState = eXULContentSinkState_InEpilog; + + // We're about to finish parsing. Now we want to kick off the processing + // of our child overlays. + PRInt32 count; + if (mOverlayArray && (count = mOverlayArray->Count())) { + nsString* href = (nsString*)mOverlayArray->ElementAt(0); + ProcessOverlay(*href); + + // Block the parser. It will only be unblocked after all + // of our child overlays have finished parsing. + rv = NS_ERROR_HTMLPARSER_BLOCK; + } + + // Unblock the next sibling overlay. If there is no next sibling + // overlay, unblock our parent. + if (mParentContentSink) { + mParentContentSink->UnblockNextOverlay(); + } } PopNameSpaces(); @@ -1400,7 +1400,19 @@ XULContentSinkImpl::AddAttributes(const nsIParserNode& aNode, rv = gRDFService->GetLiteral(valueStr.GetUnicode(), getter_AddRefs(value)); if (NS_FAILED(rv)) return rv; - rv = mDataSource->Assert(aSubject, property, value, PR_TRUE); + // XUL overlays may cause an old attribute to be over-ridden by + // a new value. So we check the graph to see if somebody has set + // the attribute already, and act appropriately. + nsCOMPtr oldvalue; + rv = mDataSource->GetTarget(aSubject, property, PR_TRUE, getter_AddRefs(oldvalue)); + if (NS_FAILED(rv)) return rv; + + if (oldvalue) { + rv = mDataSource->Change(aSubject, property, oldvalue, value); + } + else { + rv = mDataSource->Assert(aSubject, property, value, PR_TRUE); + } if (NS_FAILED(rv)) return rv; } return NS_OK;