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

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

Issue 2525233002: Move pathLength attribute 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/SVGPathElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp
index d65a378887c3fa87b332ce1d6a6c3683e3ff56a3..c2bd58a427f52c2760aadb2823a5ec30c3da4e04 100644
--- a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp
@@ -30,37 +30,13 @@
namespace blink {
-class SVGAnimatedPathLength final : public SVGAnimatedNumber {
- public:
- static SVGAnimatedPathLength* create(SVGPathElement* contextElement) {
- return new SVGAnimatedPathLength(contextElement);
- }
-
- SVGParsingError setBaseValueAsString(const String& value) override {
- SVGParsingError parseStatus =
- SVGAnimatedNumber::setBaseValueAsString(value);
- if (parseStatus == SVGParseStatus::NoError && baseValue()->value() < 0)
- parseStatus = SVGParseStatus::NegativeValue;
- return parseStatus;
- }
-
- private:
- explicit SVGAnimatedPathLength(SVGPathElement* contextElement)
- : SVGAnimatedNumber(contextElement,
- SVGNames::pathLengthAttr,
- SVGNumber::create()) {}
-};
-
inline SVGPathElement::SVGPathElement(Document& document)
: SVGGeometryElement(SVGNames::pathTag, document),
- m_pathLength(SVGAnimatedPathLength::create(this)),
m_path(SVGAnimatedPath::create(this, SVGNames::dAttr, CSSPropertyD)) {
- addToPropertyMap(m_pathLength);
addToPropertyMap(m_path);
}
DEFINE_TRACE(SVGPathElement) {
- visitor->trace(m_pathLength);
visitor->trace(m_path);
SVGGeometryElement::trace(visitor);
}
@@ -81,18 +57,8 @@ const StylePath* SVGPathElement::stylePath() const {
return m_path->currentValue()->stylePath();
}
-float SVGPathElement::pathLengthScaleFactor() const {
- if (!pathLength()->isSpecified())
- return 1;
- float authorPathLength = pathLength()->currentValue()->value();
- if (authorPathLength < 0)
- return 1;
- if (!authorPathLength)
- return 0;
- float computedPathLength = stylePath()->length();
- if (!computedPathLength)
- return 1;
- return computedPathLength / authorPathLength;
+float SVGPathElement::computePathLength() const {
+ return stylePath()->length();
}
Path SVGPathElement::asPath() const {
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathElement.h ('k') | third_party/WebKit/Source/core/svg/SVGPathElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698