Bug 1304437 - Part 1. Return nsChangeHint_UpdateEffects when the length of the mask-image property has changed. r=heycam

MozReview-Commit-ID: 8ETx873Atu7

--HG--
extra : rebase_source : 8b67cd96dbc89a1dabe7c05e0b7254f6fa48bc56
This commit is contained in:
cku 2016-09-22 18:24:52 +08:00
Родитель 849aca37da
Коммит 0a4b5b390c
2 изменённых файлов: 19 добавлений и 9 удалений

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

@ -1318,7 +1318,8 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
hint |= nsChangeHint_RepaintFrame;
}
hint |= mMask.CalcDifference(aNewData.mMask, nsChangeHint_RepaintFrame);
hint |= mMask.CalcDifference(aNewData.mMask,
nsStyleImageLayers::LayerType::Mask);
return hint;
}
@ -2427,8 +2428,13 @@ nsStyleImageLayers::nsStyleImageLayers(const nsStyleImageLayers &aSource)
nsChangeHint
nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aNewLayers,
nsChangeHint aPositionChangeHint) const
nsStyleImageLayers::LayerType aType) const
{
nsChangeHint positionChangeHint =
(aType == nsStyleImageLayers::LayerType::Background)
? nsChangeHint_UpdateBackgroundPosition
: nsChangeHint_RepaintFrame;
nsChangeHint hint = nsChangeHint(0);
const nsStyleImageLayers& moreLayers =
@ -2442,7 +2448,7 @@ nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aNewLayers,
if (i < lessLayers.mImageCount) {
nsChangeHint layerDifference =
moreLayers.mLayers[i].CalcDifference(lessLayers.mLayers[i],
aPositionChangeHint);
positionChangeHint);
hint |= layerDifference;
if (layerDifference &&
((moreLayers.mLayers[i].mImage.GetType() == eStyleImageType_Element) ||
@ -2457,6 +2463,11 @@ nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aNewLayers,
}
}
if (aType == nsStyleImageLayers::LayerType::Mask &&
mImageCount != aNewLayers.mImageCount) {
hint |= nsChangeHint_UpdateEffects;
}
if (hint) {
return hint;
}
@ -2729,7 +2740,7 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aNewL
{
nsChangeHint hint = nsChangeHint(0);
if (mSourceURI != aNewLayer.mSourceURI) {
hint |= nsChangeHint_RepaintFrame;
hint |= nsChangeHint_RepaintFrame | nsChangeHint_UpdateEffects;
// If Layer::mSourceURI links to a SVG mask, it has a fragment. Not vice
// versa. Here are examples of URI contains a fragment, two of them link
@ -2757,10 +2768,9 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aNewL
}
}
// Return nsChangeHint_UpdateEffects and nsChangeHint_UpdateOverflow if
// either URI might link to an SVG mask.
// Return nsChangeHint_UpdateOverflow if either URI might link to an SVG
// mask.
if (maybeSVGMask) {
hint |= nsChangeHint_UpdateEffects;
// Mask changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
hint |= nsChangeHint_UpdateOverflow;
@ -2827,7 +2837,7 @@ nsStyleBackground::CalcDifference(const nsStyleBackground& aNewData) const
}
hint |= mImage.CalcDifference(aNewData.mImage,
nsChangeHint_UpdateBackgroundPosition);
nsStyleImageLayers::LayerType::Background);
return hint;
}

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

@ -818,7 +818,7 @@ struct nsStyleImageLayers {
}
nsChangeHint CalcDifference(const nsStyleImageLayers& aNewLayers,
nsChangeHint aPositionChangeHint) const;
nsStyleImageLayers::LayerType aType) const;
bool HasLayerWithImage() const;