Bug 1588791 - Make fission iframes honor and deal with the scrolling attribute. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D59630
This commit is contained in:
Emilio Cobos Álvarez
2020-01-12 22:22:29 +00:00
parent e5ca64b0c8
commit 0ad1bec404
11 changed files with 50 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/XULFrameElement.h"
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/dom/WindowProxyHolder.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
@@ -291,10 +292,15 @@ nsresult nsGenericHTMLFrameElement::AfterSetAttr(
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::scrolling) {
if (mFrameLoader) {
// FIXME(bug 1588791): This should work for fission iframes.
ScrollbarPreference pref = MapScrollingAttribute(aValue);
if (nsIDocShell* docshell = mFrameLoader->GetExistingDocShell()) {
nsDocShell::Cast(docshell)->SetScrollbarPreference(
MapScrollingAttribute(aValue));
nsDocShell::Cast(docshell)->SetScrollbarPreference(pref);
} else if (auto* child = mFrameLoader->GetBrowserBridgeChild()) {
// NOTE(emilio): We intentionally don't deal with the
// GetBrowserParent() case, and only deal with the fission iframe
// case. There's no reason not to make it work, but it's a bit of
// boilerplate for something that we don't use...
child->SendScrollbarPreferenceChanged(pref);
}
}
} else if (aName == nsGkAtoms::mozbrowser) {