Bug 1395476 - Do not call mStoredList.RecomputeVisibility for 3d transforms
MozReview-Commit-ID: 1pnYL2RtFi6
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -8446,16 +8446,24 @@ nsDisplayTransform::GetLayerState(nsDisp
// animation can be accelerated.
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
*mStoredList.GetChildren(), mAnimatedGeometryRootForChildren);
}
bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion)
{
+ // nsDisplayTransform::GetBounds() returns an empty rect in nested 3d context.
+ // Calling mStoredList.RecomputeVisibility below for such transform causes the
+ // child display items to end up with empty visible rect.
+ // We avoid this by bailing out always if we are dealing with a 3d context.
+ if (mFrame->Extend3DContext() || mFrame->Combines3DTransformWithAncestors()) {
+ return true;
+ }
+
/* As we do this, we need to be sure to
* untransform the visible rect, since we want everything that's painting to
* think that it's painting in its original rectangular coordinate space.
* If we can't untransform, take the entire overflow rect */
nsRect untransformedVisibleRect;
if (!UntransformVisibleRect(aBuilder, &untransformedVisibleRect))
{
untransformedVisibleRect = mFrame->GetVisualOverflowRectRelativeToSelf();
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/preserves3d-nested-filter-1-ref.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Green square</title>
+<style>
+.filter {
+ filter: brightness(0.75);
+}
+
+.container {
+ width: 200px;
+ height: 200px;
+
+ background-color: green;
+}
+
+.square {
+ position: absolute;
+
+ width: 200px;
+ height: 200px;
+
+ background-color: green;
+}
+</style>
+</head>
+<body>
+
+<div class="filter">
+ <div class="container">
+ <div class="square"></div>
+ </div>
+</div>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/preserves3d-nested-filter-1.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Green square</title>
+<style>
+.filter {
+ filter: brightness(0.75);
+}
+
+.container {
+ width: 200px;
+ height: 200px;
+
+ transform-style: preserve-3d;
+ background-color: red;
+}
+
+.square {
+ position: absolute;
+
+ width: 200px;
+ height: 200px;
+
+ transform-style: preserve-3d;
+ background-color: green;
+}
+</style>
+</head>
+<body>
+
+<div class="filter">
+ <div class="container">
+ <div class="square"></div>
+ </div>
+</div>
+
+</body>
+</html>
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -85,8 +85,9 @@ fuzzy(1,10000) == opacity-preserve3d-4.h
fails-if(webrender) == mask-layer-3.html mask-layer-ref.html
== split-intersect1.html split-intersect1-ref.html
fuzzy(255,150) == split-intersect2.html split-intersect2-ref.html
fuzzy(255,100) fails-if(webrender) == split-non-ortho1.html split-non-ortho1-ref.html
fuzzy-if(winWidget,150,120) == component-alpha-1.html component-alpha-1-ref.html
== nested-transform-1.html nested-transform-1-ref.html
== transform-geometry-1.html transform-geometry-1-ref.html
== intermediate-1.html intermediate-1-ref.html
+== preserves3d-nested-filter-1.html preserves3d-nested-filter-1-ref.html