From b8aa8a176120885f50e8b1248f9db499b403d273 Mon Sep 17 00:00:00 2001 From: "saari%netscape.com" Date: Thu, 11 May 2000 22:43:32 +0000 Subject: [PATCH] more for 29800 --- .../document/src/nsXULCommandDispatcher.cpp | 14 +++++++++ .../xul/document/src/nsXULCommandDispatcher.h | 1 + dom/public/idl/xul/XULCommandDispatcher.idl | 1 + dom/src/xul/nsJSXULCommandDispatcher.cpp | 30 ++++++++++++++++++- .../public/idl/XULCommandDispatcher.idl | 1 + rdf/content/src/nsJSXULCommandDispatcher.cpp | 30 ++++++++++++++++++- rdf/content/src/nsXULCommandDispatcher.cpp | 14 +++++++++ rdf/content/src/nsXULCommandDispatcher.h | 1 + 8 files changed, 90 insertions(+), 2 deletions(-) diff --git a/content/xul/document/src/nsXULCommandDispatcher.cpp b/content/xul/document/src/nsXULCommandDispatcher.cpp index bfb0fdd6b89..ded65ac062e 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -579,6 +579,20 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont return NS_OK; } +NS_IMETHODIMP +nsXULCommandDispatcher::GetSuppressFocusScroll(PRBool* aSuppressFocusScroll) +{ + *aSuppressFocusScroll = mSuppressFocusScroll; + return NS_OK; +} + +NS_IMETHODIMP +nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll) +{ + mSuppressFocusScroll = aSuppressFocusScroll; + return NS_OK; +} + NS_IMETHODIMP nsXULCommandDispatcher::GetSuppressFocus(PRBool* aSuppressFocus) { diff --git a/content/xul/document/src/nsXULCommandDispatcher.h b/content/xul/document/src/nsXULCommandDispatcher.h index 9ad9aceda1e..a7a6594c2ba 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.h +++ b/content/xul/document/src/nsXULCommandDispatcher.h @@ -88,6 +88,7 @@ protected: nsCOMPtr mCurrentWindow; // [OWNER] PRBool mSuppressFocus; + PRBool mSuppressFocusScroll; PRBool mActive; PRBool mFocusInitialized; diff --git a/dom/public/idl/xul/XULCommandDispatcher.idl b/dom/public/idl/xul/XULCommandDispatcher.idl index 9c2a3a6c195..8a924e63fe6 100644 --- a/dom/public/idl/xul/XULCommandDispatcher.idl +++ b/dom/public/idl/xul/XULCommandDispatcher.idl @@ -6,6 +6,7 @@ interface XULCommandDispatcher { attribute Element focusedElement; attribute Window focusedWindow; attribute boolean suppressFocus; + attribute boolean suppressFocusScroll; attribute boolean active; void addCommandUpdater(in Element updater, in DOMString events, in DOMString targets); diff --git a/dom/src/xul/nsJSXULCommandDispatcher.cpp b/dom/src/xul/nsJSXULCommandDispatcher.cpp index 9d3b51db8b2..80073aef81d 100644 --- a/dom/src/xul/nsJSXULCommandDispatcher.cpp +++ b/dom/src/xul/nsJSXULCommandDispatcher.cpp @@ -57,7 +57,8 @@ enum XULCommandDispatcher_slots { XULCOMMANDDISPATCHER_FOCUSEDELEMENT = -1, XULCOMMANDDISPATCHER_FOCUSEDWINDOW = -2, XULCOMMANDDISPATCHER_SUPPRESSFOCUS = -3, - XULCOMMANDDISPATCHER_ACTIVE = -4 + XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL = -4, + XULCOMMANDDISPATCHER_ACTIVE = -5 }; /***********************************************************************/ @@ -118,6 +119,18 @@ GetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v } break; } + case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + PRBool prop; + rv = a->GetSuppressFocusScroll(&prop); + if (NS_SUCCEEDED(rv)) { + *vp = BOOLEAN_TO_JSVAL(prop); + } + } + break; + } case XULCOMMANDDISPATCHER_ACTIVE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_FALSE); @@ -209,6 +222,20 @@ SetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v } break; } + case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_TRUE); + if (NS_SUCCEEDED(rv)) { + PRBool prop; + if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) { + rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR; + } + + rv = a->SetSuppressFocusScroll(prop); + + } + break; + } case XULCOMMANDDISPATCHER_ACTIVE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_TRUE); @@ -514,6 +541,7 @@ static JSPropertySpec XULCommandDispatcherProperties[] = {"focusedElement", XULCOMMANDDISPATCHER_FOCUSEDELEMENT, JSPROP_ENUMERATE}, {"focusedWindow", XULCOMMANDDISPATCHER_FOCUSEDWINDOW, JSPROP_ENUMERATE}, {"suppressFocus", XULCOMMANDDISPATCHER_SUPPRESSFOCUS, JSPROP_ENUMERATE}, + {"suppressFocusScroll", XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, JSPROP_ENUMERATE}, {"active", XULCOMMANDDISPATCHER_ACTIVE, JSPROP_ENUMERATE}, {0} }; diff --git a/rdf/content/public/idl/XULCommandDispatcher.idl b/rdf/content/public/idl/XULCommandDispatcher.idl index 9c2a3a6c195..8a924e63fe6 100644 --- a/rdf/content/public/idl/XULCommandDispatcher.idl +++ b/rdf/content/public/idl/XULCommandDispatcher.idl @@ -6,6 +6,7 @@ interface XULCommandDispatcher { attribute Element focusedElement; attribute Window focusedWindow; attribute boolean suppressFocus; + attribute boolean suppressFocusScroll; attribute boolean active; void addCommandUpdater(in Element updater, in DOMString events, in DOMString targets); diff --git a/rdf/content/src/nsJSXULCommandDispatcher.cpp b/rdf/content/src/nsJSXULCommandDispatcher.cpp index 9d3b51db8b2..80073aef81d 100644 --- a/rdf/content/src/nsJSXULCommandDispatcher.cpp +++ b/rdf/content/src/nsJSXULCommandDispatcher.cpp @@ -57,7 +57,8 @@ enum XULCommandDispatcher_slots { XULCOMMANDDISPATCHER_FOCUSEDELEMENT = -1, XULCOMMANDDISPATCHER_FOCUSEDWINDOW = -2, XULCOMMANDDISPATCHER_SUPPRESSFOCUS = -3, - XULCOMMANDDISPATCHER_ACTIVE = -4 + XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL = -4, + XULCOMMANDDISPATCHER_ACTIVE = -5 }; /***********************************************************************/ @@ -118,6 +119,18 @@ GetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v } break; } + case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + PRBool prop; + rv = a->GetSuppressFocusScroll(&prop); + if (NS_SUCCEEDED(rv)) { + *vp = BOOLEAN_TO_JSVAL(prop); + } + } + break; + } case XULCOMMANDDISPATCHER_ACTIVE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_FALSE); @@ -209,6 +222,20 @@ SetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v } break; } + case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_TRUE); + if (NS_SUCCEEDED(rv)) { + PRBool prop; + if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) { + rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR; + } + + rv = a->SetSuppressFocusScroll(prop); + + } + break; + } case XULCOMMANDDISPATCHER_ACTIVE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_TRUE); @@ -514,6 +541,7 @@ static JSPropertySpec XULCommandDispatcherProperties[] = {"focusedElement", XULCOMMANDDISPATCHER_FOCUSEDELEMENT, JSPROP_ENUMERATE}, {"focusedWindow", XULCOMMANDDISPATCHER_FOCUSEDWINDOW, JSPROP_ENUMERATE}, {"suppressFocus", XULCOMMANDDISPATCHER_SUPPRESSFOCUS, JSPROP_ENUMERATE}, + {"suppressFocusScroll", XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, JSPROP_ENUMERATE}, {"active", XULCOMMANDDISPATCHER_ACTIVE, JSPROP_ENUMERATE}, {0} }; diff --git a/rdf/content/src/nsXULCommandDispatcher.cpp b/rdf/content/src/nsXULCommandDispatcher.cpp index bfb0fdd6b89..ded65ac062e 100644 --- a/rdf/content/src/nsXULCommandDispatcher.cpp +++ b/rdf/content/src/nsXULCommandDispatcher.cpp @@ -579,6 +579,20 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont return NS_OK; } +NS_IMETHODIMP +nsXULCommandDispatcher::GetSuppressFocusScroll(PRBool* aSuppressFocusScroll) +{ + *aSuppressFocusScroll = mSuppressFocusScroll; + return NS_OK; +} + +NS_IMETHODIMP +nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll) +{ + mSuppressFocusScroll = aSuppressFocusScroll; + return NS_OK; +} + NS_IMETHODIMP nsXULCommandDispatcher::GetSuppressFocus(PRBool* aSuppressFocus) { diff --git a/rdf/content/src/nsXULCommandDispatcher.h b/rdf/content/src/nsXULCommandDispatcher.h index 9ad9aceda1e..a7a6594c2ba 100644 --- a/rdf/content/src/nsXULCommandDispatcher.h +++ b/rdf/content/src/nsXULCommandDispatcher.h @@ -88,6 +88,7 @@ protected: nsCOMPtr mCurrentWindow; // [OWNER] PRBool mSuppressFocus; + PRBool mSuppressFocusScroll; PRBool mActive; PRBool mFocusInitialized;