Chromium Code Reviews| 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) |
| { |