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

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

Issue 1491023003: Refactor SVGAnimatedLength negative values mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace SVGLengthNegativeValuesMode enum with bool Created 5 years 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/SVGLength.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGLength.cpp b/third_party/WebKit/Source/core/svg/SVGLength.cpp
index 075649fe8654ad8732510410bd30e21a07c1b5be..924008740a21cea8529aa362278de5ee99d5ebba 100644
--- a/third_party/WebKit/Source/core/svg/SVGLength.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLength.cpp
@@ -197,6 +197,7 @@ SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedNam
s_lengthModeMap.set(SVGNames::cyAttr, SVGLengthMode::Height);
s_lengthModeMap.set(SVGNames::dxAttr, SVGLengthMode::Width);
s_lengthModeMap.set(SVGNames::dyAttr, SVGLengthMode::Height);
+ s_lengthModeMap.set(SVGNames::frAttr, SVGLengthMode::Other);
s_lengthModeMap.set(SVGNames::fxAttr, SVGLengthMode::Width);
s_lengthModeMap.set(SVGNames::fyAttr, SVGLengthMode::Height);
s_lengthModeMap.set(SVGNames::rAttr, SVGLengthMode::Other);
@@ -222,6 +223,25 @@ SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedNam
return SVGLengthMode::Other;
}
+bool SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(const QualifiedName& attrName)
+{
+ DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, s_noNegativeValuesSet, ());
+
+ if (s_noNegativeValuesSet.isEmpty()) {
+ s_noNegativeValuesSet.add(SVGNames::frAttr);
+ s_noNegativeValuesSet.add(SVGNames::rAttr);
+ s_noNegativeValuesSet.add(SVGNames::rxAttr);
+ s_noNegativeValuesSet.add(SVGNames::ryAttr);
+ s_noNegativeValuesSet.add(SVGNames::widthAttr);
+ s_noNegativeValuesSet.add(SVGNames::heightAttr);
+ s_noNegativeValuesSet.add(SVGNames::markerWidthAttr);
+ s_noNegativeValuesSet.add(SVGNames::markerHeightAttr);
+ s_noNegativeValuesSet.add(SVGNames::textLengthAttr);
+ }
+
+ return s_noNegativeValuesSet.contains(attrName);
+}
+
void SVGLength::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* contextElement)
{
SVGLengthContext lengthContext(contextElement);
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLength.h ('k') | third_party/WebKit/Source/core/svg/SVGLineElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698