Index: Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
diff --git a/Source/core/layout/svg/LayoutSVGResourceClipper.cpp b/Source/core/layout/svg/LayoutSVGResourceClipper.cpp |
index ec02b32ca3ee31a74c68aaade1fea311cab625bf..745acdfc78e2a91845f8879eda21d60d84be598d 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" |
@@ -83,7 +84,7 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj |
return false; |
if (!childElement->isSVGGraphicsElement()) |
continue; |
- SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); |
+ SVGGeometryElement* styled = toSVGGeometryElement(childElement); |
pdr.
2015/06/09 05:15:58
Because this element can be an SVGUseElement, we'l
hyunjunekim2
2015/06/10 14:00:42
Ok, I understand.
|
const ComputedStyle* style = childLayoutObject->style(); |
if (!style || style->display() == NONE || style->visibility() != VISIBLE) |
continue; |
@@ -92,16 +93,25 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj |
if (!svgStyle.clipperResource().isEmpty()) |
return false; |
+ bool isUseElement = isSVGUseElement(*childElement); |
+ |
if (clipPath.isEmpty()) { |
// First clip shape. |
- styled->toClipPath(clipPath); |
+ if (!isUseElement) |
+ styled->toClipPath(clipPath); |
+ else |
+ toSVGUseElement(*childElement).layoutObjectClipChild(clipPath); |
continue; |
} |
if (RuntimeEnabledFeatures::pathOpsSVGClippingEnabled()) { |
// Attempt to generate a combined clip path, fall back to masking if not possible. |
Path subPath; |
- styled->toClipPath(subPath); |
+ if (!isUseElement) |
+ styled->toClipPath(clipPath); |
+ else |
+ toSVGUseElement(*childElement).layoutObjectClipChild(clipPath); |
+ |
if (!clipPath.unionPath(subPath)) |
return false; |
} else { |
@@ -164,7 +174,9 @@ PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin |
bool isUseElement = isSVGUseElement(*childElement); |
if (isUseElement) { |
- layoutObject = toSVGUseElement(*childElement).layoutObjectClipChild(); |
+ Path clipPath; |
+ SVGGeometryElement* element = toSVGUseElement(*childElement).layoutObjectClipChild(clipPath); |
+ layoutObject = element->layoutObject(); |
if (!layoutObject) |
continue; |
} |