| Index: Source/core/paint/SVGClipPainter.cpp
|
| diff --git a/Source/core/paint/SVGClipPainter.cpp b/Source/core/paint/SVGClipPainter.cpp
|
| index 4d49205577d979988048f3af89f665e6d7e61980..22a93ce1df174289ed8fccb607d77488d7d93d8a 100644
|
| --- a/Source/core/paint/SVGClipPainter.cpp
|
| +++ b/Source/core/paint/SVGClipPainter.cpp
|
| @@ -49,17 +49,10 @@ bool SVGClipPainter::applyClippingToContext(const LayoutObject& target, const Fl
|
|
|
| SVGClipExpansionCycleHelper inClipExpansionChange(m_clip);
|
|
|
| - AffineTransform animatedLocalTransform = toSVGClipPathElement(m_clip.element())->calculateAnimatedLocalTransform();
|
| - // When drawing a clip for non-SVG elements, the CTM does not include the zoom factor.
|
| - // In this case, we need to apply the zoom scale explicitly - but only for clips with
|
| - // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolved lengths).
|
| - if (!target.isSVG() && m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
|
| - ASSERT(m_clip.style());
|
| - animatedLocalTransform.scale(m_clip.style()->effectiveZoom());
|
| - }
|
| + AffineTransform contentTransformation = m_clip.calculateContentTransformation(&target, targetBoundingBox);
|
|
|
| // First, try to apply the clip as a clipPath.
|
| - if (m_clip.tryPathOnlyClipping(target, context, animatedLocalTransform, targetBoundingBox)) {
|
| + if (m_clip.tryPathOnlyClipping(target, context, contentTransformation)) {
|
| clipperState = ClipperAppliedPath;
|
| return true;
|
| }
|
| @@ -70,19 +63,20 @@ bool SVGClipPainter::applyClippingToContext(const LayoutObject& target, const Fl
|
| // Begin compositing the clip mask.
|
| CompositingRecorder::beginCompositing(*context, target, SkXfermode::kSrcOver_Mode, 1, &paintInvalidationRect);
|
| {
|
| - TransformRecorder recorder(*context, target, animatedLocalTransform);
|
| -
|
| // clipPath can also be clipped by another clipPath.
|
| SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(&m_clip);
|
| LayoutSVGResourceClipper* clipPathClipper = resources ? resources->clipper() : 0;
|
| ClipperState clipPathClipperState = ClipperNotApplied;
|
| - if (clipPathClipper && !SVGClipPainter(*clipPathClipper).applyClippingToContext(m_clip, targetBoundingBox, paintInvalidationRect, context, clipPathClipperState)) {
|
| - // End the clip mask's compositor.
|
| - CompositingRecorder::endCompositing(*context, target);
|
| - return false;
|
| + if (clipPathClipper) {
|
| + FloatRect contentBoundingBox = contentTransformation.mapRect(targetBoundingBox);
|
| + if (!SVGClipPainter(*clipPathClipper).applyClippingToContext(m_clip, contentBoundingBox, paintInvalidationRect, context, clipPathClipperState)) {
|
| + // End the clip mask's compositor.
|
| + CompositingRecorder::endCompositing(*context, target);
|
| + return false;
|
| + }
|
| }
|
|
|
| - drawClipMaskContent(context, target, targetBoundingBox);
|
| + drawClipMaskContent(context, target, contentTransformation);
|
|
|
| if (clipPathClipper)
|
| SVGClipPainter(*clipPathClipper).postApplyStatefulResource(m_clip, context, clipPathClipperState);
|
| @@ -120,12 +114,11 @@ void SVGClipPainter::postApplyStatefulResource(const LayoutObject& target, Graph
|
| }
|
| }
|
|
|
| -void SVGClipPainter::drawClipMaskContent(GraphicsContext* context, const LayoutObject& layoutObject, const FloatRect& targetBoundingBox)
|
| +void SVGClipPainter::drawClipMaskContent(GraphicsContext* context, const LayoutObject& layoutObject, const AffineTransform& contentTransformation)
|
| {
|
| ASSERT(context);
|
|
|
| - AffineTransform contentTransformation;
|
| - RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPicture(contentTransformation, targetBoundingBox, context);
|
| + RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPicture(contentTransformation, context);
|
|
|
| TransformRecorder recorder(*context, layoutObject, contentTransformation);
|
| if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
|
|