зеркало из https://github.com/mozilla/gecko-dev.git
more implementation
some nits to conform more to seamonkey coding conventions.
This commit is contained in:
Родитель
98f5483cfb
Коммит
00bac5c8c3
|
@ -21,23 +21,25 @@
|
|||
*/
|
||||
|
||||
#include "nsDocShellBase.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShellBase: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsDocShellBase::nsDocShellBase() : m_Created(PR_FALSE)
|
||||
nsDocShellBase::nsDocShellBase() : mCreated(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
m_BaseInitInfo = new nsDocShellInitInfo();
|
||||
mBaseInitInfo = new nsDocShellInitInfo();
|
||||
}
|
||||
|
||||
nsDocShellBase::~nsDocShellBase()
|
||||
{
|
||||
if(m_BaseInitInfo)
|
||||
if(mBaseInitInfo)
|
||||
{
|
||||
delete m_BaseInitInfo;
|
||||
m_BaseInitInfo = nsnull;
|
||||
delete mBaseInitInfo;
|
||||
mBaseInitInfo = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ NS_IMETHODIMP nsDocShellBase::LoadURI(const PRUnichar* uri)
|
|||
NS_IMETHODIMP nsDocShellBase::LoadURIVia(const PRUnichar* uri,
|
||||
PRUint32 adapterBinding)
|
||||
{
|
||||
NS_ENSURE_ARG(uri);
|
||||
NS_ENSURE_ARG(uri);
|
||||
//XXX First Check
|
||||
/*
|
||||
Loads a given URI through the specified adapter. This will give priority
|
||||
|
@ -81,62 +83,68 @@ NS_IMETHODIMP nsDocShellBase::LoadURIVia(const PRUnichar* uri,
|
|||
@param uri - The URI to load.
|
||||
@param adapterBinding - The local IP address of the adapter to bind to.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetDocument(nsIDOMDocument** document)
|
||||
NS_IMETHODIMP nsDocShellBase::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(document);
|
||||
//XXX First Check
|
||||
/*
|
||||
The current document that is loaded in the DocShell. When setting this it
|
||||
will will simulate the normal load process.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
|
||||
nsCOMPtr<nsIDocument>doc;
|
||||
NS_ENSURE_SUCCESS(mPresShell->GetDocument(getter_AddRefs(doc)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(doc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// the result's addref comes from this QueryInterface call
|
||||
doc->QueryInterface(nsIDOMDocument::GetIID(), (void **)aDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetDocument(nsIDOMDocument* document)
|
||||
// SetDocument is only meaningful for doc shells that support DOM documents. Not all do.
|
||||
NS_IMETHODIMP nsDocShellBase::SetDocument(nsIDOMDocument* aDocument)
|
||||
{
|
||||
//XXX First Check
|
||||
/*
|
||||
The current document that is loaded in the DocShell. When setting this it
|
||||
will will simulate the normal load process.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "Subclasses should override this method!!!!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetName(PRUnichar** name)
|
||||
// caller is responsible for calling nsString::Recycle(*aName);
|
||||
NS_IMETHODIMP nsDocShellBase::GetName(PRUnichar** aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(name);
|
||||
//XXX First Check
|
||||
/*
|
||||
name of the DocShell
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
*aName = nsnull;
|
||||
if (0!=mName.Length())
|
||||
{
|
||||
*aName = mName.ToNewUnicode();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetName(const PRUnichar* name)
|
||||
NS_IMETHODIMP nsDocShellBase::SetName(const PRUnichar* aName)
|
||||
{
|
||||
//XXX First Check
|
||||
/*
|
||||
name of the DocShell
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aName) {
|
||||
mName = aName; // this does a copy of aName
|
||||
}
|
||||
else {
|
||||
mName = "";
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetPresContext(nsIPresContext** presContext)
|
||||
NS_IMETHODIMP nsDocShellBase::GetPresContext(nsIPresContext** aPresContext)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(presContext);
|
||||
NS_ENSURE_ARG_POINTER(aPresContext);
|
||||
|
||||
*presContext = m_PresContext;
|
||||
NS_IF_ADDREF(*presContext);
|
||||
*aPresContext = mPresContext;
|
||||
NS_IF_ADDREF(*aPresContext);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetPresContext(nsIPresContext* presContext)
|
||||
NS_IMETHODIMP nsDocShellBase::SetPresContext(nsIPresContext* aPresContext)
|
||||
{
|
||||
m_PresContext = presContext;
|
||||
// null aPresContext is ok
|
||||
mPresContext = aPresContext; // this assignment does an addref
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -146,16 +154,17 @@ NS_IMETHODIMP nsDocShellBase::GetParent(nsIDocShell** parent)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(parent);
|
||||
|
||||
*parent = m_Parent;
|
||||
*parent = mParent;
|
||||
NS_IF_ADDREF(*parent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetParent(nsIDocShell* parent)
|
||||
NS_IMETHODIMP nsDocShellBase::SetParent(nsIDocShell* aParent)
|
||||
{
|
||||
m_Parent = parent;
|
||||
return NS_OK;
|
||||
// null aParent is ok
|
||||
mParent = aParent; // this assignment does an addref
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::CanHandleContentType(const PRUnichar* contentType,
|
||||
|
@ -169,35 +178,37 @@ NS_IMETHODIMP nsDocShellBase::CanHandleContentType(const PRUnichar* contentType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetPrefs(nsIPref** prefs)
|
||||
NS_IMETHODIMP nsDocShellBase::GetPrefs(nsIPref** aPrefs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(prefs);
|
||||
//XXX First Check
|
||||
/*
|
||||
Prefs to use for the DocShell.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aPrefs);
|
||||
|
||||
*aPrefs = mPrefs;
|
||||
NS_IF_ADDREF(*aPrefs);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetPrefs(nsIPref* prefs)
|
||||
NS_IMETHODIMP nsDocShellBase::SetPrefs(nsIPref* aPrefs)
|
||||
{
|
||||
//XXX First Check
|
||||
/*
|
||||
Prefs to use for the DocShell.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
// null aPrefs is ok
|
||||
mPrefs = aPrefs; // this assignment does an addref
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetRootDocShell(nsIDocShell** rootDocShell)
|
||||
NS_IMETHODIMP nsDocShellBase::GetRootDocShell(nsIDocShell** aRootDocShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(rootDocShell);
|
||||
//XXX First Check
|
||||
/*
|
||||
Returns the root DocShell instance. Since DocShells can be nested
|
||||
(when frames are present for example) this instance represents the
|
||||
outermost DocShell.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aRootDocShell);
|
||||
*aRootDocShell = this;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
NS_ENSURE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
while (parent)
|
||||
{
|
||||
*aRootDocShell = parent;
|
||||
NS_ENSURE(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
}
|
||||
NS_IF_ADDREF(*aRootDocShell);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -206,23 +217,23 @@ NS_IMETHODIMP nsDocShellBase::GetRootDocShell(nsIDocShell** rootDocShell)
|
|||
|
||||
NS_IMETHODIMP nsDocShellBase::Search()
|
||||
{
|
||||
//XXX First Check
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "Subclasses should override this method!!!!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetSearchable(PRBool* searchable)
|
||||
NS_IMETHODIMP nsDocShellBase::GetSearchable(PRBool* aSearchable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(searchable);
|
||||
//XXX First Check
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aSearchable);
|
||||
*aSearchable = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::ClearSelection()
|
||||
{
|
||||
NS_ENSURE_STATE(m_PresShell);
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
NS_ENSURE_SUCCESS(m_PresShell->GetSelection(SELECTION_NORMAL,
|
||||
NS_ENSURE_SUCCESS(mPresShell->GetSelection(SELECTION_NORMAL,
|
||||
getter_AddRefs(selection)), NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(selection->ClearSelection(), NS_ERROR_FAILURE);
|
||||
|
@ -232,16 +243,16 @@ NS_IMETHODIMP nsDocShellBase::ClearSelection()
|
|||
|
||||
NS_IMETHODIMP nsDocShellBase::SelectAll()
|
||||
{
|
||||
//XXX First Check
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "Subclasses should override this method!!!!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::CopySelection()
|
||||
{
|
||||
NS_ENSURE_STATE(m_PresShell);
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
|
||||
// the pres shell knows how to copy, so let it do the work
|
||||
NS_ENSURE_SUCCESS(m_PresShell->DoCopy(), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(mPresShell->DoCopy(), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -252,10 +263,10 @@ NS_IMETHODIMP nsDocShellBase::GetCopyable(PRBool *aCopyable)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aCopyable);
|
||||
|
||||
NS_ENSURE_STATE(m_PresShell);
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
NS_ENSURE_SUCCESS(m_PresShell->GetSelection(SELECTION_NORMAL,
|
||||
NS_ENSURE_SUCCESS(mPresShell->GetSelection(SELECTION_NORMAL,
|
||||
getter_AddRefs(selection)), NS_ERROR_FAILURE);
|
||||
|
||||
if(!selection)
|
||||
|
@ -278,13 +289,14 @@ NS_IMETHODIMP nsDocShellBase::CutSelection()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetCutable(PRBool* cutable)
|
||||
NS_IMETHODIMP nsDocShellBase::GetCutable(PRBool* aCutable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(cutable);
|
||||
NS_ENSURE_ARG_POINTER(aCutable);
|
||||
//XXX Implement
|
||||
//Should check to find the current focused object. Then see if it can
|
||||
//be cut out of. For now the answer is always no since CutSelection()
|
||||
// has not been implemented.
|
||||
*aCutable = PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -294,15 +306,15 @@ NS_IMETHODIMP nsDocShellBase::Paste()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetPasteable(PRBool* pasteable)
|
||||
NS_IMETHODIMP nsDocShellBase::GetPasteable(PRBool* aPasteable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(pasteable);
|
||||
NS_ENSURE_ARG_POINTER(aPasteable);
|
||||
|
||||
//XXX Implement
|
||||
//Should check to find the current focused object. Then see if it can
|
||||
//be pasted into. For now the answer is always no since Paste()
|
||||
// has not been implemented.
|
||||
*pasteable = PR_FALSE;
|
||||
*aPasteable = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -355,23 +367,23 @@ NS_IMETHODIMP nsDocShellBase::InitWindow(nativeWindow parentNativeWindow,
|
|||
nsIWidget* parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
|
||||
{
|
||||
NS_ENSURE_ARG(parentWidget); // DocShells must get a widget for a parent
|
||||
NS_ENSURE_STATE(!m_Created && m_BaseInitInfo);
|
||||
NS_ENSURE_STATE(!mCreated && mBaseInitInfo);
|
||||
|
||||
m_ParentWidget = parentWidget;
|
||||
m_BaseInitInfo->x = x;
|
||||
m_BaseInitInfo->y = y;
|
||||
m_BaseInitInfo->cx = cx;
|
||||
m_BaseInitInfo->cy = cy;
|
||||
mParentWidget = parentWidget;
|
||||
mBaseInitInfo->x = x;
|
||||
mBaseInitInfo->y = y;
|
||||
mBaseInitInfo->cx = cx;
|
||||
mBaseInitInfo->cy = cy;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::Create()
|
||||
{
|
||||
NS_ENSURE_STATE(!m_Created);
|
||||
NS_ENSURE_STATE(!mCreated);
|
||||
|
||||
// Use m_BaseInitInfo to do create
|
||||
// Then delete m_BaseInitInfo
|
||||
// Use mBaseInitInfo to do create
|
||||
// Then delete mBaseInitInfo
|
||||
//XXX First Check
|
||||
/*
|
||||
Tells the window that intialization and setup is complete. When this is
|
||||
|
@ -390,10 +402,10 @@ NS_IMETHODIMP nsDocShellBase::Destroy()
|
|||
|
||||
NS_IMETHODIMP nsDocShellBase::SetPosition(PRInt32 x, PRInt32 y)
|
||||
{
|
||||
if(!m_Created)
|
||||
if(!mCreated)
|
||||
{
|
||||
m_BaseInitInfo->x = x;
|
||||
m_BaseInitInfo->y = y;
|
||||
mBaseInitInfo->x = x;
|
||||
mBaseInitInfo->y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -429,10 +441,10 @@ NS_IMETHODIMP nsDocShellBase::GetPosition(PRInt32* x, PRInt32* y)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(x && y);
|
||||
|
||||
if(!m_Created)
|
||||
if(!mCreated)
|
||||
{
|
||||
*x = m_BaseInitInfo->x;
|
||||
*y = m_BaseInitInfo->y;
|
||||
*x = mBaseInitInfo->x;
|
||||
*y = mBaseInitInfo->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -460,10 +472,10 @@ NS_IMETHODIMP nsDocShellBase::GetPosition(PRInt32* x, PRInt32* y)
|
|||
|
||||
NS_IMETHODIMP nsDocShellBase::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
if(!m_Created)
|
||||
if(!mCreated)
|
||||
{
|
||||
m_BaseInitInfo->cx = cx;
|
||||
m_BaseInitInfo->cy = cy;
|
||||
mBaseInitInfo->cx = cx;
|
||||
mBaseInitInfo->cy = cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -506,10 +518,10 @@ NS_IMETHODIMP nsDocShellBase::GetSize(PRInt32* cx, PRInt32* cy)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(cx && cy);
|
||||
|
||||
if(!m_Created)
|
||||
if(!mCreated)
|
||||
{
|
||||
*cx = m_BaseInitInfo->cx;
|
||||
*cy = m_BaseInitInfo->cy;
|
||||
*cx = mBaseInitInfo->cx;
|
||||
*cy = mBaseInitInfo->cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -538,12 +550,12 @@ NS_IMETHODIMP nsDocShellBase::GetSize(PRInt32* cx, PRInt32* cy)
|
|||
NS_IMETHODIMP nsDocShellBase::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
||||
PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
if(!m_Created)
|
||||
if(!mCreated)
|
||||
{
|
||||
m_BaseInitInfo->x = x;
|
||||
m_BaseInitInfo->y = y;
|
||||
m_BaseInitInfo->cx = cx;
|
||||
m_BaseInitInfo->cy = cy;
|
||||
mBaseInitInfo->x = x;
|
||||
mBaseInitInfo->y = y;
|
||||
mBaseInitInfo->cx = cx;
|
||||
mBaseInitInfo->cy = cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -614,16 +626,16 @@ NS_IMETHODIMP nsDocShellBase::GetParentWidget(nsIWidget** parentWidget)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(parentWidget);
|
||||
|
||||
*parentWidget = m_ParentWidget;
|
||||
*parentWidget = mParentWidget;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::SetParentWidget(nsIWidget* parentWidget)
|
||||
{
|
||||
NS_ENSURE_STATE(!m_Created);
|
||||
NS_ENSURE_STATE(!mCreated);
|
||||
|
||||
m_ParentWidget = parentWidget;
|
||||
mParentWidget = parentWidget;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -632,8 +644,8 @@ NS_IMETHODIMP nsDocShellBase::GetParentNativeWindow(nativeWindow* parentNativeWi
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(parentNativeWindow);
|
||||
|
||||
if(m_ParentWidget)
|
||||
*parentNativeWindow = m_ParentWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
if(mParentWidget)
|
||||
*parentNativeWindow = mParentWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
else
|
||||
*parentNativeWindow = nsnull;
|
||||
|
||||
|
@ -649,8 +661,8 @@ NS_IMETHODIMP nsDocShellBase::GetVisibility(PRBool* visibility)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(visibility);
|
||||
|
||||
if(!m_Created)
|
||||
*visibility = m_BaseInitInfo->visible;
|
||||
if(!mCreated)
|
||||
*visibility = mBaseInitInfo->visible;
|
||||
else
|
||||
{
|
||||
//XXX Query underlying control
|
||||
|
@ -661,8 +673,8 @@ NS_IMETHODIMP nsDocShellBase::GetVisibility(PRBool* visibility)
|
|||
|
||||
NS_IMETHODIMP nsDocShellBase::SetVisibility(PRBool visibility)
|
||||
{
|
||||
if(!m_Created)
|
||||
m_BaseInitInfo->visible = visibility;
|
||||
if(!mCreated)
|
||||
mBaseInitInfo->visible = visibility;
|
||||
else
|
||||
{
|
||||
// XXX Set underlying control visibility
|
||||
|
@ -676,7 +688,7 @@ NS_IMETHODIMP nsDocShellBase::GetMainWidget(nsIWidget** mainWidget)
|
|||
NS_ENSURE_ARG_POINTER(mainWidget);
|
||||
|
||||
// For now we don't create our own widget, so simply return the parent one.
|
||||
*mainWidget = m_ParentWidget;
|
||||
*mainWidget = mParentWidget;
|
||||
NS_IF_ADDREF(*mainWidget);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsIGenericWindow.h"
|
||||
#include "nsIScrollable.h"
|
||||
#include "nsITextScroll.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
class nsDocShellInitInfo
|
||||
{
|
||||
|
@ -71,12 +72,14 @@ protected:
|
|||
nsresult GetRootScrollableView(nsIScrollableView** aOutScrollView);
|
||||
|
||||
protected:
|
||||
PRBool m_Created;
|
||||
nsDocShellInitInfo* m_BaseInitInfo;
|
||||
nsCOMPtr<nsIDocShell> m_Parent;
|
||||
nsCOMPtr<nsIPresContext> m_PresContext;
|
||||
nsCOMPtr<nsIWidget> m_ParentWidget;
|
||||
nsCOMPtr<nsIPresShell> m_PresShell;
|
||||
PRBool mCreated;
|
||||
nsString mName;
|
||||
nsDocShellInitInfo* mBaseInitInfo;
|
||||
nsCOMPtr<nsIDocShell> mParent;
|
||||
nsCOMPtr<nsIPresContext> mPresContext;
|
||||
nsCOMPtr<nsIWidget> mParentWidget;
|
||||
nsCOMPtr<nsIPresShell> mPresShell;
|
||||
nsCOMPtr<nsIPref> mPrefs;
|
||||
};
|
||||
|
||||
#endif /* nsDocShellBase_h__ */
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
//*** nsHTMLDocShell: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsHTMLDocShell::nsHTMLDocShell() : nsDocShellBase(), m_AllowPlugins(PR_TRUE),
|
||||
m_MarginWidth(0), m_MarginHeight(0), m_IsFrame(PR_FALSE)
|
||||
nsHTMLDocShell::nsHTMLDocShell() : nsDocShellBase(), mAllowPlugins(PR_TRUE),
|
||||
mMarginWidth(0), mMarginHeight(0), mIsFrame(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ NS_IMETHODIMP nsHTMLDocShell::CanHandleContentType(const PRUnichar* contentType,
|
|||
NS_IMETHODIMP nsHTMLDocShell::ScrollToNode(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_ENSURE_ARG(aNode);
|
||||
NS_ENSURE_STATE(m_PresShell);
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
|
||||
// Get the nsIContent interface, because that's what we need to
|
||||
// get the primary frame
|
||||
|
@ -99,7 +99,7 @@ NS_IMETHODIMP nsHTMLDocShell::ScrollToNode(nsIDOMNode* aNode)
|
|||
NS_ERROR_FAILURE);
|
||||
|
||||
// tell the pres shell to scroll to the frame
|
||||
NS_ENSURE_SUCCESS(m_PresShell->ScrollFrameIntoView(frame,
|
||||
NS_ENSURE_SUCCESS(mPresShell->ScrollFrameIntoView(frame,
|
||||
NS_PRESSHELL_SCROLL_TOP, NS_PRESSHELL_SCROLL_ANYWHERE), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -108,13 +108,13 @@ NS_IMETHODIMP nsHTMLDocShell::GetAllowPlugins(PRBool* aAllowPlugins)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowPlugins);
|
||||
|
||||
*aAllowPlugins = m_AllowPlugins;
|
||||
*aAllowPlugins = mAllowPlugins;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLDocShell::SetAllowPlugins(PRBool aAllowPlugins)
|
||||
{
|
||||
m_AllowPlugins = aAllowPlugins;
|
||||
mAllowPlugins = aAllowPlugins;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -122,13 +122,13 @@ NS_IMETHODIMP nsHTMLDocShell::GetMarginWidth(PRInt32* aMarginWidth)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aMarginWidth);
|
||||
|
||||
*aMarginWidth = m_MarginWidth;
|
||||
*aMarginWidth = mMarginWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLDocShell::SetMarginWidth(PRInt32 aMarginWidth)
|
||||
{
|
||||
m_MarginWidth = aMarginWidth;
|
||||
mMarginWidth = aMarginWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -136,13 +136,13 @@ NS_IMETHODIMP nsHTMLDocShell::GetMarginHeight(PRInt32* aMarginHeight)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aMarginHeight);
|
||||
|
||||
*aMarginHeight = m_MarginHeight;
|
||||
*aMarginHeight = mMarginHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLDocShell::SetMarginHeight(PRInt32 aMarginHeight)
|
||||
{
|
||||
m_MarginHeight = aMarginHeight;
|
||||
mMarginHeight = aMarginHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -150,13 +150,13 @@ NS_IMETHODIMP nsHTMLDocShell::GetIsFrame(PRBool* aIsFrame)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsFrame);
|
||||
|
||||
*aIsFrame = m_IsFrame;
|
||||
*aIsFrame = mIsFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLDocShell::SetIsFrame(PRBool aIsFrame)
|
||||
{
|
||||
m_IsFrame = aIsFrame;
|
||||
mIsFrame = aIsFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -167,12 +167,12 @@ NS_IMETHODIMP nsHTMLDocShell::GetDefaultCharacterSet(PRUnichar** aDefaultCharact
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultCharacterSet);
|
||||
|
||||
/* if (0 == m_DefaultCharacterSet.Length())
|
||||
/* if (0 == mDefaultCharacterSet.Length())
|
||||
{
|
||||
if ((nsnull == gDefCharset) || (nsnull == *gDefCharset))
|
||||
{
|
||||
if(m_Prefs)
|
||||
m_Prefs->CopyCharPref("intl.charset.default", &gDefCharset);
|
||||
if(mPrefs)
|
||||
mPrefs->CopyCharPref("intl.charset.default", &gDefCharset);
|
||||
}
|
||||
if ((nsnull == gDefCharset) || (nsnull == *gDefCharset))
|
||||
mDefaultCharacterSet = "ISO-8859-1";
|
||||
|
@ -283,13 +283,13 @@ NS_IMETHODIMP nsHTMLDocShell::SizeToContent()
|
|||
*/
|
||||
NS_IMETHODIMP nsHTMLDocShell::SelectAll()
|
||||
{
|
||||
NS_ENSURE_STATE(m_Document && m_PresShell);
|
||||
NS_ENSURE_STATE(mDocument && mPresShell);
|
||||
/* XXX Implement - There is something not quite right with the objects
|
||||
being retrieved. bodyNode isn't defined and bodyElement isn't used
|
||||
and nor is node.
|
||||
// get the selection object
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
NS_ENSURE_SUCCESS(m_PresShell->GetSelection(SELECTION_NORMAL,
|
||||
NS_ENSURE_SUCCESS(mPresShell->GetSelection(SELECTION_NORMAL,
|
||||
getter_AddRefs(selection)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(selection, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -298,7 +298,7 @@ NS_IMETHODIMP nsHTMLDocShell::SelectAll()
|
|||
nsCOMPtr<nsIDOMElement> bodyElement;
|
||||
nsAutoString bodyTag = "body";
|
||||
|
||||
NS_ENSURE_SUCCESS(m_Document->GetElementsByTagName(bodyTag,
|
||||
NS_ENSURE_SUCCESS(mDocument->GetElementsByTagName(bodyTag,
|
||||
getter_AddRefs(nodeList)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE(nodeList, NS_OK); // this means the document has no body, so nothing to select
|
||||
|
||||
|
|
|
@ -52,11 +52,13 @@ protected:
|
|||
nsresult GetPrimaryFrameFor(nsIContent* content, nsIFrame** frame);
|
||||
|
||||
protected:
|
||||
PRBool m_AllowPlugins;
|
||||
PRInt32 m_MarginWidth;
|
||||
PRInt32 m_MarginHeight;
|
||||
PRBool m_IsFrame;
|
||||
nsCOMPtr<nsIDOMDocument> m_Document;
|
||||
PRBool mAllowPlugins;
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
PRBool mIsFrame;
|
||||
// XXX: mDocument is going away RSN! we shouldn't hold onto it at this level.
|
||||
// the content viewer owns it
|
||||
nsCOMPtr<nsIDOMDocument> mDocument;
|
||||
};
|
||||
|
||||
#endif /* nsHTMLDocShell_h__ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче