Back out e751d638ab4b (bug 1229317) for reftest "Assertion failure: oldState < kReadMax" and crashes

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2016-02-05 22:42:55 -08:00
parent efe23eadc2
commit ec6b8aac53
5 changed files with 22 additions and 75 deletions

View File

@ -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]";
}

View File

@ -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;
}

View File

@ -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.
/* Else, if the list is non-empty and there is CSS group opacity without SVG
* effects, wrap it up in an opacity item.
*/
CreateOpacityItem(aBuilder, this, resultList, opacityItemForEventsOnly);
useOpacity = false;
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.

View File

@ -1,11 +0,0 @@
<html>
<head>
</head>
<body>
<div style="opacity:0.5">
<div style="transform: rotatey(90deg); transform-style: preserve-3d; width:100px;">
<div style="transform: rotatey(90deg); width: 100px; height: 100px; background-color: #00FF00"></div>
</div>
</div>
</body>
</html>

View File

@ -1,9 +0,0 @@
<html>
<head>
</head>
<body>
<div style="transform: rotatey(90deg); transform-style: preserve-3d; width:100px; opacity:0.5">
<div style="transform: rotatey(90deg); width: 100px; height: 100px; background-color: #00FF00"></div>
</div>
</body>
</html>