Port to new nsIWebShell and related API's

This commit is contained in:
kipp%netscape.com 1998-07-18 21:47:56 +00:00
Родитель 1abce127ef
Коммит 6eef05bf6b
21 изменённых файлов: 151 добавлений и 191 удалений

Просмотреть файл

@ -38,7 +38,7 @@ class nsIURL;
class nsIViewManager;
class nsString;
class nsIScriptContextOwner;
class nsIViewerContainer;
class nsIContentViewerContainer;
class nsIDOMEvent;
class nsIDeviceContext;
class nsIParser;
@ -74,7 +74,7 @@ public:
virtual nsIArena* GetArena() = 0;
NS_IMETHOD StartDocumentLoad(nsIURL *aUrl,
nsIViewerContainer* aContainer,
nsIContentViewerContainer* aContainer,
nsIStreamListener **aDocListener) = 0;
/**

Просмотреть файл

@ -41,10 +41,11 @@
#include "nsIImageMap.h"
#include "nsRepository.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
extern nsresult NS_NewHTMLIFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget); // XXX move
nsIAtom* aTag, nsIWebShell* aWebShell); // XXX move
// XXX attribute values have entities in them - use the parsers expander!
// XXX Go through a factory for this one
@ -102,7 +103,9 @@ public:
return (void*) rv;
}
nsresult Init(nsIDocument* aDoc, nsIURL* aURL, nsIWebWidget* aWebWidget);
nsresult Init(nsIDocument* aDoc,
nsIURL* aURL,
nsIWebShell* aContainer);
nsIHTMLContent* GetCurrentContainer(eHTMLTags* aType);
nsIHTMLContent* GetTableParent();
@ -229,7 +232,7 @@ protected:
PRTime mUpdateDelta;
PRBool mLayoutStarted;
PRInt32 mInMonolithicContainer;
nsIWebWidget* mWebWidget;
nsIWebShell* mWebShell;
};
// Note: operator new zeros our memory
@ -257,7 +260,7 @@ HTMLContentSink::~HTMLContentSink()
NS_IF_RELEASE(mCurrentMap);
NS_IF_RELEASE(mCurrentSelect);
NS_IF_RELEASE(mCurrentOption);
NS_IF_RELEASE(mWebWidget);
NS_IF_RELEASE(mWebShell);
if (nsnull != mTitle) {
delete mTitle;
@ -267,7 +270,7 @@ HTMLContentSink::~HTMLContentSink()
nsresult
HTMLContentSink::Init(nsIDocument* aDoc,
nsIURL* aDocURL,
nsIWebWidget* aWebWidget)
nsIWebShell* aWebShell)
{
NS_IF_RELEASE(mDocument);
mDocument = aDoc;
@ -277,9 +280,9 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mDocumentURL = aDocURL;
NS_IF_ADDREF(mDocumentURL);
NS_IF_RELEASE(mWebWidget);
mWebWidget = aWebWidget;
NS_IF_ADDREF(mWebWidget);
NS_IF_RELEASE(mWebShell);
mWebShell = aWebShell;
NS_IF_ADDREF(mWebShell);
// Make root part
NS_IF_RELEASE(mRoot);
@ -1846,7 +1849,7 @@ HTMLContentSink::ProcessIFRAMETag(nsIHTMLContent** aInstancePtrResult,
nsAutoString tmp("IFRAME");
nsIAtom* atom = NS_NewAtom(tmp);
nsresult rv = NS_NewHTMLIFrame(aInstancePtrResult, atom, mWebWidget);
nsresult rv = NS_NewHTMLIFrame(aInstancePtrResult, atom, mWebShell);
NS_RELEASE(atom);
return rv;
@ -1871,7 +1874,7 @@ nsresult HTMLContentSink::ProcessWBRTag(nsIHTMLContent** aInstancePtrResult,
nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
nsIDocument* aDoc,
nsIURL* aURL,
nsIWebWidget* aWebWidget)
nsIWebShell* aWebShell)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
@ -1881,7 +1884,7 @@ nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aDoc, aURL, aWebWidget);
nsresult rv = it->Init(aDoc, aURL, aWebShell);
if (NS_OK != rv) {
delete it;
return rv;

Просмотреть файл

@ -33,7 +33,8 @@
#include "nsIPostToServer.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsIWebWidget.h"
#include "nsIContentViewerContainer.h"
#include "nsIWebShell.h"
#include "nsIDocumentLoader.h"
#include "CNavDTD.h"
@ -43,7 +44,7 @@
#include "nsHTMLContentSinkStream.h"
#endif
static NS_DEFINE_IID(kIWebWidgetIID, NS_IWEBWIDGET_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
@ -87,11 +88,11 @@ NS_IMETHODIMP nsHTMLDocument::QueryInterface(REFNSIID aIID,
NS_IMETHODIMP
nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
nsIViewerContainer* aWebWidget,
nsIContentViewerContainer* aContainer,
nsIStreamListener **aDocListener)
{
nsresult rv;
nsIWebWidget* ww;
nsIWebShell* webShell;
// Delete references to style sheets - this should be done in superclass...
PRInt32 index = mStyleSheets.Count();
@ -119,9 +120,9 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
#ifdef rickgdebug
rv = NS_New_HTML_ContentSinkStream(&sink);
#else
aWebWidget->QueryInterface(kIWebWidgetIID, (void**)&ww);
rv = NS_NewHTMLContentSink(&sink, this, aURL, ww);
NS_IF_RELEASE(ww);
aContainer->QueryInterface(kIWebShellIID, (void**)&webShell);
rv = NS_NewHTMLContentSink(&sink, this, aURL, webShell);
NS_IF_RELEASE(webShell);
#endif
if (NS_OK == rv) {

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsIHTMLDocument.h"
class nsIHTMLStyleSheet;
class nsIViewerContainer;
class nsIContentViewerContainer;
class nsHTMLDocument : public nsMarkupDocument {
public:
@ -33,7 +33,7 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD StartDocumentLoad(nsIURL* aUrl,
nsIViewerContainer* aContainer,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener);
NS_IMETHOD SetTitle(const nsString& aTitle);

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsIRobotSink.h"
#include "nsIRobotSinkObserver.h"
#include "nsIParser.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsVoidArray.h"
#include "nsString.h"
#include "nsIURL.h"
@ -148,7 +148,7 @@ extern "C" NS_EXPORT void DumpVectorRecord(void);
//----------------------------------------------------------------------
extern "C" NS_EXPORT int DebugRobot(
nsVoidArray * workList,
nsIWebWidget * ww,
nsIWebShell * ww,
int iMaxLoads,
char * verify_dir,
void (*yieldProc )(const char *)

Просмотреть файл

@ -1,9 +1,9 @@
#include <stdio.h>
#include "nsVoidArray.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsString.h"
extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww);
extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww);
int main(int argc, char **argv)
{

Просмотреть файл

@ -38,7 +38,7 @@ class nsIURL;
class nsIViewManager;
class nsString;
class nsIScriptContextOwner;
class nsIViewerContainer;
class nsIContentViewerContainer;
class nsIDOMEvent;
class nsIDeviceContext;
class nsIParser;
@ -74,7 +74,7 @@ public:
virtual nsIArena* GetArena() = 0;
NS_IMETHOD StartDocumentLoad(nsIURL *aUrl,
nsIViewerContainer* aContainer,
nsIContentViewerContainer* aContainer,
nsIStreamListener **aDocListener) = 0;
/**

Просмотреть файл

@ -30,14 +30,15 @@ class nsIHTMLContentSink;
class nsITextContent;
class nsIURL;
class nsString;
class nsIWebWidget;
class nsIWebShell;
// XXX naming consistency puhleeze!
// XXX passing aWebShell into this is wrong
extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
nsIDocument* aDoc,
nsIURL* aURL,
nsIWebWidget* aWebWidget);
nsIWebShell* aWebShell);
/**
* Create a new content object for the given tag.

Просмотреть файл

@ -30,14 +30,15 @@ class nsIHTMLContentSink;
class nsITextContent;
class nsIURL;
class nsString;
class nsIWebWidget;
class nsIWebShell;
// XXX naming consistency puhleeze!
// XXX passing aWebShell into this is wrong
extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
nsIDocument* aDoc,
nsIURL* aURL,
nsIWebWidget* aWebWidget);
nsIWebShell* aWebShell);
/**
* Create a new content object for the given tag.

Просмотреть файл

@ -1,43 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIWebFrame_h___
#define nsIWebFrame_h___
#include "nsCom.h"
#include "nsISupports.h"
#include "nsIWebWidget.h"
// IID for the nsIWebFrame interface
#define NS_IWEBFRAME_IID \
{ 0xecace1b0, 0x541, 0x11d2, \
{ 0x80, 0x34, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
/**
* Interface used for distinguishing frames that have web widgets associated
* with them (i.e. <iframe>, <frame>)
*/
class nsIWebFrame : public nsISupports {
public:
/**
* Get the associated web widget and increment the ref count.
*/
virtual nsIWebWidget* GetWebWidget() = 0;
};
#endif /* nsIWebWidget_h___ */

Просмотреть файл

@ -41,10 +41,11 @@
#include "nsIImageMap.h"
#include "nsRepository.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
extern nsresult NS_NewHTMLIFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget); // XXX move
nsIAtom* aTag, nsIWebShell* aWebShell); // XXX move
// XXX attribute values have entities in them - use the parsers expander!
// XXX Go through a factory for this one
@ -102,7 +103,9 @@ public:
return (void*) rv;
}
nsresult Init(nsIDocument* aDoc, nsIURL* aURL, nsIWebWidget* aWebWidget);
nsresult Init(nsIDocument* aDoc,
nsIURL* aURL,
nsIWebShell* aContainer);
nsIHTMLContent* GetCurrentContainer(eHTMLTags* aType);
nsIHTMLContent* GetTableParent();
@ -229,7 +232,7 @@ protected:
PRTime mUpdateDelta;
PRBool mLayoutStarted;
PRInt32 mInMonolithicContainer;
nsIWebWidget* mWebWidget;
nsIWebShell* mWebShell;
};
// Note: operator new zeros our memory
@ -257,7 +260,7 @@ HTMLContentSink::~HTMLContentSink()
NS_IF_RELEASE(mCurrentMap);
NS_IF_RELEASE(mCurrentSelect);
NS_IF_RELEASE(mCurrentOption);
NS_IF_RELEASE(mWebWidget);
NS_IF_RELEASE(mWebShell);
if (nsnull != mTitle) {
delete mTitle;
@ -267,7 +270,7 @@ HTMLContentSink::~HTMLContentSink()
nsresult
HTMLContentSink::Init(nsIDocument* aDoc,
nsIURL* aDocURL,
nsIWebWidget* aWebWidget)
nsIWebShell* aWebShell)
{
NS_IF_RELEASE(mDocument);
mDocument = aDoc;
@ -277,9 +280,9 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mDocumentURL = aDocURL;
NS_IF_ADDREF(mDocumentURL);
NS_IF_RELEASE(mWebWidget);
mWebWidget = aWebWidget;
NS_IF_ADDREF(mWebWidget);
NS_IF_RELEASE(mWebShell);
mWebShell = aWebShell;
NS_IF_ADDREF(mWebShell);
// Make root part
NS_IF_RELEASE(mRoot);
@ -1846,7 +1849,7 @@ HTMLContentSink::ProcessIFRAMETag(nsIHTMLContent** aInstancePtrResult,
nsAutoString tmp("IFRAME");
nsIAtom* atom = NS_NewAtom(tmp);
nsresult rv = NS_NewHTMLIFrame(aInstancePtrResult, atom, mWebWidget);
nsresult rv = NS_NewHTMLIFrame(aInstancePtrResult, atom, mWebShell);
NS_RELEASE(atom);
return rv;
@ -1871,7 +1874,7 @@ nsresult HTMLContentSink::ProcessWBRTag(nsIHTMLContent** aInstancePtrResult,
nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
nsIDocument* aDoc,
nsIURL* aURL,
nsIWebWidget* aWebWidget)
nsIWebShell* aWebShell)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
@ -1881,7 +1884,7 @@ nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aDoc, aURL, aWebWidget);
nsresult rv = it->Init(aDoc, aURL, aWebShell);
if (NS_OK != rv) {
delete it;
return rv;

Просмотреть файл

@ -33,7 +33,8 @@
#include "nsIPostToServer.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsIWebWidget.h"
#include "nsIContentViewerContainer.h"
#include "nsIWebShell.h"
#include "nsIDocumentLoader.h"
#include "CNavDTD.h"
@ -43,7 +44,7 @@
#include "nsHTMLContentSinkStream.h"
#endif
static NS_DEFINE_IID(kIWebWidgetIID, NS_IWEBWIDGET_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
@ -87,11 +88,11 @@ NS_IMETHODIMP nsHTMLDocument::QueryInterface(REFNSIID aIID,
NS_IMETHODIMP
nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
nsIViewerContainer* aWebWidget,
nsIContentViewerContainer* aContainer,
nsIStreamListener **aDocListener)
{
nsresult rv;
nsIWebWidget* ww;
nsIWebShell* webShell;
// Delete references to style sheets - this should be done in superclass...
PRInt32 index = mStyleSheets.Count();
@ -119,9 +120,9 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
#ifdef rickgdebug
rv = NS_New_HTML_ContentSinkStream(&sink);
#else
aWebWidget->QueryInterface(kIWebWidgetIID, (void**)&ww);
rv = NS_NewHTMLContentSink(&sink, this, aURL, ww);
NS_IF_RELEASE(ww);
aContainer->QueryInterface(kIWebShellIID, (void**)&webShell);
rv = NS_NewHTMLContentSink(&sink, this, aURL, webShell);
NS_IF_RELEASE(webShell);
#endif
if (NS_OK == rv) {

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsIHTMLDocument.h"
class nsIHTMLStyleSheet;
class nsIViewerContainer;
class nsIContentViewerContainer;
class nsHTMLDocument : public nsMarkupDocument {
public:
@ -33,7 +33,7 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD StartDocumentLoad(nsIURL* aUrl,
nsIViewerContainer* aContainer,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener);
NS_IMETHOD SetTitle(const nsString& aTitle);

Просмотреть файл

@ -19,7 +19,7 @@
#include "nsHTMLContainer.h"
#include "nsLeafFrame.h"
#include "nsHTMLContainerFrame.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
@ -38,15 +38,15 @@
#include "nsIStyleContext.h"
#include "nsCSSLayout.h"
#include "nsIDocumentLoader.h"
#include "nsIDocumentWidget.h"
//#include "nsIDocumentWidget.h"
#include "nsHTMLFrameset.h"
class nsHTMLFrame;
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIWebWidgetIID, NS_IWEBWIDGET_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIWebFrameIID, NS_IWEBFRAME_IID);
static NS_DEFINE_IID(kCWebWidgetCID, NS_WEBWIDGET_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
static NS_DEFINE_IID(kCViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
@ -129,6 +129,8 @@ public:
nsHTMLFrameInnerFrame(nsIContent* aContent, nsIFrame* aParentFrame);
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
/**
* @see nsIFrame::Paint
*/
@ -147,16 +149,14 @@ public:
NS_IMETHOD MoveTo(nscoord aX, nscoord aY);
NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight);
virtual nsIWebWidget* GetWebWidget();
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
float GetTwipsToPixels();
// float GetTwipsToPixels();
NS_IMETHOD GetParentContent(nsHTMLFrame*& aContent);
NS_DECL_ISUPPORTS
protected:
nsresult CreateWebWidget(const nsSize& aSize);
nsresult CreateWebShell(nsIPresContext& aPresContext, const nsSize& aSize);
virtual ~nsHTMLFrameInnerFrame();
@ -164,7 +164,7 @@ protected:
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsIWebWidget* mWebWidget;
nsIWebShell* mWebShell;
PRBool mCreatingViewer;
// XXX fix these
@ -193,17 +193,17 @@ public:
virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue);
protected:
nsHTMLFrame(nsIAtom* aTag, PRBool aInline, nsIWebWidget* aParentWebWidget);
nsHTMLFrame(nsIAtom* aTag, PRBool aInline, nsIWebShell* aParentWebWidget);
virtual ~nsHTMLFrame();
PRBool mInline; // true for <IFRAME>, false for <FRAME>
// this is held for a short time until the frame uses it, so it is not ref counted
nsIWebWidget* mParentWebWidget;
nsIWebShell* mParentWebWidget;
friend nsresult NS_NewHTMLIFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget);
nsIAtom* aTag, nsIWebShell* aWebWidget);
friend nsresult NS_NewHTMLFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget);
nsIAtom* aTag, nsIWebShell* aWebWidget);
friend class nsHTMLFrameInnerFrame;
};
@ -301,6 +301,8 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
if (nsnull == mFirstChild) {
mFirstChild = new nsHTMLFrameInnerFrame(mContent, this);
// XXX temporary! use style system to get correct style!
mFirstChild->SetStyleContext(&aPresContext, mStyleContext);
mChildCount = 1;
}
@ -335,15 +337,11 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
/*******************************************************************************
* nsHTMLFrameInnerFrame
******************************************************************************/
nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame(nsIContent* aContent, nsIFrame* aParentFrame)
nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame(nsIContent* aContent,
nsIFrame* aParentFrame)
: nsLeafFrame(aContent, aParentFrame)
{
NS_INIT_REFCNT();
// Addref this frame because it supports interfaces which require ref-counting!
NS_ADDREF(this);
mWebWidget = nsnull;
mWebShell = nsnull;
mCreatingViewer = PR_FALSE;
mTempObserver = new TempObserver();
NS_ADDREF(mTempObserver);
@ -351,16 +349,13 @@ nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame(nsIContent* aContent, nsIFrame* aPa
nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
{
NS_IF_RELEASE(mWebWidget);
NS_IF_RELEASE(mWebShell);
NS_RELEASE(mTempObserver);
}
NS_IMPL_ADDREF(nsHTMLFrameInnerFrame);
NS_IMPL_RELEASE(nsHTMLFrameInnerFrame);
nsresult
nsHTMLFrameInnerFrame::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult)
void** aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
if (nsnull == aInstancePtrResult) {
@ -368,30 +363,27 @@ nsHTMLFrameInnerFrame::QueryInterface(const nsIID& aIID,
}
if (aIID.Equals(kIWebFrameIID)) {
*aInstancePtrResult = (void*) ((nsIWebFrame*)this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtrResult = (void*) ((nsISupports*)((nsIWebFrame*)this));
AddRef();
return NS_OK;
}
return nsLeafFrame::QueryInterface(aIID, aInstancePtrResult);
}
nsIWebWidget* nsHTMLFrameInnerFrame::GetWebWidget()
NS_IMETHODIMP
nsHTMLFrameInnerFrame::GetWebShell(nsIWebShell*& aResult)
{
NS_IF_ADDREF(mWebWidget);
return mWebWidget;
aResult = mWebShell;
NS_IF_ADDREF(mWebShell);
return NS_OK;
}
#if 0
float nsHTMLFrameInnerFrame::GetTwipsToPixels()
{
nsISupports* parentSup;
if (mWebWidget) {
mWebWidget->GetContainer(&parentSup);
if (mWebShell) {
mWebShell->GetContainer(&parentSup);
if (parentSup) {
nsIWebWidget* parentWidget;
nsIWebShell* parentWidget;
nsresult res = parentSup->QueryInterface(kIWebWidgetIID, (void**)&parentWidget);
if (NS_OK == res) {
nsIPresContext* presContext = parentWidget->GetPresContext();
@ -410,6 +402,7 @@ float nsHTMLFrameInnerFrame::GetTwipsToPixels()
}
return (float)0.05; // this should not be reached
}
#endif
NS_METHOD
@ -430,8 +423,8 @@ nsHTMLFrameInnerFrame::Paint(nsIPresContext& aPresContext,
const nsRect& aDirtyRect)
{
//printf("inner paint %d %d %d %d \n", aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
if (nsnull != mWebWidget) {
//mWebWidget->Show();
if (nsnull != mWebShell) {
//mWebShell->Show();
}
return NS_OK;
}
@ -461,13 +454,16 @@ void TempMakeAbsURL(nsIContent* aContent, nsString& aRelURL, nsString& aAbsURL)
}
nsresult nsHTMLFrameInnerFrame::CreateWebWidget(const nsSize& aSize)
nsresult
nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
const nsSize& aSize)
{
nsresult rv;
nsHTMLFrame* content;
GetParentContent(content);
rv = NSRepository::CreateInstance(kCWebWidgetCID, nsnull, kIWebWidgetIID, (void**)&mWebWidget);
rv = NSRepository::CreateInstance(kWebShellCID, nsnull, kIWebShellIID,
(void**)&mWebShell);
if (NS_OK != rv) {
NS_ASSERTION(0, "could not create web widget");
return rv;
@ -475,26 +471,29 @@ nsresult nsHTMLFrameInnerFrame::CreateWebWidget(const nsSize& aSize)
nsString frameName;
if (content->GetName(frameName)) {
mWebWidget->SetName(frameName);
mWebShell->SetName(frameName);
}
// set the web widget parentage
nsIWebWidget* parentWebWidget = content->mParentWebWidget;
parentWebWidget->AddChild(mWebWidget);
// If our container is a web-shell, inform it that it has a new
// child. If it's not a web-shell then some things will not operate
// properly.
nsISupports* container;
aPresContext.GetContainer(&container);
if (nsnull != container) {
nsIWebShell* outerShell = nsnull;
container->QueryInterface(kIWebShellIID, (void**) &outerShell);
if (nsnull != outerShell) {
outerShell->AddChild(mWebShell);
NS_RELEASE(outerShell);
}
NS_RELEASE(container);
}
// Get the view manager, conversion
float t2p = 0.0f;
float t2p = aPresContext.GetTwipsToPixels();
nsIViewManager* viewMan = nsnull;
nsIPresContext* presContext = parentWebWidget->GetPresContext();
t2p = presContext->GetTwipsToPixels();
nsIPresShell *presShell = presContext->GetShell();
nsIPresShell *presShell = aPresContext.GetShell();
viewMan = presShell->GetViewManager();
NS_RELEASE(presShell);
NS_RELEASE(presContext);
//NS_RELEASE(parentWebWidget);
// create, init, set the parent of the view
nsIView* view;
@ -516,20 +515,17 @@ nsresult nsHTMLFrameInnerFrame::CreateWebWidget(const nsSize& aSize)
SetView(view);
NS_RELEASE(parView);
// init the web widget
// init the web widget
mWebWidget->SetUAStyleSheet(parentWebWidget->GetUAStyleSheet());
nsIWidget* widget = view->GetWidget();
NS_RELEASE(view);
nsRect webBounds(0, 0, NS_TO_INT_ROUND(aSize.width * t2p),
NS_TO_INT_ROUND(aSize.height * t2p));
mWebWidget->Init(widget->GetNativeData(NS_NATIVE_WIDGET), webBounds,
mWebShell->Init(widget->GetNativeData(NS_NATIVE_WIDGET), webBounds,
content->GetScrolling());
NS_RELEASE(content);
NS_RELEASE(widget);
mWebWidget->Show();
mWebShell->Show();
return NS_OK;
}
@ -551,20 +547,20 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
content->GetURL(url);
nsSize size;
if (nsnull == mWebWidget) {
rv = CreateWebWidget(aReflowState.maxSize);
if (nsnull == mWebShell) {
rv = CreateWebShell(aPresContext, aReflowState.maxSize);
}
if (nsnull != mWebWidget) {
if (nsnull != mWebShell) {
mCreatingViewer=PR_TRUE;
// load the document
nsString absURL;
TempMakeAbsURL(content, url, absURL);
rv = mWebWidget->LoadURL(absURL, // URL string
mTempObserver, // Observer
nsnull); // Post Data
rv = mWebShell->LoadURL(absURL, // URL string
mTempObserver, // Observer
nsnull); // Post Data
}
NS_RELEASE(content);
}
@ -594,7 +590,7 @@ nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext,
/*******************************************************************************
* nsHTMLFrame
******************************************************************************/
nsHTMLFrame::nsHTMLFrame(nsIAtom* aTag, PRBool aInline, nsIWebWidget* aParentWebWidget)
nsHTMLFrame::nsHTMLFrame(nsIAtom* aTag, PRBool aInline, nsIWebShell* aParentWebWidget)
: nsHTMLContainer(aTag), mInline(aInline), mParentWebWidget(aParentWebWidget)
{
}
@ -697,7 +693,7 @@ PRBool nsHTMLFrame::GetFrameBorder()
nsresult
NS_NewHTMLFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget)
nsIAtom* aTag, nsIWebShell* aWebWidget)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
@ -714,7 +710,7 @@ NS_NewHTMLFrame(nsIHTMLContent** aInstancePtrResult,
nsresult
NS_NewHTMLIFrame(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget)
nsIAtom* aTag, nsIWebShell* aWebWidget)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {

Просмотреть файл

@ -20,7 +20,7 @@
#include "nsHTMLContainer.h"
#include "nsLeafFrame.h"
#include "nsHTMLContainerFrame.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
@ -43,15 +43,16 @@
class nsHTMLIFrame;
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIWebWidgetIID, NS_IWEBWIDGET_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIWebFrameIID, NS_IWEBFRAME_IID);
static NS_DEFINE_IID(kCWebWidgetCID, NS_WEBWIDGET_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
static NS_DEFINE_IID(kCViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID);
static NS_DEFINE_IID(kIViewerContainerIID, NS_IVIEWERCONTAINER_IID);
static NS_DEFINE_IID(kIContentViewerContainerIID,
NS_ICONTENT_VIEWER_CONTAINER_IID);
static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID);
@ -413,14 +414,14 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
/*******************************************************************************
* nsHTMLFrameset
******************************************************************************/
nsHTMLFrameset::nsHTMLFrameset(nsIAtom* aTag, nsIWebWidget* aParentWebWidget)
: nsHTMLContainer(aTag), mParentWebWidget(aParentWebWidget)
nsHTMLFrameset::nsHTMLFrameset(nsIAtom* aTag, nsIWebShell* aParentWebShell)
: nsHTMLContainer(aTag), mParentWebShell(aParentWebShell)
{
}
nsHTMLFrameset::~nsHTMLFrameset()
{
mParentWebWidget = nsnull;
mParentWebShell = nsnull;
}
void nsHTMLFrameset::SetAttribute(nsIAtom* aAttribute, const nsString& aString)
@ -457,14 +458,14 @@ nsHTMLFrameset::CreateFrame(nsIPresContext* aPresContext,
nsresult
NS_NewHTMLFrameset(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget)
nsIAtom* aTag, nsIWebShell* aWebShell)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFrameset(aTag, aWebWidget);
nsIHTMLContent* it = new nsHTMLFrameset(aTag, aWebShell);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -31,7 +31,7 @@ struct nsRect;
struct nsReflowState;
struct nsSize;
class nsIAtom;
class nsIWebWidget;
class nsIWebShell;
enum nsFramesetUnit {
eFramesetUnit_Free = 0,
@ -107,18 +107,15 @@ public:
virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue);
protected:
nsHTMLFrameset(nsIAtom* aTag, nsIWebWidget* aParentWebWidget);
nsHTMLFrameset(nsIAtom* aTag, nsIWebShell* aParentWebShell);
virtual ~nsHTMLFrameset();
friend nsresult NS_NewHTMLFrameset(nsIHTMLContent** aInstancePtrResult,
nsIAtom* aTag, nsIWebWidget* aWebWidget);
nsIAtom* aTag, nsIWebShell* aWebShell);
//friend class nsHTMLFramesetFrame;
// this is held for a short time until the frame uses it, so it is not ref counted
nsIWebWidget* mParentWebWidget;
nsIWebShell* mParentWebShell;
};
#endif

Просмотреть файл

Просмотреть файл

@ -29,7 +29,6 @@
#include "nsISupportsArray.h"
#include "nsDocument.h"
#include "nsIURL.h"
#include "nsIDocumentWidget.h"
void testAttributes(nsIHTMLContent* content) {
nsIAtom* sBORDER = NS_NewAtom("BORDER");
@ -169,7 +168,7 @@ class MyDocument : public nsDocument {
public:
MyDocument();
NS_IMETHOD StartDocumentLoad(nsIURL *aUrl,
nsIViewerContainer* aContainer,
nsIContentViewerContainer* aContainer,
nsIStreamListener **aDocListener)
{
return NS_OK;

Просмотреть файл

@ -40,7 +40,7 @@ class MyDocument : public nsDocument {
public:
MyDocument();
NS_IMETHOD StartDocumentLoad(nsIURL *aUrl,
nsIWebWidget* aWebWidget,
nsIWebShell* aShell,
nsIStreamListener **aDocListener)
{
return NS_OK;

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsIRobotSink.h"
#include "nsIRobotSinkObserver.h"
#include "nsIParser.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsVoidArray.h"
#include "nsString.h"
#include "nsIURL.h"
@ -148,7 +148,7 @@ extern "C" NS_EXPORT void DumpVectorRecord(void);
//----------------------------------------------------------------------
extern "C" NS_EXPORT int DebugRobot(
nsVoidArray * workList,
nsIWebWidget * ww,
nsIWebShell * ww,
int iMaxLoads,
char * verify_dir,
void (*yieldProc )(const char *)

Просмотреть файл

@ -1,9 +1,9 @@
#include <stdio.h>
#include "nsVoidArray.h"
#include "nsIWebWidget.h"
#include "nsIWebShell.h"
#include "nsString.h"
extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww);
extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww);
int main(int argc, char **argv)
{