Change calls to Flash(void) in nsIWidget, nsWindow to GetAttention().

r=sdagley a=chofmann. Add support for GetAttention API to nsIDOMWindow.
r=vidur, a=chofmann. To do, make call to WebShell from nsIDOMWindow,
this will come once travis lands some webshell code.
This commit is contained in:
syd%netscape.com 1999-12-17 06:11:45 +00:00
Родитель 2f3c8ee1ee
Коммит 76d39e5500
15 изменённых файлов: 72 добавлений и 11 удалений

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

@ -158,6 +158,8 @@ public:
NS_IMETHOD SizeToContent()=0;
NS_IMETHOD GetAttention()=0;
NS_IMETHOD Scroll(PRInt32 aXScroll, PRInt32 aYScroll)=0;
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll)=0;
@ -256,6 +258,7 @@ public:
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight); \
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif); \
NS_IMETHOD SizeToContent(); \
NS_IMETHOD GetAttention(); \
NS_IMETHOD Scroll(PRInt32 aXScroll, PRInt32 aYScroll); \
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll); \
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif); \
@ -338,6 +341,7 @@ public:
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight) { return _to ResizeTo(aWidth, aHeight); } \
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif) { return _to ResizeBy(aWidthDif, aHeightDif); } \
NS_IMETHOD SizeToContent() { return _to SizeToContent(); } \
NS_IMETHOD GetAttention() { return _to GetAttention(); } \
NS_IMETHOD Scroll(PRInt32 aXScroll, PRInt32 aYScroll) { return _to Scroll(aXScroll, aYScroll); } \
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll) { return _to ScrollTo(aXScroll, aYScroll); } \
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif) { return _to ScrollBy(aXScrollDif, aYScrollDif); } \

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

@ -52,6 +52,7 @@
void resizeTo(in long width, in long height);
void resizeBy(in long widthDif, in long heightDif);
void sizeToContent();
void GetAttention();
void scroll(in long xScroll, in long yScroll);
void scrollTo(in long xScroll, in long yScroll);
void scrollBy(in long xScrollDif, in long yScrollDif);

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

@ -814,6 +814,7 @@ enum nsDOMProp {
NS_DOM_PROP_WINDOW_FOCUS,
NS_DOM_PROP_WINDOW_FORWARD,
NS_DOM_PROP_WINDOW_FRAMES,
NS_DOM_PROP_WINDOW_GETATTENTION,
NS_DOM_PROP_WINDOW_HISTORY,
NS_DOM_PROP_WINDOW_HOME,
NS_DOM_PROP_WINDOW_INNERHEIGHT,

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

@ -1550,6 +1550,16 @@ GlobalWindowImpl::SizeToContent()
return NS_ERROR_NOT_INITIALIZED;
}
NS_IMETHODIMP
GlobalWindowImpl::GetAttention()
{
#if 0
if (mWebShell)
return mWebShell->GetAttention();
#endif
return NS_OK;
}
nsresult
GlobalWindowImpl::GetScrollInfo(nsIScrollableView** aScrollableView,
float* aP2T, float* aT2P)

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

@ -166,6 +166,7 @@ public:
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif);
NS_IMETHOD SizeToContent();
NS_IMETHOD GetAttention();
NS_IMETHOD Scroll(PRInt32 aXScroll, PRInt32 aYScroll);
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll);
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif);

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

@ -1791,6 +1791,49 @@ WindowSizeToContent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
//
// Native method GetAttention
//
PR_STATIC_CALLBACK(JSBool)
WindowGetAttention(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMWindow *nativeThis = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
*rval = JSVAL_NULL;
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsCOMPtr<nsIScriptSecurityManager> secMan;
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECMAN_ERR);
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_WINDOW_GETATTENTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
}
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
result = nativeThis->GetAttention();
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, result);
}
*rval = JSVAL_VOID;
}
return JS_TRUE;
}
//
// Native method Scroll
//
@ -2809,6 +2852,7 @@ static JSFunctionSpec WindowMethods[] =
{"resizeTo", WindowResizeTo, 2},
{"resizeBy", WindowResizeBy, 2},
{"sizeToContent", WindowSizeToContent, 0},
{"GetAttention", WindowGetAttention, 0},
{"scroll", WindowScroll, 2},
{"scrollTo", WindowScrollTo, 2},
{"scrollBy", WindowScrollBy, 2},

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

@ -728,7 +728,7 @@ class nsIWidget : public nsISupports {
* in the foreground and should be dismissed when the user brings this window
* to the foreground.
*/
NS_IMETHOD Flash() = 0;
NS_IMETHOD GetAttention() = 0;
};

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

@ -2311,7 +2311,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
return NS_OK;
}
NS_IMETHODIMP nsWindow::Flash(void)
NS_IMETHODIMP nsWindow::GetAttention(void)
{
// get the next up moz area
GtkWidget *top_mozarea = GetMozArea();

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

@ -81,7 +81,7 @@ public:
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetCursor(nsCursor aCursor);
NS_IMETHOD SetFocus(void);
NS_IMETHOD Flash(void);
NS_IMETHOD GetAttention(void);
void QueueDraw();
void UnqueueDraw();

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

@ -1976,7 +1976,7 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& title)
return NS_OK;
}
NS_IMETHODIMP nsWindow::Flash()
NS_IMETHODIMP nsWindow::GetAttention()
{
// Since the Mac doesn't consider each window a seperate process this call functions
// slightly different than on other platforms. We first check to see if we're the

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

@ -172,7 +172,7 @@ public:
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD SetTitle(const nsString& title);
NS_IMETHOD Flash();
NS_IMETHOD GetAttention();
// Mac specific methods
void nsRectToMacRect(const nsRect& aRect, Rect& aMacRect) const;

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

@ -4317,7 +4317,7 @@ NS_IMETHODIMP nsWindow::PasswordFieldExit(PRUint32 aState)
// This function is called on a timer to do the flashing. It simply toggles the flash
// status until the window comes to the foreground.
static VOID CALLBACK nsFlashTimerFunc( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ) {
static VOID CALLBACK nsGetAttentionTimerFunc( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ) {
// Flash the window until we're in the foreground.
if ( GetForegroundWindow() != hwnd ) {
// We're not in the foreground yet.
@ -4329,7 +4329,7 @@ static VOID CALLBACK nsFlashTimerFunc( HWND hwnd, UINT uMsg, UINT idEvent, DWORD
// Draw user's attention to this window until it comes to foreground.
NS_IMETHODIMP
nsWindow::Flash() {
nsWindow::GetAttention() {
// Got window?
if ( !mWnd ) {
return NS_ERROR_NOT_INITIALIZED;
@ -4338,7 +4338,7 @@ nsWindow::Flash() {
// If window is in foreground, no notification is necessary.
if ( GetForegroundWindow() != mWnd ) {
// Kick off timer that does single flash till window comes to foreground.
SetTimer( mWnd, NS_FLASH_TIMER_ID, GetCaretBlinkTime(), (TIMERPROC)nsFlashTimerFunc );
SetTimer( mWnd, NS_FLASH_TIMER_ID, GetCaretBlinkTime(), (TIMERPROC)nsGetAttentionTimerFunc );
}
return NS_OK;

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

@ -143,7 +143,7 @@ public:
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD Flash();
NS_IMETHOD GetAttention();
// nsIKBStateControl interface

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

@ -721,7 +721,7 @@ NS_METHOD nsBaseWidget::ModalEventFilter(PRBool aRealEvent, void *aEvent,
}
NS_IMETHODIMP
nsBaseWidget::Flash() {
nsBaseWidget::GetAttention() {
return NS_OK;
}

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

@ -98,7 +98,7 @@ public:
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
#endif
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD Flash();
NS_IMETHOD GetAttention();
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~