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 148437 b85f944181d88d083572b56b06eb9a6fd46ffcfb
parent 148436 d856284278cc0df9bc87c862f31baed1fca400fa
child 148438 ad1f0ae291d76eee3ee91002c232f213fda5a3f3
push id2801
push userrocallahan@mozilla.com
push dateMon, 26 Aug 2013 01:54:44 +0000
treeherdermozilla-beta@b85f944181d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, bajaj
bugs906199
milestone24.0
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
@@ -1659,16 +1659,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
@@ -1756,8 +1756,9 @@ fails-if(Android) == 836844-1.html 83684
 == 847850-1.html 847850-1-ref.html
 == 848421-1.html 848421-1-ref.html
 test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html
 == 849996-1.html 849996-1-ref.html
 == 858803-1.html 858803-1-ref.html
 != 860370.html 860370-notref.html
 == 871338-1.html 871338-1-ref.html
 == 875060-1.html 875060-1-ref.html
+fuzzy-if(Android,4,245) == 906199-1.html 906199-1-ref.html