Bug 1477366 - Always make SVG/CSS filters active within blobs when possible. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 21 Jan 2019 20:05:20 +0000
changeset 514747 3d23cfc9df06f8ab77e83cafbb7792ed8a97d9c9
parent 514746 08939adf27908bb6b8e5a5fa0a8e1b6e396a2f41
child 514748 4e1eb0b0b422a44b882bef43b86a756d8f25eb8a
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1477366
milestone66.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 1477366 - Always make SVG/CSS filters active within blobs when possible. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D16146
gfx/layers/wr/WebRenderCommandBuilder.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -1086,16 +1086,20 @@ static bool IsItemProbablyActive(nsDispl
     }
     case DisplayItemType::TYPE_WRAP_LIST:
     case DisplayItemType::TYPE_PERSPECTIVE: {
       if (aItem->GetChildren()) {
         return HasActiveChildren(*aItem->GetChildren(), aDisplayListBuilder);
       }
       return false;
     }
+    case DisplayItemType::TYPE_FILTER: {
+      nsDisplayFilters* filters = static_cast<nsDisplayFilters*>(aItem);
+      return filters->CanCreateWebRenderCommands(aDisplayListBuilder);
+    }
     default:
       // TODO: handle other items?
       return false;
   }
 }
 
 // This does a pass over the display lists and will join the display items
 // into groups as well as paint them
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -9342,16 +9342,27 @@ bool nsDisplayFilters::CreateWebRenderCS
       default:
         return false;
     }
   }
 
   return true;
 }
 
+bool nsDisplayFilters::CanCreateWebRenderCommands(nsDisplayListBuilder* aBuilder) {
+  nsTArray<mozilla::wr::FilterOp> wrFilters;
+  Maybe<nsRect> filterClip;
+  if (!CreateWebRenderCSSFilters(wrFilters) &&
+      !nsSVGIntegrationUtils::BuildWebRenderFilters(
+          mFrame, wrFilters, filterClip)) {
+    return false;
+  }
+  return true;
+}
+
 bool nsDisplayFilters::CreateWebRenderCommands(
     mozilla::wr::DisplayListBuilder& aBuilder,
     mozilla::wr::IpcResourceUpdateQueue& aResources,
     const StackingContextHelper& aSc,
     mozilla::layers::RenderRootStateManager* aManager,
     nsDisplayListBuilder* aDisplayListBuilder) {
   float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
 
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -6354,16 +6354,17 @@ class nsDisplayFilters : public nsDispla
                     LayerManager* aManager);
 
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
+  bool CanCreateWebRenderCommands(nsDisplayListBuilder* aBuilder);
 
   bool CreateWebRenderCSSFilters(nsTArray<mozilla::wr::FilterOp>& wrFilters);
 
  private:
   // relative to mFrame
   nsRect mEffectsBounds;
 };