Log Message
Support the [Supplemental] IDL for constants https://bugs.webkit.org/show_bug.cgi?id=77228
Reviewed by Adam Barth. We have supported the [Supplemental] IDL for attributes and methods. This patch supports it for constants. Test: bindings/scripts/test/TestSupplemental.idl * bindings/scripts/generate-bindings.pl: Supported [Supplemental] constants. Updated some comments. * bindings/scripts/test/TestSupplemental.idl: Added test cases for [Supplemental] constants. * bindings/scripts/test/CPP/WebDOMTestInterface.h: Updated the test results. * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto. (WebCore::JSTestInterfacePrototype::getOwnPropertySlot): (WebCore::JSTestInterfacePrototype::getOwnPropertyDescriptor): (WebCore): (WebCore::jsTestInterfaceSUPPLEMENTAL_CONSTANT1): (WebCore::jsTestInterfaceSUPPLEMENTAL_CONSTANT2): * bindings/scripts/test/JS/JSTestInterface.h: Ditto. (WebCore): * bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto. * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto. (WebCore::ConfigureV8TestInterfaceTemplate):
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/bindings/scripts/generate-bindings.pl
- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h
- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h
- trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl
- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
Diff
Modified: trunk/Source/WebCore/ChangeLog (106139 => 106140)
--- trunk/Source/WebCore/ChangeLog 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/ChangeLog 2012-01-27 20:00:34 UTC (rev 106140)
@@ -1,3 +1,35 @@
+2012-01-27 Kentaro Hara <[email protected]>
+
+ Support the [Supplemental] IDL for constants
+ https://bugs.webkit.org/show_bug.cgi?id=77228
+
+ Reviewed by Adam Barth.
+
+ We have supported the [Supplemental] IDL for attributes and methods.
+ This patch supports it for constants.
+
+ Test: bindings/scripts/test/TestSupplemental.idl
+
+ * bindings/scripts/generate-bindings.pl:
+ Supported [Supplemental] constants.
+ Updated some comments.
+
+ * bindings/scripts/test/TestSupplemental.idl:
+ Added test cases for [Supplemental] constants.
+
+ * bindings/scripts/test/CPP/WebDOMTestInterface.h: Updated the test results.
+ * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto.
+ (WebCore::JSTestInterfacePrototype::getOwnPropertySlot):
+ (WebCore::JSTestInterfacePrototype::getOwnPropertyDescriptor):
+ (WebCore):
+ (WebCore::jsTestInterfaceSUPPLEMENTAL_CONSTANT1):
+ (WebCore::jsTestInterfaceSUPPLEMENTAL_CONSTANT2):
+ * bindings/scripts/test/JS/JSTestInterface.h: Ditto.
+ (WebCore):
+ * bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto.
+ * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.
+ (WebCore::ConfigureV8TestInterfaceTemplate):
+
2012-01-27 Anders Carlsson <[email protected]>
When threaded scrolling is enabled for a FrameView, always put scrollbars in layers
Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings.pl (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/generate-bindings.pl 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings.pl 2012-01-27 20:00:34 UTC (rev 106140)
@@ -148,6 +148,7 @@
}
die "Not found an interface ${targetInterfaceName} in ${targetInterfaceName}.idl." unless defined $targetDataNode;
+ # Support [Supplemental] for attributes.
foreach my $attribute (@{$dataNode->attributes}) {
# Record that this attribute is implemented by $interfaceName.
$attribute->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName;
@@ -160,17 +161,31 @@
push(@{$targetDataNode->attributes}, $attribute);
}
+ # Support [Supplemental] for methods.
foreach my $function (@{$dataNode->functions}) {
- # Record that this attribute is implemented by $interfaceName.
+ # Record that this method is implemented by $interfaceName.
$function->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName;
- # Add interface-wide extended attributes to each attribute.
+ # Add interface-wide extended attributes to each method.
foreach my $extendedAttributeName (keys %{$dataNode->extendedAttributes}) {
next if ($extendedAttributeName eq "Supplemental");
$function->signature->extendedAttributes->{$extendedAttributeName} = $dataNode->extendedAttributes->{$extendedAttributeName};
}
push(@{$targetDataNode->functions}, $function);
}
+
+ # Support [Supplemental] for constants.
+ foreach my $constant (@{$dataNode->constants}) {
+ # Record that this constant is implemented by $interfaceName.
+ $constant->extendedAttributes->{"ImplementedBy"} = $interfaceName;
+
+ # Add interface-wide extended attributes to each constant.
+ foreach my $extendedAttributeName (keys %{$dataNode->extendedAttributes}) {
+ next if ($extendedAttributeName eq "Supplemental");
+ $constant->extendedAttributes->{$extendedAttributeName} = $dataNode->extendedAttributes->{$extendedAttributeName};
+ }
+ push(@{$targetDataNode->constants}, $constant);
+ }
}
}
}
Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h 2012-01-27 20:00:34 UTC (rev 106140)
@@ -42,7 +42,17 @@
WebDOMTestInterface& operator=(const WebDOMTestInterface&);
virtual ~WebDOMTestInterface();
+ enum {
#if ENABLE(Condition11) || ENABLE(Condition12)
+ WEBDOM_SUPPLEMENTALCONSTANT1 = 1,
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ WEBDOM_SUPPLEMENTALCONSTANT2 = 2
+#endif
+
+ };
+
+#if ENABLE(Condition11) || ENABLE(Condition12)
WebDOMString supplementalStr1() const;
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2012-01-27 20:00:34 UTC (rev 106140)
@@ -68,10 +68,24 @@
static const HashTableValue JSTestInterfaceConstructorTableValues[] =
{
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic },
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic },
+#endif
{ 0, 0, 0, 0, NoIntrinsic }
};
-static const HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 };
+static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 };
+
+#if ENABLE(Condition11) || ENABLE(Condition12)
+COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums);
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums);
+#endif
+
ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestInterfaceConstructor);
const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &Base::s_info, &JSTestInterfaceConstructorTable, 0, CREATE_METHOD_TABLE(JSTestInterfaceConstructor) };
@@ -132,6 +146,12 @@
static const HashTableValue JSTestInterfacePrototypeTableValues[] =
{
#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic },
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic },
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
{ "supplementalMethod1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t)0, NoIntrinsic },
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
@@ -143,7 +163,7 @@
{ 0, 0, 0, 0, NoIntrinsic }
};
-static const HashTable JSTestInterfacePrototypeTable = { 8, 7, JSTestInterfacePrototypeTableValues, 0 };
+static const HashTable JSTestInterfacePrototypeTable = { 17, 15, JSTestInterfacePrototypeTableValues, 0 };
const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
@@ -154,13 +174,13 @@
bool JSTestInterfacePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(cell);
- return getStaticFunctionSlot<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot);
+ return getStaticPropertySlot<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot);
}
bool JSTestInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(object);
- return getStaticFunctionDescriptor<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor);
+ return getStaticPropertyDescriptor<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor);
}
const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, &JSTestInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestInterface) };
@@ -330,6 +350,24 @@
#endif
+// Constant getters
+
+#if ENABLE(Condition11) || ENABLE(Condition12)
+JSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(ExecState* exec, JSValue, const Identifier&)
+{
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(1));
+}
+
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+JSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(ExecState* exec, JSValue, const Identifier&)
+{
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(2));
+}
+
+#endif
static inline bool isObservable(JSTestInterface* jsTestInterface)
{
if (jsTestInterface->hasCustomProperties())
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h 2012-01-27 20:00:34 UTC (rev 106140)
@@ -159,7 +159,15 @@
JSC::JSValue jsTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+// Constants
+#if ENABLE(Condition11) || ENABLE(Condition12)
+JSC::JSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+JSC::JSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+#endif
+
} // namespace WebCore
#endif // ENABLE(Condition1) || ENABLE(Condition2)
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h 2012-01-27 20:00:34 UTC (rev 106140)
@@ -31,6 +31,16 @@
@class DOMTestObj;
@class NSString;
+enum {
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ DOM_SUPPLEMENTALCONSTANT1 = 1,
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ DOM_SUPPLEMENTALCONSTANT2 = 2
+#endif
+
+};
+
@interface DOMTestInterface : DOMObject
#if ENABLE(Condition11) || ENABLE(Condition12)
- (NSString *)supplementalStr1;
Modified: trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl 2012-01-27 20:00:34 UTC (rev 106140)
@@ -40,5 +40,8 @@
void supplementalMethod1();
[CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException);
[Custom] void supplementalMethod3();
+
+ const unsigned short SUPPLEMENTALCONSTANT1 = 1;
+ const [Reflect=CONST_IMPL] unsigned short SUPPLEMENTALCONSTANT2 = 2;
};
}
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp (106139 => 106140)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-01-27 19:40:22 UTC (rev 106139)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp 2012-01-27 20:00:34 UTC (rev 106140)
@@ -146,6 +146,23 @@
#endif
};
+static const BatchedConstant TestInterfaceConsts[] = {
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ {"SUPPLEMENTALCONSTANT1", static_cast<signed int>(1)},
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+ {"SUPPLEMENTALCONSTANT2", static_cast<signed int>(2)},
+#endif
+};
+
+
+#if ENABLE(Condition11) || ENABLE(Condition12)
+COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums);
+#endif
+#if ENABLE(Condition11) || ENABLE(Condition12)
+COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums);
+#endif
+
v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestInterface.Constructor");
@@ -202,6 +219,7 @@
#if ENABLE(Condition11) || ENABLE(Condition12)
proto->Set(v8::String::New("supplementalMethod2"), v8::FunctionTemplate::New(TestInterfaceInternal::supplementalMethod2Callback, v8::Handle<v8::Value>(), supplementalMethod2Signature));
#endif // ENABLE(Condition11) || ENABLE(Condition12)
+ batchConfigureConstants(desc, proto, TestInterfaceConsts, WTF_ARRAY_LENGTH(TestInterfaceConsts));
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
