Bug 1541920. Handle blend mode activeness properly. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D26364

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Muizelaar 2019-04-08 22:37:26 +00:00
parent 85035c7910
commit 43dc286d72
5 changed files with 30 additions and 4 deletions

View File

@ -1083,12 +1083,13 @@ class WebRenderGroupData : public WebRenderUserData {
};
static bool IsItemProbablyActive(nsDisplayItem* aItem,
nsDisplayListBuilder* aDisplayListBuilder);
nsDisplayListBuilder* aDisplayListBuilder,
bool aParentActive = true);
static bool HasActiveChildren(const nsDisplayList& aList,
nsDisplayListBuilder* aDisplayListBuilder) {
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
if (IsItemProbablyActive(i, aDisplayListBuilder)) {
if (IsItemProbablyActive(i, aDisplayListBuilder, false)) {
return true;
}
}
@ -1103,7 +1104,8 @@ static bool HasActiveChildren(const nsDisplayList& aList,
// We can't easily use GetLayerState because it wants a bunch of layers related
// information.
static bool IsItemProbablyActive(nsDisplayItem* aItem,
nsDisplayListBuilder* aDisplayListBuilder) {
nsDisplayListBuilder* aDisplayListBuilder,
bool aParentActive) {
switch (aItem->GetType()) {
case DisplayItemType::TYPE_TRANSFORM: {
nsDisplayTransform* transformItem =
@ -1128,6 +1130,13 @@ static bool IsItemProbablyActive(nsDisplayItem* aItem,
case DisplayItemType::TYPE_FOREIGN_OBJECT: {
return true;
}
case DisplayItemType::TYPE_BLEND_MODE: {
/* BLEND_MODE needs to be active if it might have a previous sibling
* that is active. We use the activeness of the parent as a rough
* proxy for this situation. */
return aParentActive || HasActiveChildren(*aItem->GetChildren(),
aDisplayListBuilder);
}
case DisplayItemType::TYPE_WRAP_LIST:
case DisplayItemType::TYPE_PERSPECTIVE: {
if (aItem->GetChildren()) {

View File

@ -41,7 +41,7 @@ fuzzy-if(azureSkia||d2d||gtkWidget,0-1,0-40000) == background-blending-image-col
fuzzy(0-65,0-53) == mix-blend-mode-952051.html mix-blend-mode-952051-ref.html
fuzzy-if(d3d11,0-49,0-200) == mix-blend-mode-and-filter.html mix-blend-mode-and-filter-ref.html
fuzzy-if(webrender,9-9,2531-2716) fuzzy-if(d3d11,0-1,0-5) == mix-blend-mode-and-filter.svg mix-blend-mode-and-filter-ref.svg
fuzzy-if(d3d11,0-1,0-5) == mix-blend-mode-and-filter.svg mix-blend-mode-and-filter-ref.svg
fuzzy(0-2,0-14400) == mix-blend-mode-child-of-blended-has-opacity.html mix-blend-mode-child-of-blended-has-opacity-ref.html

View File

@ -0,0 +1,8 @@
<svg width=1000 height=1000>
<g style="transform: translateY(-2px) translateX(0px) translateZ(0px);">
<rect fill="#0000ff" height="93" width="32" x="100" y="163"></rect>
</g>
<g style="mix-blend-mode: multiply;">
<rect fill="#ff0000" height="93" width="32" x="100" y="161"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 325 B

View File

@ -0,0 +1,8 @@
<svg width=1000 height=1000>
<g style="transform: translateY(-2px) translateX(0px) translateZ(0px); will-change: transform;">
<rect fill="#0000ff" height="93" width="32" x="100" y="163"></rect>
</g>
<g style="mix-blend-mode: multiply;">
<rect fill="#ff0000" height="93" width="32" x="100" y="161"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 349 B

View File

@ -53,6 +53,7 @@ fuzzy-if(skiaContent,0-1,0-1600) skip-if(Android) == blend-multiply.svg blend-mu
#skip-if(Android) == blend-screen.svg blend-screen-ref.svg
#skip-if(Android) == blend-soft-light.svg blend-soft-light-ref.svg
skip == blend-difference-stacking.html blend-difference-stacking-ref.html # bug 1458353
== active-transform-blend-mode.html active-transform-blend-mode-ref.html
fuzzy(0-11,0-7155) == blur-inside-clipPath.svg blur-inside-clipPath-ref.svg