2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-06-09 18:59:04 +00:00
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
#include "mozilla/dom/BarProps.h"
|
2013-06-01 08:53:00 +00:00
|
|
|
#include "mozilla/dom/BarPropBinding.h"
|
|
|
|
#include "nsContentUtils.h"
|
2002-02-16 01:15:52 +00:00
|
|
|
#include "nsGlobalWindow.h"
|
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsIScrollable.h"
|
2013-08-15 18:17:48 +00:00
|
|
|
#include "nsIWebBrowserChrome.h"
|
2013-05-31 10:30:00 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
1999-06-09 18:59:04 +00:00
|
|
|
//
|
|
|
|
// Basic (virtual) BarProp class implementation
|
|
|
|
//
|
2013-10-25 11:12:01 +00:00
|
|
|
BarProp::BarProp(nsGlobalWindow* aWindow)
|
2013-06-01 08:53:00 +00:00
|
|
|
: mDOMWindow(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-10-25 11:12:01 +00:00
|
|
|
MOZ_ASSERT(aWindow->IsInnerWindow());
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
BarProp::~BarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
nsPIDOMWindowInner*
|
2013-06-01 08:53:00 +00:00
|
|
|
BarProp::GetParentObject() const
|
|
|
|
{
|
2016-01-30 17:05:36 +00:00
|
|
|
return mDOMWindow->AsInner();
|
2013-06-01 08:53:00 +00:00
|
|
|
}
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
BarProp::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-06-01 08:53:00 +00:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
return BarPropBinding::Wrap(aCx, this, aGivenProto);
|
2013-06-01 08:53:00 +00:00
|
|
|
}
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2014-04-29 08:57:00 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BarProp, mDOMWindow)
|
2013-06-01 08:53:00 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(BarProp)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(BarProp)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BarProp)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
BarProp::GetVisibleByFlag(uint32_t aChromeFlag, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2011-04-27 20:54:07 +00:00
|
|
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
2013-06-01 08:53:00 +00:00
|
|
|
NS_ENSURE_TRUE(browserChrome, false);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t chromeFlags;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
if (NS_FAILED(browserChrome->GetChromeFlags(&chromeFlags))) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return false;
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
return (chromeFlags & aChromeFlag);
|
1999-06-10 01:27:47 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
BarProp::SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
|
|
|
|
ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2011-04-27 20:54:07 +00:00
|
|
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
2013-06-01 08:53:00 +00:00
|
|
|
NS_ENSURE_TRUE_VOID(browserChrome);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
if (!nsContentUtils::IsCallerChrome()) {
|
|
|
|
return;
|
|
|
|
}
|
2004-03-09 00:45:41 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t chromeFlags;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
if (NS_FAILED(browserChrome->GetChromeFlags(&chromeFlags))) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-27 20:54:07 +00:00
|
|
|
if (aVisible)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
chromeFlags |= aChromeFlag;
|
|
|
|
else
|
|
|
|
chromeFlags &= ~aChromeFlag;
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
if (NS_FAILED(browserChrome->SetChromeFlags(chromeFlags))) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
}
|
1999-06-10 01:27:47 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 20:54:07 +00:00
|
|
|
already_AddRefed<nsIWebBrowserChrome>
|
2013-05-31 10:30:00 +00:00
|
|
|
BarProp::GetBrowserChrome()
|
2011-04-27 20:54:07 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
if (!mDOMWindow) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2013-06-01 08:53:00 +00:00
|
|
|
}
|
2011-04-27 20:54:07 +00:00
|
|
|
|
2013-04-26 06:51:04 +00:00
|
|
|
return mDOMWindow->GetWebBrowserChrome();
|
2011-04-27 20:54:07 +00:00
|
|
|
}
|
|
|
|
|
1999-06-09 18:59:04 +00:00
|
|
|
//
|
|
|
|
// MenubarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
MenubarProp::MenubarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
MenubarProp::~MenubarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
MenubarProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
MenubarProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ToolbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
ToolbarProp::ToolbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
ToolbarProp::~ToolbarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
ToolbarProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR, aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
ToolbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR,
|
|
|
|
aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// LocationbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
LocationbarProp::LocationbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
LocationbarProp::~LocationbarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
LocationbarProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
|
|
|
aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
LocationbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
|
|
|
aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// PersonalbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
PersonalbarProp::PersonalbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
PersonalbarProp::~PersonalbarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
PersonalbarProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
|
|
|
aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
PersonalbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
BarProp::SetVisibleByFlag(aVisible,
|
|
|
|
nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
|
|
|
aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// StatusbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
StatusbarProp::StatusbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
StatusbarProp::~StatusbarProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
StatusbarProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
StatusbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-05-31 10:30:00 +00:00
|
|
|
return BarProp::SetVisibleByFlag(aVisible,
|
2013-06-01 08:53:00 +00:00
|
|
|
nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ScrollbarsProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
ScrollbarsProp::ScrollbarsProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
ScrollbarsProp::~ScrollbarsProp()
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
bool
|
|
|
|
ScrollbarsProp::GetVisible(ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2013-06-01 08:53:00 +00:00
|
|
|
if (!mDOMWindow) {
|
|
|
|
return true;
|
2002-02-16 01:15:52 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
nsCOMPtr<nsIScrollable> scroller =
|
|
|
|
do_QueryInterface(mDOMWindow->GetDocShell());
|
|
|
|
|
|
|
|
if (!scroller) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t prefValue;
|
|
|
|
scroller->GetDefaultScrollbarPreferences(
|
|
|
|
nsIScrollable::ScrollOrientation_Y, &prefValue);
|
|
|
|
if (prefValue != nsIScrollable::Scrollbar_Never) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
scroller->GetDefaultScrollbarPreferences(
|
|
|
|
nsIScrollable::ScrollOrientation_X, &prefValue);
|
|
|
|
return prefValue != nsIScrollable::Scrollbar_Never;
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
|
|
|
|
2013-06-01 08:53:00 +00:00
|
|
|
void
|
|
|
|
ScrollbarsProp::SetVisible(bool aVisible, ErrorResult& aRv)
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
2014-09-25 09:04:45 +00:00
|
|
|
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
2013-06-01 08:53:00 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-12-30 16:57:46 +00:00
|
|
|
|
2002-02-16 01:15:52 +00:00
|
|
|
/* Scrollbars, unlike the other barprops, implement visibility directly
|
|
|
|
rather than handing off to the superclass (and from there to the
|
|
|
|
chrome window) because scrollbar visibility uniquely applies only
|
|
|
|
to the window making the change (arguably. it does now, anyway.)
|
|
|
|
and because embedding apps have no interface for implementing this
|
|
|
|
themselves, and therefore the implementation must be internal. */
|
|
|
|
|
2016-03-11 23:10:13 +00:00
|
|
|
nsContentUtils::SetScrollbarsVisibility(mDOMWindow->GetDocShell(), aVisible);
|
2002-02-16 01:15:52 +00:00
|
|
|
|
|
|
|
/* Notably absent is the part where we notify the chrome window using
|
2011-04-27 20:54:07 +00:00
|
|
|
GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple
|
2002-02-16 01:15:52 +00:00
|
|
|
DOM windows (multiple top-level windows, even) within a single
|
|
|
|
chrome window, the historical concept of a single "has scrollbars"
|
|
|
|
flag in the chrome is inapplicable, and we can't tell at this level
|
|
|
|
whether we represent the particular DOM window that makes this decision
|
|
|
|
for the chrome.
|
|
|
|
|
|
|
|
So only this object (and its corresponding DOM window) knows whether
|
|
|
|
scrollbars are visible. The corresponding chrome window will need to
|
|
|
|
ask (one of) its DOM window(s) when it needs to know about scrollbar
|
|
|
|
visibility, rather than caching its own copy of that information.
|
|
|
|
*/
|
1999-06-09 18:59:04 +00:00
|
|
|
}
|
2002-02-16 01:15:52 +00:00
|
|
|
|
2013-05-31 10:30:00 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|