зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to inbound. a=merge
This commit is contained in:
Коммит
5ce0589d61
|
@ -4340,13 +4340,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
} else if (item->GetType() == nsDisplayItem::TYPE_MASK) {
|
||||
nsDisplayMask* maskItem = static_cast<nsDisplayMask*>(item);
|
||||
SetupMaskLayerForCSSMask(ownLayer, maskItem);
|
||||
|
||||
nsDisplayItem* next = aList->GetBottom();
|
||||
if (next && next->GetType() == nsDisplayItem::TYPE_SCROLL_INFO_LAYER) {
|
||||
// Since we do build a layer for mask, there is no need for this
|
||||
// scroll info layer anymore.
|
||||
aList->RemoveBottom();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the visible rect to a region and give the item
|
||||
|
|
|
@ -7353,9 +7353,13 @@ bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager)
|
|||
nsSVGUtils::MaskUsage maskUsage;
|
||||
nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage);
|
||||
|
||||
// XXX Bug 1323912. nsSVGIntegrationUtils::PaintMask can not handle opacity
|
||||
// correctly. Turn it off before bug fixed.
|
||||
if (maskUsage.opacity != 1.0) {
|
||||
if (!maskUsage.shouldGenerateMaskLayer &&
|
||||
!maskUsage.shouldGenerateClipMaskLayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyClipPath ||
|
||||
maskUsage.shouldApplyBasicShape) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,6 +272,8 @@ nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext,
|
|||
SourceSurface* aExtraMask,
|
||||
const Matrix& aExtraMasksTransform)
|
||||
{
|
||||
MOZ_ASSERT(!IsTrivial(), "Caller needs to use ApplyClipPath");
|
||||
|
||||
IntPoint offset;
|
||||
RefPtr<DrawTarget> maskDT = CreateClipMask(aReferenceContext, offset);
|
||||
if (!maskDT) {
|
||||
|
|
|
@ -755,6 +755,8 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
|||
nsSVGUtils::MaskUsage maskUsage;
|
||||
nsSVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity,
|
||||
maskUsage);
|
||||
MOZ_ASSERT(maskUsage.shouldGenerateMaskLayer ||
|
||||
maskUsage.shouldGenerateClipMaskLayer);
|
||||
|
||||
nsIFrame* frame = aParams.frame;
|
||||
if (!ValidateSVGFrame(frame)) {
|
||||
|
@ -775,80 +777,38 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
|||
nsPoint offsetToBoundingBox;
|
||||
nsPoint offsetToUserSpace;
|
||||
gfxContextMatrixAutoSaveRestore matSR;
|
||||
RefPtr<DrawTarget> maskTarget = ctx.GetDrawTarget();
|
||||
|
||||
if (maskUsage.shouldGenerateMaskLayer &&
|
||||
maskUsage.shouldGenerateClipMaskLayer) {
|
||||
// We will paint both mask of positioned mask and clip-path into
|
||||
// maskTarget.
|
||||
//
|
||||
// Create one extra draw target for drawing positioned mask, so that we do
|
||||
// not have to copy the content of maskTarget before painting
|
||||
// clip-path into it.
|
||||
maskTarget = maskTarget->CreateSimilarDrawTarget(maskTarget->GetSize(),
|
||||
SurfaceFormat::A8);
|
||||
}
|
||||
|
||||
if (maskUsage.shouldApplyBasicShape) {
|
||||
matSR.SetContext(&ctx);
|
||||
|
||||
SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox,
|
||||
offsetToUserSpace, false);
|
||||
|
||||
nsCSSClipPathInstance::ApplyBasicShapeClip(ctx, frame);
|
||||
if (!maskUsage.shouldGenerateMaskLayer) {
|
||||
// Only have basic-shape clip-path effect. Fill clipped region by
|
||||
// opaque white.
|
||||
ctx.SetColor(Color(0.0, 0.0, 0.0, 1.0));
|
||||
ctx.Fill();
|
||||
ctx.PopClip();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
DrawTarget* target = ctx.GetDrawTarget();
|
||||
|
||||
// Paint mask onto ctx.
|
||||
if (maskUsage.shouldGenerateMaskLayer) {
|
||||
matSR.Restore();
|
||||
matSR.SetContext(&ctx);
|
||||
|
||||
SetupContextMatrix(frame, aParams, offsetToBoundingBox,
|
||||
offsetToUserSpace, false);
|
||||
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
|
||||
// XXX Bug 1323912.
|
||||
MOZ_ASSERT(maskUsage.opacity == 1.0,
|
||||
"nsSVGIntegrationUtils::PaintMask can not handle opacity now.");
|
||||
result = PaintMaskSurface(aParams, maskTarget, 1.0,
|
||||
bool opacityApplied = !HasNonSVGMask(maskFrames);
|
||||
result = PaintMaskSurface(aParams, target,
|
||||
opacityApplied ? maskUsage.opacity : 1.0,
|
||||
firstFrame->StyleContext(), maskFrames,
|
||||
ctx.CurrentMatrix(), offsetToUserSpace);
|
||||
if (result != DrawResult::SUCCESS) {
|
||||
if (maskUsage.shouldApplyBasicShape) {
|
||||
ctx.PopClip();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (maskUsage.shouldApplyBasicShape) {
|
||||
ctx.PopClip();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Paint clip-path onto ctx.
|
||||
if (maskUsage.shouldGenerateClipMaskLayer || maskUsage.shouldApplyClipPath) {
|
||||
if (maskUsage.shouldGenerateClipMaskLayer) {
|
||||
matSR.Restore();
|
||||
matSR.SetContext(&ctx);
|
||||
|
||||
SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox,
|
||||
offsetToUserSpace, false);
|
||||
|
||||
Matrix clipMaskTransform;
|
||||
gfxMatrix cssPxToDevPxMatrix = GetCSSPxToDevPxMatrix(frame);
|
||||
|
||||
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame();
|
||||
RefPtr<SourceSurface> maskSurface =
|
||||
maskUsage.shouldGenerateMaskLayer ? maskTarget->Snapshot() : nullptr;
|
||||
maskUsage.shouldGenerateMaskLayer ? target->Snapshot() : nullptr;
|
||||
result =
|
||||
clipPathFrame->PaintClipMask(ctx, frame, cssPxToDevPxMatrix,
|
||||
&clipMaskTransform, maskSurface,
|
||||
|
|
Загрузка…
Ссылка в новой задаче