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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106140
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-27 Kentaro Hara <haraken@chromium.org>
+
+ 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 <andersca@apple.com>
When threaded scrolling is enabled for a FrameView, always put scrollbars in layers
}
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;
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);
+ }
}
}
}
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
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) };
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)
{ 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)
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) };
#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())
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
@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;
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;
};
}
#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");
#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());