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

Differential Revision: https://phabricator.services.mozilla.com/D59630

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-01-12 22:22:29 +00:00
Родитель 874686801b
Коммит 6e69347f9f
11 изменённых файлов: 50 добавлений и 9 удалений

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

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

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

@ -143,6 +143,12 @@ IPCResult BrowserBridgeParent::RecvShow(const OwnerShowInfo& aOwnerInfo) {
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvScrollbarPreferenceChanged(
ScrollbarPreference aPref) {
Unused << mBrowserParent->SendScrollbarPreferenceChanged(aPref);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvLoadURL(const nsCString& aUrl) {
Unused << mBrowserParent->SendLoadURL(aUrl, mBrowserParent->GetShowInfo());
return IPC_OK();

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

@ -67,6 +67,7 @@ class BrowserBridgeParent : public PBrowserBridgeParent {
friend class PBrowserBridgeParent;
mozilla::ipc::IPCResult RecvShow(const OwnerShowInfo&);
mozilla::ipc::IPCResult RecvScrollbarPreferenceChanged(ScrollbarPreference);
mozilla::ipc::IPCResult RecvLoadURL(const nsCString& aUrl);
mozilla::ipc::IPCResult RecvResumeLoad(uint64_t aPendingSwitchID);
mozilla::ipc::IPCResult RecvUpdateDimensions(

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

@ -1111,7 +1111,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvResumeLoad(
}
void BrowserChild::DoFakeShow(const ParentShowInfo& aParentShowInfo) {
OwnerShowInfo ownerInfo{ScreenIntSize(), mParentIsActive, nsSizeMode_Normal};
OwnerShowInfo ownerInfo{ScreenIntSize(), ScrollbarPreference::Auto,
mParentIsActive, nsSizeMode_Normal};
RecvShow(aParentShowInfo, ownerInfo);
mDidFakeShow = true;
}
@ -1187,6 +1188,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvShow(
ApplyParentShowInfo(aParentInfo);
RecvParentActivated(aOwnerInfo.parentWindowIsActive());
RecvScrollbarPreferenceChanged(aOwnerInfo.scrollbarPreference());
if (!res) {
return IPC_FAIL_NO_REASON(this);
@ -1213,6 +1215,13 @@ mozilla::ipc::IPCResult BrowserChild::RecvInitRendering(
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvScrollbarPreferenceChanged(
ScrollbarPreference aPreference) {
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
nsDocShell::Cast(docShell)->SetScrollbarPreference(aPreference);
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvCompositorOptionsChanged(
const CompositorOptions& aNewOptions) {
MOZ_ASSERT(mCompositorOptions);

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

@ -702,6 +702,8 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
mozilla::ipc::IPCResult RecvParentActivated(const bool& aActivated);
mozilla::ipc::IPCResult RecvScrollbarPreferenceChanged(ScrollbarPreference);
mozilla::ipc::IPCResult RecvSetKeyboardIndicators(
const UIStateChangeType& aShowFocusRings);

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

@ -29,6 +29,7 @@ using CSSSize from "Units.h";
using ScreenIntSize from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using nsSizeMode from "nsIWidgetListener.h";
using ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using refcounted class nsIPrincipal from "mozilla/dom/PermissionMessageUtils.h";
@ -354,7 +355,8 @@ struct OwnerShowInfo {
// render to a virtual <0, 0> top-left point.
ScreenIntSize size;
// TODO(emilio): Scrollbar and margin preferences go here.
// TODO(emilio): Margin preferences go here.
ScrollbarPreference scrollbarPreference;
// TODO(emilio): I think we should really be able to figure out these from the
// parent process too instead.

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

@ -10,6 +10,7 @@
#include "ipc/IPCMessageUtils.h"
#include "nsCOMPtr.h"
#include "nsDocShellLoadState.h"
#include "mozilla/ScrollbarPreferences.h"
namespace mozilla {
namespace ipc {
@ -25,4 +26,14 @@ struct IPDLParamTraits<nsDocShellLoadState*> {
} // namespace ipc
} // namespace mozilla
namespace IPC {
template <>
struct ParamTraits<mozilla::ScrollbarPreference>
: public ContiguousEnumSerializerInclusive<
mozilla::ScrollbarPreference, mozilla::ScrollbarPreference::Auto,
mozilla::ScrollbarPreference::LAST> {};
} // namespace IPC
#endif // mozilla_dom_docshell_message_utils_h__

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

@ -718,6 +718,8 @@ child:
*/
async Show(ParentShowInfo parentInfo, OwnerShowInfo childInfo);
async ScrollbarPreferenceChanged(ScrollbarPreference pref);
async InitRendering(TextureFactoryIdentifier textureFactoryIdentifier,
LayersId layersId,
CompositorOptions compositorOptions,

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

@ -77,6 +77,7 @@ parent:
// Out of process rendering.
async Show(OwnerShowInfo info);
async ScrollbarPreferenceChanged(ScrollbarPreference pref);
async UpdateDimensions(DimensionInfo dimensions) compressall;
async RenderLayers(bool aEnabled, LayersObserverEpoch aEpoch);

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

@ -14,6 +14,7 @@ namespace mozilla {
enum class ScrollbarPreference : uint8_t {
Auto,
Never,
LAST = Never,
};
} // namespace mozilla

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

@ -34,10 +34,10 @@ fuzzy-if(Android,0-5,0-20000) == uncovering-2.html uncovering-2-ref.html
fuzzy-if(asyncPan&&!layersGPUAccelerated,0-149,0-4520) == less-than-scrollbar-height.html less-than-scrollbar-height-ref.html
== huge-horizontal-overflow.html huge-horizontal-overflow-ref.html
== huge-vertical-overflow.html huge-vertical-overflow-ref.html
fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-6818) fails-if(browserIsFission) == iframe-scrolling-attr-1.html iframe-scrolling-attr-ref.html # Fission failure bug 1588791
fuzzy-if(asyncPan&&!layersGPUAccelerated,0-140,0-6818) fails-if(browserIsFission) == iframe-scrolling-attr-2.html iframe-scrolling-attr-ref.html
fuzzy(0-1,0-2) fuzzy-if(geckoview,0-1,0-15) fails-if(browserIsFission) == frame-scrolling-attr-1.html frame-scrolling-attr-ref.html
fuzzy(0-1,0-2) fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-2420) fuzzy-if(geckoview,0-1,0-88) fails-if(browserIsFission) == frame-scrolling-attr-2.html frame-scrolling-attr-ref.html
fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-6818) == iframe-scrolling-attr-1.html iframe-scrolling-attr-ref.html
fuzzy-if(asyncPan&&!layersGPUAccelerated,0-140,0-6818) == iframe-scrolling-attr-2.html iframe-scrolling-attr-ref.html
fuzzy(0-1,0-2) fuzzy-if(geckoview,0-1,0-15) == frame-scrolling-attr-1.html frame-scrolling-attr-ref.html
fuzzy(0-1,0-2) fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-2420) fuzzy-if(geckoview,0-1,0-88) == frame-scrolling-attr-2.html frame-scrolling-attr-ref.html
== move-item.html move-item-ref.html # bug 1125750
== fractional-scroll-area.html?top=-0.4&outerBottom=100&innerBottom=200 fractional-scroll-area.html?top=0&outerBottom=100&innerBottom=200
== fractional-scroll-area.html?top=0.4&outerBottom=100&innerBottom=200 fractional-scroll-area.html?top=0&outerBottom=100&innerBottom=200