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
This commit is contained in:
Emilio Cobos Álvarez 2019-12-17 22:25:54 +00:00
Родитель b5abcaa367
Коммит df3f6a804e
2 изменённых файлов: 21 добавлений и 48 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -38,8 +38,7 @@ class BarProp : public nsISupports, public nsWrapperCache {
nsPIDOMWindowInner* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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