From 8f9244cc3a94dbb8c9b72a10f9fc21fb19183650 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Sat, 16 Feb 2002 01:15:57 +0000 Subject: [PATCH] reimplement window scrollbar chrome attribute. oh and revert the damn nonstandard indentation tbogard snuck in in rev 1.5. bug 111524 r=hyatt,jst git-svn-id: svn://10.0.0.236/trunk@114616 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsBarProps.h | 67 +++++++++++++++++++------------ 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/mozilla/dom/src/base/nsBarProps.h b/mozilla/dom/src/base/nsBarProps.h index 0457f3ca0a8..ed08c58f7cd 100644 --- a/mozilla/dom/src/base/nsBarProps.h +++ b/mozilla/dom/src/base/nsBarProps.h @@ -48,79 +48,94 @@ #include "nscore.h" #include "nsIScriptContext.h" #include "nsIDOMBarProp.h" +#include "nsIWeakReference.h" +class GlobalWindowImpl; class nsIWebBrowserChrome; // Script "BarProp" object class BarPropImpl : public nsIDOMBarProp { public: - BarPropImpl(); - virtual ~BarPropImpl(); + BarPropImpl(); + virtual ~BarPropImpl(); - NS_DECL_ISUPPORTS + NS_DECL_ISUPPORTS - NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome); + NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome); - NS_IMETHOD GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag); - NS_IMETHOD SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag); + NS_IMETHOD GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag); + NS_IMETHOD SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag); protected: - // Weak Reference - nsIWebBrowserChrome* mBrowserChrome; + // Weak Reference + nsIWebBrowserChrome* mBrowserChrome; }; // Script "menubar" object class MenubarPropImpl : public BarPropImpl { public: - MenubarPropImpl(); - virtual ~MenubarPropImpl(); + MenubarPropImpl(); + virtual ~MenubarPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP }; // Script "toolbar" object class ToolbarPropImpl : public BarPropImpl { public: - ToolbarPropImpl(); - virtual ~ToolbarPropImpl(); + ToolbarPropImpl(); + virtual ~ToolbarPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP }; // Script "locationbar" object class LocationbarPropImpl : public BarPropImpl { public: - LocationbarPropImpl(); - virtual ~LocationbarPropImpl(); + LocationbarPropImpl(); + virtual ~LocationbarPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP }; // Script "personalbar" object class PersonalbarPropImpl : public BarPropImpl { public: - PersonalbarPropImpl(); - virtual ~PersonalbarPropImpl(); + PersonalbarPropImpl(); + virtual ~PersonalbarPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP }; // Script "statusbar" object class StatusbarPropImpl : public BarPropImpl { public: - StatusbarPropImpl(); - virtual ~StatusbarPropImpl(); + StatusbarPropImpl(); + virtual ~StatusbarPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP }; // Script "scrollbars" object class ScrollbarsPropImpl : public BarPropImpl { public: - ScrollbarsPropImpl(); - virtual ~ScrollbarsPropImpl(); + ScrollbarsPropImpl(GlobalWindowImpl *aWindow); + virtual ~ScrollbarsPropImpl(); - NS_DECL_NSIDOMBARPROP + NS_DECL_NSIDOMBARPROP + +private: + GlobalWindowImpl *mDOMWindow; + nsCOMPtr mDOMWindowWeakref; + /* Note the odd double reference to the owning global window. + Since the corresponding DOM window nominally owns this object, + yet refcounted ownership of this object can be handed off to + owners unknown, we need a weak ref to back to the DOM window. + However we also need access to properties of the DOM Window + that aren't available through interfaces. Then it's either + a weak ref and some skanky casting, or this funky double ref. + Funky beats skanky, so here we are. */ }; #endif /* nsBarProps_h___ */ +