зеркало из https://github.com/mozilla/gecko-dev.git
adding ability to open a browser without scrollbars (window.open(...scrollbars=no)) bug 28193
This commit is contained in:
Родитель
030de906de
Коммит
3427427192
|
@ -221,6 +221,7 @@ nsWebShellWindow::nsWebShellWindow() : nsXULWindow()
|
|||
mIntrinsicallySized = PR_FALSE;
|
||||
mDebuting = PR_FALSE;
|
||||
mLoadDefaultPage = PR_TRUE;
|
||||
mKillScrollbarsAfterLoad = PR_FALSE;
|
||||
mSPTimerLock = PR_NewLock();
|
||||
}
|
||||
|
||||
|
@ -262,6 +263,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
|
|||
nsIAppShell* aShell, nsIURI* aUrl,
|
||||
PRBool aCreatedVisible,
|
||||
PRBool aLoadDefaultPage,
|
||||
PRBool aContentScrollbars,
|
||||
PRUint32 aZlevel,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
nsWidgetInitData& widgetInitData)
|
||||
|
@ -271,6 +273,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
|
|||
|
||||
mShowAfterLoad = aCreatedVisible;
|
||||
mLoadDefaultPage = aLoadDefaultPage;
|
||||
mKillScrollbarsAfterLoad = !aContentScrollbars;
|
||||
mZlevel = aZlevel;
|
||||
|
||||
// XXX: need to get the default window size from prefs...
|
||||
|
@ -1277,6 +1280,8 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
|
||||
OnChromeLoaded();
|
||||
LoadContentAreas();
|
||||
if (mKillScrollbarsAfterLoad)
|
||||
KillContentScrollbars();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
// nsWebShellWindow methods...
|
||||
nsresult Initialize(nsIXULWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl,
|
||||
PRBool aCreatedVisible, PRBool aLoadDefaultPage,
|
||||
PRUint32 aZlevel,
|
||||
PRBool aContentScrollbars, PRUint32 aZlevel,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
nsWidgetInitData& widgetInitData);
|
||||
nsIWidget* GetWidget(void) { return mWindow; }
|
||||
|
@ -193,6 +193,7 @@ protected:
|
|||
nsIWebShell* mWebShell;
|
||||
PRBool mLockedUntilChromeLoad;
|
||||
PRBool mLoadDefaultPage;
|
||||
PRBool mKillScrollbarsAfterLoad;
|
||||
|
||||
nsVoidArray mMenuDelegates;
|
||||
|
||||
|
|
|
@ -47,8 +47,11 @@
|
|||
#include "nsIWindowMediator.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsIScreen.h"
|
||||
#include "nsIScrollable.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
// XXX Get rid of this
|
||||
#pragma message("WARNING: XXX bad include, remove it.")
|
||||
#include "nsIWebShellWindow.h"
|
||||
|
@ -1227,6 +1230,20 @@ PRBool nsXULWindow::ConstrainToZLevel(
|
|||
return altered;
|
||||
}
|
||||
|
||||
/* Disable scrollbars in the primary content shell (to open a browser window
|
||||
without scrollbars, for example)
|
||||
*/
|
||||
void nsXULWindow::KillContentScrollbars() {
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> content;
|
||||
if (NS_SUCCEEDED(GetPrimaryContentShell(getter_AddRefs(content))) && content) {
|
||||
nsCOMPtr<nsIScrollable> shell(do_QueryInterface(content));
|
||||
if (shell)
|
||||
shell->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, NS_STYLE_OVERFLOW_HIDDEN);
|
||||
shell->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, NS_STYLE_OVERFLOW_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsXULWindow: Accessors
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -88,10 +88,10 @@ protected:
|
|||
nsIDocShellTreeItem** aDocShellTreeItem);
|
||||
NS_IMETHOD NotifyObservers(const PRUnichar* aTopic, const PRUnichar* aData);
|
||||
|
||||
protected:
|
||||
void EnableParent(PRBool aEnable);
|
||||
PRBool ConstrainToZLevel(PRBool aImmediate, nsWindowZ *aPlacement,
|
||||
nsIWidget *aReqBelow, nsIWidget **aActualBelow);
|
||||
void KillContentScrollbars();
|
||||
|
||||
nsChromeTreeOwner* mChromeTreeOwner;
|
||||
nsContentTreeOwner* mContentTreeOwner;
|
||||
|
|
Загрузка…
Ссылка в новой задаче