| Index: third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
|
| index f1e59e8533bca6b522c1c74e93c0507af68bb1a8..a9e5d32e2b8e4986123a53d0f7f42b08eb1046c4 100644
|
| --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
|
| @@ -53,12 +53,6 @@ SVGPaintContext::~SVGPaintContext()
|
| ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(&m_object)->masker() == m_masker);
|
| SVGMaskPainter(*m_masker).finishEffect(m_object, paintInfo().context);
|
| }
|
| -
|
| - if (m_clipper) {
|
| - ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(&m_object));
|
| - ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(&m_object)->clipper() == m_clipper);
|
| - SVGClipPainter(*m_clipper).finishEffect(m_object, paintInfo().context, m_clipperState);
|
| - }
|
| }
|
|
|
| bool SVGPaintContext::applyClipMaskAndFilterIfNecessary()
|
| @@ -73,8 +67,8 @@ bool SVGPaintContext::applyClipMaskAndFilterIfNecessary()
|
| // When rendering clip paths as masks, only geometric operations should be included so skip
|
| // non-geometric operations such as compositing, masking, and filtering.
|
| if (paintInfo().isRenderingClipPathAsMaskImage()) {
|
| - if (!applyClipIfNecessary(resources))
|
| - return false;
|
| + DCHECK(!m_object.isSVGRoot());
|
| + applyClipIfNecessary(resources);
|
| return true;
|
| }
|
|
|
| @@ -87,8 +81,11 @@ bool SVGPaintContext::applyClipMaskAndFilterIfNecessary()
|
| applyCompositingIfNecessary();
|
| }
|
|
|
| - if (!applyClipIfNecessary(resources))
|
| - return false;
|
| + if (isSVGRoot) {
|
| + DCHECK(!m_object.styleRef().clipPath() || m_object.hasLayer());
|
| + } else {
|
| + applyClipIfNecessary(resources);
|
| + }
|
|
|
| if (!applyMaskIfNecessary(resources))
|
| return false;
|
| @@ -120,26 +117,11 @@ void SVGPaintContext::applyCompositingIfNecessary()
|
| }
|
| }
|
|
|
| -bool SVGPaintContext::applyClipIfNecessary(SVGResources* resources)
|
| +void SVGPaintContext::applyClipIfNecessary(SVGResources* resources)
|
| {
|
| - // resources->clipper() corresponds to the non-prefixed 'clip-path' whereas
|
| - // m_object.style()->clipPath() corresponds to '-webkit-clip-path'.
|
| - // FIXME: We should unify the clip-path and -webkit-clip-path codepaths.
|
| - if (LayoutSVGResourceClipper* clipper = resources ? resources->clipper() : nullptr) {
|
| - if (!SVGClipPainter(*clipper).prepareEffect(m_object, m_object.objectBoundingBox(),
|
| - m_object.paintInvalidationRectInLocalSVGCoordinates(), FloatPoint(), paintInfo().context, m_clipperState))
|
| - return false;
|
| - m_clipper = clipper;
|
| - } else {
|
| - ClipPathOperation* clipPathOperation = m_object.style()->clipPath();
|
| - if (clipPathOperation && clipPathOperation->type() == ClipPathOperation::SHAPE) {
|
| - ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOperation);
|
| - if (!clipPath->isValid())
|
| - return false;
|
| - m_clipPathRecorder = wrapUnique(new ClipPathRecorder(paintInfo().context, m_object, clipPath->path(m_object.objectBoundingBox())));
|
| - }
|
| - }
|
| - return true;
|
| + if (!m_object.styleRef().clipPath())
|
| + return;
|
| + m_clipPathClipper.emplace(paintInfo().context, m_object, m_object.objectBoundingBox(), FloatPoint());
|
| }
|
|
|
| bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources)
|
| @@ -182,7 +164,7 @@ bool SVGPaintContext::isIsolationInstalled() const
|
| return true;
|
| if (m_masker || m_filter)
|
| return true;
|
| - if (m_clipper && m_clipperState == SVGClipPainter::ClipperAppliedMask)
|
| + if (m_clipPathClipper && m_clipPathClipper->usingMask())
|
| return true;
|
| return false;
|
| }
|
|
|