Bug 1454653 - Do not skip transparent items in ContainerState::FindOpaqueBackgroundColorInLayer() r=mattwoodrow

MozReview-Commit-ID: NGnL8r9x0U

--HG--
extra : rebase_source : d782eae5bcb8873eff7ccf564c48067cfb97ff2b
This commit is contained in:
Miko Mynttinen 2018-04-23 17:33:16 +02:00
parent b80a5b938a
commit 6606aea17f
4 changed files with 121 additions and 7 deletions

View File

@ -2735,10 +2735,8 @@ ContainerState::FindOpaqueBackgroundColorInLayer(const PaintedLayerData* aData,
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;
}
@ -2774,9 +2772,13 @@ ContainerState::FindOpaqueBackgroundColorInLayer(const PaintedLayerData* aData,
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);
}

View File

@ -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>

View File

@ -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>

View File

@ -38,3 +38,5 @@ skip-if(!asyncPan) == fixed-pos-scrolled-clip-opacity-layerize.html fixed-pos-sc
# 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