Bug 1395476 - Do not call mStoredList.RecomputeVisibility for 3d transforms r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Wed, 08 Nov 2017 02:54:10 +0100
changeset 444140 250063fc6ce206de9c58484163dd6981bb0c7fa1
parent 444139 706b069128e34e298685070a4cfb6f1e472b2a28
child 444141 e3aec6e0fb79a249c1344717d69eb16b9af5ad39
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1395476
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395476 - Do not call mStoredList.RecomputeVisibility for 3d transforms r=mattwoodrow 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
@@ -8490,16 +8490,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