**Not hooked up to build** Implemented Repaint. Changed document to be a readonly attribute. Added a SetDocument that takes a contentType. Implemented this. Changed all the idl methods to be lower-case.

git-svn-id: svn://10.0.0.236/trunk@52450 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tbogard%aol.net
1999-11-02 01:04:25 +00:00
parent 81ef7e0434
commit c98bf7e9a6
2 changed files with 47 additions and 22 deletions

View File

@@ -45,12 +45,12 @@ interface nsIWebBrowserNav : nsISupports
/*
Tells the browser to navigate to the next Back session history item.
*/
void GoBack();
void goBack();
/*
Tells the browser to navigate to the next Forward session history item.
*/
void GoForward();
void goForward();
/*
Loads a given URI. This will give priority to loading the requested URI
@@ -60,7 +60,7 @@ interface nsIWebBrowserNav : nsISupports
@param uri - The URI to load.
*/
void LoadURI(in wstring uri);
void loadURI(in wstring uri);
/*
Loads a given URI through the specified adapter. This will give priority
@@ -71,19 +71,31 @@ interface nsIWebBrowserNav : nsISupports
@param uri - The URI to load.
@param adapterBinding - The local IP address of the adapter to bind to.
*/
void LoadURIVia(in wstring uri, in unsigned long adapterBinding);
void loadURIVia(in wstring uri, in unsigned long adapterBinding);
void Reload(); //XXX Should take a cache parameter
void reload(); //XXX Should take a cache parameter
/*
Stops a load of a URI.
*/
void Stop();
void stop();
/*
Set the document for the current webBrowser. This will simulate the normal
load process of a document being loaded.
@param document - The document to be set.
@param contentType - This is the content type to try and render the document
as. This may be null. If this is null, the method will try to query
the document to identify the content type of the document. If the query
fails, content type "HTML" will be assumed.
*/
void setDocument(in nsIDOMDocument document, in wstring contentType);
/*
Retrieves or sets the current Document for the WebBrowser. When setting
this will simulate the normal load process.
*/
attribute nsIDOMDocument document;
readonly attribute nsIDOMDocument document;
};

View File

@@ -24,6 +24,8 @@
#include "nsGfxCIID.h"
#include "nsWidgetsCID.h"
#include "nsIDeviceContext.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsWebBrowser.h"
@@ -219,14 +221,28 @@ NS_IMETHODIMP nsWebBrowser::Stop()
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsWebBrowser::SetDocument(nsIDOMDocument* document)
NS_IMETHODIMP nsWebBrowser::SetDocument(nsIDOMDocument* aDocument,
const PRUnichar* aContentType)
{
//XXX First Check
/*
Retrieves or sets the current Document for the WebBrowser. When setting
this will simulate the normal load process.
*/
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aDocument);
nsAutoString contentType(aContentType);
if(contentType.IsEmpty())
{
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDocument));
if(doc)
doc->GetContentType(contentType);
}
if(contentType.IsEmpty())
contentType.Assign("HTML");
NS_ENSURE_SUCCESS(CreateDocShell(contentType.GetUnicode()),
NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(mDocShell->SetDocument(aDocument, nsnull),
NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP nsWebBrowser::GetDocument(nsIDOMDocument** document)
@@ -582,14 +598,11 @@ NS_IMETHODIMP nsWebBrowser::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
NS_IMETHODIMP nsWebBrowser::Repaint(PRBool fForce)
{
//XXX First Check
/**
* Tell the window to repaint itself
* @param aForce - if true, repaint immediately
* if false, the window may defer repainting as it sees fit.
*/
return NS_ERROR_FAILURE;
}
NS_ENSURE_STATE(mDocShell);
nsCOMPtr<nsIGenericWindow> docWnd(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(docWnd, NS_ERROR_FAILURE);
return docWnd->Repaint(fForce); // Can directly return this as it is the
} // same interface, thus same returns.
NS_IMETHODIMP nsWebBrowser::GetParentWidget(nsIWidget** parentWidget)
{