mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Checking in Fabian Guisset's <hidday@geocities.com> fix for bug 30529. Implement window.minimize(), .maximize() and .restore() for chrome windows, and split chrome specific window methods/attributes into its own nsIDOMChromeWindow interface. r=heikki@netscape.com, sr=jst@netscape.com
This commit is contained in:
parent
52ade1c793
commit
f8e111bab0
@ -5894,7 +5894,8 @@ nsDocShell::EnsureScriptEnvironment()
|
||||
do_GetService(kDOMScriptObjectFactoryCID);
|
||||
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
|
||||
|
||||
factory->NewScriptGlobalObject(getter_AddRefs(mScriptGlobal));
|
||||
factory->NewScriptGlobalObject(mItemType == typeChrome,
|
||||
getter_AddRefs(mScriptGlobal));
|
||||
NS_ENSURE_TRUE(mScriptGlobal, NS_ERROR_FAILURE);
|
||||
|
||||
mScriptGlobal->SetDocShell(NS_STATIC_CAST(nsIDocShell *, this));
|
||||
|
@ -42,9 +42,18 @@
|
||||
[scriptable, uuid(876d6f96-2420-4f78-bc17-00b1a2ec12ba)]
|
||||
interface nsIDOMChromeWindow : nsISupports
|
||||
{
|
||||
const unsigned short STATE_MAXIMIZED = 1;
|
||||
const unsigned short STATE_MINIMIZED = 2;
|
||||
const unsigned short STATE_NORMAL = 3;
|
||||
|
||||
attribute DOMString title;
|
||||
readonly attribute unsigned short windowState;
|
||||
|
||||
void getAttention();
|
||||
|
||||
void setCursor(in DOMString cursor);
|
||||
|
||||
void maximize();
|
||||
void minimize();
|
||||
void restore();
|
||||
};
|
||||
|
@ -84,8 +84,10 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
readonly attribute nsIDOMCrypto crypto;
|
||||
readonly attribute nsIDOMPkcs11 pkcs11;
|
||||
|
||||
// XXX Shouldn't this be in nsIDOMChromeWindow?
|
||||
/* [replaceable] controllers */
|
||||
readonly attribute nsIControllers controllers;
|
||||
|
||||
attribute nsIDOMWindowInternal opener;
|
||||
|
||||
/* [replaceable] */
|
||||
@ -95,8 +97,6 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
// XXX: The setter that takes a string argument needs to be special
|
||||
// cased!
|
||||
readonly attribute nsIDOMLocation location;
|
||||
attribute DOMString title;
|
||||
|
||||
|
||||
/* [replaceable] */
|
||||
attribute long innerWidth;
|
||||
@ -115,7 +115,7 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
void alert(in DOMString text);
|
||||
boolean confirm(in DOMString text);
|
||||
|
||||
// XXX prompt() should return a null string if cancel is pressed
|
||||
// prompt() should return a null string if cancel is pressed
|
||||
DOMString prompt(in DOMString aMessage,
|
||||
in DOMString aInitial,
|
||||
in DOMString aTitle,
|
||||
@ -135,7 +135,6 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
void moveBy(in long xDif, in long yDif);
|
||||
void resizeTo(in long width, in long height);
|
||||
void resizeBy(in long widthDif, in long heightDif);
|
||||
void GetAttention();
|
||||
void scroll(in long xScroll, in long yScroll);
|
||||
|
||||
void clearTimeout(in long timerID);
|
||||
@ -145,8 +144,6 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
//[noscript] long setInterval(/* in function,
|
||||
// in unsigned long timeout */);
|
||||
|
||||
void setCursor(in DOMString cursor);
|
||||
|
||||
[noscript] nsIDOMWindow open(in DOMString url, in DOMString name,
|
||||
in DOMString options);
|
||||
// This method works like open except that aExtraArgument gets
|
||||
@ -160,6 +157,7 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
in nsISupports aExtraArgument);
|
||||
void close();
|
||||
|
||||
// XXX Should this be in nsIDOMChromeWindow?
|
||||
void updateCommands(in DOMString action);
|
||||
|
||||
DOMString escape(in DOMString str);
|
||||
|
@ -253,6 +253,9 @@ enum nsDOMClassInfoID {
|
||||
// more putting things in those categories up there. New entries
|
||||
// are to be added right before eDOMClassInfoIDCount
|
||||
eDOMClassInfo_CSSRect_id,
|
||||
|
||||
// DOM Chrome Window class, almost identical to Window
|
||||
eDOMClassInfo_ChromeWindow_id,
|
||||
|
||||
// This one better be the last one in this list
|
||||
eDOMClassInfoIDCount
|
||||
|
@ -62,7 +62,8 @@ public:
|
||||
nsISupports* aObject,
|
||||
nsIDOMEventListener ** aInstancePtrResult) = 0;
|
||||
|
||||
NS_IMETHOD NewScriptGlobalObject(nsIScriptGlobalObject **aGlobal) = 0;
|
||||
NS_IMETHOD NewScriptGlobalObject(PRBool aIsChrome,
|
||||
nsIScriptGlobalObject **aGlobal) = 0;
|
||||
|
||||
NS_IMETHOD_(nsISupports *)GetClassInfoInstance(nsDOMClassInfoID aID) = 0;
|
||||
};
|
||||
|
@ -90,6 +90,7 @@
|
||||
#include "nsIDOMHistory.h"
|
||||
#include "nsIDOMNSHistory.h"
|
||||
#include "nsIDOMMediaList.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
|
||||
// DOM core includes
|
||||
#include "nsDOMError.h"
|
||||
@ -801,6 +802,19 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
// are to be added to the end of the list
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSRect, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// DOM Chrome Window class
|
||||
NS_DEFINE_CLASSINFO_DATA(ChromeWindow, nsWindowSH,
|
||||
DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_GETPROPERTY |
|
||||
nsIXPCScriptable::WANT_SETPROPERTY |
|
||||
nsIXPCScriptable::WANT_NEWRESOLVE |
|
||||
nsIXPCScriptable::WANT_PRECREATE |
|
||||
nsIXPCScriptable::WANT_FINALIZE |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY |
|
||||
nsIXPCScriptable::WANT_DELPROPERTY |
|
||||
nsIXPCScriptable::WANT_ENUMERATE |
|
||||
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
|
||||
};
|
||||
|
||||
nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull;
|
||||
@ -2010,6 +2024,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeList)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeWindow, nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMChromeWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventReceiver)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -64,6 +64,7 @@
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMJSWindow.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsITimer.h"
|
||||
@ -282,7 +283,6 @@ protected:
|
||||
PRPackedBool mIsDocumentLoaded; // true between onload and onunload events
|
||||
nsString mStatus;
|
||||
nsString mDefaultStatus;
|
||||
nsString mTitle;
|
||||
|
||||
nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // Weak Reference
|
||||
nsIDocShell* mDocShell; // Weak Reference
|
||||
@ -296,6 +296,26 @@ protected:
|
||||
static nsIXPConnect *sXPConnect;
|
||||
};
|
||||
|
||||
/*
|
||||
* nsGlobalChromeWindow inherits from GlobalWindowImpl. It is the global
|
||||
* object created for a Chrome Window only.
|
||||
*/
|
||||
class nsGlobalChromeWindow : public GlobalWindowImpl,
|
||||
public nsIDOMChromeWindow
|
||||
{
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMChromeWindow interface
|
||||
NS_DECL_NSIDOMCHROMEWINDOW
|
||||
|
||||
protected:
|
||||
nsresult GetMainWidget(nsIWidget** aMainWidget);
|
||||
|
||||
nsString mTitle;
|
||||
};
|
||||
|
||||
/*
|
||||
* Timeout struct that holds information about each JavaScript
|
||||
* timeout.
|
||||
|
@ -56,7 +56,8 @@ extern nsresult NS_NewJSEventListener(nsIDOMEventListener **aInstancePtrResult,
|
||||
nsIScriptContext *aContext,
|
||||
nsISupports *aObject);
|
||||
|
||||
extern nsresult NS_NewScriptGlobalObject(nsIScriptGlobalObject **aGlobal);
|
||||
extern nsresult NS_NewScriptGlobalObject(PRBool aIsChrome,
|
||||
nsIScriptGlobalObject **aGlobal);
|
||||
|
||||
extern nsresult NS_NewDOMException(nsresult aResult,
|
||||
nsIException* aDefaultException,
|
||||
@ -88,7 +89,8 @@ public:
|
||||
nsISupports* aObject,
|
||||
nsIDOMEventListener ** aInstancePtrResult);
|
||||
|
||||
NS_IMETHOD NewScriptGlobalObject(nsIScriptGlobalObject **aGlobal);
|
||||
NS_IMETHOD NewScriptGlobalObject(PRBool aIsChrome,
|
||||
nsIScriptGlobalObject **aGlobal);
|
||||
|
||||
NS_IMETHOD_(nsISupports *)GetClassInfoInstance(nsDOMClassInfoID aID);
|
||||
};
|
||||
@ -145,9 +147,10 @@ nsDOMSOFactory::NewJSEventListener(nsIScriptContext *aContext,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMSOFactory::NewScriptGlobalObject(nsIScriptGlobalObject **aGlobal)
|
||||
nsDOMSOFactory::NewScriptGlobalObject(PRBool aIsChrome,
|
||||
nsIScriptGlobalObject **aGlobal)
|
||||
{
|
||||
return NS_NewScriptGlobalObject(aGlobal);
|
||||
return NS_NewScriptGlobalObject(aIsChrome, aGlobal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsISupports *)
|
||||
|
@ -1793,7 +1793,7 @@ function notifyAttention (source)
|
||||
}
|
||||
|
||||
if (client.FLASH_WINDOW)
|
||||
window.GetAttention();
|
||||
window.getAttention();
|
||||
|
||||
}
|
||||
|
||||
@ -2381,7 +2381,7 @@ function __display(message, msgtype, sourceObj, destObj)
|
||||
{
|
||||
setTabState(this, "attention");
|
||||
if (client.FLASH_WINDOW)
|
||||
window.GetAttention();
|
||||
window.getAttention();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ function debugTrap (frame, type, rv)
|
||||
|
||||
console.trapType = type;
|
||||
window.focus();
|
||||
window.GetAttention();
|
||||
window.getAttention();
|
||||
|
||||
console.jsds.enterNestedEventLoop({onNest: console.onDebugTrap});
|
||||
|
||||
|
@ -134,7 +134,7 @@ function commonDialogOnLoad()
|
||||
// initialize the checkbox
|
||||
setCheckbox(gCommonDialogParam.GetString(1), gCommonDialogParam.GetInt(1));
|
||||
|
||||
GetAttention();
|
||||
getAttention();
|
||||
}
|
||||
|
||||
function initTextbox(aName, aLabelIndex, aValueIndex, aAlwaysLabel)
|
||||
|
Loading…
x
Reference in New Issue
Block a user