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

Unified Diff: Source/core/layout/svg/LayoutSVGResourceClipper.cpp

Issue 1154853007: Move toClipPath to SVGGeometryElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Draft 1 Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/svg/SVGGeometryElement.h » ('j') | Source/core/svg/SVGUseElement.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | Source/core/svg/SVGGeometryElement.h » ('j') | Source/core/svg/SVGUseElement.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698