Bug 1295094 - Part 10. nsDisplayMask creation flow. r=mstange

MozReview-Commit-ID: Jk9B54WtThK

--HG--
extra : rebase_source : 199b71fef0cce209b048dc362f89ecd700fda3e9
This commit is contained in:
cku 2016-08-16 13:56:11 +08:00
parent 40235c5c47
commit 78ca020a31
4 changed files with 24 additions and 5 deletions

View File

@ -6795,9 +6795,9 @@ nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
return nullptr;
}
if (mFrame->StyleEffects()->mOpacity == 0.0f &&
!mOpacityItemCreated)
if (mFrame->StyleEffects()->mOpacity == 0.0f && !mOpacityItemCreated) {
return nullptr;
}
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);

View File

@ -2446,9 +2446,13 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
}
// Revert to the post-filter dirty rect.
buildingDisplayList.SetDirtyRect(dirtyRectOutsideSVGEffects);
/* List now emptied, so add the new list to the top. */
resultList.AppendNewToTop(
new (aBuilder) nsDisplayMask(aBuilder, this, &resultList, useOpacity));
if (nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(this)) {
/* List now emptied, so add the new list to the top. */
resultList.AppendNewToTop(
new (aBuilder) nsDisplayMask(aBuilder, this, &resultList, useOpacity));
}
// Also add the hoisted scroll info items. We need those for APZ scrolling
// because nsDisplayMask items can't build active layers.
aBuilder->ExitSVGEffectsContents();

View File

@ -160,6 +160,15 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
style->mMask.HasLayerWithImage();
}
bool
nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(const nsIFrame* aFrame)
{
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
return style->HasClipPath() ||
style->mMask.HasLayerWithImage() ||
(aFrame->StyleEffects()->mOpacity != 1.0f);
}
// For non-SVG frames, this gives the offset to the frame's "user space".
// For SVG frames, this returns a zero offset.
static nsPoint

View File

@ -46,6 +46,12 @@ public:
static bool
UsingEffectsForFrame(const nsIFrame* aFrame);
/**
* Returns true if mask or clippath are currently applied to this frame.
*/
static bool
UsingMaskOrClipPathForFrame(const nsIFrame* aFrame);
/**
* Returns the size of the union of the border-box rects of all of
* aNonSVGFrame's continuations.