Index: bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp |
=================================================================== |
--- bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp (revision 148530) |
+++ bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp (working copy) |
@@ -37,6 +37,8 @@ |
#include "CSSValue.h" |
#include "CSSPrimitiveValue.h" |
#include "EventTarget.h" |
+#include "HashTools.h" |
+#include "RuntimeCSSEnabled.h" |
#include "V8Binding.h" |
@@ -141,7 +143,7 @@ |
String propName = builder.toString(); |
CSSPropertyID propertyID = cssPropertyID(propName); |
- if (propertyID) { |
+ if (propertyID && RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)) { |
propInfo = new CSSPropertyInfo(); |
propInfo->hadPixelOrPosPrefix = hadPixelOrPosPrefix; |
propInfo->propID = propertyID; |
@@ -151,6 +153,33 @@ |
return propInfo; |
} |
+static bool isCSSValueEnabled(String& value) |
+{ |
+ const struct Value* propertyValue = findValue( |
+ reinterpret_cast<const char*>(value.characters8()), |
+ value.length()); |
+ |
+ if (!propertyValue) |
+ return true; |
+ return RuntimeCSSEnabled::isCSSValueEnabled( |
+ static_cast<CSSValueID>(propertyValue->id)); |
+} |
+ |
+static bool isValueOfPropertyEnabled(CSSStyleDeclaration* imp, v8::Local<v8::String> propertyName) |
+{ |
+ if (!imp) |
+ return true; |
+ |
+ CSSPropertyInfo* propInfo = cssPropertyInfo(propertyName); |
+ if (!propInfo || propInfo->propID == CSSPropertyInvalid) |
eseidel
2013/04/23 01:36:36
When is CSSPropertyInvalid ever possible in propIn
|
+ return true; |
+ |
+ String propertyValueName = imp->getPropertyValueInternal(propInfo->propID); |
+ if (propertyValueName.isEmpty()) |
+ return true; |
+ return isCSSValueEnabled(propertyValueName); |
+} |
+ |
v8::Handle<v8::Array> V8CSSStyleDeclaration::namedPropertyEnumerator(const v8::AccessorInfo& info) |
{ |
typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector; |
@@ -159,7 +188,8 @@ |
if (propertyNames.isEmpty()) { |
for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id) |
- propertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id))); |
+ if (RuntimeCSSEnabled::isCSSPropertyEnabled(static_cast<CSSPropertyID>(id))) |
+ propertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id))); |
sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessThan); |
propertyNamesLength = propertyNames.size(); |
} |
@@ -196,6 +226,9 @@ |
return v8Undefined(); |
CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder()); |
+ if (!isValueOfPropertyEnabled(imp, name)) |
+ return v8Undefined(); |
+ |
RefPtr<CSSValue> cssValue = imp->getPropertyCSSValueInternal(static_cast<CSSPropertyID>(propInfo->propID)); |
if (cssValue) { |
if (propInfo->hadPixelOrPosPrefix && |
@@ -215,6 +248,10 @@ |
v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) |
{ |
+ String wsValue = toWebCoreString(value); |
+ if (!isCSSValueEnabled(wsValue)) |
eseidel
2013/04/23 01:32:00
I don't believe this part is correct or necessary.
|
+ return v8Undefined(); |
+ |
CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder()); |
CSSPropertyInfo* propInfo = cssPropertyInfo(name); |
if (!propInfo) |