Bug 1278021 - Don't treat nsDisplayOpacity as participating in a preserve-3d context if it is an untransformed leaf. r=thinker
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 07 Jun 2016 19:47:06 +1200
changeset 300855 7bae0fb42b79502aa92e25f5d7a01bb95a37c9e7
parent 300854 7f5be0d15ff0ff65abb6baa4b41fa8a75601b0ff
child 300856 84811a596e32eaa4576b4548610619d3d2c898ae
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersthinker
bugs1278021
milestone50.0a1
Bug 1278021 - Don't treat nsDisplayOpacity as participating in a preserve-3d context if it is an untransformed leaf. r=thinker
layout/base/tests/mochitest.ini
layout/base/tests/test_bug1278021.html
layout/generic/nsFrame.cpp
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -277,15 +277,16 @@ skip-if = buildapp == 'android' || build
 support-files = bug1153130_inner.html
 [test_bug1162990.html]
 support-files =
   bug1162990_inner_1.html
   bug1162990_inner_2.html
 [test_bug1226904.html]
 support-files = bug1226904.html
 [test_bug1246622.html]
+[test_bug1278021.html]
 [test_transformed_scrolling_repaints.html]
 skip-if = buildapp == 'b2g'
 [test_transformed_scrolling_repaints_2.html]
 skip-if = buildapp == 'b2g'
 [test_transformed_scrolling_repaints_3.html]
 skip-if = buildapp == 'b2g'
 [test_frame_reconstruction_scroll_restore.html]
copy from layout/base/tests/test_bug1246622.html
copy to layout/base/tests/test_bug1278021.html
--- a/layout/base/tests/test_bug1246622.html
+++ b/layout/base/tests/test_bug1278021.html
@@ -1,45 +1,45 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<title>Test for Bug 1246622</title>
+<title>Test for Bug 1278021</title>
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-<style>
-  #grandparent {
-    position: absolute;
-    height: 100px;
-    width: 100px;
-    left: 400px;
+<style type="text/css">
+  #parent {
     transform-style: preserve-3d;
   }
 
-  #parent {
-    transform: translateX(0px);
+  #firstchild {
+    width: 100%;
+    height: 226px;
+    background-color: blue;
   }
 
-  #child {
-    width: 100px;
-    height: 100px;
-    background-color: green;
-    transform-style: preserve-3d;
+  #secondchild {
+    display: block;
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 100%;
+    height: 100%;
+    opacity: 0;
   }
-  </style>
+</style>
 </head>
 <body>
-<div id="grandparent">
-  <div id="parent">
-    <div id="child"></div>
-  </div>
+<div id="parent">
+  <div id="firstchild"></div>
+  <div id="secondchild"></div>
 </div>
 
 <pre id="test">
 <script type="application/javascript">
 
-/** Test for Bug 1246622 **/
+/** Test for Bug 1278021 **/
 
-is(document.elementFromPoint(450,50), document.getElementById("child"), "Able to hit transformed object");
+is(document.elementFromPoint(50,50), document.getElementById("secondchild"), "Able to hit transformed object");
 
 </script>
 </pre>
 </body>
 </html>
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2127,19 +2127,23 @@ FrameParticipatesIn3DContext(nsIFrame* a
   MOZ_ASSERT(frame == aAncestor);
   return true;
 }
 
 static bool
 ItemParticipatesIn3DContext(nsIFrame* aAncestor, nsDisplayItem* aItem)
 {
   nsIFrame* transformFrame;
-  if (aItem->GetType() == nsDisplayItem::TYPE_TRANSFORM ||
-      aItem->GetType() == nsDisplayItem::TYPE_OPACITY) {
+  if (aItem->GetType() == nsDisplayItem::TYPE_TRANSFORM) {
+    transformFrame = aItem->Frame();
+  } else if (aItem->GetType() == nsDisplayItem::TYPE_OPACITY) {
     transformFrame = aItem->Frame();
+    if (!transformFrame->IsTransformed()) {
+      return false;
+    }
   } else if (aItem->GetType() == nsDisplayItem::TYPE_PERSPECTIVE) {
     transformFrame = static_cast<nsDisplayPerspective*>(aItem)->TransformFrame();
   } else {
     return false;
   }
   if (aAncestor == transformFrame) {
     return true;
   }