Bug 906199. Ensure that nsDisplayTransforms being bubbled up by preserve-3d have the correct clip applied. r=mattwoodrow,a=bajaj
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 21 Aug 2013 15:04:23 +1200
changeset 153867 3667169831cb73527a3372dac7ad405a91d15880
parent 153866 54dc957b3de8684ecaad007e5ef487f2234c8014
child 153868 f4ed497d794bf8e0daf7ea7024ad06511f455bed
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, bajaj
bugs906199
milestone25.0a2
Bug 906199. Ensure that nsDisplayTransforms being bubbled up by preserve-3d have the correct clip applied. r=mattwoodrow,a=bajaj
layout/generic/nsFrame.cpp
layout/reftests/bugs/906199-1-ref.html
layout/reftests/bugs/906199-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1678,16 +1678,24 @@ WrapPreserve3DListInternal(nsIFrame* aFr
 
     if (childFrame->GetParent() &&
         (childFrame->GetParent()->Preserves3DChildren() || childFrame == aFrame)) {
       switch (item->GetType()) {
         case nsDisplayItem::TYPE_TRANSFORM: {
           if (!aTemp->IsEmpty()) {
             aOutput->AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, aTemp, aIndex++));
           }
+          // Override item's clipping with our current clip state (if any). Since we're
+          // bubbling up a preserve-3d transformed child to a preserve-3d parent,
+          // we can be sure the child doesn't have clip state of its own.
+          NS_ASSERTION(!item->GetClip().HasClip(), "Unexpected clip on item");
+          const DisplayItemClip* clip = aBuilder->ClipState().GetCurrentCombinedClip(aBuilder);
+          if (clip) {
+            item->SetClip(aBuilder, *clip);
+          }
           aOutput->AppendToTop(item);
           break;
         }
         case nsDisplayItem::TYPE_WRAP_LIST: {
           nsDisplayWrapList *list = static_cast<nsDisplayWrapList*>(item);
           rv = WrapPreserve3DListInternal(aFrame, aBuilder,
               list->GetChildren(), aOutput, aIndex, aTemp);
           list->~nsDisplayWrapList();
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/906199-1-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+  position:relative;
+  width:300px;
+  height:200px;
+  left:50px;
+  top:50px;
+}
+.grandparentdiv {
+  background:yellow;
+  overflow:hidden;
+}
+.childdiv {
+  background:green;
+}
+.grandchilddiv {
+  background:red;
+}
+</style>
+</head>
+<body>
+<div class="grandparentdiv">
+  <div class="childdiv">
+    <div class="grandchilddiv"></div>
+  </div>
+</div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/906199-1.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+  position:relative;
+  width:300px;
+  height:200px;
+  left:50px;
+  top:50px;
+  transform-style:preserve-3d;
+}
+.grandparentdiv {
+  background:yellow;
+  overflow:hidden;
+}
+.childdiv {
+  background:green;
+}
+.grandchilddiv {
+  background:red;
+}
+</style>
+</head>
+<body>
+<div class="grandparentdiv">
+  <div class="childdiv">
+    <div class="grandchilddiv"></div>
+  </div>
+</div>
+</body>
+</html>
+
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1766,8 +1766,9 @@ random-if(Android&&AndroidVersion>=15) =
 == 883987-1a.html 883987-1-ref.html
 == 883987-1b.html 883987-1-ref.html
 == 883987-1c.html 883987-1-ref.html
 == 883987-1d.html 883987-1-ref.html
 == 883987-1e.html 883987-1-ref.html
 == 883987-1f.html 883987-1-ref.html
 == 890495-1.html 890495-1-ref.html
 == 894931-1.html 894931-1-ref.html
+fuzzy-if(Android,4,245) == 906199-1.html 906199-1-ref.html