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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp

Issue 2413753004: Move getTotalLength and getPointAtLength methods from SVGPathElement to SVGGeometryElement. (Closed)
Patch Set: Align with review comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 2 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 void SVGGeometryElement::toClipPath(Path& path) const { 81 void SVGGeometryElement::toClipPath(Path& path) const {
82 path = asPath(); 82 path = asPath();
83 path.transform(calculateAnimatedLocalTransform()); 83 path.transform(calculateAnimatedLocalTransform());
84 84
85 ASSERT(layoutObject()); 85 ASSERT(layoutObject());
86 ASSERT(layoutObject()->style()); 86 ASSERT(layoutObject()->style());
87 path.setWindRule(layoutObject()->style()->svgStyle().clipRule()); 87 path.setWindRule(layoutObject()->style()->svgStyle().clipRule());
88 } 88 }
89 89
90 float SVGGeometryElement::getTotalLength() {
91 document().updateStyleAndLayoutIgnorePendingStylesheets();
92
93 if (!layoutObject())
94 return 0;
95 return asPath().length();
96 }
97
98 SVGPointTearOff* SVGGeometryElement::getPointAtLength(float length) {
99 document().updateStyleAndLayoutIgnorePendingStylesheets();
100
101 FloatPoint point;
102 if (layoutObject())
103 point = asPath().pointAtLength(length);
104 return SVGPointTearOff::create(SVGPoint::create(point), 0,
105 PropertyIsNotAnimVal);
106 }
107
90 LayoutObject* SVGGeometryElement::createLayoutObject(const ComputedStyle&) { 108 LayoutObject* SVGGeometryElement::createLayoutObject(const ComputedStyle&) {
91 // By default, any subclass is expected to do path-based drawing. 109 // By default, any subclass is expected to do path-based drawing.
92 return new LayoutSVGPath(this); 110 return new LayoutSVGPath(this);
93 } 111 }
94 112
95 } // namespace blink 113 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGGeometryElement.h ('k') | third_party/WebKit/Source/core/svg/SVGGeometryElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698