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

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 14 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') | no next file with comments »
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..1f2fc9d2defec15c5bf88c975af62560a346c102 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"
@@ -86,7 +87,7 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj
return false;
if (!childElement->isSVGGraphicsElement())
continue;
- SVGGraphicsElement* styled = toSVGGraphicsElement(childElement);
+
const ComputedStyle* style = childLayoutObject->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
@@ -97,7 +98,10 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj
// First clip shape.
if (clipPath.isEmpty()) {
- styled->toClipPath(clipPath);
+ if (isSVGGeometryElement(childElement))
+ toSVGGeometryElement(childElement)->toClipPath(clipPath);
+ else if (isSVGUseElement(childElement))
+ toSVGUseElement(childElement)->toClipPath(clipPath);
continue;
}
@@ -113,7 +117,11 @@ bool LayoutSVGResourceClipper::tryPathOnlyClipping(const LayoutObject& layoutObj
}
Path subPath;
- styled->toClipPath(subPath);
+ if (isSVGGeometryElement(childElement))
+ toSVGGeometryElement(childElement)->toClipPath(subPath);
+ else if (isSVGUseElement(childElement))
+ toSVGUseElement(childElement)->toClipPath(subPath);
+
clipPathBuilder.add(subPath.skPath(), kUnion_SkPathOp);
}
@@ -179,7 +187,11 @@ PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin
bool isUseElement = isSVGUseElement(*childElement);
if (isUseElement) {
- layoutObject = toSVGUseElement(*childElement).layoutObjectClipChild();
+ const SVGGraphicsElement* clippingElement = toSVGUseElement(*childElement).targetGraphicsElementForClipping();
+ if (!clippingElement)
+ continue;
+
+ layoutObject = clippingElement->layoutObject();
if (!layoutObject)
continue;
}
« no previous file with comments | « no previous file | Source/core/svg/SVGGeometryElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698