Bug 1298209 - Create variables for extend3DContext and hasPerspective. r?mattwoodrow
MozReview-Commit-ID: 9Dm7lnLQ4I4
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2186,47 +2186,49 @@ nsIFrame::BuildDisplayListForStackingCon
return;
}
}
if (disp->mWillChangeBitField != 0) {
aBuilder->AddToWillChangeBudget(this, GetSize());
}
+ bool extend3DContext = Extend3DContext();
Maybe<nsDisplayListBuilder::AutoPreserves3DContext> autoPreserves3DContext;
- if (Extend3DContext() && !Combines3DTransformWithAncestors()) {
+ if (extend3DContext && !Combines3DTransformWithAncestors()) {
// Start a new preserves3d context to keep informations on
// nsDisplayListBuilder.
autoPreserves3DContext.emplace(aBuilder);
// Save dirty rect on the builder to avoid being distorted for
// multiple transforms along the chain.
aBuilder->SetPreserves3DDirtyRect(aDirtyRect);
}
// For preserves3d, use the dirty rect already installed on the
// builder, since aDirtyRect maybe distorted for transforms along
// the chain.
nsRect dirtyRect = aDirtyRect;
bool inTransform = aBuilder->IsInTransform();
bool isTransformed = IsTransformed();
+ bool hasPerspective = HasPerspective();
// reset blend mode so we can keep track if this stacking context needs have
// a nsDisplayBlendContainer. Set the blend mode back when the routine exits
// so we keep track if the parent stacking context needs a container too.
AutoSaveRestoreContainsBlendMode autoRestoreBlendMode(*aBuilder);
aBuilder->SetContainsBlendMode(false);
nsRect dirtyRectOutsideTransform = dirtyRect;
if (isTransformed) {
const nsRect overflow = GetVisualOverflowRectRelativeToSelf();
if (nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder,
this)) {
dirtyRect = overflow;
} else {
- if (overflow.IsEmpty() && !Extend3DContext()) {
+ if (overflow.IsEmpty() && !extend3DContext) {
return;
}
// If we're in preserve-3d then grab the dirty rect that was given to the root
// and transform using the combined transform.
if (Combines3DTransformWithAncestors()) {
dirtyRect = aBuilder->GetPreserves3DDirtyRect(this);
}
@@ -2294,19 +2296,19 @@ nsIFrame::BuildDisplayListForStackingCon
CheckForApzAwareEventHandlers(aBuilder, this);
nsRect clipPropClip;
if (ApplyClipPropClipping(aBuilder, this, disp, effects, &clipPropClip,
nestedClipState)) {
dirtyRect.IntersectRect(dirtyRect, clipPropClip);
}
- // Extend3DContext() also guarantees that applyAbsPosClipping and usingSVGEffects are false
+ // extend3DContext also guarantees that applyAbsPosClipping and usingSVGEffects are false
// We only modify the preserve-3d rect if we are the top of a preserve-3d heirarchy
- if (Extend3DContext()) {
+ if (extend3DContext) {
// Mark these first so MarkAbsoluteFramesForDisplayList knows if we are
// going to be forced to descend into frames.
aBuilder->MarkPreserve3DFramesForDisplayList(this);
}
MarkAbsoluteFramesForDisplayList(aBuilder, dirtyRect);
nsDisplayLayerEventRegions* eventRegions = nullptr;
@@ -2452,17 +2454,17 @@ nsIFrame::BuildDisplayListForStackingCon
*
* For the preserve-3d case we want to individually wrap every child in the list with
* a separate nsDisplayTransform instead. When the child is already an nsDisplayTransform,
* we can skip this step, as the computed transform will already include our own.
*
* We also traverse into sublists created by nsDisplayWrapList, so that we find all the
* correct children.
*/
- if (isTransformed && !resultList.IsEmpty() && Extend3DContext()) {
+ if (isTransformed && !resultList.IsEmpty() && extend3DContext) {
// Install dummy nsDisplayTransform as a leaf containing
// descendants not participating this 3D rendering context.
nsDisplayList nonparticipants;
nsDisplayList participants;
int index = 1;
while (nsDisplayItem* item = resultList.RemoveBottom()) {
if (ItemParticipatesIn3DContext(this, item) && !item->GetClip().HasClip()) {
@@ -2486,24 +2488,24 @@ nsIFrame::BuildDisplayListForStackingCon
resultList.AppendToTop(&participants);
}
/* If we're creating an nsDisplayTransform item that is going to combine its transform
* with its children (preserve-3d or perspective), then we can't have an intermediate
* surface. Mask layers force an intermediate surface, so if we're going to need both
* then create a separate wrapping layer for the mask.
*/
- bool needsLayerForMask = isTransformed && (Extend3DContext() || HasPerspective()) &&
+ bool needsLayerForMask = isTransformed && (extend3DContext || hasPerspective) &&
clipState.SavedStateHasRoundedCorners();
NS_ASSERTION(!Combines3DTransformWithAncestors() || !clipState.SavedStateHasRoundedCorners(),
"Can't support mask layers on intermediate preserve-3d frames");
if (isTransformed && !resultList.IsEmpty()) {
// Restore clip state now so nsDisplayTransform is clipped properly.
- if (!HasPerspective() && !useFixedPosition && !useStickyPosition && !needsLayerForMask) {
+ if (!hasPerspective && !useFixedPosition && !useStickyPosition && !needsLayerForMask) {
clipState.ExitStackingContextContents(&containerItemScrollClip);
}
// Revert to the dirtyrect coming in from the parent, without our transform
// taken into account.
buildingDisplayList.SetDirtyRect(dirtyRectOutsideTransform);
// Revert to the outer reference frame and offset because all display
// items we create from now on are outside the transform.
nsPoint toOuterReferenceFrame;
@@ -2521,17 +2523,17 @@ nsIFrame::BuildDisplayListForStackingCon
dirtyRectOutsideSVGEffects.Contains(GetVisualOverflowRectRelativeToSelf());
nsDisplayTransform *transformItem =
new (aBuilder) nsDisplayTransform(aBuilder, this,
&resultList, dirtyRect, 0,
isFullyVisible);
resultList.AppendNewToTop(transformItem);
}
- if (HasPerspective()) {
+ if (hasPerspective) {
if (!useFixedPosition && !useStickyPosition && !needsLayerForMask) {
clipState.ExitStackingContextContents(&containerItemScrollClip);
}
resultList.AppendNewToTop(
new (aBuilder) nsDisplayPerspective(
aBuilder, this,
GetContainingBlock()->GetContent()->GetPrimaryFrame(), &resultList));
}