Bug 1578777 - Move UsesSVGEffectsNotSupportedInCompositor() to nsSVGIntegrationUtils. r=tnikkel

Depends on D46061

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-09-17 00:06:28 +00:00
parent 2f3236c03c
commit 439820f334
3 changed files with 23 additions and 15 deletions

View File

@ -26,6 +26,7 @@
#include "FrameLayerBuilder.h"
#include "BasicLayers.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/gfx/gfxVars.h"
#include "nsCSSRendering.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/Unused.h"
@ -1208,6 +1209,20 @@ bool nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(
BuildWebRenderFilters(aFrame, filterChain, wrFilters, filterClip);
}
bool nsSVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(
nsIFrame* aFrame) {
// WebRender supports masks / clip-paths and some filters in the compositor.
// Non-WebRender doesn't support any SVG effects in the compositor.
if (aFrame->StyleEffects()->HasFilters()) {
return !gfx::gfxVars::UseWebRender() ||
!nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
}
if (nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(aFrame)) {
return !gfx::gfxVars::UseWebRender();
}
return false;
}
class PaintFrameCallback : public gfxDrawingCallback {
public:
PaintFrameCallback(nsIFrame* aFrame, const nsSize aPaintServerSize,

View File

@ -226,6 +226,12 @@ class nsSVGIntegrationUtils final {
*/
static bool CanCreateWebRenderFiltersForFrame(nsIFrame* aFrame);
/**
* Check if |aFrame| uses any SVG effects that cannot be rendered in the
* compositor.
*/
static bool UsesSVGEffectsNotSupportedInCompositor(nsIFrame* aFrame);
/**
* @param aRenderingContext the target rendering context in which the paint
* server will be rendered

View File

@ -42,7 +42,6 @@
#include "mozilla/PresShell.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/Event.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/InputAPZContext.h"
@ -927,19 +926,6 @@ class AsyncScrollbarDragStarter final : public nsAPostRefreshObserver {
AsyncDragMetrics mDragMetrics;
};
static bool UsesSVGEffectsNotSupportedInCompositor(nsIFrame* aFrame) {
// WebRender supports masks / clip-paths and some filters in the compositor.
// Non-WebRender doesn't support any SVG effects in the compositor.
if (aFrame->StyleEffects()->HasFilters()) {
return !gfx::gfxVars::UseWebRender() ||
!nsSVGIntegrationUtils::CanCreateWebRenderFiltersForFrame(aFrame);
}
if (nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(aFrame)) {
return !gfx::gfxVars::UseWebRender();
}
return false;
}
static bool ScrollFrameWillBuildScrollInfoLayer(nsIFrame* aScrollFrame) {
/*
* Note: if changing the conditions in this function, make a corresponding
@ -948,7 +934,8 @@ static bool ScrollFrameWillBuildScrollInfoLayer(nsIFrame* aScrollFrame) {
*/
nsIFrame* current = aScrollFrame;
while (current) {
if (UsesSVGEffectsNotSupportedInCompositor(current)) {
if (nsSVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor(
current)) {
return true;
}
current = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(current);