зеркало из https://github.com/mozilla/gecko-dev.git
Removed huge chunks of dead webshell and cleaned up a few references to it elsewhere in the code. b=113970 r=valeski@netscape.com sr=rpotts@netscape.com
This commit is contained in:
Родитель
ab43b4f842
Коммит
87bfcf8f7f
|
@ -176,7 +176,6 @@ nsDocShellFocusController nsDocShellFocusController::mDocShellFocusControllerSin
|
|||
|
||||
nsDocShell::nsDocShell():
|
||||
mContentListener(nsnull),
|
||||
mInitInfo(nsnull),
|
||||
mMarginWidth(0),
|
||||
mMarginHeight(0),
|
||||
mItemType(typeContent),
|
||||
|
@ -258,6 +257,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIRefreshURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentViewerContainer)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
///*****************************************************************************
|
||||
|
@ -1116,6 +1116,53 @@ nsDocShell::SetParentURIContentListener(nsIURIContentListener * aParent)
|
|||
return mContentListener->SetParentContentListener(aParent);
|
||||
}
|
||||
|
||||
/* [noscript] void setCurrentURI (in nsIURI uri); */
|
||||
NS_IMETHODIMP nsDocShell::SetCurrentURI(nsIURI *aURI)
|
||||
{
|
||||
mCurrentURI = aURI; //This assignment addrefs
|
||||
PRBool isRoot = PR_FALSE; // Is this the root docshell
|
||||
PRBool isSubFrame=PR_FALSE; // Is this a subframe navigation?
|
||||
|
||||
if (!mLoadCookie)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentLoader> loader(do_GetInterface(mLoadCookie));
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(mLoadCookie));
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
|
||||
GetSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
if (root.get() == NS_STATIC_CAST(nsIDocShellTreeItem *, this))
|
||||
{
|
||||
// This is the root docshell
|
||||
isRoot = PR_TRUE;
|
||||
}
|
||||
if (mLSHE) {
|
||||
nsCOMPtr<nsIHistoryEntry> historyEntry(do_QueryInterface(mLSHE));
|
||||
|
||||
// Check if this is a subframe navigation
|
||||
if (historyEntry) {
|
||||
historyEntry->GetIsSubFrame(&isSubFrame);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSubFrame && !isRoot) {
|
||||
/*
|
||||
* We don't want to send OnLocationChange notifications when
|
||||
* a subframe is being loaded for the first time, while
|
||||
* visiting a frameset page
|
||||
*/
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_ASSERTION(loader, "No document loader");
|
||||
if (loader) {
|
||||
loader->FireOnLocationChange(webProgress, nsnull, aURI);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetCharset(PRUnichar** aCharset)
|
||||
{
|
||||
|
@ -2509,11 +2556,6 @@ nsDocShell::Destroy()
|
|||
|
||||
SetLoadCookie(nsnull);
|
||||
|
||||
if (mInitInfo) {
|
||||
delete mInitInfo;
|
||||
mInitInfo = nsnull;
|
||||
}
|
||||
|
||||
if (mContentListener) {
|
||||
mContentListener->DocShell(nsnull);
|
||||
mContentListener->SetParentContentListener(nsnull);
|
||||
|
@ -2526,14 +2568,11 @@ nsDocShell::Destroy()
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::SetPosition(PRInt32 x, PRInt32 y)
|
||||
{
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
|
||||
if (mContentViewer)
|
||||
NS_ENSURE_SUCCESS(mContentViewer->Move(x, y), NS_ERROR_FAILURE);
|
||||
else if (InitInfo()) {
|
||||
mInitInfo->x = x;
|
||||
mInitInfo->y = y;
|
||||
}
|
||||
else
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2564,20 +2603,15 @@ NS_IMETHODIMP
|
|||
nsDocShell::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
||||
PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
mBounds.width = cx;
|
||||
mBounds.height = cy;
|
||||
|
||||
if (mContentViewer) {
|
||||
//XXX Border figured in here or is that handled elsewhere?
|
||||
nsRect bounds(x, y, cx, cy);
|
||||
|
||||
NS_ENSURE_SUCCESS(mContentViewer->SetBounds(bounds), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(mContentViewer->SetBounds(mBounds), NS_ERROR_FAILURE);
|
||||
}
|
||||
else if (InitInfo()) {
|
||||
mInitInfo->x = x;
|
||||
mInitInfo->y = y;
|
||||
mInitInfo->cx = cx;
|
||||
mInitInfo->cy = cy;
|
||||
}
|
||||
else
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2586,32 +2620,14 @@ NS_IMETHODIMP
|
|||
nsDocShell::GetPositionAndSize(PRInt32 * x, PRInt32 * y, PRInt32 * cx,
|
||||
PRInt32 * cy)
|
||||
{
|
||||
if (mContentViewer) {
|
||||
nsRect bounds;
|
||||
|
||||
NS_ENSURE_SUCCESS(mContentViewer->GetBounds(bounds), NS_ERROR_FAILURE);
|
||||
|
||||
if (x)
|
||||
*x = bounds.x;
|
||||
if (y)
|
||||
*y = bounds.y;
|
||||
if (cx)
|
||||
*cx = bounds.width;
|
||||
if (cy)
|
||||
*cy = bounds.height;
|
||||
}
|
||||
else if (InitInfo()) {
|
||||
if (x)
|
||||
*x = mInitInfo->x;
|
||||
if (y)
|
||||
*y = mInitInfo->y;
|
||||
if (cx)
|
||||
*cx = mInitInfo->cx;
|
||||
if (cy)
|
||||
*cy = mInitInfo->cy;
|
||||
}
|
||||
else
|
||||
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_FAILURE);
|
||||
if (x)
|
||||
*x = mBounds.x;
|
||||
if (y)
|
||||
*y = mBounds.y;
|
||||
if (cx)
|
||||
*cx = mBounds.width;
|
||||
if (cy)
|
||||
*cy = mBounds.height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5061,51 +5077,6 @@ nsDocShell::OnLoadingSite(nsIChannel * aChannel)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShell::SetCurrentURI(nsIURI * aURI)
|
||||
{
|
||||
mCurrentURI = aURI; //This assignment addrefs
|
||||
PRBool isRoot = PR_FALSE; // Is this the root docshell
|
||||
PRBool isSubFrame=PR_FALSE; // Is this a subframe navigation?
|
||||
|
||||
if (!mLoadCookie)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocumentLoader> loader(do_GetInterface(mLoadCookie));
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(mLoadCookie));
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
|
||||
GetSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
if (root.get() == NS_STATIC_CAST(nsIDocShellTreeItem *, this))
|
||||
{
|
||||
// This is the root docshell
|
||||
isRoot = PR_TRUE;
|
||||
}
|
||||
if (mLSHE) {
|
||||
nsCOMPtr<nsIHistoryEntry> historyEntry(do_QueryInterface(mLSHE));
|
||||
|
||||
// Check if this is a subframe navigation
|
||||
if (historyEntry) {
|
||||
historyEntry->GetIsSubFrame(&isSubFrame);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSubFrame && !isRoot) {
|
||||
/*
|
||||
* We don't want to send OnLocationChange notifications when
|
||||
* a subframe is being loaded for the first time, while
|
||||
* visiting a frameset page
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NS_ASSERTION(loader, "No document loader");
|
||||
if (loader) {
|
||||
loader->FireOnLocationChange(webProgress, nsnull, aURI);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShell::SetReferrerURI(nsIURI * aURI)
|
||||
{
|
||||
|
@ -5626,14 +5597,6 @@ nsDocShell::GetLoadType(PRUint32 * aLoadType)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDocShellInitInfo *
|
||||
nsDocShell::InitInfo()
|
||||
{
|
||||
if (mInitInfo)
|
||||
return mInitInfo;
|
||||
return mInitInfo = new nsDocShellInitInfo();
|
||||
}
|
||||
|
||||
#define DIALOG_STRING_URI "chrome://global/locale/appstrings.properties"
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -131,20 +131,6 @@ protected:
|
|||
virtual ~nsRefreshTimer();
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShellInitInfo
|
||||
//*****************************************************************************
|
||||
|
||||
class nsDocShellInitInfo
|
||||
{
|
||||
public:
|
||||
//nsIGenericWindow Stuff
|
||||
PRInt32 x;
|
||||
PRInt32 y;
|
||||
PRInt32 cx;
|
||||
PRInt32 cy;
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShell
|
||||
//*****************************************************************************
|
||||
|
@ -226,7 +212,6 @@ protected:
|
|||
|
||||
NS_IMETHOD OnNewURI(nsIURI * aURI, nsIChannel * aChannel, PRUint32 aLoadType);
|
||||
|
||||
virtual void SetCurrentURI(nsIURI * aURI);
|
||||
virtual void SetReferrerURI(nsIURI * aURI);
|
||||
|
||||
// Session History
|
||||
|
@ -247,7 +232,6 @@ protected:
|
|||
NS_IMETHOD UpdateCurrentGlobalHistory();
|
||||
|
||||
// Helper Routines
|
||||
nsDocShellInitInfo * InitInfo();
|
||||
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||
nsIStringBundle ** aStringBundle);
|
||||
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
|
||||
|
@ -289,7 +273,7 @@ protected:
|
|||
nsVoidArray mChildren;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsDSURIContentListener * mContentListener;
|
||||
nsDocShellInitInfo * mInitInfo;
|
||||
nsRect mBounds; // Dimensions of the docshell
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
||||
nsCOMPtr<nsIDeviceContext> mDeviceContext;
|
||||
|
|
|
@ -113,7 +113,7 @@ interface nsIDocShell : nsISupports
|
|||
* in nsIWebNavigation.
|
||||
* @param aSHEntry - Active Session History entry (if loading from SH)
|
||||
*/
|
||||
[noscript]void InternalLoad(in nsIURI aURI,
|
||||
[noscript]void internalLoad(in nsIURI aURI,
|
||||
in nsIURI aReferrer,
|
||||
in nsISupports aOwner,
|
||||
in boolean aInheritOwner,
|
||||
|
@ -135,7 +135,18 @@ interface nsIDocShell : nsISupports
|
|||
*/
|
||||
void prepareForNewContentModel();
|
||||
|
||||
[noscript] void FireUnloadNotification();
|
||||
/**
|
||||
* For editors and suchlike who wish to change the URI associated with the
|
||||
* document. Note if you want to get the current URI, use the read-only
|
||||
* property on nsIWebNavigation.
|
||||
*/
|
||||
[noscript] void setCurrentURI(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Notify the associated content viewer and all child docshells that they are
|
||||
* about to be unloaded.
|
||||
*/
|
||||
[noscript] void fireUnloadNotification();
|
||||
|
||||
/**
|
||||
* Presentation context for the currently loaded document. This may be null.
|
||||
|
@ -245,15 +256,15 @@ interface nsIDocShell : nsISupports
|
|||
*/
|
||||
attribute long marginHeight;
|
||||
|
||||
/*
|
||||
* Tells the DocShell that it now has focus or has lost focus
|
||||
*/
|
||||
attribute boolean hasFocus;
|
||||
/*
|
||||
* Tells the DocShell that it now has focus or has lost focus
|
||||
*/
|
||||
attribute boolean hasFocus;
|
||||
|
||||
/*
|
||||
* Tells the docshell whether the canvas should have focus
|
||||
*/
|
||||
attribute boolean canvasHasFocus;
|
||||
/*
|
||||
* Tells the docshell whether the canvas should have focus
|
||||
*/
|
||||
attribute boolean canvasHasFocus;
|
||||
|
||||
/*
|
||||
* Tells the docshell to offer focus to its tree owner.
|
||||
|
@ -280,6 +291,6 @@ interface nsIDocShell : nsISupports
|
|||
/*
|
||||
* returns true if the docshell is being destroyed, false otherwise
|
||||
*/
|
||||
boolean IsBeingDestroyed();
|
||||
boolean isBeingDestroyed();
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ typedef unsigned long HMTX;
|
|||
#include "nsIStreamListener.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsISocketProvider.h"
|
||||
#include "nsIRefreshURI.h"
|
||||
|
@ -70,7 +69,6 @@ typedef unsigned long HMTX;
|
|||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
@ -82,11 +80,8 @@ typedef unsigned long HMTX;
|
|||
#include "prprf.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsplugin.h"
|
||||
//#include "nsPluginsCID.h"
|
||||
#include "nsIPluginManager.h"
|
||||
#include "nsCDefaultURIFixup.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsIContent.h"
|
||||
#include "prlog.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -97,8 +92,6 @@ typedef unsigned long HMTX;
|
|||
#include "prthread.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
|
@ -120,21 +113,14 @@ typedef unsigned long HMTX;
|
|||
#include "nsIController.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIHistoryEntry.h"
|
||||
|
||||
#include "nsIHttpChannel.h" // add this to the ick include list...we need it to QI for post data interface
|
||||
#include "nsIUploadChannel.h"
|
||||
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsICachingChannel.h"
|
||||
|
||||
//XXX for nsIPostData; this is wrong; we shouldn't see the nsIDocument type
|
||||
|
@ -165,8 +151,6 @@ static PRLogModuleInfo* gLogModule = PR_NewLogModule("webshell");
|
|||
#define WEB_TRACE(_bit,_args)
|
||||
#endif
|
||||
|
||||
//static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID);
|
||||
//static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -195,8 +179,6 @@ nsWebShell::nsWebShell() : nsDocShell()
|
|||
InitFrameData();
|
||||
mItemType = typeContent;
|
||||
mCharsetReloadState = eCharsetReloadInit;
|
||||
mHistoryState = nsnull;
|
||||
mBounds.SetRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
nsWebShell::~nsWebShell()
|
||||
|
@ -250,26 +232,11 @@ NS_IMPL_ADDREF_INHERITED(nsWebShell, nsDocShell)
|
|||
NS_IMPL_RELEASE_INHERITED(nsWebShell, nsDocShell)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsWebShell)
|
||||
#if 0 // inherits from nsDocShell:
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebShell)
|
||||
#endif
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebShellServices)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIContentViewerContainer, nsIWebShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILinkHandler)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
|
||||
#if 0 // inherits from nsDocShell:
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObjectOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRefreshURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
||||
#endif
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDocShell)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -314,36 +281,6 @@ nsWebShell::GetInterface(const nsIID &aIID, void** aInstancePtr)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetupNewViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(nsDocShell::SetupNewViewer(aViewer), NS_ERROR_FAILURE);
|
||||
|
||||
// If the history state has been set by session history,
|
||||
// set it on the pres shell now that we have a content
|
||||
// viewer.
|
||||
if(mContentViewer && mHistoryState)
|
||||
{
|
||||
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
|
||||
if(docv)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
docv->GetPresShell(*getter_AddRefs(shell));
|
||||
if(shell)
|
||||
shell->SetHistoryState((nsILayoutHistoryState*)mHistoryState);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::Embed(nsIContentViewer* aContentViewer,
|
||||
const char* aCommand,
|
||||
nsISupports* aExtraInfo)
|
||||
{
|
||||
return nsDocShell::Embed(aContentViewer, aCommand, aExtraInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetContainer(nsIWebShellContainer* aContainer)
|
||||
{
|
||||
|
@ -362,98 +299,12 @@ nsWebShell::GetContainer(nsIWebShellContainer*& aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetTopLevelWindow(nsIWebShellContainer** aTopLevelWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTopLevelWindow);
|
||||
*aTopLevelWindow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIWebShell> rootWebShell;
|
||||
|
||||
GetRootWebShellEvenIfChrome(getter_AddRefs(rootWebShell));
|
||||
if(!rootWebShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIWebShellContainer> rootContainer;
|
||||
rootWebShell->GetContainer(*aTopLevelWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStatus PR_CALLBACK
|
||||
nsWebShell::HandleEvent(nsGUIEvent *aEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetRootWebShell(nsIWebShell*& aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> top;
|
||||
GetSameTypeRootTreeItem(getter_AddRefs(top));
|
||||
nsCOMPtr<nsIWebShell> topAsWebShell(do_QueryInterface(top));
|
||||
aResult = topAsWebShell;
|
||||
NS_IF_ADDREF(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::GetRootWebShellEvenIfChrome(nsIWebShell** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> top;
|
||||
GetRootTreeItem(getter_AddRefs(top));
|
||||
nsCOMPtr<nsIWebShell> topAsWebShell(do_QueryInterface(top));
|
||||
*aResult = topAsWebShell;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetParent(nsIWebShell* aParent)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsTreeItem(do_QueryInterface(aParent));
|
||||
|
||||
mParent = parentAsTreeItem.get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetParent(nsIWebShell*& aParent)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
NS_ENSURE_SUCCESS(GetSameTypeParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
|
||||
if(parent)
|
||||
parent->QueryInterface(NS_GET_IID(nsIWebShell), (void**)&aParent);
|
||||
else
|
||||
aParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetReferrer(nsIURI **aReferrer)
|
||||
{
|
||||
*aReferrer = mReferrerURI;
|
||||
NS_IF_ADDREF(*aReferrer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::SetReferrer(const PRUnichar* aReferrer)
|
||||
{
|
||||
NS_NewURI(getter_AddRefs(mReferrerURI), nsDependentString(aReferrer), nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetURL(const PRUnichar* aURL)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(uri), nsDependentString(aURL),
|
||||
nsnull),
|
||||
NS_ERROR_FAILURE);
|
||||
SetCurrentURI(uri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document Load methods
|
||||
|
@ -466,85 +317,6 @@ nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult)
|
|||
return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// History methods
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GoTo(PRInt32 aIndex)
|
||||
{
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIHistoryEntry> entry;
|
||||
|
||||
mSessionHistory->GetEntryAtIndex(aIndex, PR_TRUE, getter_AddRefs(entry));
|
||||
NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsISHEntry> shEntry(do_QueryInterface(entry));
|
||||
NS_ENSURE_TRUE(shEntry, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(shEntry, LOAD_HISTORY), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetHistoryLength(PRInt32& aResult)
|
||||
{
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(mSessionHistory->GetCount(&aResult), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetHistoryIndex(PRInt32& aResult)
|
||||
{
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(mSessionHistory->GetIndex(&aResult), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetURL(PRInt32 aIndex, PRUnichar** aURLResult)
|
||||
{
|
||||
NS_ENSURE_STATE(mSessionHistory);
|
||||
NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIHistoryEntry> entry;
|
||||
|
||||
NS_ENSURE_SUCCESS(mSessionHistory->GetEntryAtIndex(aIndex, PR_TRUE,
|
||||
getter_AddRefs(entry)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
entry->GetURI(getter_AddRefs(uri));
|
||||
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
nsXPIDLCString spec;
|
||||
uri->GetSpec(getter_Copies(spec));
|
||||
|
||||
*aURLResult = ToNewUnicode(NS_ConvertASCIItoUCS2(spec));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// WebShell container implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetHistoryState(nsISupports* aLayoutHistoryState)
|
||||
{
|
||||
mHistoryState = aLayoutHistoryState;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Web Shell Services API
|
||||
|
||||
|
@ -1405,13 +1177,6 @@ nsWebShell::SelectNone(void)
|
|||
}
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::FindNext(const PRUnichar * aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
@ -1439,8 +1204,9 @@ NS_IMETHODIMP nsWebShell::Create()
|
|||
nsCOMPtr<nsIURILoader> uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID);
|
||||
uriLoader->GetDocumentLoaderForContext(NS_STATIC_CAST( nsISupports*, (nsIWebShell *) this), &mDocLoader);
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> shellAsContainer = do_QueryInterface(NS_STATIC_CAST(nsIWebShell*, this));
|
||||
// Set the webshell as the default IContentViewerContainer for the loader...
|
||||
mDocLoader->SetContainer(NS_STATIC_CAST(nsIContentViewerContainer*, (nsIWebShell*)this));
|
||||
mDocLoader->SetContainer(shellAsContainer);
|
||||
|
||||
return nsDocShell::Create();
|
||||
}
|
||||
|
@ -1454,28 +1220,6 @@ NS_IMETHODIMP nsWebShell::Destroy()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
||||
PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
mBounds.SetRect(x, y, cx, cy);
|
||||
return nsDocShell::SetPositionAndSize(x, y, cx, cy, fRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetPositionAndSize(PRInt32* x, PRInt32* y,
|
||||
PRInt32* cx, PRInt32* cy)
|
||||
{
|
||||
if(x)
|
||||
*x = mBounds.x;
|
||||
if(y)
|
||||
*y = mBounds.y;
|
||||
if(cx)
|
||||
*cx = mBounds.width;
|
||||
if(cy)
|
||||
*cy = mBounds.height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
unsigned long nsWebShell::gNumberOfWebShells = 0;
|
||||
#endif
|
||||
|
|
|
@ -58,36 +58,11 @@ public:
|
|||
NS_DECL_NSICLIPBOARDCOMMANDS
|
||||
NS_DECL_NSIWEBSHELLSERVICES
|
||||
|
||||
NS_IMETHOD SetupNewViewer(nsIContentViewer* aViewer);
|
||||
|
||||
// nsIContentViewerContainer
|
||||
NS_IMETHOD Embed(nsIContentViewer* aDocViewer,
|
||||
const char* aCommand,
|
||||
nsISupports* aExtraInfo);
|
||||
|
||||
// nsIWebShell
|
||||
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
|
||||
NS_IMETHOD GetTopLevelWindow(nsIWebShellContainer** aWebShellWindow);
|
||||
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult);
|
||||
/*NS_IMETHOD SetParent(nsIWebShell* aParent);
|
||||
NS_IMETHOD GetParent(nsIWebShell*& aParent);*/
|
||||
NS_IMETHOD GetReferrer(nsIURI **aReferrer);
|
||||
|
||||
// Document load api's
|
||||
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
|
||||
|
||||
void SetReferrer(const PRUnichar* aReferrer);
|
||||
|
||||
// History api's
|
||||
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
|
||||
NS_IMETHOD GetHistoryLength(PRInt32& aResult);
|
||||
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
|
||||
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
|
||||
|
||||
// nsIWebShellContainer
|
||||
NS_IMETHOD SetHistoryState(nsISupports* aLayoutHistoryState);
|
||||
|
||||
// nsILinkHandler
|
||||
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
||||
nsLinkVerb aVerb,
|
||||
|
@ -100,14 +75,6 @@ public:
|
|||
const PRUnichar* aTargetSpec);
|
||||
NS_IMETHOD GetLinkState(const char* aLinkURI, nsLinkState& aState);
|
||||
|
||||
NS_IMETHOD FindNext(const PRUnichar * aSearchStr, PRBool aMatchCase,
|
||||
PRBool aSearchDown, PRBool &aIsFound);
|
||||
|
||||
// nsIBaseWindow
|
||||
NS_IMETHOD SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
||||
PRInt32 cy, PRBool fRepaint);
|
||||
NS_IMETHOD GetPositionAndSize(PRInt32* x, PRInt32* y,
|
||||
PRInt32* cx, PRInt32* cy);
|
||||
NS_IMETHOD Create();
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
|
@ -122,10 +89,10 @@ public:
|
|||
|
||||
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD SetURL(const PRUnichar* aURL);
|
||||
// NS_IMETHOD SetURL(const PRUnichar* aURL);
|
||||
|
||||
protected:
|
||||
void GetRootWebShellEvenIfChrome(nsIWebShell** aResult);
|
||||
// void GetRootWebShellEvenIfChrome(nsIWebShell** aResult);
|
||||
void InitFrameData();
|
||||
|
||||
// helpers for executing commands
|
||||
|
@ -146,8 +113,6 @@ protected:
|
|||
nsIWebShellContainer* mContainer;
|
||||
nsIDocumentLoader* mDocLoader;
|
||||
|
||||
nsRect mBounds;
|
||||
|
||||
eCharsetReloadState mCharsetReloadState;
|
||||
|
||||
nsISupports* mHistoryState; // Weak reference. Session history owns this.
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "nsEditorShell.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIContentViewerFile.h"
|
||||
#include "prprf.h"
|
||||
|
@ -2827,10 +2826,13 @@ nsEditorShell::DoAfterSave(PRBool aShouldUpdateURL, const PRUnichar *aURLString)
|
|||
if (aShouldUpdateURL)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURLString);
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mContentAreaDocShell));
|
||||
if (!webShell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = webShell->SetURL(aURLString);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), nsDependentString(aURLString), nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to create a uri");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
mContentAreaDocShell->SetCurrentURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
// Update window title to show possibly different filename
|
||||
|
|
|
@ -82,10 +82,16 @@ public:
|
|||
* Web shells are also nsIWebShellContainer's because they can contain
|
||||
* other web shells.
|
||||
*/
|
||||
class nsIWebShell : public nsIContentViewerContainer {
|
||||
class nsIWebShell : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IWEB_SHELL_IID; return iid; }
|
||||
|
||||
/**
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!!
|
||||
*
|
||||
* THIS INTERFACE IS DEPRECATED. DO NOT ADD STUFF OR CODE TO IT!!!!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the nsIWebShellContainer for the WebShell.
|
||||
*/
|
||||
|
@ -96,56 +102,10 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Returns the top level window (this would be the containing window
|
||||
* the same object that implements nsIWebShellContainer, nsIWebShellWindow).
|
||||
*/
|
||||
NS_IMETHOD GetTopLevelWindow(nsIWebShellContainer** aTopLevelWindow) = 0;
|
||||
|
||||
/**
|
||||
* Return the root WebShell instance. Since WebShells can be nested
|
||||
* (when frames are present for example) this instance represents the
|
||||
* outermost WebShell.
|
||||
*/
|
||||
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the referrer of the link using this WebShell.
|
||||
*/
|
||||
NS_IMETHOD GetReferrer(nsIURI **aReferrer) = 0;
|
||||
|
||||
//
|
||||
// Document load api's
|
||||
//
|
||||
/**
|
||||
* Return the nsIDocumentLoader associated with the WebShell.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult) = 0;
|
||||
|
||||
//
|
||||
// History api's
|
||||
//
|
||||
/**
|
||||
* Load the previous document in the history list.
|
||||
*/
|
||||
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
|
||||
NS_IMETHOD GetHistoryLength(PRInt32& aResult) = 0;
|
||||
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
|
||||
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar **aURLResult) = 0;
|
||||
|
||||
// SetToolBar
|
||||
// SetMenuBar
|
||||
// SetStatusBar
|
||||
|
||||
/**
|
||||
* Finds text in content
|
||||
*/
|
||||
NS_IMETHOD FindNext(const PRUnichar * aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
||||
|
||||
/**
|
||||
* Set the URL of the current WebShell.
|
||||
*/
|
||||
NS_IMETHOD SetURL(const PRUnichar* aURL) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIWebShell_h___ */
|
||||
|
|
|
@ -807,13 +807,13 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
|||
|
||||
case VIEW_SOURCE:
|
||||
{
|
||||
PRInt32 theIndex;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
webShell->GetHistoryIndex(theIndex);
|
||||
nsXPIDLString theURL;
|
||||
webShell->GetURL(theIndex, getter_Copies(theURL));
|
||||
nsAutoString theString(theURL);
|
||||
mApp->ViewSource(theString);
|
||||
// PRInt32 theIndex;
|
||||
// nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
// webShell->GetHistoryIndex(theIndex);
|
||||
// nsXPIDLString theURL;
|
||||
// webShell->GetURL(theIndex, getter_Copies(theURL));
|
||||
// nsAutoString theString(theURL);
|
||||
// mApp->ViewSource(theString);
|
||||
//XXX Find out how the string is allocated, and perhaps delete it...
|
||||
}
|
||||
break;
|
||||
|
@ -1532,7 +1532,8 @@ nsnull, r.x, r.y, r.width, r.height);
|
|||
nsIDocumentViewer* docv;
|
||||
aDocumentViewer->CreateDocumentViewerUsing(aPresContext, docv);
|
||||
docv->SetContainer(mWebBrowser);
|
||||
webShell->Embed(docv, "duh", nsnull);
|
||||
nsCOMPtr<nsIContentViewerContainer> cvContainer = do_QueryInterface(mDocShell);
|
||||
cvContainer->Embed(docv, "duh", nsnull);
|
||||
|
||||
|
||||
webBrowserWin->SetVisibility(PR_TRUE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче