Bug 1436415 - Part 1: Reuse some local variables in nsIFrame::BuildDisplayListForChild()
MozReview-Commit-ID: Cprpg6nMeY2
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3500,34 +3500,37 @@ nsIFrame::BuildDisplayListForChild(nsDis
const bool doingShortcut =
(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;
+ nsRect dirty = aBuilder->GetDirtyRect() - offset;
+
if (doingShortcut) {
// This is the shortcut for frames been handled along the common
// path, the most common one of THE COMMON CASE mentioned later.
MOZ_ASSERT(child->Type() != LayoutFrameType::Placeholder);
MOZ_ASSERT(!aBuilder->GetSelectedFramesOnly() &&
!aBuilder->GetIncludeAllOutOfFlows(),
"It should be held for painting to window");
if (child->HasPerspective()) {
// We need to allocate a perspective index before a potential early
// return below.
aBuilder->AllocatePerspectiveItemIndex();
}
- // dirty rect in child-relative coordinates
- nsRect dirty = aBuilder->GetDirtyRect() - child->GetOffsetTo(this);
- nsRect visible = aBuilder->GetVisibleRect() - child->GetOffsetTo(this);
-
if (!DescendIntoChild(aBuilder, child, visible, dirty)) {
return;
}
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, child, visible, dirty, false);
CheckForApzAwareEventHandlers(aBuilder, child);
@@ -3567,22 +3570,16 @@ nsIFrame::BuildDisplayListForChild(nsDis
!child->IsFrameOfType(eLineParticipant)) {
// child is a non-inline frame in an inline context, i.e.,
// it acts like inline-block or inline-table. Therefore it is a
// pseudo-stacking-context.
pseudoStackingContext = true;
awayFromCommonPath = true;
}
- // dirty rect in child-relative coordinates
- NS_ASSERTION(aBuilder->GetCurrentFrame() == this, "Wrong coord space!");
- nsPoint offset = child->GetOffsetTo(this);
- nsRect visible = aBuilder->GetVisibleRect() - offset;
- nsRect dirty = aBuilder->GetDirtyRect() - offset;
-
nsDisplayListBuilder::OutOfFlowDisplayData* savedOutOfFlowData = nullptr;
bool isPlaceholder = false;
if (child->IsPlaceholderFrame()) {
isPlaceholder = true;
nsPlaceholderFrame* placeholder = static_cast<nsPlaceholderFrame*>(child);
child = placeholder->GetOutOfFlowFrame();
aBuilder->ClearWillChangeBudget(child);
NS_ASSERTION(child, "No out of flow frame?");
@@ -3613,17 +3610,19 @@ nsIFrame::BuildDisplayListForChild(nsDis
// to enter to reach other out-of-flow frames that are visible.
visible.SetEmpty();
dirty.SetEmpty();
}
pseudoStackingContext = true;
awayFromCommonPath = true;
}
- if (child->HasPerspective()) {
+ const nsStyleDisplay* disp = child->StyleDisplay();
+
+ if (child->HasPerspective(disp)) {
// We need to allocate a perspective index before a potential early
// return below.
aBuilder->AllocatePerspectiveItemIndex();
}
NS_ASSERTION(!child->IsPlaceholderFrame(),
"Should have dealt with placeholders already");
if (aBuilder->GetSelectedFramesOnly() &&
@@ -3658,17 +3657,16 @@ nsIFrame::BuildDisplayListForChild(nsDis
awayFromCommonPath = true;
}
child->SetBuiltDisplayList(true);
// Child is composited if it's transformed, partially transparent, or has
// SVG effects or a blend mode..
EffectSet* effectSet = EffectSet::GetEffectSet(child);
- const nsStyleDisplay* disp = child->StyleDisplay();
const nsStyleEffects* effects = child->StyleEffects();
const nsStylePosition* pos = child->StylePosition();
bool isVisuallyAtomic = child->IsVisuallyAtomic(effectSet, disp, effects);
bool isPositioned = disp->IsAbsPosContainingBlock(child);
bool isStackingContext = child->IsStackingContext(disp, pos, isPositioned, isVisuallyAtomic) ||
(aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
if (isVisuallyAtomic || isPositioned || (!isSVG && disp->IsFloating(child)) ||