Index: Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp |
diff --git a/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp |
index 274b2a810117baef802acacdf74132f9294b11d6..914dd3408e9eb0b0902a170b7fdbe96396b816bb 100644 |
--- a/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp |
+++ b/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp |
@@ -86,6 +86,14 @@ struct CSSPropertyInfo { |
unsigned nameWithCssPrefix: 1; |
}; |
+static inline void countCssPropertyInfoUsage(const CSSPropertyInfo& propInfo) |
+{ |
+ if (propInfo.nameWithDash) |
+ UseCounter::count(activeDOMWindow(), UseCounter::CSSStyleDeclarationPropertyName); |
+ if (propInfo.propID == CSSPropertyFloat && !propInfo.nameWithCssPrefix) |
+ UseCounter::count(activeDOMWindow(), UseCounter::CSSStyleDeclarationFloatPropertyName); |
+} |
+ |
// When getting properties on CSSStyleDeclarations, the name used from |
// Javascript and the actual name of the property are not the same, so |
// we have to do the following translation. The translation turns upper |
@@ -147,14 +155,6 @@ static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String> v8PropertyName) |
map.add(propertyName, propInfo); |
} |
} |
- |
- if (propInfo) { |
- if (propInfo->nameWithDash) |
- UseCounter::count(activeDOMWindow(), UseCounter::CSSStyleDeclarationPropertyName); |
- if (propInfo->propID == CSSPropertyFloat && !propInfo->nameWithCssPrefix) |
- UseCounter::count(activeDOMWindow(), UseCounter::CSSStyleDeclarationFloatPropertyName); |
- } |
- |
return propInfo; |
} |
@@ -188,7 +188,8 @@ void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::String> v8Nam |
{ |
// NOTE: cssPropertyInfo lookups incur several mallocs. |
// Successful lookups have the same cost the first time, but are cached. |
- if (cssPropertyInfo(v8Name)) { |
+ if (CSSPropertyInfo* propInfo = cssPropertyInfo(v8Name)) { |
+ countCssPropertyInfoUsage(*propInfo); |
v8SetReturnValueInt(info, 0); |
return; |
} |
@@ -207,6 +208,7 @@ void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::String> name |
if (!propInfo) |
return; |
+ countCssPropertyInfoUsage(*propInfo); |
CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder()); |
RefPtr<CSSValue> cssValue = imp->getPropertyCSSValueInternal(static_cast<CSSPropertyID>(propInfo->propID)); |
if (cssValue) { |
@@ -228,6 +230,7 @@ void V8CSSStyleDeclaration::namedPropertySetterCustom(v8::Local<v8::String> name |
if (!propInfo) |
return; |
+ countCssPropertyInfoUsage(*propInfo); |
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, propertyValue, value); |
ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
imp->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), propertyValue, false, exceptionState); |