#include "bindings/core/v8/V8Binding.h"
#include "core/CSSPropertyNames.h"
#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSPropertyMetadata.h"
#include "core/css/CSSStyleDeclaration.h"
#include "core/css/CSSValue.h"
-#include "core/css/RuntimeCSSEnabled.h"
-#include "core/css/parser/BisonCSSParser.h"
+#include "core/css/parser/CSSParser.h"
#include "core/events/EventTarget.h"
+#include "core/frame/UseCounter.h"
#include "wtf/ASCIICType.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
CSSPropertyID propID;
};
-static CSSPropertyID cssResolvedPropertyID(const String& propertyName)
+static CSSPropertyID cssResolvedPropertyID(const String& propertyName, v8::Isolate* isolate)
{
unsigned length = propertyName.length();
if (!length)
unsigned i = 0;
bool hasSeenDash = false;
- if (hasCSSPropertyNamePrefix(propertyName, "css"))
+ if (hasCSSPropertyNamePrefix(propertyName, "css")) {
i += 3;
- else if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
+ // getComputedStyle(elem).cssX is a non-standard behaviour
+ // Measure this behaviour as CSSXGetComputedStyleQueries.
+ UseCounter::countIfNotPrivateScript(isolate, callingExecutionContext(isolate), UseCounter::CSSXGetComputedStyleQueries);
+ } else if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
builder.append('-');
else if (isASCIIUpper(propertyName[0]))
return CSSPropertyInvalid;
// Example: 'backgroundPositionY' -> 'background-position-y'
//
// Also, certain prefixes such as 'css-' are stripped.
-static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String> v8PropertyName)
+static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String> v8PropertyName, v8::Isolate* isolate)
{
String propertyName = toCoreString(v8PropertyName);
typedef HashMap<String, CSSPropertyInfo*> CSSPropertyInfoMap;
CSSPropertyInfo* propInfo = map.get(propertyName);
if (!propInfo) {
propInfo = new CSSPropertyInfo();
- propInfo->propID = cssResolvedPropertyID(propertyName);
+ propInfo->propID = cssResolvedPropertyID(propertyName, isolate);
map.add(propertyName, propInfo);
}
- if (propInfo->propID && RuntimeCSSEnabled::isCSSPropertyEnabled(propInfo->propID))
- return propInfo;
- return 0;
+ if (!propInfo->propID)
+ return 0;
+ ASSERT(CSSPropertyMetadata::isEnabledProperty(propInfo->propID));
+ return propInfo;
}
void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8::Array>& info)
if (propertyNames.isEmpty()) {
for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) {
CSSPropertyID propertyId = static_cast<CSSPropertyID>(id);
- if (RuntimeCSSEnabled::isCSSPropertyEnabled(propertyId))
+ if (CSSPropertyMetadata::isEnabledProperty(propertyId))
propertyNames.append(getJSPropertyName(propertyId));
}
std::sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessThan);
{
// NOTE: cssPropertyInfo lookups incur several mallocs.
// Successful lookups have the same cost the first time, but are cached.
- if (cssPropertyInfo(v8Name)) {
+ if (cssPropertyInfo(v8Name, info.GetIsolate())) {
v8SetReturnValueInt(info, 0);
return;
}
return;
// Search the style declaration.
- CSSPropertyInfo* propInfo = cssPropertyInfo(name);
+ CSSPropertyInfo* propInfo = cssPropertyInfo(name, info.GetIsolate());
// Do not handle non-property names.
if (!propInfo)
return;
- CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toNative(info.Holder());
+ CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(static_cast<CSSPropertyID>(propInfo->propID));
if (cssValue) {
v8SetReturnValueStringOrNull(info, cssValue->cssText(), info.GetIsolate());
void V8CSSStyleDeclaration::namedPropertySetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toNative(info.Holder());
- CSSPropertyInfo* propInfo = cssPropertyInfo(name);
+ CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
+ CSSPropertyInfo* propInfo = cssPropertyInfo(name, info.GetIsolate());
if (!propInfo)
return;