Bug 1234485 - Part 2. Implement nsSVGIntegrationUtils::IsMaskResourceReady. r=mstange

We need this new function to determine whether paint mask onto mask layer.
MozReview-Commit-ID: IeEamPi9S8v

--HG--
extra : rebase_source : 993ae4bbe31c2c21704813c318f5328719194930
This commit is contained in:
cku 2016-10-30 21:41:06 +08:00
Родитель 882c5bf086
Коммит 999ca66251
2 изменённых файлов: 32 добавлений и 0 удалений

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

@ -723,6 +723,32 @@ nsSVGIntegrationUtils::DetermineMaskUsage(nsIFrame* aFrame,
}
}
bool
nsSVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
nsTArray<nsSVGMaskFrame*> maskFrames = effectProperties.GetMaskFrames();
const nsStyleSVGReset* svgReset = firstFrame->StyleSVGReset();
for (uint32_t i = 0; i < maskFrames.Length(); i++) {
// Refers to a valid SVG mask.
if (maskFrames[i]) {
continue;
}
// Refers to an external resource, which is not ready yet.
if (!svgReset->mMask.mLayers[i].mImage.IsComplete()) {
return false;
}
}
// Either all mask resources are ready, or no mask resource is needed.
return true;
}
DrawResult
nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
{

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

@ -176,6 +176,12 @@ public:
static void
DetermineMaskUsage(nsIFrame* aFrame, bool aHandleOpacity, MaskUsage& aUsage);
/**
* Return true if all the mask resource of aFrame are ready.
*/
static bool
IsMaskResourceReady(nsIFrame* aFrame);
/**
* Paint non-SVG frame with filter and opacity effect.
*/