Bug 1528743 - Move the top-layer display items inside the async zoom container. r=mstange

This maintains the important invariant that layers that carry scroll metadata
for the RCD-RSF are inside the async zoom container.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-03-06 22:51:09 +00:00
parent 258f9ffb1f
commit 5a7e4e2124
3 changed files with 36 additions and 12 deletions

View File

@ -60,18 +60,6 @@ void ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// below negative z-index elements.
BuildDisplayListForChild(aBuilder, kid, aLists);
}
nsDisplayList topLayerList;
BuildDisplayListForTopLayer(aBuilder, &topLayerList);
if (!topLayerList.IsEmpty()) {
// Wrap the whole top layer in a single item with maximum z-index,
// and append it at the very end, so that it stays at the topmost.
nsDisplayWrapList* wrapList =
MakeDisplayItem<nsDisplayWrapList>(aBuilder, this, &topLayerList);
wrapList->SetOverrideZIndex(
std::numeric_limits<decltype(wrapList->ZIndex())>::max());
aLists.PositionedDescendants()->AppendToTop(wrapList);
}
}
#ifdef DEBUG

View File

@ -68,6 +68,7 @@
#include "UnitTransforms.h"
#include "nsPluginFrame.h"
#include "nsSliderFrame.h"
#include "ViewportFrame.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/AxisPhysicsModel.h"
#include "mozilla/layers/AxisPhysicsMSDModel.h"
@ -3378,6 +3379,8 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, aLists);
}
MaybeAddTopLayerItems(aBuilder, aLists);
if (addScrollBars) {
// Add overlay scrollbars.
AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, true);
@ -3662,6 +3665,8 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
}
MaybeAddTopLayerItems(aBuilder, set);
if (willBuildAsyncZoomContainer) {
MOZ_ASSERT(mClipAllDescendants);
@ -3735,6 +3740,25 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
scrolledContent.MoveTo(aLists);
}
void ScrollFrameHelper::MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
if (mIsRoot) {
if (ViewportFrame* viewportFrame = do_QueryFrame(mOuter->GetParent())) {
nsDisplayList topLayerList;
viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList);
if (!topLayerList.IsEmpty()) {
// Wrap the whole top layer in a single item with maximum z-index,
// and append it at the very end, so that it stays at the topmost.
nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>(
aBuilder, viewportFrame, &topLayerList);
wrapList->SetOverrideZIndex(
std::numeric_limits<decltype(wrapList->ZIndex())>::max());
aLists.PositionedDescendants()->AppendToTop(wrapList);
}
}
}
}
bool ScrollFrameHelper::DecideScrollableLayer(
nsDisplayListBuilder* aBuilder, nsRect* aVisibleRect, nsRect* aDirtyRect,
bool aSetBase, bool* aDirtyRectHasBeenOverriden) {

View File

@ -82,6 +82,18 @@ class ScrollFrameHelper : public nsIReflowCallback {
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists);
// Add display items for the top-layer (which includes things like
// the fullscreen element, its backdrop, and text selection carets)
// to |aLists|.
// This is a no-op for scroll frames other than the viewport's
// root scroll frame.
// This should be called with an nsDisplayListSet that will be
// wrapped in the async zoom container, if we're building one.
// It should not be called with an ASR setter on the stack, as the
// top-layer items handle setting up their own ASRs.
void MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists);
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists, bool aCreateLayer,
bool aPositioned);