зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305253 - Part 1. Use nsCSSClipPathInstance::ApplyBasicShapeClip when clip-path type is basic-shape or geometry-box. r=mstange
Before this patch, shouldApplyBasicShape will be set as true when the url of a clip-path is not resolvable, for example: clip-path: url("#non-exist-id"); So we call nsCSSClipPathInstance::ApplyBasicShapeClip and early return even if the clip-path's type is StyleShapeSourceType::URL. This patch aims to correct this wrong behavior: nsCSSClipPathInstance::ApplyBasicShapeClip shoud be used only when the type of clip-path is StyleShapeSourceType::Shape or StyleShapeSourceType::Box. MozReview-Commit-ID: 1ON4dEY9pva --HG-- extra : rebase_source : 88e89526f4b57bcbb0a1db585884d578682d118c
This commit is contained in:
Родитель
ca4fc9245c
Коммит
9d24e031f3
|
@ -23,13 +23,13 @@ nsCSSClipPathInstance::ApplyBasicShapeClip(gfxContext& aContext,
|
|||
nsIFrame* aFrame)
|
||||
{
|
||||
auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
|
||||
|
||||
#ifdef DEBUG
|
||||
StyleShapeSourceType type = clipPathStyle.GetType();
|
||||
MOZ_ASSERT(type != StyleShapeSourceType::None, "unexpected none value");
|
||||
// In the future nsCSSClipPathInstance may handle <clipPath> references as
|
||||
// well. For the time being return early.
|
||||
if (type == StyleShapeSourceType::URL) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(type == StyleShapeSourceType::Shape ||
|
||||
type == StyleShapeSourceType::Box,
|
||||
"This function is used with basic-shape and geometry-box only.");
|
||||
#endif
|
||||
|
||||
nsCSSClipPathInstance instance(aFrame, clipPathStyle);
|
||||
|
||||
|
|
|
@ -705,11 +705,6 @@ nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
|
|||
nsSVGEffects::EffectProperties effectProperties =
|
||||
nsSVGEffects::GetEffectProperties(firstFrame);
|
||||
|
||||
bool isOK = effectProperties.HasNoFilterOrHasValidFilter();
|
||||
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame(&isOK);
|
||||
|
||||
bool isTrivialClip = clipPathFrame ? clipPathFrame->IsTrivial() : true;
|
||||
|
||||
gfxMatrix cssPxToDevPxMatrix = GetCSSPxToDevPxMatrix(frame);
|
||||
const nsStyleSVGReset *svgReset = firstFrame->StyleSVGReset();
|
||||
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
|
||||
|
@ -734,11 +729,34 @@ nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
|
|||
bool shouldGenerateMaskLayer = maskFrames.Length() == 1 && maskFrames[0];
|
||||
#endif
|
||||
|
||||
bool shouldGenerateClipMaskLayer = clipPathFrame && !isTrivialClip;
|
||||
bool shouldApplyClipPath = clipPathFrame && isTrivialClip;
|
||||
bool shouldApplyBasicShape = !clipPathFrame && svgReset->HasClipPath();
|
||||
MOZ_ASSERT_IF(shouldGenerateClipMaskLayer,
|
||||
!shouldApplyClipPath && !shouldApplyBasicShape);
|
||||
bool isOK = effectProperties.HasNoFilterOrHasValidFilter();
|
||||
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame(&isOK);
|
||||
MOZ_ASSERT_IF(clipPathFrame,
|
||||
svgReset->mClipPath.GetType() == StyleShapeSourceType::URL);
|
||||
|
||||
bool shouldGenerateClipMaskLayer = false;
|
||||
bool shouldApplyClipPath = false;
|
||||
bool shouldApplyBasicShape = false;
|
||||
switch (svgReset->mClipPath.GetType()) {
|
||||
case StyleShapeSourceType::URL:
|
||||
if (clipPathFrame) {
|
||||
if (clipPathFrame->IsTrivial()) {
|
||||
shouldApplyClipPath = true;
|
||||
} else {
|
||||
shouldGenerateClipMaskLayer = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StyleShapeSourceType::Shape:
|
||||
case StyleShapeSourceType::Box:
|
||||
shouldApplyBasicShape = true;
|
||||
break;
|
||||
case StyleShapeSourceType::None:
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unsupported clip-path type.");
|
||||
break;
|
||||
}
|
||||
|
||||
nsPoint offsetToBoundingBox;
|
||||
nsPoint offsetToUserSpace;
|
||||
|
|
Загрузка…
Ссылка в новой задаче