Bug 1119117. Don't clip nsDisplayOpacity items, since some of its descendants maybe should not be clipped with the nsDisplayOpacity clip. r=mattwoodrow
☠☠ backed out by b55daf871dd2 ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Sun, 11 Jan 2015 00:12:33 +1300
changeset 223121 f5a5f74632247cbd336a486955a0c6aa1e141d89
parent 223120 2552e114980df1e982aecaf7ebfbfffaab1be534
child 223122 1eab42dfb4282700cd927704bb905ee2f3dc26e4
push id28082
push usercbook@mozilla.com
push dateMon, 12 Jan 2015 10:44:52 +0000
treeherdermozilla-central@643589c3ef94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1119117
milestone37.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 1119117. Don't clip nsDisplayOpacity items, since some of its descendants maybe should not be clipped with the nsDisplayOpacity clip. r=mattwoodrow
layout/generic/nsFrame.cpp
layout/reftests/bugs/1119117-1-ref.html
layout/reftests/bugs/1119117-1a.html
layout/reftests/bugs/1119117-1b.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2015,17 +2015,17 @@ nsIFrame::BuildDisplayListForStackingCon
 
   mozilla::gfx::VRHMDInfo* vrHMDInfo = nullptr;
   if ((GetStateBits() & NS_FRAME_HAS_VR_CONTENT)) {
     vrHMDInfo = static_cast<mozilla::gfx::VRHMDInfo*>(mContent->GetProperty(nsGkAtoms::vr_state));
   }
 
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
 
-  if (isTransformed || useOpacity || useBlendMode || usingSVGEffects || useStickyPosition) {
+  if (isTransformed || useBlendMode || usingSVGEffects || useStickyPosition) {
     // We don't need to pass ancestor clipping down to our children;
     // everything goes inside a display item's child list, and the display
     // item itself will be clipped.
     // For transforms we also need to clear ancestor clipping because it's
     // relative to the wrong display item reference frame anyway.
     clipState.Clear();
   }
 
@@ -2131,16 +2131,21 @@ nsIFrame::BuildDisplayListForStackingCon
     /* List now emptied, so add the new list to the top. */
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplaySVGEffects(aBuilder, this, &resultList));
   }
   /* Else, if the list is non-empty and there is CSS group opacity without SVG
    * effects, wrap it up in an opacity item.
    */
   else if (useOpacity && !resultList.IsEmpty()) {
+    // Don't clip nsDisplayOpacity items. We clip their descendants instead.
+    // The clip we would set on an element with opacity would clip
+    // all descendant content, but some should not be clipped.
+    DisplayListClipState::AutoSaveRestore opacityClipState(aBuilder);
+    opacityClipState.Clear();
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplayOpacity(aBuilder, this, &resultList));
   }
   /* If we have sticky positioning, wrap it in a sticky position item.
    */
   if (useStickyPosition) {
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplayStickyPosition(aBuilder, this, &resultList));
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1119117-1-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#image {
+  position:fixed;
+  opacity:0.5;
+  left:0;
+  top:0;
+  width:100%;
+  height:100%;
+  background:blue;
+}
+</style>
+</head>
+<body>
+  <div id="image"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1119117-1a.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#d1 {
+  overflow:hidden;
+  height:0;
+}
+#d2 {
+  opacity:0.5;
+}
+#d3 {
+  position:absolute;
+  left:0;
+  top:0;
+  width:100%;
+  height:100%;
+  background:blue;
+}
+</style>
+</head>
+<body>
+<div id="d1">
+  <div id="d2">
+    <div id="d3"></div>
+  </div>
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1119117-1b.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#d1 {
+  overflow:hidden;
+  height:0;
+}
+#d2 {
+  opacity:0.5;
+}
+#image {
+  position:fixed;
+  left:0;
+  top:0;
+  width:100%;
+  height:100%;
+  background:blue;
+}
+</style>
+</head>
+<body>
+  <div id="d1">
+    <div id="d2" class="active">
+      <div id="image"></div>
+      <h2>ABCDEFG</h2>
+    </div>
+  </div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1849,8 +1849,10 @@ test-pref(dom.webcomponents.enabled,true
 == 1078262-1.html about:blank
 test-pref(layout.testing.overlay-scrollbars.always-visible,false) == 1081072-1.html 1081072-1-ref.html
 fuzzy-if(winWidget&&!layersGPUAccelerated,1,31) fuzzy-if(B2G,128,75) == 1081185-1.html 1081185-1-ref.html   # fuzzy with event-regions, see bug 1107843
 == 1097437-1.html 1097437-1-ref.html
 == 1103258-1.html 1103258-1-ref.html # assertion crash test with layers culling test
 == 1105137-1.html 1105137-1-ref.html
 fuzzy-if(d2d,36,304) HTTP(..) == 1116480-1-fakeitalic-overflow.html 1116480-1-fakeitalic-overflow-ref.html
 == 1111753-1.html about:blank
+== 1119117-1a.html 1119117-1-ref.html
+== 1119117-1b.html 1119117-1-ref.html