--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -416,17 +416,16 @@ public:
PaintedLayerData() :
mAnimatedGeometryRoot(nullptr),
mScrollClip(nullptr),
mReferenceFrame(nullptr),
mLayer(nullptr),
mSolidColor(NS_RGBA(0, 0, 0, 0)),
mIsSolidColorInVisibleRegion(false),
mFontSmoothingBackgroundColor(NS_RGBA(0,0,0,0)),
- mExclusiveToOneItem(false),
mClipMovesWithLayer(true),
mIsCaret(false),
mNeedComponentAlpha(false),
mForceTransparentSurface(false),
mHideAllLayersBelow(false),
mOpaqueForAnimatedGeometryRootParent(false),
mDisableFlattening(false),
mBackfaceHidden(false),
@@ -572,20 +571,16 @@ public:
*/
bool mIsSolidColorInVisibleRegion;
/**
* The target background color for smoothing fonts that are drawn on top of
* transparent parts of the layer.
*/
nscolor mFontSmoothingBackgroundColor;
/**
- * True if only one display item can be assigned to this layer.
- */
- bool mExclusiveToOneItem;
- /**
* True unless the layer contains exactly one item whose clip scrolls
* relative to the layer rather than moving with the layer.
*/
bool mClipMovesWithLayer;
/**
* True if the layer contains exactly one item for the caret.
*/
bool mIsCaret;
@@ -947,17 +942,16 @@ public:
* Find a PaintedLayerData for aItem. This can either be an existing
* PaintedLayerData from inside a node in our tree, or a new one that gets
* created by a call out to aNewPaintedLayerCallback.
*/
template<typename NewPaintedLayerCallbackType>
PaintedLayerData* FindPaintedLayerFor(AnimatedGeometryRoot* aAnimatedGeometryRoot,
const DisplayItemScrollClip* aScrollClip,
const nsIntRect& aVisibleRect,
- bool aForceOwnLayer,
bool aBackfaceidden,
NewPaintedLayerCallbackType aNewPaintedLayerCallback);
/**
* Finish everything.
*/
void Finish();
@@ -2649,49 +2643,42 @@ PaintedLayerDataNode::AddChildNodeFor(An
template<typename NewPaintedLayerCallbackType>
PaintedLayerData*
PaintedLayerDataNode::FindPaintedLayerFor(const nsIntRect& aVisibleRect,
bool aBackfaceHidden,
const DisplayItemScrollClip* aScrollClip,
NewPaintedLayerCallbackType aNewPaintedLayerCallback)
{
if (!mPaintedLayerDataStack.IsEmpty()) {
- if (mPaintedLayerDataStack[0].mExclusiveToOneItem) {
- MOZ_ASSERT(mPaintedLayerDataStack.Length() == 1);
- SetAllDrawingAbove();
- MOZ_ASSERT(mPaintedLayerDataStack.IsEmpty());
- } else {
- PaintedLayerData* lowestUsableLayer = nullptr;
- for (auto& data : Reversed(mPaintedLayerDataStack)) {
- if (data.mVisibleAboveRegion.Intersects(aVisibleRect)) {
- break;
- }
- MOZ_ASSERT(!data.mExclusiveToOneItem);
- if (data.mBackfaceHidden == aBackfaceHidden &&
- data.mScrollClip == aScrollClip) {
- lowestUsableLayer = &data;
- }
- nsIntRegion visibleRegion = data.mVisibleRegion;
- // Also check whether the event-regions intersect the visible rect,
- // unless we're in an inactive layer, in which case the event-regions
- // will be hoisted out into their own layer.
- // For performance reasons, we check the intersection with the bounds
- // of the event-regions.
- if (!mTree.ContState().IsInInactiveLayer() &&
- (data.mScaledHitRegionBounds.Intersects(aVisibleRect) ||
- data.mScaledMaybeHitRegionBounds.Intersects(aVisibleRect))) {
- break;
- }
- if (visibleRegion.Intersects(aVisibleRect)) {
- break;
- }
+ PaintedLayerData* lowestUsableLayer = nullptr;
+ for (auto& data : Reversed(mPaintedLayerDataStack)) {
+ if (data.mVisibleAboveRegion.Intersects(aVisibleRect)) {
+ break;
+ }
+ if (data.mBackfaceHidden == aBackfaceHidden &&
+ data.mScrollClip == aScrollClip) {
+ lowestUsableLayer = &data;
}
- if (lowestUsableLayer) {
- return lowestUsableLayer;
+ nsIntRegion visibleRegion = data.mVisibleRegion;
+ // Also check whether the event-regions intersect the visible rect,
+ // unless we're in an inactive layer, in which case the event-regions
+ // will be hoisted out into their own layer.
+ // For performance reasons, we check the intersection with the bounds
+ // of the event-regions.
+ if (!mTree.ContState().IsInInactiveLayer() &&
+ (data.mScaledHitRegionBounds.Intersects(aVisibleRect) ||
+ data.mScaledMaybeHitRegionBounds.Intersects(aVisibleRect))) {
+ break;
}
+ if (visibleRegion.Intersects(aVisibleRect)) {
+ break;
+ }
+ }
+ if (lowestUsableLayer) {
+ return lowestUsableLayer;
}
}
return mPaintedLayerDataStack.AppendElement(aNewPaintedLayerCallback());
}
void
PaintedLayerDataNode::FinishChildrenIntersecting(const nsIntRect& aRect)
{
@@ -2810,31 +2797,26 @@ PaintedLayerDataTree::AddingOwnLayer(Ani
}
}
template<typename NewPaintedLayerCallbackType>
PaintedLayerData*
PaintedLayerDataTree::FindPaintedLayerFor(AnimatedGeometryRoot* aAnimatedGeometryRoot,
const DisplayItemScrollClip* aScrollClip,
const nsIntRect& aVisibleRect,
- bool aForceOwnLayer,
bool aBackfaceHidden,
NewPaintedLayerCallbackType aNewPaintedLayerCallback)
{
- const nsIntRect* bounds = aForceOwnLayer ? nullptr : &aVisibleRect;
+ const nsIntRect* bounds = &aVisibleRect;
FinishPotentiallyIntersectingNodes(aAnimatedGeometryRoot, bounds);
PaintedLayerDataNode* node = EnsureNodeFor(aAnimatedGeometryRoot);
- if (aForceOwnLayer) {
- node->SetAllDrawingAbove();
- }
PaintedLayerData* data =
node->FindPaintedLayerFor(aVisibleRect, aBackfaceHidden, aScrollClip,
aNewPaintedLayerCallback);
- data->mExclusiveToOneItem = aForceOwnLayer;
return data;
}
void
PaintedLayerDataTree::FinishPotentiallyIntersectingNodes(AnimatedGeometryRoot* aAnimatedGeometryRoot,
const nsIntRect* aRect)
{
AnimatedGeometryRoot* ancestorThatIsChildOfCommonAncestor = nullptr;
@@ -4184,17 +4166,17 @@ ContainerState::ProcessDisplayItems(nsDi
/**
* No need to allocate geometry for items that aren't
* part of a PaintedLayer.
*/
mLayerBuilder->AddLayerDisplayItem(ownLayer, item, layerState, nullptr);
} else {
PaintedLayerData* paintedLayerData =
mPaintedLayerDataTree.FindPaintedLayerFor(animatedGeometryRoot, agrScrollClip,
- itemVisibleRect, false,
+ itemVisibleRect,
item->Frame()->In3DContextAndBackfaceIsHidden(),
[&]() {
return NewPaintedLayerData(item, animatedGeometryRoot, agrScrollClip,
topLeft, clipMovesWithLayer);
});
if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
nsDisplayLayerEventRegions* eventRegions =