Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp

Issue 2322343003: Add support for <basic-shape> to 'clip-path' on SVG elements (Closed)
Patch Set: Update SPv2 expectations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index 83d67c8c83eef93361ca0caa9fc487fe5c5805a7..2274567e7652b12f0a10ee97c7e662ef046ff8ea 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -370,16 +370,18 @@ bool SVGLayoutSupport::hasFilterResource(const LayoutObject& object)
bool SVGLayoutSupport::pointInClippingArea(const LayoutObject& object, const FloatPoint& point)
{
- // We just take clippers into account to determine if a point is on the node. The Specification may
- // change later and we also need to check maskers.
+ ClipPathOperation* clipPathOperation = object.styleRef().svgStyle().clipPath();
+ if (!clipPathOperation)
+ return true;
+ if (clipPathOperation->type() == ClipPathOperation::SHAPE) {
+ ShapeClipPathOperation& clipPath = toShapeClipPathOperation(*clipPathOperation);
+ return clipPath.path(object.objectBoundingBox()).contains(point);
+ }
+ DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE);
SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(&object);
- if (!resources)
+ if (!resources || !resources->clipper())
return true;
-
- if (LayoutSVGResourceClipper* clipper = resources->clipper())
- return clipper->hitTestClipContent(object.objectBoundingBox(), point);
-
- return true;
+ return resources->clipper()->hitTestClipContent(object.objectBoundingBox(), point);
}
bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(const LayoutObject& object, const AffineTransform& localTransform, const FloatPoint& pointInParent, FloatPoint& localPoint)
@@ -435,7 +437,7 @@ bool SVGLayoutSupport::willIsolateBlendingDescendantsForStyle(const ComputedStyl
const SVGComputedStyle& svgStyle = style.svgStyle();
return style.hasIsolation() || style.opacity() < 1 || style.hasBlendMode()
- || style.hasFilter() || svgStyle.hasMasker() || svgStyle.hasClipper();
+ || style.hasFilter() || svgStyle.hasMasker() || svgStyle.clipPath();
}
bool SVGLayoutSupport::willIsolateBlendingDescendantsForObject(const LayoutObject* object)

Powered by Google App Engine
This is Rietveld 408576698