Continuing XUL overlay work.
git-svn-id: svn://10.0.0.236/trunk@39664 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -649,8 +649,8 @@ public:
|
||||
NS_IMETHOD CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aResult);
|
||||
|
||||
// nsIXULChildDocument Interface
|
||||
NS_IMETHOD SetFragmentRoot(nsIRDFResource* aFragmentRoot);
|
||||
NS_IMETHOD GetFragmentRoot(nsIRDFResource** aFragmentRoot);
|
||||
NS_IMETHOD SetContentSink(nsIXULContentSink* aContentSink);
|
||||
NS_IMETHOD GetContentSink(nsIXULContentSink** aContentSink);
|
||||
NS_IMETHOD LayoutPopupDocument();
|
||||
|
||||
// nsIDOMNode interface
|
||||
@@ -782,7 +782,7 @@ protected:
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
||||
nsIContentViewerContainer* mContentViewerContainer; // [WEAK] it owns me! (indirectly)
|
||||
nsString mCommand;
|
||||
nsCOMPtr<nsIRDFResource> mFragmentRoot; // [OWNER]
|
||||
nsIXULContentSink* mParentContentSink; // [WEAK]
|
||||
nsVoidArray mSubDocuments; // [OWNER] of subelements
|
||||
PRBool mIsPopup;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> mHiddenForm; // [OWNER] of this content element
|
||||
@@ -1126,7 +1126,7 @@ XULDocumentImpl::PrepareToLoad( nsCOMPtr<nsIParser>* created_parser,
|
||||
// Create the composite data source and builder, but only do this
|
||||
// if we're not a XUL fragment. XUL fragments get "imported"
|
||||
// directly into the parent document's datasource.
|
||||
if (mFragmentRoot == nsnull) {
|
||||
if (mParentContentSink == nsnull) {
|
||||
// Create a "scratch" in-memory data store to associate with the
|
||||
// document to be a catch-all for any doc-specific info that we
|
||||
// need to store (e.g., current sort order, etc.)
|
||||
@@ -1790,9 +1790,9 @@ XULDocumentImpl::EndLoad()
|
||||
{
|
||||
// Set up the document's composite datasource, which will include
|
||||
// the main document datasource and the local store. Only do this
|
||||
// if we are a bona-fide top-level XUL document; (mFragmentRoot !=
|
||||
// nsnull) implies we are a XUL fragment.
|
||||
if (mFragmentRoot == nsnull) {
|
||||
// if we are a bona-fide top-level XUL document; (mParentContentSink !=
|
||||
// nsnull) implies we are a XUL overlay.
|
||||
if (mParentContentSink == nsnull) {
|
||||
NS_PRECONDITION(mRootResource != nsnull, "no root resource");
|
||||
if (! mRootResource)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@@ -3191,21 +3191,16 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIXULChildDocument interface
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::SetFragmentRoot(nsIRDFResource* aFragmentRoot)
|
||||
XULDocumentImpl::SetContentSink(nsIXULContentSink* aParentContentSink)
|
||||
{
|
||||
if (aFragmentRoot != mFragmentRoot.get()) {
|
||||
mFragmentRoot = dont_QueryInterface(aFragmentRoot);
|
||||
}
|
||||
mParentContentSink = aParentContentSink;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::GetFragmentRoot(nsIRDFResource** aFragmentRoot)
|
||||
XULDocumentImpl::GetContentSink(nsIXULContentSink** aParentContentSink)
|
||||
{
|
||||
if (mFragmentRoot) {
|
||||
*aFragmentRoot = mFragmentRoot;
|
||||
NS_ADDREF(*aFragmentRoot);
|
||||
}
|
||||
*aParentContentSink = mParentContentSink;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -3917,13 +3912,13 @@ XULDocumentImpl::Init(void)
|
||||
nsresult
|
||||
XULDocumentImpl::StartLayout(void)
|
||||
{
|
||||
if (mParentContentSink)
|
||||
return NS_OK; // Overlays rely on the master document for layout
|
||||
|
||||
NS_ASSERTION(mRootContent != nsnull, "Error in XUL file. Love to tell ya where if only I knew.");
|
||||
if (!mRootContent)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (mFragmentRoot)
|
||||
return NS_OK; // Subdocuments rely on the parent document for layout
|
||||
|
||||
PRInt32 count = GetNumberOfShells();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIPresShell* shell = GetShellAt(i);
|
||||
|
||||
@@ -25,15 +25,14 @@
|
||||
#define NS_IXULCHILDDOCUMENT_IID \
|
||||
{ 0x7b75c621, 0xd641, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
|
||||
|
||||
class nsIContentViewerContainer;
|
||||
class nsIRDFResource;
|
||||
class nsIXULContentSink;
|
||||
|
||||
class nsIXULChildDocument: public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULCHILDDOCUMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD SetFragmentRoot(nsIRDFResource* aContent) = 0;
|
||||
NS_IMETHOD GetFragmentRoot(nsIRDFResource** aContent) = 0;
|
||||
NS_IMETHOD SetContentSink(nsIXULContentSink* aContentSink) = 0;
|
||||
NS_IMETHOD GetContentSink(nsIXULContentSink** aContentSink) = 0;
|
||||
|
||||
// Used for popup child documents
|
||||
NS_IMETHOD LayoutPopupDocument() = 0;
|
||||
|
||||
@@ -649,8 +649,8 @@ public:
|
||||
NS_IMETHOD CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aResult);
|
||||
|
||||
// nsIXULChildDocument Interface
|
||||
NS_IMETHOD SetFragmentRoot(nsIRDFResource* aFragmentRoot);
|
||||
NS_IMETHOD GetFragmentRoot(nsIRDFResource** aFragmentRoot);
|
||||
NS_IMETHOD SetContentSink(nsIXULContentSink* aContentSink);
|
||||
NS_IMETHOD GetContentSink(nsIXULContentSink** aContentSink);
|
||||
NS_IMETHOD LayoutPopupDocument();
|
||||
|
||||
// nsIDOMNode interface
|
||||
@@ -782,7 +782,7 @@ protected:
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
||||
nsIContentViewerContainer* mContentViewerContainer; // [WEAK] it owns me! (indirectly)
|
||||
nsString mCommand;
|
||||
nsCOMPtr<nsIRDFResource> mFragmentRoot; // [OWNER]
|
||||
nsIXULContentSink* mParentContentSink; // [WEAK]
|
||||
nsVoidArray mSubDocuments; // [OWNER] of subelements
|
||||
PRBool mIsPopup;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> mHiddenForm; // [OWNER] of this content element
|
||||
@@ -1126,7 +1126,7 @@ XULDocumentImpl::PrepareToLoad( nsCOMPtr<nsIParser>* created_parser,
|
||||
// Create the composite data source and builder, but only do this
|
||||
// if we're not a XUL fragment. XUL fragments get "imported"
|
||||
// directly into the parent document's datasource.
|
||||
if (mFragmentRoot == nsnull) {
|
||||
if (mParentContentSink == nsnull) {
|
||||
// Create a "scratch" in-memory data store to associate with the
|
||||
// document to be a catch-all for any doc-specific info that we
|
||||
// need to store (e.g., current sort order, etc.)
|
||||
@@ -1790,9 +1790,9 @@ XULDocumentImpl::EndLoad()
|
||||
{
|
||||
// Set up the document's composite datasource, which will include
|
||||
// the main document datasource and the local store. Only do this
|
||||
// if we are a bona-fide top-level XUL document; (mFragmentRoot !=
|
||||
// nsnull) implies we are a XUL fragment.
|
||||
if (mFragmentRoot == nsnull) {
|
||||
// if we are a bona-fide top-level XUL document; (mParentContentSink !=
|
||||
// nsnull) implies we are a XUL overlay.
|
||||
if (mParentContentSink == nsnull) {
|
||||
NS_PRECONDITION(mRootResource != nsnull, "no root resource");
|
||||
if (! mRootResource)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@@ -3191,21 +3191,16 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIXULChildDocument interface
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::SetFragmentRoot(nsIRDFResource* aFragmentRoot)
|
||||
XULDocumentImpl::SetContentSink(nsIXULContentSink* aParentContentSink)
|
||||
{
|
||||
if (aFragmentRoot != mFragmentRoot.get()) {
|
||||
mFragmentRoot = dont_QueryInterface(aFragmentRoot);
|
||||
}
|
||||
mParentContentSink = aParentContentSink;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::GetFragmentRoot(nsIRDFResource** aFragmentRoot)
|
||||
XULDocumentImpl::GetContentSink(nsIXULContentSink** aParentContentSink)
|
||||
{
|
||||
if (mFragmentRoot) {
|
||||
*aFragmentRoot = mFragmentRoot;
|
||||
NS_ADDREF(*aFragmentRoot);
|
||||
}
|
||||
*aParentContentSink = mParentContentSink;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -3917,13 +3912,13 @@ XULDocumentImpl::Init(void)
|
||||
nsresult
|
||||
XULDocumentImpl::StartLayout(void)
|
||||
{
|
||||
if (mParentContentSink)
|
||||
return NS_OK; // Overlays rely on the master document for layout
|
||||
|
||||
NS_ASSERTION(mRootContent != nsnull, "Error in XUL file. Love to tell ya where if only I knew.");
|
||||
if (!mRootContent)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (mFragmentRoot)
|
||||
return NS_OK; // Subdocuments rely on the parent document for layout
|
||||
|
||||
PRInt32 count = GetNumberOfShells();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIPresShell* shell = GetShellAt(i);
|
||||
|
||||
@@ -262,9 +262,8 @@ protected:
|
||||
nsIDocument* mDocument;
|
||||
nsIParser* mParser;
|
||||
|
||||
nsIRDFResource* mFragmentRoot;
|
||||
|
||||
nsVoidArray* mOverlayArray;
|
||||
nsVoidArray* mOverlayArray;
|
||||
nsIXULContentSink* mParentContentSink;
|
||||
|
||||
nsString mPreferredStyle;
|
||||
PRInt32 mStyleSheetCount;
|
||||
@@ -296,8 +295,8 @@ XULContentSinkImpl::XULContentSinkImpl()
|
||||
mHaveSetRootResource(PR_FALSE),
|
||||
mDocument(nsnull),
|
||||
mParser(nsnull),
|
||||
mFragmentRoot(nsnull),
|
||||
mOverlayArray(nsnull),
|
||||
mOverlayArray(nsnull),
|
||||
mParentContentSink(nsnull),
|
||||
mStyleSheetCount(0),
|
||||
mCSSLoader(nsnull)
|
||||
{
|
||||
@@ -427,7 +426,6 @@ XULContentSinkImpl::~XULContentSinkImpl()
|
||||
NS_IF_RELEASE(mDataSource);
|
||||
NS_IF_RELEASE(mDocument);
|
||||
NS_IF_RELEASE(mParser);
|
||||
NS_IF_RELEASE(mFragmentRoot);
|
||||
NS_IF_RELEASE(mCSSLoader);
|
||||
|
||||
PR_FREEIF(mText);
|
||||
@@ -701,7 +699,7 @@ XULContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
|
||||
// Block the parser. It will only be unblocked after all
|
||||
// of our child overlays have finished parsing.
|
||||
rv = NS_ERROR_HTMLPARSER_BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PopNameSpaces();
|
||||
@@ -1079,9 +1077,9 @@ XULContentSinkImpl::Init(nsIDocument* aDocument, nsIRDFDataSource* aDataSource)
|
||||
|
||||
nsCOMPtr<nsIXULChildDocument> childDocument;
|
||||
childDocument = do_QueryInterface(aDocument);
|
||||
childDocument->GetFragmentRoot(&mFragmentRoot);
|
||||
if (mFragmentRoot) {
|
||||
// We're totally a subdocument. Find the root document's
|
||||
childDocument->GetContentSink(&mParentContentSink);
|
||||
if (mParentContentSink) {
|
||||
// We're an overlay. Find the parent document's
|
||||
// data source and make assertions there.
|
||||
|
||||
// First of all, find the root document.
|
||||
@@ -1141,7 +1139,7 @@ XULContentSinkImpl::Init(nsIDocument* aDocument, nsIRDFDataSource* aDataSource)
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (mFragmentRoot == nsnull) {
|
||||
if (mParentContentSink == nsnull) {
|
||||
// XUL Namespace isn't registered if we're a root document.
|
||||
// We need to register it.
|
||||
rv = mNameSpaceManager->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL);
|
||||
@@ -1474,14 +1472,14 @@ XULContentSinkImpl::OpenTag(const nsIParserNode& aNode)
|
||||
// container).
|
||||
mHaveSetRootResource = PR_TRUE;
|
||||
|
||||
if (mFragmentRoot) {
|
||||
/*if (mFragmentRoot) {
|
||||
// We're a subdocument. We need to take this fragment
|
||||
// node (which is the root of the fragment) and completely
|
||||
// discard it. The fragment root's resource is actually what
|
||||
// should become the root of this subtree.
|
||||
rdfResource = dont_QueryInterface(mFragmentRoot);
|
||||
}
|
||||
else {
|
||||
else*/ {
|
||||
nsCOMPtr<nsIRDFDocument> rdfDoc;
|
||||
if (NS_SUCCEEDED(mDocument->QueryInterface(nsIRDFDocument::GetIID(),
|
||||
(void**) getter_AddRefs(rdfDoc)))) {
|
||||
|
||||
Reference in New Issue
Block a user