Bug 1454653 - Do not skip transparent items in ContainerState::FindOpaqueBackgroundColorInLayer() r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Mon, 23 Apr 2018 17:33:16 +0200
changeset 468621 ce1d9b338bda9b21873f765faab05220727f2fa8
parent 468620 054afcafce15bb548d26893d592959019923c4cc
child 468704 b35a1f66c4529227dacf60e43d446918f179df47
child 468706 e2573db9d14e05ccc90c80a5bab27a8db0d3c489
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1454653
milestone61.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 1454653 - Do not skip transparent items in ContainerState::FindOpaqueBackgroundColorInLayer() r=mattwoodrow MozReview-Commit-ID: NGnL8r9x0U
layout/painting/FrameLayerBuilder.cpp
layout/reftests/layers/opacity-background-1-ref.html
layout/reftests/layers/opacity-background-1.html
layout/reftests/layers/reftest.list
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -2730,20 +2730,18 @@ ContainerState::FindOpaqueBackgroundColo
   *aOutIntersectsLayer = true;
 
   // Scan the candidate's display items.
   nsIntRect deviceRect = aRect;
   nsRect appUnitRect = ToAppUnits(deviceRect, mAppUnitsPerDevPixel);
   appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale);
 
   for (auto& assignedItem : Reversed(aData->mAssignedDisplayItems)) {
-    if (assignedItem.mType != DisplayItemEntryType::ITEM ||
-        assignedItem.mHasOpacity) {
-      // |assignedItem| is either an effect marker, or within a flatten opacity
-      // group. In both cases, there is no opaque area.
+    if (assignedItem.mType != DisplayItemEntryType::ITEM) {
+      // |assignedItem| is an effect marker.
       continue;
     }
 
     nsDisplayItem* item = assignedItem.mItem;
     bool snap;
     nsRect bounds = item->GetBounds(mBuilder, &snap);
     if (snap && mSnappingEnabled) {
       nsIntRect snappedBounds = ScaleToNearestPixels(bounds);
@@ -2769,19 +2767,23 @@ ContainerState::FindOpaqueBackgroundColo
 
     if (assignedItem.mClip.IsRectAffectedByClip(deviceRect,
                                                 mParameters.mXScale,
                                                 mParameters.mYScale,
                                                 mAppUnitsPerDevPixel)) {
       return NS_RGBA(0,0,0,0);
     }
 
-    Maybe<nscolor> color = item->IsUniform(mBuilder);
-    if (color && NS_GET_A(*color) == 255)
-      return *color;
+    if (!assignedItem.mHasOpacity) {
+      Maybe<nscolor> color = item->IsUniform(mBuilder);
+
+      if (color && NS_GET_A(*color) == 255) {
+        return *color;
+      }
+    }
 
     return NS_RGBA(0,0,0,0);
   }
 
   *aOutIntersectsLayer = false;
   return NS_RGBA(0,0,0,0);
 }
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/layers/opacity-background-1-ref.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta charset="utf-8">
+
+<style>
+.main {
+    top: 0px;
+    left: 0px;
+    width: 100px;
+    height: 100px;
+    position: absolute;
+    background-color: red;
+}
+
+.background {
+    background-color: white;
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    height: 100%;
+    width: 100%;
+    opacity: 0.9;
+}
+
+.container {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    height: 100%;
+    width: 100%;
+    overflow: scroll;
+}
+
+.message {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 101%;
+    height: 101%;
+}
+</style>
+</head>
+
+<body>
+<div class="main">
+    <div class="background"></div>
+    <div class="container">
+        <div class="message">foo</div>
+    </div>
+</div>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/layers/opacity-background-1.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta charset="utf-8">
+
+<style>
+.main {
+    top: 0px;
+    left: 0px;
+    width: 100px;
+    height: 100px;
+    position: absolute;
+    background-color: red;
+}
+
+.background {
+    background: linear-gradient(#ffffff, #ffffff);
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    height: 100%;
+    width: 100%;
+    opacity: 0.9;
+}
+
+.container {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    height: 100%;
+    width: 100%;
+    overflow: scroll;
+}
+
+.message {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 101%;
+    height: 101%;
+}
+</style>
+</head>
+
+<body>
+<div class="main">
+    <div class="background"></div>
+    <div class="container">
+        <div class="message">foo</div>
+    </div>
+</div>
+
+</body>
+</html>
--- a/layout/reftests/layers/reftest.list
+++ b/layout/reftests/layers/reftest.list
@@ -33,8 +33,10 @@ skip-if(!asyncPan) == fixed-pos-scrolled
 # These tests check whether the GPU process is working. We expect it to work if:
 #   E10S is enabled, and
 #   Direct2D 1.1 works (as a proxy for Windows 7 SP1 + Platform Update or higher), OR
 #   The GPU process has been forced on.
 # If these conditions are met, but the GPU process is not on, these tests will turn on
 # and compare false.
 skip-if(!browserIsRemote||!d2d||gpuProcess) == data:text/plain,FAIL about:blank
 skip-if(!gpuProcessForceEnabled||gpuProcess) == data:text/plain,FAIL about:blank
+
+fuzzy-if(webrender,1,8033) == opacity-background-1.html opacity-background-1-ref.html