Skip to content

Commit

Permalink
Removed huge chunks of dead webshell and cleaned up a few references …
Browse files Browse the repository at this point in the history
…to it elsewhere in the code. b=113970 r=valeski@netscape.com sr=rpotts@netscape.com
  • Loading branch information
locka%iol.ie committed Jan 8, 2002
1 parent ab43b4f commit 87bfcf8
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 485 deletions.
167 changes: 65 additions & 102 deletions docshell/base/nsDocShell.cpp
Expand Up @@ -176,7 +176,6 @@ nsDocShellFocusController nsDocShellFocusController::mDocShellFocusControllerSin

nsDocShell::nsDocShell():
mContentListener(nsnull),
mInitInfo(nsnull),
mMarginWidth(0),
mMarginHeight(0),
mItemType(typeContent),
Expand Down Expand Up @@ -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

///*****************************************************************************
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -2509,11 +2556,6 @@ nsDocShell::Destroy()

SetLoadCookie(nsnull);

if (mInitInfo) {
delete mInitInfo;
mInitInfo = nsnull;
}

if (mContentListener) {
mContentListener->DocShell(nsnull);
mContentListener->SetParentContentListener(nsnull);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}
else if (InitInfo()) {
mInitInfo->x = x;
mInitInfo->y = y;
mInitInfo->cx = cx;
mInitInfo->cy = cy;
NS_ENSURE_SUCCESS(mContentViewer->SetBounds(mBounds), NS_ERROR_FAILURE);
}
else
NS_ENSURE_TRUE(PR_FALSE, NS_ERROR_FAILURE);

return NS_OK;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions docshell/base/nsDocShell.h
Expand Up @@ -131,20 +131,6 @@ class nsRefreshTimer : public nsITimerCallback
virtual ~nsRefreshTimer();
};

//*****************************************************************************
//*** nsDocShellInitInfo
//*****************************************************************************

class nsDocShellInitInfo
{
public:
//nsIGenericWindow Stuff
PRInt32 x;
PRInt32 y;
PRInt32 cx;
PRInt32 cy;
};

//*****************************************************************************
//*** nsDocShell
//*****************************************************************************
Expand Down Expand Up @@ -226,7 +212,6 @@ friend class nsDSURIContentListener;

NS_IMETHOD OnNewURI(nsIURI * aURI, nsIChannel * aChannel, PRUint32 aLoadType);

virtual void SetCurrentURI(nsIURI * aURI);
virtual void SetReferrerURI(nsIURI * aURI);

// Session History
Expand All @@ -247,7 +232,6 @@ friend class nsDSURIContentListener;
NS_IMETHOD UpdateCurrentGlobalHistory();

// Helper Routines
nsDocShellInitInfo * InitInfo();
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
nsIStringBundle ** aStringBundle);
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
Expand Down Expand Up @@ -289,7 +273,7 @@ friend class nsDSURIContentListener;
nsVoidArray mChildren;
nsCOMPtr<nsISupportsArray> mRefreshURIList;
nsDSURIContentListener * mContentListener;
nsDocShellInitInfo * mInitInfo;
nsRect mBounds; // Dimensions of the docshell
nsCOMPtr<nsIContentViewer> mContentViewer;
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
nsCOMPtr<nsIDeviceContext> mDeviceContext;
Expand Down
33 changes: 22 additions & 11 deletions docshell/base/nsIDocShell.idl
Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -280,6 +291,6 @@ interface nsIDocShell : nsISupports
/*
* returns true if the docshell is being destroyed, false otherwise
*/
boolean IsBeingDestroyed();
boolean isBeingDestroyed();
};

0 comments on commit 87bfcf8

Please sign in to comment.