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

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 12 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.cpp » ('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 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;
}
« no previous file with comments | « no previous file | Source/core/svg/SVGGeometryElement.h » ('j') | Source/core/svg/SVGUseElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698