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

Unified Diff: Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp

Issue 47923015: Add UseCounters for certain properties on CSSStyleDeclaration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | Source/core/page/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
index 143acdfdf6bea439d8db7452ded75ec006820428..6f01b9266845a30c0238461188794f15023c4428 100644
--- a/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ b/Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -82,9 +82,10 @@ static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* pre
return false;
}
-class CSSPropertyInfo {
-public:
- CSSPropertyID propID;
+struct CSSPropertyInfo {
+ unsigned propID: 30; // CSSPropertyID
+ unsigned nameWithDash: 1;
+ unsigned nameWithCssPrefix: 1;
};
// When getting properties on CSSStyleDeclarations, the name used from
@@ -111,20 +112,27 @@ static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String> v8PropertyName)
builder.reserveCapacity(length);
unsigned i = 0;
+ bool hasSeenDash = false;
+ bool hasSeenCssPrefix = false;
- if (hasCSSPropertyNamePrefix(propertyName, "css"))
+ if (hasCSSPropertyNamePrefix(propertyName, "css")) {
+ hasSeenCssPrefix = true;
i += 3;
- else if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
+ } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")) {
builder.append('-');
- else if (isASCIIUpper(propertyName[0]))
+ } else if (isASCIIUpper(propertyName[0])) {
return 0;
+ }
builder.append(toASCIILower(propertyName[i++]));
for (; i < length; ++i) {
UChar c = propertyName[i];
- if (!isASCIIUpper(c))
+ if (!isASCIIUpper(c)) {
+ if (c == '-')
+ hasSeenDash = true;
builder.append(c);
+ }
else {
builder.append('-');
builder.append(toASCIILower(c));
@@ -136,9 +144,19 @@ static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String> v8PropertyName)
if (propertyID && RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)) {
propInfo = new CSSPropertyInfo();
propInfo->propID = propertyID;
+ propInfo->nameWithDash = hasSeenDash;
+ propInfo->nameWithCssPrefix = hasSeenCssPrefix;
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;
}
« no previous file with comments | « no previous file | Source/core/page/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698