Chromium Code Reviews| Index: Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
| diff --git a/Source/core/layout/svg/LayoutSVGResourceClipper.cpp b/Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
| index 49bd5d6cb0b3563e199de4ce7004bde22392fe32..6b519f85b748b1957a6256bed55563e642d2fe16 100644 |
| --- a/Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
| +++ b/Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
| @@ -32,6 +32,7 @@ |
| #include "core/paint/CompositingRecorder.h" |
| #include "core/paint/PaintInfo.h" |
| #include "core/paint/TransformRecorder.h" |
| +#include "core/svg/SVGGeometryElement.h" |
| #include "core/svg/SVGUseElement.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/graphics/paint/ClipPathDisplayItem.h" |
| @@ -97,7 +98,10 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj |
| // First clip shape. |
| if (clipPath.isEmpty()) { |
| - styled->toClipPath(clipPath); |
| + if (isSVGGeometryElement(styled)) |
| + toSVGGeometryElement(styled)->toClipPath(clipPath); |
| + else if (isSVGUseElement(styled)) |
| + toSVGUseElement(styled)->toClipPath(clipPath); |
| continue; |
| } |
| @@ -113,7 +117,11 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj |
| } |
| Path subPath; |
| - styled->toClipPath(subPath); |
| + if (isSVGGeometryElement(styled)) |
| + toSVGGeometryElement(styled)->toClipPath(subPath); |
| + else if (isSVGUseElement(styled)) |
| + toSVGUseElement(styled)->toClipPath(subPath); |
| + |
| clipPathBuilder.add(subPath.skPath(), kUnion_SkPathOp); |
| } |
| @@ -179,7 +187,12 @@ PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin |
| bool isUseElement = isSVGUseElement(*childElement); |
| if (isUseElement) { |
| - layoutObject = toSVGUseElement(*childElement).layoutObjectClipChild(); |
| + const SVGGraphicsElement* clippingElement = toSVGUseElement(*childElement).targetGraphicsElementForClipping(); |
| + if (!clippingElement) { |
| + layoutObject = nullptr; |
|
fs
2015/06/22 10:57:44
This is a dead store (layoutObject will go out of
|
| + continue; |
| + } |
| + layoutObject = clippingElement->layoutObject(); |
| if (!layoutObject) |
| continue; |
| } |