Bug 1436415 - Part 2: Enable nsIFrame::BuildDisplayListForChild() fast-path when using simple event region items
MozReview-Commit-ID: 77rwS0cDUnn
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3492,21 +3492,22 @@ nsIFrame::BuildDisplayListForChild(nsDis
}
nsIFrame* child = aChild;
if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
return;
aBuilder->ClearWillChangeBudget(child);
- const bool doingShortcut =
+ const bool shortcutPossible = aBuilder->IsPaintingToWindow() &&
+ (aBuilder->IsBuildingLayerEventRegions() ||
+ aBuilder->BuildCompositorHitTestInfo());
+
+ const bool doingShortcut = shortcutPossible &&
(child->GetStateBits() & NS_FRAME_SIMPLE_DISPLAYLIST) &&
- aBuilder->IsPaintingToWindow() &&
- // This would be changed by the change of preference.
- aBuilder->IsBuildingLayerEventRegions() &&
// Animations may change the value of |HasOpacity()|.
!(child->GetContent() &&
child->GetContent()->MayHaveAnimations());
// dirty rect in child-relative coordinates
NS_ASSERTION(aBuilder->GetCurrentFrame() == this, "Wrong coord space!");
const nsPoint offset = child->GetOffsetTo(this);
nsRect visible = aBuilder->GetVisibleRect() - offset;
@@ -3778,23 +3779,23 @@ nsIFrame::BuildDisplayListForChild(nsDis
} else {
aLists.BorderBackground()->AppendToTop(eventRegions);
}
} else {
nsDisplayLayerEventRegions* eventRegions = aBuilder->GetLayerEventRegions();
if (eventRegions) {
eventRegions->AddFrame(aBuilder, child);
}
- if (!awayFromCommonPath &&
- aBuilder->IsPaintingToWindow() &&
- !buildingForChild.MaybeAnimatedGeometryRoot()) {
- // The shortcut is available for the child for next time.
- child->AddStateBits(NS_FRAME_SIMPLE_DISPLAYLIST);
- }
- }
+ }
+ }
+
+ if (!awayFromCommonPath && shortcutPossible &&
+ !differentAGR && !buildingForChild.MaybeAnimatedGeometryRoot()) {
+ // The shortcut is available for the child for next time.
+ child->AddStateBits(NS_FRAME_SIMPLE_DISPLAYLIST);
}
if (!pseudoStackingContext) {
// THIS IS THE COMMON CASE.
// Not a pseudo or real stacking context. Do the simple thing and
// return early.
aBuilder->AdjustWindowDraggingRegion(child);