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

Unified Diff: Source/core/css/CSSParser-in.cpp

Issue 96283002: Web Animations API: Start implementation of Element.animate(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout test for animate() Created 7 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: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index ab2aea348938621f9d980ae5c2d7468010563aa0..482a427e7f225d9ca0e1b7a74ab25af10abcf7e0 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -79,6 +79,7 @@
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/page/PageConsole.h"
+#include "core/page/RuntimeCSSEnabled.h"
#include "core/page/Settings.h"
#include "core/rendering/RenderTheme.h"
#include "core/svg/SVGParserUtilities.h"
@@ -10219,6 +10220,31 @@ CSSPropertyID cssPropertyID(const CSSParserString& string)
return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPropertyID(string.characters16(), length);
}
+CSSPropertyID camelCaseCSSPropertyNameToID(StringImpl* propertyName)
+{
+ typedef HashMap<StringImpl*, CSSPropertyID> CSSPropertyIDMap;
+ DEFINE_STATIC_LOCAL(CSSPropertyIDMap, map, ());
+
+ CSSPropertyID id = map.get(propertyName);
+
+ if (!id) {
+ StringBuilder builder;
+ size_t position = 0;
+ size_t end;
+ while ((end = propertyName->find(isASCIIUpper, position)) != kNotFound) {
+ builder.append(propertyName->substring(position, end) + "-" + toASCIILower((*propertyName)[end]));
esprehn 2013/12/09 18:51:25 You shouldn't add this, instead refactor the V8CSS
Steve Block 2013/12/09 23:32:20 I recommended this too, but after discussion with
esprehn 2013/12/09 23:36:16 Why is it safe to ignore the webkit prefix? It doe
shans 2013/12/09 23:48:40 We don't intend the Web Animations API to support
+ position = end + 1;
+ }
+ builder.append(propertyName->substring(position));
+ // Doesn't handle prefixed properties.
+ id = cssPropertyID(builder.toString());
+ if (id != CSSPropertyInvalid && RuntimeCSSEnabled::isCSSPropertyEnabled(id))
+ map.add(propertyName, id);
esprehn 2013/12/09 18:51:25 This is a memory leak, it'll just grow forever wit
shans 2013/12/09 23:25:57 Invalid property names are explicitly filtered out
esprehn 2013/12/09 23:36:16 Awesome.
+ }
+
+ return id;
+}
+
template <typename CharacterType>
static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length)
{

Powered by Google App Engine
This is Rietveld 408576698