Bug 1395476 - Do not call mStoredList.RecomputeVisibility for 3d transforms draft
authorMiko Mynttinen <mikokm@gmail.com>
Wed, 08 Nov 2017 02:54:10 +0100
changeset 694844 cfd7ea29a546f6acfe3d20b1680e3095bee769eb
parent 694164 7851d6768dfd9fe5568d1315a98f142d9bb9234f
child 739462 590358705575317e6c75d49cc7034bb9f4c29b68
push id88275
push userbmo:mikokm@gmail.com
push dateWed, 08 Nov 2017 12:02:38 +0000
bugs1395476
milestone58.0a1
Bug 1395476 - Do not call mStoredList.RecomputeVisibility for 3d transforms MozReview-Commit-ID: 1pnYL2RtFi6
layout/painting/nsDisplayList.cpp
layout/reftests/transform-3d/preserves3d-nested-filter-1-ref.html
layout/reftests/transform-3d/preserves3d-nested-filter-1.html
layout/reftests/transform-3d/reftest.list
--- 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