Bug 1319825 - Update the overflow areas of all descendants when we toggle opacity on a preserve-3d frame. r=tnikkel, a=gchang
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 13 Feb 2017 13:09:17 +1300
changeset 376234 3a3e07e22ea8a9f6523172c6e85ff363b9b1a53d
parent 376233 f7a276a267cd292c512e9e8dfb6b14c6f5f9e0ee
child 376235 ce2403f3f23bf34c6708b9162502459823ca9af5
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, gchang
bugs1319825
milestone53.0a2
Bug 1319825 - Update the overflow areas of all descendants when we toggle opacity on a preserve-3d frame. r=tnikkel, a=gchang
layout/base/RestyleManagerBase.cpp
layout/reftests/transform-3d/opacity-preserve3d-5-ref.html
layout/reftests/transform-3d/opacity-preserve3d-5.html
layout/reftests/transform-3d/reftest.list
--- a/layout/base/RestyleManagerBase.cpp
+++ b/layout/base/RestyleManagerBase.cpp
@@ -1227,16 +1227,23 @@ RestyleManagerBase::ProcessRestyledFrame
         // backgrounds (and those of table parts inside of it) are
         // painted as part of the table's nsDisplayTableBorderBackground
         // display item, or part of its own display item.  That requires
         // invalidation, so change UpdateOpacityLayer to RepaintFrame.
         hint &= ~nsChangeHint_UpdateOpacityLayer;
         hint |= nsChangeHint_RepaintFrame;
       }
 
+      // Opacity disables preserve-3d, so if we toggle it, then we also need
+      // to update the overflow areas of all potentially affected frames.
+      if ((hint & nsChangeHint_UpdateUsesOpacity) &&
+          frame->StyleDisplay()->mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D) {
+        hint |= nsChangeHint_UpdateSubtreeOverflow;
+      }
+
       if (hint & nsChangeHint_UpdateBackgroundPosition) {
         // For most frame types, DLBI can detect background position changes,
         // so we only need to schedule a paint.
         hint |= nsChangeHint_SchedulePaint;
         if (frame->IsFrameOfType(nsIFrame::eTablePart) ||
             frame->IsFrameOfType(nsIFrame::eMathML)) {
           // Table parts and MathML frames don't build display items for their
           // backgrounds, so DLBI can't detect background-position changes for
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/opacity-preserve3d-5-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    .outer {
+        transform-style: preserve-3d;
+        width: 200px;
+        height: 200px;
+        opacity: 0.7;
+    }
+    .inner {
+        top: 50%;
+        transform: translateY(-50%);
+        background-color: green;
+        position:relative;
+        width: 200px;
+        height: 200px;
+    }
+</style>
+</head>
+<body>
+
+<div id="outer" class="outer">
+    <div class="inner">
+    </div>
+</div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/opacity-preserve3d-5.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<style>
+    .outer {
+        transform-style: preserve-3d;
+        width: 200px;
+        height: 200px;
+    }
+    .inner {
+        top: 50%;
+        transform: translateY(-50%);
+        background-color: green;
+        position:relative;
+        width: 200px;
+        height: 200px;
+    }
+</style>
+</head>
+<body>
+
+<div id="outer" class="outer">
+    <div class="inner">
+    </div>
+</div>
+<script>
+  function doTest() {
+    document.getElementById("outer").style.opacity = 0.7;
+    document.documentElement.removeAttribute("class");
+  }
+    
+  window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>
+
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -72,16 +72,17 @@ fuzzy-if(gtkWidget,128,100) fuzzy-if(And
 fuzzy-if(cocoaWidget,128,9) == animate-preserve3d-parent.html animate-preserve3d-ref.html # intermittently fuzzy on Mac
 fuzzy-if(cocoaWidget,128,9) == animate-preserve3d-child.html animate-preserve3d-ref.html # intermittently fuzzy on Mac
 == animate-backface-hidden.html about:blank
 == 1245450-1.html green-rect.html
 fuzzy(1,2000) == opacity-preserve3d-1.html opacity-preserve3d-1-ref.html
 fuzzy(1,15000) == opacity-preserve3d-2.html opacity-preserve3d-2-ref.html
 fuzzy(1,10000) == opacity-preserve3d-3.html opacity-preserve3d-3-ref.html
 fuzzy(1,10000) == opacity-preserve3d-4.html opacity-preserve3d-4-ref.html
+== opacity-preserve3d-5.html opacity-preserve3d-5-ref.html
 == snap-perspective-1.html snap-perspective-1-ref.html
 == mask-layer-1.html mask-layer-ref.html
 == mask-layer-2.html mask-layer-ref.html
 == mask-layer-3.html mask-layer-ref.html
 fails-if(winWidget&&layersGPUAccelerated) == split-intersect1.html split-intersect1-ref.html # Bug 1323791: implement DirectX compositor polygon support
 fuzzy(255,150) fails-if(winWidget&&layersGPUAccelerated) == split-intersect2.html split-intersect2-ref.html # Bug 1323791
 fuzzy(255,100) fails-if(winWidget&&layersGPUAccelerated) == split-non-ortho1.html split-non-ortho1-ref.html # Bug 1323791
 fuzzy-if(winWidget,150,120) == component-alpha-1.html component-alpha-1-ref.html