2015-05-03 22:32:37 +03: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 15:12:37 +04: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 22:59:04 +04:00
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
#include "mozilla/dom/BarProps.h"
|
2013-06-01 12:53:00 +04:00
|
|
|
#include "mozilla/dom/BarPropBinding.h"
|
|
|
|
#include "nsContentUtils.h"
|
2002-02-16 04:15:52 +03:00
|
|
|
#include "nsGlobalWindow.h"
|
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsIScrollable.h"
|
2013-08-15 22:17:48 +04:00
|
|
|
#include "nsIWebBrowserChrome.h"
|
2013-05-31 14:30:00 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
1999-06-09 22:59:04 +04:00
|
|
|
//
|
|
|
|
// Basic (virtual) BarProp class implementation
|
|
|
|
//
|
2013-10-25 15:12:01 +04:00
|
|
|
BarProp::BarProp(nsGlobalWindow* aWindow)
|
2013-06-01 12:53:00 +04:00
|
|
|
: mDOMWindow(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-10-25 15:12:01 +04:00
|
|
|
MOZ_ASSERT(aWindow->IsInnerWindow());
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
BarProp::~BarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner*
|
2013-06-01 12:53:00 +04:00
|
|
|
BarProp::GetParentObject() const
|
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return mDOMWindow->AsInner();
|
2013-06-01 12:53:00 +04:00
|
|
|
}
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2013-06-01 12:53:00 +04: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 17:13:33 +03:00
|
|
|
BarProp::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-06-01 12:53:00 +04: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 17:13:33 +03:00
|
|
|
return BarPropBinding::Wrap(aCx, this, aGivenProto);
|
2013-06-01 12:53:00 +04:00
|
|
|
}
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2014-04-29 12:57:00 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BarProp, mDOMWindow)
|
2013-06-01 12:53:00 +04: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 21:42:36 +04:00
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
|
|
|
BarProp::GetVisibleByFlag(uint32_t aChromeFlag, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2011-04-28 00:54:07 +04:00
|
|
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
2013-06-01 12:53:00 +04: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 21:42:36 +04:00
|
|
|
|
2012-08-22 19:56:38 +04: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 21:42:36 +04:00
|
|
|
|
2013-06-01 12:53:00 +04: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 21:42:36 +04:00
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
return (chromeFlags & aChromeFlag);
|
1999-06-10 05:27:47 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
|
|
|
BarProp::SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
|
2016-11-19 00:13:07 +03:00
|
|
|
CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2011-04-28 00:54:07 +04:00
|
|
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
2013-06-01 12:53:00 +04: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 21:42:36 +04:00
|
|
|
|
2016-11-19 00:13:07 +03:00
|
|
|
if (aCallerType != CallerType::System) {
|
2013-06-01 12:53:00 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-03-09 03:45:41 +03:00
|
|
|
|
2012-08-22 19:56:38 +04: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 21:42:36 +04:00
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
if (NS_FAILED(browserChrome->GetChromeFlags(&chromeFlags))) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-28 00:54:07 +04: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 21:42:36 +04:00
|
|
|
chromeFlags |= aChromeFlag;
|
|
|
|
else
|
|
|
|
chromeFlags &= ~aChromeFlag;
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
if (NS_FAILED(browserChrome->SetChromeFlags(chromeFlags))) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
}
|
1999-06-10 05:27:47 +04:00
|
|
|
}
|
|
|
|
|
2011-04-28 00:54:07 +04:00
|
|
|
already_AddRefed<nsIWebBrowserChrome>
|
2013-05-31 14:30:00 +04:00
|
|
|
BarProp::GetBrowserChrome()
|
2011-04-28 00:54:07 +04:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
if (!mDOMWindow) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2013-06-01 12:53:00 +04:00
|
|
|
}
|
2011-04-28 00:54:07 +04:00
|
|
|
|
2013-04-26 10:51:04 +04:00
|
|
|
return mDOMWindow->GetWebBrowserChrome();
|
2011-04-28 00:54:07 +04:00
|
|
|
}
|
|
|
|
|
1999-06-09 22:59:04 +04:00
|
|
|
//
|
|
|
|
// MenubarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
MenubarProp::MenubarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
MenubarProp::~MenubarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
MenubarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
MenubarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2016-11-19 00:13:07 +03:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR,
|
|
|
|
aCallerType, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ToolbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
ToolbarProp::ToolbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
ToolbarProp::~ToolbarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
ToolbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR,
|
2016-11-19 00:13:07 +03:00
|
|
|
aCallerType, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// LocationbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
LocationbarProp::LocationbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
LocationbarProp::~LocationbarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
LocationbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
|
|
|
aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
2016-11-19 00:13:07 +03:00
|
|
|
aCallerType, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// PersonalbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
PersonalbarProp::PersonalbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
PersonalbarProp::~PersonalbarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
PersonalbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
|
|
|
aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
BarProp::SetVisibleByFlag(aVisible,
|
|
|
|
nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
2016-11-19 00:13:07 +03:00
|
|
|
aCallerType, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// StatusbarProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
StatusbarProp::StatusbarProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
StatusbarProp::~StatusbarProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
StatusbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-05-31 14:30:00 +04:00
|
|
|
return BarProp::SetVisibleByFlag(aVisible,
|
2016-11-19 00:13:07 +03:00
|
|
|
nsIWebBrowserChrome::CHROME_STATUSBAR,
|
|
|
|
aCallerType, aRv);
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ScrollbarsProp class implementation
|
|
|
|
//
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
ScrollbarsProp::ScrollbarsProp(nsGlobalWindow *aWindow)
|
|
|
|
: BarProp(aWindow)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
ScrollbarsProp::~ScrollbarsProp()
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1999-06-09 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
bool
|
2016-11-15 20:46:32 +03:00
|
|
|
ScrollbarsProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2013-06-01 12:53:00 +04:00
|
|
|
if (!mDOMWindow) {
|
|
|
|
return true;
|
2002-02-16 04:15:52 +03:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04: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 22:59:04 +04:00
|
|
|
}
|
|
|
|
|
2013-06-01 12:53:00 +04:00
|
|
|
void
|
2016-11-15 20:46:32 +03:00
|
|
|
ScrollbarsProp::SetVisible(bool aVisible, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv)
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
2016-11-15 20:46:32 +03:00
|
|
|
if (aCallerType != CallerType::System) {
|
2013-06-01 12:53:00 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-12-30 19:57:46 +03:00
|
|
|
|
2002-02-16 04:15:52 +03: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-12 02:10:13 +03:00
|
|
|
nsContentUtils::SetScrollbarsVisibility(mDOMWindow->GetDocShell(), aVisible);
|
2002-02-16 04:15:52 +03:00
|
|
|
|
|
|
|
/* Notably absent is the part where we notify the chrome window using
|
2011-04-28 00:54:07 +04:00
|
|
|
GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple
|
2002-02-16 04:15:52 +03: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 22:59:04 +04:00
|
|
|
}
|
2002-02-16 04:15:52 +03:00
|
|
|
|
2013-05-31 14:30:00 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|