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

Unified Diff: Source/core/animation/EffectInput.cpp

Issue 1151573017: Web Animations: Always use svg prefix when animating SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Only first letter changes case when svg prefix is added/removed Created 5 years, 6 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: Source/core/animation/EffectInput.cpp
diff --git a/Source/core/animation/EffectInput.cpp b/Source/core/animation/EffectInput.cpp
index 7aebdfb6bc241f5280c21797be809363ff34d101..82d9db38b47b621e9e29b2f877ea76411d219b3c 100644
--- a/Source/core/animation/EffectInput.cpp
+++ b/Source/core/animation/EffectInput.cpp
@@ -44,6 +44,7 @@
#include "core/dom/Element.h"
#include "core/dom/NodeComputedStyle.h"
#include "core/svg/animation/SVGSMILElement.h"
+#include "wtf/ASCIICType.h"
#include "wtf/HashSet.h"
#include "wtf/NonCopyingSort.h"
@@ -51,13 +52,18 @@ namespace blink {
namespace {
+bool svgPrefixed(const String& property)
+{
+ return property.length() >= 4 && property.startsWith("svg") && isASCIIUpper(property[3]);
+}
+
QualifiedName svgAttributeName(String property)
{
- if (property.length() >= 4 && property.startsWith("svg")) {
- // Replace 'svgTransform' with 'transform', etc.
- property.remove(0, 3);
- property = property.lower();
- }
+ // Replace 'svgTransform' with 'transform', etc.
+ ASSERT(svgPrefixed(property));
+ UChar first = toASCIILower(property[3]);
+ property.remove(0, 4);
+ property.insert(&first, 1, 0);
shans 2015/06/07 06:42:06 This differs from the previous behaviour, but I as
Eric Willigers 2015/06/09 04:02:12 Yes, I was sloppy before, it is now correct.
alancutter (OOO until 2018) 2015/06/09 06:25:05 So we no longer support animating things like svgc
if (property == "href")
return XLinkNames::hrefAttr;
@@ -260,7 +266,7 @@ PassRefPtrWillBeRawPtr<EffectModel> EffectInput::convert(Element* element, const
continue;
}
- if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element->isSVGElement())
+ if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element->isSVGElement() || !svgPrefixed(property))
continue;
SVGElement* svgElement = toSVGElement(element);

Powered by Google App Engine
This is Rietveld 408576698