From 43dc286d72670967352ccf2c4d556d1cde7d07a3 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Mon, 8 Apr 2019 22:37:26 +0000 Subject: [PATCH] Bug 1541920. Handle blend mode activeness properly. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D26364 --HG-- extra : moz-landing-system : lando --- gfx/layers/wr/WebRenderCommandBuilder.cpp | 15 ++++++++++++--- layout/reftests/css-blending/reftest.list | 2 +- .../svg/active-transform-blend-mode-ref.html | 8 ++++++++ .../reftests/svg/active-transform-blend-mode.html | 8 ++++++++ layout/reftests/svg/reftest.list | 1 + 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 layout/reftests/svg/active-transform-blend-mode-ref.html create mode 100644 layout/reftests/svg/active-transform-blend-mode.html diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 657320d6ea2d..7e2895674342 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -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()) { diff --git a/layout/reftests/css-blending/reftest.list b/layout/reftests/css-blending/reftest.list index a2b04e309875..e49806fc085f 100644 --- a/layout/reftests/css-blending/reftest.list +++ b/layout/reftests/css-blending/reftest.list @@ -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 diff --git a/layout/reftests/svg/active-transform-blend-mode-ref.html b/layout/reftests/svg/active-transform-blend-mode-ref.html new file mode 100644 index 000000000000..6bb1bee6e40f --- /dev/null +++ b/layout/reftests/svg/active-transform-blend-mode-ref.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/layout/reftests/svg/active-transform-blend-mode.html b/layout/reftests/svg/active-transform-blend-mode.html new file mode 100644 index 000000000000..2ed8dc46462d --- /dev/null +++ b/layout/reftests/svg/active-transform-blend-mode.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 254637f90847..403311628e2c 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -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