From ec6b8aac5359e0dbb2740e8f07ac2182a81ffa86 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 5 Feb 2016 22:42:55 -0800 Subject: [PATCH] Back out e751d638ab4b (bug 1229317) for reftest "Assertion failure: oldState < kReadMax" and crashes CLOSED TREE --- gfx/layers/Layers.cpp | 5 +- .../composite/LayerManagerComposite.cpp | 6 +- layout/generic/nsFrame.cpp | 66 ++++++------------- .../transform-3d/preserve3d-7-ref.html | 11 ---- .../reftests/transform-3d/preserve3d-7a.html | 9 --- 5 files changed, 22 insertions(+), 75 deletions(-) delete mode 100644 layout/reftests/transform-3d/preserve3d-7-ref.html delete mode 100644 layout/reftests/transform-3d/preserve3d-7a.html diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 655f1123a6a5..f6081cadb781 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -1380,7 +1380,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS } else { float opacity = GetEffectiveOpacity(); CompositionOp blendMode = GetEffectiveMixBlendMode(); - if (((opacity != 1.0f || blendMode != CompositionOp::OP_OVER) && (HasMultipleChildren() || Creates3DContextWithExtendingChildren())) || + if (((opacity != 1.0f || blendMode != CompositionOp::OP_OVER) && HasMultipleChildren()) || (!idealTransform.Is2D() && Creates3DContextWithExtendingChildren())) { useIntermediateSurface = true; } else { @@ -1882,9 +1882,6 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix) if (!mTransform.IsIdentity()) { AppendToString(aStream, mTransform, " [transform=", "]"); } - if (!GetEffectiveTransform().IsIdentity()) { - AppendToString(aStream, GetEffectiveTransform(), " [effective-transform=", "]"); - } if (mTransformIsPerspective) { aStream << " [perspective]"; } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 1124e42bcbe9..74e8204cb61d 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -282,12 +282,8 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer, // - They recalculate their visible regions, taking ancestorClipForChildren // into account, and accumulate them into descendantsVisibleRegion. LayerIntRegion descendantsVisibleRegion; - bool hasPreserve3DChild = false; for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) { PostProcessLayers(child, localOpaque, descendantsVisibleRegion, ancestorClipForChildren); - if (child->Extend3DContext()) { - hasPreserve3DChild = true; - } } // Recalculate our visible region. @@ -295,7 +291,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer, // If we have descendants, throw away the visible region stored on this // layer, and use the region accumulated by our descendants instead. - if (aLayer->GetFirstChild() && !hasPreserve3DChild) { + if (aLayer->GetFirstChild()) { visible = descendantsVisibleRegion; } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index d1372fc471f5..a9a1663f802f 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1143,12 +1143,6 @@ nsIFrame::Extend3DContext() const return false; } - // Opacity can only be only the root or leaves of a preserve-3d context - // as it requires flattening. - if (HasOpacity() && Combines3DTransformWithAncestors()) { - return false; - } - nsRect temp; return !nsFrame::ShouldApplyOverflowClipping(this, disp) && !GetClipPropClipRect(disp, &temp, GetSize()) && @@ -1967,28 +1961,6 @@ WrapSeparatorTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, } } -static void -CreateOpacityItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList& aList, bool aItemForEventsOnly) -{ - // Don't clip nsDisplayOpacity items. We clip their descendants instead. - // The clip we would set on an element with opacity would clip - // all descendant content, but some should not be clipped. - // We clear both regular clips and scroll clips. If this item's animated - // geometry root has async scrolling, then the async scroll transform will - // be applied on the opacity's descendants (because that's where the - // scroll clip will be). However, this won't work if the opacity item is - // inactive, which is why we record the pre-clear scroll clip here. - const DisplayItemScrollClip* scrollClipForSameAGRChildren = - aBuilder->ClipState().GetCurrentInnermostScrollClip(); - DisplayListClipState::AutoSaveRestore opacityClipState(aBuilder); - opacityClipState.ClearIncludingScrollClip(); - aList.AppendNewToTop( - new (aBuilder) nsDisplayOpacity(aBuilder, aFrame, &aList, - scrollClipForSameAGRChildren, - aItemForEventsOnly)); -} - void nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, @@ -2211,8 +2183,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, clipState.Restore(); } - bool is3DContextRoot = Extend3DContext() && !Combines3DTransformWithAncestors(); - /* If there are any SVG effects, wrap the list up in an SVG effects item * (which also handles CSS group opacity). Note that we create an SVG effects * item even if resultList is empty, since a filter can produce graphical @@ -2225,16 +2195,26 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, resultList.AppendNewToTop( new (aBuilder) nsDisplaySVGEffects(aBuilder, this, &resultList)); } - else if (useOpacity && !resultList.IsEmpty() && !is3DContextRoot) { - /* If this element is the root of a preserve-3d context, then we want - * to make sure any opacity items are on the outside of the transform - * so that they don't interfere with the chain of nsDisplayTransforms. - * Opacity on preserve-3d leaves need to be inside the transform for the - * same reason, and we do this in the general case as well to preserve - * existing behaviour. - */ - CreateOpacityItem(aBuilder, this, resultList, opacityItemForEventsOnly); - useOpacity = false; + /* Else, if the list is non-empty and there is CSS group opacity without SVG + * effects, wrap it up in an opacity item. + */ + else if (useOpacity && !resultList.IsEmpty()) { + // Don't clip nsDisplayOpacity items. We clip their descendants instead. + // The clip we would set on an element with opacity would clip + // all descendant content, but some should not be clipped. + // We clear both regular clips and scroll clips. If this item's animated + // geometry root has async scrolling, then the async scroll transform will + // be applied on the opacity's descendants (because that's where the + // scroll clip will be). However, this won't work if the opacity item is + // inactive, which is why we record the pre-clear scroll clip here. + const DisplayItemScrollClip* scrollClipForSameAGRChildren = + aBuilder->ClipState().GetCurrentInnermostScrollClip(); + DisplayListClipState::AutoSaveRestore opacityClipState(aBuilder); + opacityClipState.ClearIncludingScrollClip(); + resultList.AppendNewToTop( + new (aBuilder) nsDisplayOpacity(aBuilder, this, &resultList, + scrollClipForSameAGRChildren, + opacityItemForEventsOnly)); } /* If we're going to apply a transformation and don't have preserve-3d set, wrap @@ -2308,12 +2288,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, GetContainingBlock()->GetContent()->GetPrimaryFrame(), &resultList)); } - /* If we need an opacity item, but didn't do it earlier, add it now on the - * outside of the transform. - */ - if (useOpacity && !usingSVGEffects) { - CreateOpacityItem(aBuilder, this, resultList, opacityItemForEventsOnly); - } } /* If we have sticky positioning, wrap it in a sticky position item. diff --git a/layout/reftests/transform-3d/preserve3d-7-ref.html b/layout/reftests/transform-3d/preserve3d-7-ref.html deleted file mode 100644 index 4aabf2605d20..000000000000 --- a/layout/reftests/transform-3d/preserve3d-7-ref.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -
-
-
-
-
- - diff --git a/layout/reftests/transform-3d/preserve3d-7a.html b/layout/reftests/transform-3d/preserve3d-7a.html deleted file mode 100644 index a83a12307753..000000000000 --- a/layout/reftests/transform-3d/preserve3d-7a.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - -
-
-
- -