From df3f6a804e4712d8d338b2fdfc0755c1d45fec3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 17 Dec 2019 22:25:54 +0000 Subject: [PATCH] Bug 1603889 - Make ScrollbarsProp::SetVisible do nothing, and minor cleanup of surrounding code. r=smaug This removes another dead caller of nsContentUtils::SetScrollbarVisibility. Plus, before these patches, nsContentUtils::SetScrollbarVisibility didn't invalidate layout in any way, so it's not like it'd work, even if the chrome code would set the preference (which it doesn't). Differential Revision: https://phabricator.services.mozilla.com/D57185 --HG-- extra : moz-landing-system : lando --- dom/base/BarProps.cpp | 30 ++---------------------------- dom/base/BarProps.h | 39 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 48 deletions(-) diff --git a/dom/base/BarProps.cpp b/dom/base/BarProps.cpp index 4ae773d35362..fef21d455cf9 100644 --- a/dom/base/BarProps.cpp +++ b/dom/base/BarProps.cpp @@ -201,34 +201,8 @@ bool ScrollbarsProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) { return pref != ScrollbarPreference::Never; } -void ScrollbarsProp::SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) { - if (aCallerType != CallerType::System) { - return; - } - - /* 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. */ - - nsContentUtils::SetScrollbarsVisibility(mDOMWindow->GetDocShell(), aVisible); - - /* Notably absent is the part where we notify the chrome window using - GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple - 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. - */ +void ScrollbarsProp::SetVisible(bool aVisible, CallerType, ErrorResult&) { + /* Do nothing */ } } // namespace dom diff --git a/dom/base/BarProps.h b/dom/base/BarProps.h index d402a146386a..b0af0503f6d0 100644 --- a/dom/base/BarProps.h +++ b/dom/base/BarProps.h @@ -38,8 +38,7 @@ class BarProp : public nsISupports, public nsWrapperCache { nsPIDOMWindowInner* GetParentObject() const; - virtual JSObject* WrapObject(JSContext* aCx, - JS::Handle aGivenProto) override; + JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) final; virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) = 0; virtual void SetVisible(bool aVisible, CallerType aCallerType, @@ -63,9 +62,9 @@ class MenubarProp final : public BarProp { explicit MenubarProp(nsGlobalWindowInner* aWindow); virtual ~MenubarProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; // Script "toolbar" object @@ -74,9 +73,9 @@ class ToolbarProp final : public BarProp { explicit ToolbarProp(nsGlobalWindowInner* aWindow); virtual ~ToolbarProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; // Script "locationbar" object @@ -85,9 +84,9 @@ class LocationbarProp final : public BarProp { explicit LocationbarProp(nsGlobalWindowInner* aWindow); virtual ~LocationbarProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; // Script "personalbar" object @@ -96,9 +95,9 @@ class PersonalbarProp final : public BarProp { explicit PersonalbarProp(nsGlobalWindowInner* aWindow); virtual ~PersonalbarProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; // Script "statusbar" object @@ -107,9 +106,9 @@ class StatusbarProp final : public BarProp { explicit StatusbarProp(nsGlobalWindowInner* aWindow); virtual ~StatusbarProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; // Script "scrollbars" object @@ -118,9 +117,9 @@ class ScrollbarsProp final : public BarProp { explicit ScrollbarsProp(nsGlobalWindowInner* aWindow); virtual ~ScrollbarsProp(); - virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; - virtual void SetVisible(bool aVisible, CallerType aCallerType, - ErrorResult& aRv) override; + bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override; + void SetVisible(bool aVisible, CallerType aCallerType, + ErrorResult& aRv) override; }; } // namespace dom