Remove nsRect and nsString from our external API.

git-svn-id: svn://10.0.0.236/branches/NGLayoutStability_BRANCH@7407 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scullin%netscape.com
1998-08-06 00:46:30 +00:00
parent e981030233
commit 7ab439a02a
9 changed files with 210 additions and 188 deletions

View File

@@ -94,12 +94,12 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h);
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Show();
NS_IMETHOD Hide();
@@ -117,34 +117,34 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult);
NS_IMETHOD AddChild(nsIWebShell* aChild);
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName);
NS_IMETHOD SetName(const PRUnichar* aName);
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult);
NS_IMETHOD Back(void);
NS_IMETHOD Forward(void);
NS_IMETHOD LoadURL(const nsString& aURLSpec,
NS_IMETHOD LoadURL(const PRUnichar* aURLSpec,
nsIPostData* aPostData=nsnull);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
// nsILinkHandler
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0);
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec);
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState);
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec);
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState);
// nsIScriptContextOwner
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext);
@@ -152,13 +152,13 @@ public:
NS_IMETHOD ReleaseScriptContext(nsIScriptContext *aContext);
// nsWebShell
void HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
void HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostDat = 0);
void ShowHistory();
nsIWebShell* GetTarget(const nsString& aName);
nsIWebShell* GetTarget(const PRUnichar* aName);
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
@@ -399,13 +399,14 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling,
PRBool aAllowPlugins)
{
//XXX make sure plugins have started up. this really needs to
//be associated with the nsIContentViewerContainer interfaces,
//not the nsIWebShell interfaces. this is a hack. MMP
nsRect aBounds(x,y,w,h);
if (PR_TRUE == aAllowPlugins)
CreatePluginHost();
@@ -498,30 +499,36 @@ nsWebShell::Destroy()
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
nsWebShell::GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h)
{
nsRect aResult;
NS_PRECONDITION(nsnull != mWindow, "null window");
aResult.SetRect(0, 0, 0, 0);
if (nsnull != mWindow) {
mWindow->GetBounds(aResult);
}
x = aResult.x;
y = aResult.y;
w = aResult.width;
h = aResult.height;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetBounds(const nsRect& aBounds)
nsWebShell::SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
// Don't have the widget repaint. Layout will generate repaint requests
// during reflow
mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height,
mWindow->Resize(x, y, w, h,
PR_FALSE);
}
if (nsnull != mContentViewer) {
nsRect rr(0, 0, aBounds.width, aBounds.height);
nsRect rr(0, 0, w, h);
mContentViewer->SetBounds(rr);
}
@@ -713,32 +720,33 @@ nsWebShell::ChildAt(PRInt32 aIndex, nsIWebShell*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetName(nsString& aName)
nsWebShell::GetName(PRUnichar** aName)
{
aName = mName;
*aName = mName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetName(const nsString& aName)
nsWebShell::SetName(const PRUnichar* aName)
{
mName = aName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::FindChildWithName(const nsString& aName,
nsWebShell::FindChildWithName(const PRUnichar* aName1,
nsIWebShell*& aResult)
{
aResult = nsnull;
nsString aName(aName1);
nsAutoString childName;
PRUnichar *childName;
PRInt32 i, n = mChildren.Count();
for (i = 0; i < n; i++) {
nsIWebShell* child = (nsIWebShell*) mChildren.ElementAt(i);
if (nsnull != child) {
child->GetName(childName);
if (childName.Equals(aName)) {
child->GetName(&childName);
if (aName.Equals(childName)) {
aResult = child;
NS_ADDREF(child);
break;
@@ -774,7 +782,7 @@ nsWebShell::Forward(void)
}
NS_IMETHODIMP
nsWebShell::LoadURL(const nsString& aURLSpec,
nsWebShell::LoadURL(const PRUnichar* aURLSpec,
nsIPostData* aPostData)
{
nsresult rv;
@@ -873,15 +881,14 @@ nsWebShell::GetHistoryIndex(PRInt32& aResult)
}
NS_IMETHODIMP
nsWebShell::GetURL(PRInt32 aHistoryIndex, nsString& aURLResult)
nsWebShell::GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
aURLResult.Truncate();
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
if (nsnull != s) {
aURLResult = *s;
*aURLResult = *s;
}
rv = NS_OK;
}
@@ -914,7 +921,7 @@ nsWebShell::ShowHistory()
// Chrome API's
NS_IMETHODIMP
nsWebShell::SetTitle(const nsString& aTitle)
nsWebShell::SetTitle(const PRUnichar* aTitle)
{
// Record local title
mTitle = aTitle;
@@ -930,9 +937,9 @@ nsWebShell::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsWebShell::GetTitle(nsString& aResult)
nsWebShell::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
@@ -941,7 +948,7 @@ nsWebShell::GetTitle(nsString& aResult)
// WebShell container implementation
NS_IMETHODIMP
nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->WillLoadURL(aShell, aURL);
@@ -950,7 +957,7 @@ nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->BeginLoadURL(aShell, aURL);
@@ -959,7 +966,7 @@ nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL);
@@ -972,8 +979,8 @@ nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
// WebShell link handling
struct OnLinkClickEvent : public PLEvent {
OnLinkClickEvent(nsWebShell* aHandler, const nsString& aURLSpec,
const nsString& aTargetSpec, nsIPostData* aPostData = 0);
OnLinkClickEvent(nsWebShell* aHandler, const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec, nsIPostData* aPostData = 0);
~OnLinkClickEvent();
void HandleEvent() {
@@ -997,8 +1004,8 @@ static void PR_CALLBACK DestroyPLEvent(OnLinkClickEvent* aEvent)
}
OnLinkClickEvent::OnLinkClickEvent(nsWebShell* aHandler,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
mHandler = aHandler;
@@ -1030,8 +1037,8 @@ OnLinkClickEvent::~OnLinkClickEvent()
NS_IMETHODIMP
nsWebShell::OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
OnLinkClickEvent* ev;
@@ -1050,21 +1057,22 @@ nsWebShell::OnLinkClick(nsIFrame* aFrame,
// XXX This doesn't yet know how to target other windows with their
// own tree
nsIWebShell*
nsWebShell::GetTarget(const nsString& aName)
nsWebShell::GetTarget(const PRUnichar* aName)
{
nsString name(aName);
nsIWebShell* target = nsnull;
if (aName.EqualsIgnoreCase("_blank")) {
if (name.EqualsIgnoreCase("_blank")) {
// XXX Need api in nsIWebShellContainer
NS_ASSERTION(0, "not implemented yet");
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_self")) {
else if (name.EqualsIgnoreCase("_self")) {
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_parent")) {
else if (name.EqualsIgnoreCase("_parent")) {
if (nsnull == mParent) {
target = this;
}
@@ -1073,7 +1081,7 @@ nsWebShell::GetTarget(const nsString& aName)
}
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_top")) {
else if (name.EqualsIgnoreCase("_top")) {
GetRootWebShell(target);
}
else {
@@ -1092,8 +1100,8 @@ nsWebShell::GetTarget(const nsString& aName)
}
void
nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
nsWebShell::HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
nsIWebShell* shell = GetTarget(aTargetSpec);
@@ -1104,10 +1112,10 @@ nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
NS_IMETHODIMP
nsWebShell::OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec)
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec)
{
if (!aURLSpec.Equals(mOverURL) || !aTargetSpec.Equals(mOverTarget)) {
if (!mOverURL.Equals(aURLSpec) || !mOverTarget.Equals(aTargetSpec)) {
fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOverTarget, stdout); fputs("'\n", stdout);
fputs("Over link '", stdout);
fputs(aURLSpec, stdout);
@@ -1121,20 +1129,21 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv
}
NS_IMETHODIMP
nsWebShell:: GetLinkState(const nsString& aURLSpec, nsLinkState& aState)
nsWebShell:: GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState)
{
nsString URLSpec(aURLSpec);
aState = eLinkState_Unvisited;
#ifdef NS_DEBUG
if (aURLSpec.Equals("http://visited/")) {
if (URLSpec.Equals("http://visited/")) {
aState = eLinkState_Visited;
}
else if (aURLSpec.Equals("http://out-of-date/")) {
else if (URLSpec.Equals("http://out-of-date/")) {
aState = eLinkState_OutOfDate;
}
else if (aURLSpec.Equals("http://active/")) {
else if (URLSpec.Equals("http://active/")) {
aState = eLinkState_Active;
}
else if (aURLSpec.Equals("http://hover/")) {
else if (URLSpec.Equals("http://hover/")) {
aState = eLinkState_Hover;
}
#endif

View File

@@ -69,15 +69,15 @@ public:
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult) = 0;
NS_IMETHOD LoadURL(const nsString& aURL) = 0;
NS_IMETHOD LoadURL(const PRUnichar* aURL) = 0;
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar** aResult) = 0;
NS_IMETHOD SetStatus(const nsString& aStatus) = 0;
NS_IMETHOD SetStatus(const PRUnichar* aStatus) = 0;
NS_IMETHOD GetStatus(nsString& aResult) = 0;
NS_IMETHOD GetStatus(PRUnichar** aResult) = 0;
NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0;

View File

@@ -23,7 +23,6 @@
#include "nsISupports.h"
class nsIFrame;
class nsString;
class nsIPostData;
struct nsGUIEvent;
@@ -51,8 +50,8 @@ public:
* targeted (it may be an empty string).
*/
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0) = 0;
/**
@@ -62,13 +61,13 @@ public:
* targeted (it may be an empty string).
*/
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec) = 0;
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec) = 0;
/**
* Get the state of a link to a given absolute URL
*/
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState) = 0;
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState) = 0;
};
#endif /* nsILinkHandler_h___ */

View File

@@ -49,16 +49,16 @@ class nsIPref;
// Container for web shell's
class nsIWebShellContainer : public nsISupports {
public:
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar** aResult) = 0;
// History control
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) = 0;
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) = 0;
// XXX not yet implemented; should we?
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) = 0;
// Chrome control
// NS_IMETHOD SetHistoryIndex(PRInt32 aIndex, PRInt32 aMaxIndex) = 0;
@@ -84,15 +84,15 @@ public:
class nsIWebShell : public nsIContentViewerContainer {
public:
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE) = 0;
NS_IMETHOD Destroy() = 0;
NS_IMETHOD GetBounds(nsRect& aResult) = 0;
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h) = 0;
NS_IMETHOD SetBounds(const nsRect& aBounds) = 0;
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) = 0;
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY) = 0;
@@ -120,24 +120,24 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult) = 0;
NS_IMETHOD AddChild(nsIWebShell* aChild) = 0;
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult) = 0;
NS_IMETHOD GetName(nsString& aName) = 0;
NS_IMETHOD SetName(const nsString& aName) = 0;
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName) = 0;
NS_IMETHOD SetName(const PRUnichar* aName) = 0;
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult) = 0;
// History api's
NS_IMETHOD Back() = 0;
NS_IMETHOD Forward() = 0;
NS_IMETHOD LoadURL(const nsString& aURLSpec,
NS_IMETHOD LoadURL(const PRUnichar* aURLSpec,
nsIPostData* aPostData=nsnull) = 0;
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar **aURLResult) = 0;
// Chrome api's
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar *aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar **aResult) = 0;
// SetToolBar
// SetMenuBar
// SetStatusBar

View File

@@ -34,6 +34,7 @@
#include "nsIWebShell.h"
#include "nsString.h"
#include "plevent.h"
#include "private/pprthred.h"
static HMODULE g_DllInst = NULL;
@@ -100,6 +101,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
// for now here is as good a place as any...
//
if (TRUE == isFirstTime) {
PR_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL);
PL_InitializeEventsLib("");
NS_SetupRegistry();
@@ -329,4 +331,4 @@ STDAPI DllUnregisterServer(void)
return NOERROR;
}
#endif // XP_PC
#endif // XP_PC

View File

@@ -94,12 +94,12 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h);
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Show();
NS_IMETHOD Hide();
@@ -117,34 +117,34 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult);
NS_IMETHOD AddChild(nsIWebShell* aChild);
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName);
NS_IMETHOD SetName(const PRUnichar* aName);
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult);
NS_IMETHOD Back(void);
NS_IMETHOD Forward(void);
NS_IMETHOD LoadURL(const nsString& aURLSpec,
NS_IMETHOD LoadURL(const PRUnichar* aURLSpec,
nsIPostData* aPostData=nsnull);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
// nsILinkHandler
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0);
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec);
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState);
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec);
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState);
// nsIScriptContextOwner
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext);
@@ -152,13 +152,13 @@ public:
NS_IMETHOD ReleaseScriptContext(nsIScriptContext *aContext);
// nsWebShell
void HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
void HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostDat = 0);
void ShowHistory();
nsIWebShell* GetTarget(const nsString& aName);
nsIWebShell* GetTarget(const PRUnichar* aName);
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
@@ -399,13 +399,14 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling,
PRBool aAllowPlugins)
{
//XXX make sure plugins have started up. this really needs to
//be associated with the nsIContentViewerContainer interfaces,
//not the nsIWebShell interfaces. this is a hack. MMP
nsRect aBounds(x,y,w,h);
if (PR_TRUE == aAllowPlugins)
CreatePluginHost();
@@ -498,30 +499,36 @@ nsWebShell::Destroy()
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
nsWebShell::GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h)
{
nsRect aResult;
NS_PRECONDITION(nsnull != mWindow, "null window");
aResult.SetRect(0, 0, 0, 0);
if (nsnull != mWindow) {
mWindow->GetBounds(aResult);
}
x = aResult.x;
y = aResult.y;
w = aResult.width;
h = aResult.height;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetBounds(const nsRect& aBounds)
nsWebShell::SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
// Don't have the widget repaint. Layout will generate repaint requests
// during reflow
mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height,
mWindow->Resize(x, y, w, h,
PR_FALSE);
}
if (nsnull != mContentViewer) {
nsRect rr(0, 0, aBounds.width, aBounds.height);
nsRect rr(0, 0, w, h);
mContentViewer->SetBounds(rr);
}
@@ -713,32 +720,33 @@ nsWebShell::ChildAt(PRInt32 aIndex, nsIWebShell*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetName(nsString& aName)
nsWebShell::GetName(PRUnichar** aName)
{
aName = mName;
*aName = mName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetName(const nsString& aName)
nsWebShell::SetName(const PRUnichar* aName)
{
mName = aName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::FindChildWithName(const nsString& aName,
nsWebShell::FindChildWithName(const PRUnichar* aName1,
nsIWebShell*& aResult)
{
aResult = nsnull;
nsString aName(aName1);
nsAutoString childName;
PRUnichar *childName;
PRInt32 i, n = mChildren.Count();
for (i = 0; i < n; i++) {
nsIWebShell* child = (nsIWebShell*) mChildren.ElementAt(i);
if (nsnull != child) {
child->GetName(childName);
if (childName.Equals(aName)) {
child->GetName(&childName);
if (aName.Equals(childName)) {
aResult = child;
NS_ADDREF(child);
break;
@@ -774,7 +782,7 @@ nsWebShell::Forward(void)
}
NS_IMETHODIMP
nsWebShell::LoadURL(const nsString& aURLSpec,
nsWebShell::LoadURL(const PRUnichar* aURLSpec,
nsIPostData* aPostData)
{
nsresult rv;
@@ -873,15 +881,14 @@ nsWebShell::GetHistoryIndex(PRInt32& aResult)
}
NS_IMETHODIMP
nsWebShell::GetURL(PRInt32 aHistoryIndex, nsString& aURLResult)
nsWebShell::GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
aURLResult.Truncate();
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
if (nsnull != s) {
aURLResult = *s;
*aURLResult = *s;
}
rv = NS_OK;
}
@@ -914,7 +921,7 @@ nsWebShell::ShowHistory()
// Chrome API's
NS_IMETHODIMP
nsWebShell::SetTitle(const nsString& aTitle)
nsWebShell::SetTitle(const PRUnichar* aTitle)
{
// Record local title
mTitle = aTitle;
@@ -930,9 +937,9 @@ nsWebShell::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsWebShell::GetTitle(nsString& aResult)
nsWebShell::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
@@ -941,7 +948,7 @@ nsWebShell::GetTitle(nsString& aResult)
// WebShell container implementation
NS_IMETHODIMP
nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->WillLoadURL(aShell, aURL);
@@ -950,7 +957,7 @@ nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->BeginLoadURL(aShell, aURL);
@@ -959,7 +966,7 @@ nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL);
@@ -972,8 +979,8 @@ nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
// WebShell link handling
struct OnLinkClickEvent : public PLEvent {
OnLinkClickEvent(nsWebShell* aHandler, const nsString& aURLSpec,
const nsString& aTargetSpec, nsIPostData* aPostData = 0);
OnLinkClickEvent(nsWebShell* aHandler, const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec, nsIPostData* aPostData = 0);
~OnLinkClickEvent();
void HandleEvent() {
@@ -997,8 +1004,8 @@ static void PR_CALLBACK DestroyPLEvent(OnLinkClickEvent* aEvent)
}
OnLinkClickEvent::OnLinkClickEvent(nsWebShell* aHandler,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
mHandler = aHandler;
@@ -1030,8 +1037,8 @@ OnLinkClickEvent::~OnLinkClickEvent()
NS_IMETHODIMP
nsWebShell::OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
OnLinkClickEvent* ev;
@@ -1050,21 +1057,22 @@ nsWebShell::OnLinkClick(nsIFrame* aFrame,
// XXX This doesn't yet know how to target other windows with their
// own tree
nsIWebShell*
nsWebShell::GetTarget(const nsString& aName)
nsWebShell::GetTarget(const PRUnichar* aName)
{
nsString name(aName);
nsIWebShell* target = nsnull;
if (aName.EqualsIgnoreCase("_blank")) {
if (name.EqualsIgnoreCase("_blank")) {
// XXX Need api in nsIWebShellContainer
NS_ASSERTION(0, "not implemented yet");
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_self")) {
else if (name.EqualsIgnoreCase("_self")) {
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_parent")) {
else if (name.EqualsIgnoreCase("_parent")) {
if (nsnull == mParent) {
target = this;
}
@@ -1073,7 +1081,7 @@ nsWebShell::GetTarget(const nsString& aName)
}
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_top")) {
else if (name.EqualsIgnoreCase("_top")) {
GetRootWebShell(target);
}
else {
@@ -1092,8 +1100,8 @@ nsWebShell::GetTarget(const nsString& aName)
}
void
nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
nsWebShell::HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
nsIWebShell* shell = GetTarget(aTargetSpec);
@@ -1104,10 +1112,10 @@ nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
NS_IMETHODIMP
nsWebShell::OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec)
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec)
{
if (!aURLSpec.Equals(mOverURL) || !aTargetSpec.Equals(mOverTarget)) {
if (!mOverURL.Equals(aURLSpec) || !mOverTarget.Equals(aTargetSpec)) {
fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOverTarget, stdout); fputs("'\n", stdout);
fputs("Over link '", stdout);
fputs(aURLSpec, stdout);
@@ -1121,20 +1129,21 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv
}
NS_IMETHODIMP
nsWebShell:: GetLinkState(const nsString& aURLSpec, nsLinkState& aState)
nsWebShell:: GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState)
{
nsString URLSpec(aURLSpec);
aState = eLinkState_Unvisited;
#ifdef NS_DEBUG
if (aURLSpec.Equals("http://visited/")) {
if (URLSpec.Equals("http://visited/")) {
aState = eLinkState_Visited;
}
else if (aURLSpec.Equals("http://out-of-date/")) {
else if (URLSpec.Equals("http://out-of-date/")) {
aState = eLinkState_OutOfDate;
}
else if (aURLSpec.Equals("http://active/")) {
else if (URLSpec.Equals("http://active/")) {
aState = eLinkState_Active;
}
else if (aURLSpec.Equals("http://hover/")) {
else if (URLSpec.Equals("http://hover/")) {
aState = eLinkState_Hover;
}
#endif

View File

@@ -351,7 +351,7 @@ nsBrowserWindow::Forward()
}
void
nsBrowserWindow::GoTo(const nsString& aURL)
nsBrowserWindow::GoTo(const PRUnichar* aURL)
{
mWebShell->LoadURL(aURL, nsnull);
}
@@ -412,7 +412,7 @@ nsBrowserWindow::DoFileOpen()
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
// Ask the Web widget to load the file URL
LoadURL(lpszFileURL);
LoadURL(nsString(lpszFileURL));
delete lpszFileURL;
}
}
@@ -535,7 +535,8 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
return rv;
}
r.x = r.y = 0;
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), r,
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET),
r.x, r.y, r.width, r.height,
nsScrollPreference_kAuto, aAllowPlugins);
mWebShell->SetContainer((nsIWebShellContainer*) this);
mWebShell->SetObserver((nsIStreamObserver*)this);
@@ -708,7 +709,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
rr.y += WEBSHELL_TOP_INSET;
rr.width -= WEBSHELL_LEFT_INSET + WEBSHELL_RIGHT_INSET;
rr.height -= WEBSHELL_TOP_INSET + WEBSHELL_BOTTOM_INSET;
mWebShell->SetBounds(rr);
mWebShell->SetBounds(rr.x, rr.y, rr.width, rr.height);
}
NS_IMETHODIMP
@@ -770,7 +771,7 @@ nsBrowserWindow::GetChrome(PRUint32& aChromeMaskResult)
}
NS_IMETHODIMP
nsBrowserWindow::LoadURL(const nsString& aURL)
nsBrowserWindow::LoadURL(const PRUnichar* aURL)
{
return mWebShell->LoadURL(aURL, nsnull);
}
@@ -786,7 +787,7 @@ nsBrowserWindow::GetWebShell(nsIWebShell*& aResult)
//----------------------------------------
NS_IMETHODIMP
nsBrowserWindow::SetTitle(const nsString& aTitle)
nsBrowserWindow::SetTitle(const PRUnichar* aTitle)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
mTitle = aTitle;
@@ -795,14 +796,14 @@ nsBrowserWindow::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsBrowserWindow::GetTitle(nsString& aResult)
nsBrowserWindow::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::SetStatus(const nsString& aStatus)
nsBrowserWindow::SetStatus(const PRUnichar* aStatus)
{
NS_PRECONDITION(nsnull != mStatus, "null window");
mStatus->SetText(aStatus);
@@ -810,13 +811,13 @@ nsBrowserWindow::SetStatus(const nsString& aStatus)
}
NS_IMETHODIMP
nsBrowserWindow::GetStatus(nsString& aResult)
nsBrowserWindow::GetStatus(PRUnichar** aResult)
{
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (mStatus) {
nsAutoString url("Connecting to ");
@@ -827,7 +828,7 @@ nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (mThrobber) {
mThrobber->Start();
@@ -837,7 +838,7 @@ nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (mThrobber) {
mThrobber->Stop();
@@ -1199,16 +1200,18 @@ nsBrowserWindow::DumpViews(FILE* out)
static void DumpAWebShell(nsIWebShell* aShell, FILE* out, PRInt32 aIndent)
{
nsAutoString name;
PRUnichar *name;
nsAutoString str;
nsIWebShell* parent;
PRInt32 i, n;
for (i = aIndent; --i >= 0; ) fprintf(out, " ");
fprintf(out, "%p '", aShell);
aShell->GetName(name);
aShell->GetName(&name);
aShell->GetParent(parent);
fputs(name, out);
str = name;
fputs(str, out);
fprintf(out, "' parent=%p <\n", parent);
NS_IF_RELEASE(parent);
@@ -1407,8 +1410,8 @@ nsBrowserWindow::DoDebugSave()
PRBool doSave = PR_FALSE;
nsString path;
nsString urlString;
mWebShell->GetURL(0,urlString);
PRUnichar *urlString;
mWebShell->GetURL(0,&urlString);
nsIURL* url;
nsresult rv = NS_NewURL(&url, urlString);

View File

@@ -69,23 +69,23 @@ public:
NS_IMETHOD Hide();
NS_IMETHOD ChangeChrome(PRUint32 aNewChromeMask);
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult);
NS_IMETHOD LoadURL(const nsString& aURL);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD SetStatus(const nsString& aStatus);
NS_IMETHOD GetStatus(nsString& aResult);
NS_IMETHOD LoadURL(const PRUnichar* aURL);
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
NS_IMETHOD SetStatus(const PRUnichar* aStatus);
NS_IMETHOD GetStatus(PRUnichar** aResult);
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString &aMsg);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
// nsINetSupport
NS_IMETHOD_(void) Alert(const nsString &aText);
@@ -107,7 +107,7 @@ public:
void Destroy();
void Back();
void Forward();
void GoTo(const nsString& aURL);
void GoTo(const PRUnichar* aURL);
void StartThrobber();
void StopThrobber();
void LoadThrobberImages();

View File

@@ -692,7 +692,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
SetDlgItemText(hDlg,IDC_SITE_NAME, gTop100List[gTop100Pointer]);
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),TRUE);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
return FALSE;
case WM_COMMAND:
@@ -705,7 +705,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
EnableWindow(GetDlgItem(hDlg,ID_SITE_NEXT),TRUE);
SetDlgItemText(hDlg,IDC_SITE_NAME, p);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
else {
EnableWindow(GetDlgItem(hDlg,ID_SITE_NEXT),FALSE);
@@ -720,7 +720,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),TRUE);
SetDlgItemText(hDlg,IDC_SITE_NAME, gTop100List[--gTop100Pointer]);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
else {
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),FALSE);