Change nsIDOMXULDocument --> nsIDOMDocument

bug 43424
r=akkana@netscape.com
a=phil@netscape.com ?


git-svn-id: svn://10.0.0.236/trunk@73140 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2000-06-24 01:29:58 +00:00
parent e2331d355d
commit 5a016c0fee
6 changed files with 42 additions and 46 deletions

View File

@@ -35,7 +35,6 @@
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIDOMDocument.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDocument.h"
@@ -185,18 +184,16 @@ GetChromeElement(nsIDocShell *aShell, const char *aID, nsIDOMElement **aElement)
nsresult rv = GetDocument( aShell, getter_AddRefs(doc) );
if(NS_SUCCEEDED(rv) && doc)
{
// Up-cast.
nsCOMPtr<nsIDOMXULDocument> xulDoc( do_QueryInterface(doc) );
if ( xulDoc )
nsCOMPtr<nsIDOMDocument> dDoc( do_QueryInterface(doc) );
if ( dDoc )
{
// Find specified element.
nsCOMPtr<nsIDOMElement> elem;
rv = xulDoc->GetElementById( NS_ConvertASCIItoUCS2(aID), getter_AddRefs(elem) );
if (elem)
{
*aElement = elem.get();
NS_ADDREF(*aElement);
}
nsCOMPtr<nsIDOMElement> elem;
rv = dDoc->GetElementById( NS_ConvertASCIItoUCS2(aID), getter_AddRefs(elem) );
if (elem)
{
*aElement = elem.get();
NS_ADDREF(*aElement);
}
}
}
return rv;
@@ -476,7 +473,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
if (!mStateMaintainer) return NS_ERROR_OUT_OF_MEMORY;
mStateMaintainer->AddRef(); // the owning reference
// get the XULDoc from the webshell
// get the Doc from the webshell
nsCOMPtr<nsIContentViewer> cv;
rv = mDocShell->GetContentViewer(getter_AddRefs(cv));
if (NS_FAILED(rv)) return rv;
@@ -488,11 +485,12 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
rv = docViewer->GetDocument(*getter_AddRefs(chromeDoc));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(chromeDoc, &rv);
nsCOMPtr<nsIDOMDocument> dDoc = do_QueryInterface(chromeDoc, &rv);
if (NS_FAILED(rv)) return rv;
// now init the state maintainer
rv = mStateMaintainer->Init(mEditor, xulDoc);
rv = mStateMaintainer->Init(mEditor, dDoc);
if (NS_FAILED(rv)) return rv;
// set it up as a selection listener
@@ -608,7 +606,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
// Activate the debug menu only in debug builds
// by removing the "hidden" attribute set "true" in XUL
nsCOMPtr<nsIDOMElement> elem;
rv = xulDoc->GetElementById(NS_ConvertASCIItoUCS2("debugMenu"), getter_AddRefs(elem));
rv = dDoc->GetElementById(NS_ConvertASCIItoUCS2("debugMenu"), getter_AddRefs(elem));
if (elem)
elem->RemoveAttribute(NS_ConvertASCIItoUCS2("hidden"));
#endif
@@ -1486,6 +1484,7 @@ nsEditorShell::UnregisterDocumentStateListener(nsIDocumentStateListener *docList
return editor->RemoveDocumentStateListener(docListener);
}
return NS_OK;
}

View File

@@ -30,7 +30,6 @@
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMSelection.h"
@@ -101,7 +100,7 @@ NS_IMPL_RELEASE(nsInterfaceState);
NS_IMPL_QUERY_INTERFACE4(nsInterfaceState, nsIDOMSelectionListener, nsIDocumentStateListener, nsITransactionListener, nsITimerCallback);
NS_IMETHODIMP
nsInterfaceState::Init(nsIHTMLEditor* aEditor, nsIDOMXULDocument *aChromeDoc)
nsInterfaceState::Init(nsIHTMLEditor* aEditor, nsIDOMDocument *aChromeDoc)
{
if (!aEditor)
return NS_ERROR_INVALID_ARG;
@@ -665,7 +664,7 @@ nsInterfaceState::Notify(nsITimer *timer)
#endif
nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMXULDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult)
nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult)
{
nsInterfaceState* newThang = new nsInterfaceState;
if (!newThang)

View File

@@ -33,7 +33,7 @@
#include "nsITimerCallback.h"
class nsIHTMLEditor;
class nsIDOMXULDocument;
class nsIDOMDocument;
// class responsible for communicating changes in local state back to the UI.
// This is currently somewhat tied to a given XUL UI implementation
@@ -50,7 +50,7 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsIHTMLEditor* aEditor, nsIDOMXULDocument *aChromeDoc);
NS_IMETHOD Init(nsIHTMLEditor* aEditor, nsIDOMDocument *aChromeDoc);
// force an update of the UI. At some point, we could pass flags
// here to target certain things for updating.
@@ -113,7 +113,7 @@ protected:
// so would result in cirular reference chains.
nsIHTMLEditor* mEditor; // the HTML editor
nsIDOMXULDocument* mChromeDoc; // XUL document for the chrome area
nsIDOMDocument* mChromeDoc; // XUL document for the chrome area
nsIDOMWindow* mDOMWindow; // nsIDOMWindow used for calling UpdateCommands
@@ -145,6 +145,6 @@ protected:
};
extern "C" nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMXULDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult);
extern "C" nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult);
#endif // nsInterfaceState_h__

View File

@@ -35,7 +35,6 @@
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIDOMDocument.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDocument.h"
@@ -185,18 +184,16 @@ GetChromeElement(nsIDocShell *aShell, const char *aID, nsIDOMElement **aElement)
nsresult rv = GetDocument( aShell, getter_AddRefs(doc) );
if(NS_SUCCEEDED(rv) && doc)
{
// Up-cast.
nsCOMPtr<nsIDOMXULDocument> xulDoc( do_QueryInterface(doc) );
if ( xulDoc )
nsCOMPtr<nsIDOMDocument> dDoc( do_QueryInterface(doc) );
if ( dDoc )
{
// Find specified element.
nsCOMPtr<nsIDOMElement> elem;
rv = xulDoc->GetElementById( NS_ConvertASCIItoUCS2(aID), getter_AddRefs(elem) );
if (elem)
{
*aElement = elem.get();
NS_ADDREF(*aElement);
}
nsCOMPtr<nsIDOMElement> elem;
rv = dDoc->GetElementById( NS_ConvertASCIItoUCS2(aID), getter_AddRefs(elem) );
if (elem)
{
*aElement = elem.get();
NS_ADDREF(*aElement);
}
}
}
return rv;
@@ -476,7 +473,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
if (!mStateMaintainer) return NS_ERROR_OUT_OF_MEMORY;
mStateMaintainer->AddRef(); // the owning reference
// get the XULDoc from the webshell
// get the Doc from the webshell
nsCOMPtr<nsIContentViewer> cv;
rv = mDocShell->GetContentViewer(getter_AddRefs(cv));
if (NS_FAILED(rv)) return rv;
@@ -488,11 +485,12 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
rv = docViewer->GetDocument(*getter_AddRefs(chromeDoc));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(chromeDoc, &rv);
nsCOMPtr<nsIDOMDocument> dDoc = do_QueryInterface(chromeDoc, &rv);
if (NS_FAILED(rv)) return rv;
// now init the state maintainer
rv = mStateMaintainer->Init(mEditor, xulDoc);
rv = mStateMaintainer->Init(mEditor, dDoc);
if (NS_FAILED(rv)) return rv;
// set it up as a selection listener
@@ -608,7 +606,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
// Activate the debug menu only in debug builds
// by removing the "hidden" attribute set "true" in XUL
nsCOMPtr<nsIDOMElement> elem;
rv = xulDoc->GetElementById(NS_ConvertASCIItoUCS2("debugMenu"), getter_AddRefs(elem));
rv = dDoc->GetElementById(NS_ConvertASCIItoUCS2("debugMenu"), getter_AddRefs(elem));
if (elem)
elem->RemoveAttribute(NS_ConvertASCIItoUCS2("hidden"));
#endif
@@ -1486,6 +1484,7 @@ nsEditorShell::UnregisterDocumentStateListener(nsIDocumentStateListener *docList
return editor->RemoveDocumentStateListener(docListener);
}
return NS_OK;
}

View File

@@ -30,7 +30,6 @@
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMSelection.h"
@@ -101,7 +100,7 @@ NS_IMPL_RELEASE(nsInterfaceState);
NS_IMPL_QUERY_INTERFACE4(nsInterfaceState, nsIDOMSelectionListener, nsIDocumentStateListener, nsITransactionListener, nsITimerCallback);
NS_IMETHODIMP
nsInterfaceState::Init(nsIHTMLEditor* aEditor, nsIDOMXULDocument *aChromeDoc)
nsInterfaceState::Init(nsIHTMLEditor* aEditor, nsIDOMDocument *aChromeDoc)
{
if (!aEditor)
return NS_ERROR_INVALID_ARG;
@@ -665,7 +664,7 @@ nsInterfaceState::Notify(nsITimer *timer)
#endif
nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMXULDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult)
nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult)
{
nsInterfaceState* newThang = new nsInterfaceState;
if (!newThang)

View File

@@ -33,7 +33,7 @@
#include "nsITimerCallback.h"
class nsIHTMLEditor;
class nsIDOMXULDocument;
class nsIDOMDocument;
// class responsible for communicating changes in local state back to the UI.
// This is currently somewhat tied to a given XUL UI implementation
@@ -50,7 +50,7 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsIHTMLEditor* aEditor, nsIDOMXULDocument *aChromeDoc);
NS_IMETHOD Init(nsIHTMLEditor* aEditor, nsIDOMDocument *aChromeDoc);
// force an update of the UI. At some point, we could pass flags
// here to target certain things for updating.
@@ -113,7 +113,7 @@ protected:
// so would result in cirular reference chains.
nsIHTMLEditor* mEditor; // the HTML editor
nsIDOMXULDocument* mChromeDoc; // XUL document for the chrome area
nsIDOMDocument* mChromeDoc; // XUL document for the chrome area
nsIDOMWindow* mDOMWindow; // nsIDOMWindow used for calling UpdateCommands
@@ -145,6 +145,6 @@ protected:
};
extern "C" nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMXULDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult);
extern "C" nsresult NS_NewInterfaceState(nsIHTMLEditor* aEditor, nsIDOMDocument* aChromeDoc, nsIDOMSelectionListener** aInstancePtrResult);
#endif // nsInterfaceState_h__