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

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

Issue 2525233002: Move pathLength attribute from SVGPathElement to SVGGeometryElement. (Closed)
Patch Set: 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/SVGGeometryElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp b/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
index 993675de9cf557c2e3ecbdf056578fe7ce6e8438..4f18c0424e8547800fcc4ab410743ca465b8a134 100644
--- a/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp
@@ -39,10 +39,39 @@
namespace blink {
+class SVGAnimatedPathLength final : public SVGAnimatedNumber {
+ public:
+ static SVGAnimatedPathLength* create(SVGGeometryElement* 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(SVGGeometryElement* contextElement)
+ : SVGAnimatedNumber(contextElement,
+ SVGNames::pathLengthAttr,
+ SVGNumber::create()) {}
+};
+
SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName,
Document& document,
ConstructionType constructionType)
- : SVGGraphicsElement(tagName, document, constructionType) {}
+ : SVGGraphicsElement(tagName, document, constructionType),
+ m_pathLength(SVGAnimatedPathLength::create(this)) {
+ addToPropertyMap(m_pathLength);
+}
+
+DEFINE_TRACE(SVGGeometryElement) {
+ visitor->trace(m_pathLength);
+ SVGGraphicsElement::trace(visitor);
+}
bool SVGGeometryElement::isPointInFill(SVGPointTearOff* point) const {
document().updateStyleAndLayoutIgnorePendingStylesheets();

Powered by Google App Engine
This is Rietveld 408576698