Bug 1494321 p2. Stop doing wasteful pre/post-effects work for frames with just a clip-path or mask applied. r=miko

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

--HG--
extra : rebase_source : 426e4b6d854644db1524d235651667e23d9c4908
This commit is contained in:
Jonathan Watt 2018-08-28 21:51:23 +01:00
Родитель c818957c6f
Коммит 8c224bc9d8
4 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -7346,7 +7346,7 @@ ComputeEffectsRect(nsIFrame* aFrame, const nsRect& aOverflowRect,
// only one heap-allocated rect per frame and it will be cleaned up when
// the frame dies.
if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
if (nsSVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame)) {
aFrame->SetProperty
(nsIFrame::PreEffectsBBoxProperty(), new nsRect(r));
r = nsSVGIntegrationUtils::ComputePostEffectsVisualOverflowRect(aFrame, r);

Просмотреть файл

@ -1287,9 +1287,6 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
if (mClipPath != aNewData.mClipPath) {
hint |= nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame;
// clip-path changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
hint |= nsChangeHint_UpdateOverflow;
}
if (mDominantBaseline != aNewData.mDominantBaseline) {
@ -3246,14 +3243,6 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aNewL
if (!maybeSVGMask && aNewLayer.mImage.GetURLValue()) {
maybeSVGMask = aNewLayer.mImage.GetURLValue()->MightHaveRef();
}
// Return nsChangeHint_UpdateOverflow if either URI might link to an SVG
// mask.
if (maybeSVGMask) {
// Mask changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
hint |= nsChangeHint_UpdateOverflow;
}
} else if (mAttachment != aNewLayer.mAttachment ||
mClip != aNewLayer.mClip ||
mOrigin != aNewLayer.mOrigin ||

Просмотреть файл

@ -96,7 +96,8 @@ private:
// This function may be called during reflow or painting. We should only
// do this check in painting process since the PreEffectsBBoxProperty of
// continuations are not set correctly while reflowing.
if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame) && !aInReflow) {
if (nsSVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame) &&
!aInReflow) {
nsOverflowAreas* preTransformOverflows =
aFrame->GetProperty(aFrame->PreTransformOverflowAreasProperty());
@ -157,6 +158,14 @@ GetPreEffectsVisualOverflow(nsIFrame* aFirstContinuation,
return collector.GetResult() + aFirstContinuationToUserSpace;
}
bool
nsSVGIntegrationUtils::UsingOverflowAffectingEffects(const nsIFrame* aFrame)
{
// Currently overflow don't take account of SVG or other non-absolute
// positioned clipping, or masking.
return aFrame->StyleEffects()->HasFilters();
}
bool
nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
{

Просмотреть файл

@ -44,6 +44,13 @@ class nsSVGIntegrationUtils final
typedef mozilla::image::imgDrawingParams imgDrawingParams;
public:
/**
* Returns true if SVG effects that affect the overflow of the given frame
* are currently applied to the frame.
*/
static bool
UsingOverflowAffectingEffects(const nsIFrame* aFrame);
/**
* Returns true if SVG effects are currently applied to this frame.
*/