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

Unified Diff: third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp

Issue 2413753004: Move getTotalLength and getPointAtLength methods from SVGPathElement to SVGGeometryElement. (Closed)
Patch Set: nits Created 4 years, 2 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
Index: third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp b/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
index b407cd3430fa89e4aca61633346ad55de39867f7..3d3912c534f8a30e95a53523492c910cc2286c2d 100644
--- a/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
@@ -87,6 +87,24 @@ void SVGGeometryElement::toClipPath(Path& path) const {
path.setWindRule(layoutObject()->style()->svgStyle().clipRule());
}
+float SVGGeometryElement::getTotalLength() {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+ Path path;
+ if (layoutObject())
fs 2016/10/24 10:48:53 Presumably an empty path yields a length of 0, so
Shanmuga Pandi 2016/10/26 09:52:12 Done.
+ path = asPath();
+ return path.length();
+}
+
+SVGPointTearOff* SVGGeometryElement::getPointAtLength(float length) {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+ Path path;
+ if (layoutObject())
fs 2016/10/24 10:48:53 Somewhat similar to above, I think this could be w
Shanmuga Pandi 2016/10/26 09:52:12 Done.
+ path = asPath();
+ FloatPoint point = path.pointAtLength(length);
+ return SVGPointTearOff::create(SVGPoint::create(point), 0,
+ PropertyIsNotAnimVal);
+}
+
LayoutObject* SVGGeometryElement::createLayoutObject(const ComputedStyle&) {
// By default, any subclass is expected to do path-based drawing.
return new LayoutSVGPath(this);

Powered by Google App Engine
This is Rietveld 408576698