From f4f4bed53edfc37c1e28f7030ea65e09a57b39b1 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Sat, 1 Jun 2002 00:00:12 +0000 Subject: [PATCH] scrollbar visibility is no longer reflected in mChromeFlags. bug 130174 r=bryner,jag,jst git-svn-id: svn://10.0.0.236/trunk@122457 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/appshell/src/nsContentTreeOwner.cpp | 24 ++++++++++++++----- .../xpfe/appshell/src/nsContentTreeOwner.h | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp index 738a983df91..97b714388fb 100644 --- a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -412,15 +412,23 @@ NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(PRUint32* aChromeFlags) { NS_ENSURE_ARG_POINTER(aChromeFlags); - // use scrollbar status from the content shell window to update flags + *aChromeFlags = mChromeFlags; + + /* mChromeFlags is kept up to date, except for scrollbar visibility. + That can be changed directly by the content DOM window, which + doesn't know to update the chrome window. So that we must check + separately. */ + + // however, it's pointless to ask if the window isn't set up yet + if (!mXULWindow->mChromeLoaded) + return NS_OK; + PRBool scrollbarVisibility = mXULWindow->GetContentScrollbarVisibility(); if (scrollbarVisibility) - mChromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS; + *aChromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS; else - mChromeFlags &= ~nsIWebBrowserChrome::CHROME_SCROLLBARS; + *aChromeFlags &= ~nsIWebBrowserChrome::CHROME_SCROLLBARS; - // the rest of mChromeFlags is kept up to date - *aChromeFlags = mChromeFlags; return NS_OK; } @@ -632,7 +640,11 @@ NS_IMETHODIMP nsContentTreeOwner::ApplyChromeFlags() nsIWebBrowserChrome::CHROME_MENUBAR ? PR_TRUE : PR_FALSE); - // scrollbars have their own special treatment + /* Scrollbars have their own special treatment. (note here we *do* use + mChromeFlags directly, without going through the accessor. This method + is intended to be used right after setting mChromeFlags, so this is + where the content window's scrollbar state is set to match mChromeFlags + in the first place. */ mXULWindow->SetContentScrollbarVisibility(mChromeFlags & nsIWebBrowserChrome::CHROME_SCROLLBARS ? PR_TRUE : PR_FALSE); diff --git a/mozilla/xpfe/appshell/src/nsContentTreeOwner.h b/mozilla/xpfe/appshell/src/nsContentTreeOwner.h index 2c986b707c5..392fec7a0d3 100644 --- a/mozilla/xpfe/appshell/src/nsContentTreeOwner.h +++ b/mozilla/xpfe/appshell/src/nsContentTreeOwner.h @@ -67,11 +67,12 @@ protected: nsSiteWindow2 *mSiteWindow2; PRBool mPrimary; PRBool mContentTitleSetting; - PRUint32 mChromeFlags; nsString mWindowTitleModifier; nsString mTitleSeparator; nsString mTitlePreface; +private: + PRUint32 mChromeFlags; // don't use directly! use GetChromeFlags() }; #endif /* nsContentTreeOwner_h__ */