Support latest Web IDL indexed property getters

https://bugs.webkit.org/show_bug.cgi?id=117507

Reviewed by Kentaro Hara.

Support latest Web IDL indexed property getters:
http://www.w3.org/TR/WebIDL/#dfn-support-indexed-properties

Drop support for outdated [IndexedGetter] and [NumericIndexedGetter]
IDL extended attributes. Since the new getter format specifies the
return type, the bindings generator is now smart enough to know if
the indexed getter is numeric or not on its own.

Based on Blink r149564 by <kojih@chromium.org>.

No new tests, no behavior change.

* Modules/filesystem/EntryArray.idl:
* Modules/filesystem/EntryArraySync.idl:
* Modules/gamepad/GamepadList.idl:
* Modules/mediasource/SourceBufferList.idl:
* Modules/speech/SpeechGrammarList.idl:
* Modules/speech/SpeechRecognitionResult.idl:
* Modules/speech/SpeechRecognitionResultList.idl:
* bindings/scripts/CodeGenerator.pm:
(IsNumericType):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertyDescriptorBody):
(GetIndexedGetterFunction):
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/TestEventTarget.idl:
* bindings/scripts/test/TestTypedArray.idl:
* css/CSSRuleList.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSValueList.idl:
* css/MediaList.idl:
* css/StyleSheetList.idl:
* css/WebKitCSSFilterValue.idl:
* css/WebKitCSSKeyframesRule.idl:
* css/WebKitCSSTransformValue.idl:
* dom/ClientRectList.idl:
* dom/DOMNamedFlowCollection.idl:
* dom/DOMStringList.idl:
* dom/DataTransferItemList.idl:
* dom/NamedNodeMap.idl:
* dom/NodeList.idl:
* dom/PropertyNodeList.idl:
* dom/TouchList.idl:
* fileapi/FileList.idl:
* html/DOMSettableTokenList.idl:
* html/DOMTokenList.idl:
* html/HTMLAllCollection.idl:
* html/HTMLCollection.idl:
* html/HTMLFormControlsCollection.idl:
* html/HTMLFormElement.idl:
* html/HTMLPropertiesCollection.idl:
* html/HTMLSelectElement.idl:
* html/RadioNodeList.idl:
* html/canvas/Float32Array.idl:
* html/canvas/Float64Array.idl:
* html/canvas/Int16Array.idl:
* html/canvas/Int32Array.idl:
* html/canvas/Int8Array.idl:
* html/canvas/Uint16Array.idl:
* html/canvas/Uint32Array.idl:
* html/canvas/Uint8Array.idl:
* html/canvas/Uint8ClampedArray.idl:
* html/track/AudioTrackList.idl:
* html/track/TextTrackCueList.idl:
* html/track/TextTrackList.idl:
* html/track/TextTrackRegionList.idl:
* html/track/VideoTrackList.idl:
* page/PerformanceEntryList.idl:
* page/SpeechInputResultList.idl:
* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPlugin.idl:
* plugins/DOMPluginArray.idl:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 78e9efd9
2013-06-12 Christophe Dumez <ch.dumez@sisa.samsung.com>
Support latest Web IDL indexed property getters
https://bugs.webkit.org/show_bug.cgi?id=117507
Reviewed by Kentaro Hara.
Support latest Web IDL indexed property getters:
http://www.w3.org/TR/WebIDL/#dfn-support-indexed-properties
Drop support for outdated [IndexedGetter] and [NumericIndexedGetter]
IDL extended attributes. Since the new getter format specifies the
return type, the bindings generator is now smart enough to know if
the indexed getter is numeric or not on its own.
Based on Blink r149564 by <kojih@chromium.org>.
No new tests, no behavior change.
* Modules/filesystem/EntryArray.idl:
* Modules/filesystem/EntryArraySync.idl:
* Modules/gamepad/GamepadList.idl:
* Modules/mediasource/SourceBufferList.idl:
* Modules/speech/SpeechGrammarList.idl:
* Modules/speech/SpeechRecognitionResult.idl:
* Modules/speech/SpeechRecognitionResultList.idl:
* bindings/scripts/CodeGenerator.pm:
(IsNumericType):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertyDescriptorBody):
(GetIndexedGetterFunction):
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/TestEventTarget.idl:
* bindings/scripts/test/TestTypedArray.idl:
* css/CSSRuleList.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSValueList.idl:
* css/MediaList.idl:
* css/StyleSheetList.idl:
* css/WebKitCSSFilterValue.idl:
* css/WebKitCSSKeyframesRule.idl:
* css/WebKitCSSTransformValue.idl:
* dom/ClientRectList.idl:
* dom/DOMNamedFlowCollection.idl:
* dom/DOMStringList.idl:
* dom/DataTransferItemList.idl:
* dom/NamedNodeMap.idl:
* dom/NodeList.idl:
* dom/PropertyNodeList.idl:
* dom/TouchList.idl:
* fileapi/FileList.idl:
* html/DOMSettableTokenList.idl:
* html/DOMTokenList.idl:
* html/HTMLAllCollection.idl:
* html/HTMLCollection.idl:
* html/HTMLFormControlsCollection.idl:
* html/HTMLFormElement.idl:
* html/HTMLPropertiesCollection.idl:
* html/HTMLSelectElement.idl:
* html/RadioNodeList.idl:
* html/canvas/Float32Array.idl:
* html/canvas/Float64Array.idl:
* html/canvas/Int16Array.idl:
* html/canvas/Int32Array.idl:
* html/canvas/Int8Array.idl:
* html/canvas/Uint16Array.idl:
* html/canvas/Uint32Array.idl:
* html/canvas/Uint8Array.idl:
* html/canvas/Uint8ClampedArray.idl:
* html/track/AudioTrackList.idl:
* html/track/TextTrackCueList.idl:
* html/track/TextTrackList.idl:
* html/track/TextTrackRegionList.idl:
* html/track/VideoTrackList.idl:
* page/PerformanceEntryList.idl:
* page/SpeechInputResultList.idl:
* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPlugin.idl:
* plugins/DOMPluginArray.idl:
2013-06-12 Christophe Dumez <ch.dumez@sisa.samsung.com>
Rename [CallWith] to [ConstructorCallWith] for IDL interfaces
......
......@@ -31,10 +31,9 @@
[
NoInterfaceObject,
Conditional=FILE_SYSTEM,
IndexedGetter,
JSNoStaticTables,
ImplementationLacksVTable
] interface EntryArray {
readonly attribute unsigned long length;
Entry item([IsIndex] unsigned long index);
getter Entry item([IsIndex] unsigned long index);
};
......@@ -31,10 +31,9 @@
[
NoInterfaceObject,
Conditional=FILE_SYSTEM,
IndexedGetter,
JSNoStaticTables,
ImplementationLacksVTable
] interface EntryArraySync {
readonly attribute unsigned long length;
EntrySync item([IsIndex] unsigned long index);
getter EntrySync item([IsIndex] unsigned long index);
};
......@@ -26,10 +26,9 @@
[
NoInterfaceObject,
Conditional=GAMEPAD,
IndexedGetter,
ImplementationLacksVTable
] interface GamepadList {
readonly attribute unsigned long length;
Gamepad item([Default=Undefined] optional unsigned long index);
getter Gamepad item([Default=Undefined] optional unsigned long index);
};
......@@ -30,12 +30,11 @@
[
Conditional=MEDIA_SOURCE,
IndexedGetter,
EventTarget,
InterfaceName=WebKitSourceBufferList
] interface SourceBufferList {
readonly attribute unsigned long length;
SourceBuffer item(unsigned long index);
getter SourceBuffer item(unsigned long index);
// EventTarget interface
void addEventListener(DOMString type,
......
......@@ -25,13 +25,12 @@
[
Conditional=SCRIPTED_SPEECH,
IndexedGetter,
Constructor,
ImplementationLacksVTable,
InterfaceName=webkitSpeechGrammarList
] interface SpeechGrammarList {
readonly attribute unsigned long length;
SpeechGrammar item([IsIndex] unsigned long index);
getter SpeechGrammar item([IsIndex] unsigned long index);
[CallWith=ScriptExecutionContext] void addFromUri(DOMString src, optional float weight);
void addFromString(DOMString string, optional float weight);
};
......@@ -26,10 +26,9 @@
[
NoInterfaceObject,
Conditional=SCRIPTED_SPEECH,
IndexedGetter,
ImplementationLacksVTable
] interface SpeechRecognitionResult {
readonly attribute unsigned long length;
SpeechRecognitionAlternative item([IsIndex] unsigned long index);
getter SpeechRecognitionAlternative item([IsIndex] unsigned long index);
readonly attribute boolean isFinal;
};
......@@ -26,9 +26,8 @@
[
NoInterfaceObject,
Conditional=SCRIPTED_SPEECH,
IndexedGetter,
ImplementationLacksVTable
] interface SpeechRecognitionResultList {
readonly attribute unsigned long length;
SpeechRecognitionResult item([IsIndex] unsigned long index);
getter SpeechRecognitionResult item([IsIndex] unsigned long index);
};
......@@ -48,7 +48,8 @@ my $verbose = 0;
my %numericTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
"unsigned int" => 1, "unsigned short" => 1,
"unsigned long" => 1, "unsigned long long" => 1,
"float" => 1, "double" => 1);
"float" => 1, "double" => 1, "byte" => 1,
"octet" => 1);
my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1);
......@@ -348,6 +349,15 @@ sub IsConstructorTemplate
return $interface->extendedAttributes->{"ConstructorTemplate"} && $interface->extendedAttributes->{"ConstructorTemplate"} eq $template;
}
sub IsNumericType
{
my $object = shift;
my $type = shift;
return 1 if $numericTypeHash{$type};
return 0;
}
sub IsPrimitiveType
{
my $object = shift;
......
......@@ -63,7 +63,6 @@ Immutable
ImplementationLacksVTable
ImplementationNamespace=*
ImplementedAs=*
IndexedGetter
InitializedByEventConstructor
InterfaceName=*
IsIndex
......@@ -87,7 +86,6 @@ MasqueradesAsUndefined
NamedConstructor=*
NoInterfaceObject
NotEnumerable
NumericIndexedGetter
ObjCCustomImplementation
ObjCLegacyUnnamedParameters
ObjCPolymorphic
......
......@@ -28,11 +28,10 @@
[
EventTarget,
IndexedGetter,
MasqueradesAsUndefined
] interface TestEventTarget {
Node item([IsIndex] unsigned long index);
getter Node item([IsIndex] unsigned long index);
getter Node (DOMString name);
void addEventListener(DOMString type,
......
......@@ -26,7 +26,6 @@
[
ConstructorTemplate=TypedArray,
NumericIndexedGetter,
CustomIndexedSetter,
JSGenerateToNativeObject,
JSNoStaticTables,
......@@ -36,4 +35,6 @@
] interface Float64Array : ArrayBufferView {
Int32Array foo(Float32Array array);
void set();
getter double (unsigned long index);
};
......@@ -26,10 +26,9 @@
// Introduced in DOM Level 2:
[
CustomIsReachable,
IndexedGetter,
SkipVTableValidation
] interface CSSRuleList {
readonly attribute unsigned long length;
CSSRule item([Default=Undefined] optional unsigned long index);
getter CSSRule item([Default=Undefined] optional unsigned long index);
};
......@@ -25,7 +25,6 @@
GenerateIsReachable,
JSCustomGetOwnPropertySlotAndDescriptor,
CustomNamedSetter,
IndexedGetter,
CustomEnumerateProperty,
SkipVTableValidation
] interface CSSStyleDeclaration {
......@@ -40,7 +39,7 @@
[Default=Undefined] optional DOMString priority);
readonly attribute unsigned long length;
DOMString item([Default=Undefined] optional unsigned long index);
getter DOMString item([Default=Undefined] optional unsigned long index);
readonly attribute CSSRule parentRule;
// Extensions
......
......@@ -25,10 +25,9 @@
// Introduced in DOM Level 2:
[
IndexedGetter,
ImplementationLacksVTable
] interface CSSValueList : CSSValue {
readonly attribute unsigned long length;
CSSValue item([Default=Undefined] optional unsigned long index);
getter CSSValue item([Default=Undefined] optional unsigned long index);
};
......@@ -27,14 +27,13 @@
[
JSCustomHeader,
GenerateIsReachable,
IndexedGetter,
ImplementationLacksVTable
] interface MediaList {
[TreatNullAs=NullString, TreatReturnedNullStringAs=Null, SetterRaisesException] attribute DOMString mediaText;
readonly attribute unsigned long length;
[TreatReturnedNullStringAs=Null] DOMString item([Default=Undefined] optional unsigned long index);
[TreatReturnedNullStringAs=Null] getter DOMString item([Default=Undefined] optional unsigned long index);
[RaisesException] void deleteMedium([Default=Undefined] optional DOMString oldMedium);
[RaisesException] void appendMedium([Default=Undefined] optional DOMString newMedium);
......
......@@ -21,11 +21,10 @@
// Introduced in DOM Level 2:
[
GenerateIsReachable=ImplDocument,
IndexedGetter,
ImplementationLacksVTable
] interface StyleSheetList {
readonly attribute unsigned long length;
StyleSheet item([Default=Undefined] optional unsigned long index);
getter StyleSheet item([Default=Undefined] optional unsigned long index);
getter CSSStyleSheet (DOMString name);
};
......@@ -24,9 +24,8 @@
*/
[
Conditional=CSS_FILTERS,
IndexedGetter,
DoNotCheckConstants,
Conditional=CSS_FILTERS,
DoNotCheckConstants,
ImplementationLacksVTable
] interface WebKitCSSFilterValue : CSSValueList {
......@@ -49,4 +48,6 @@
#endif
readonly attribute unsigned short operationType;
getter CSSValue ([Default=Undefined] optional unsigned long index);
};
......@@ -27,9 +27,7 @@
*/
// Introduced in DOM Level ?:
[
IndexedGetter
] interface WebKitCSSKeyframesRule : CSSRule {
interface WebKitCSSKeyframesRule : CSSRule {
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString name;
readonly attribute CSSRuleList cssRules;
......@@ -37,5 +35,7 @@
void insertRule([Default=Undefined] optional DOMString rule);
void deleteRule([Default=Undefined] optional DOMString key);
WebKitCSSKeyframeRule findRule([Default=Undefined] optional DOMString key);
getter WebKitCSSKeyframeRule (unsigned long index);
};
......@@ -27,8 +27,7 @@
*/
[
IndexedGetter,
DoNotCheckConstants,
DoNotCheckConstants,
ImplementationLacksVTable
] interface WebKitCSSTransformValue : CSSValueList {
......@@ -57,5 +56,7 @@
const unsigned short CSS_MATRIX3D = 21;
readonly attribute unsigned short operationType;
getter CSSValue ([Default=Undefined] optional unsigned long index);
};
......@@ -25,11 +25,10 @@
*/
[
IndexedGetter,
ImplementationLacksVTable
] interface ClientRectList {
readonly attribute unsigned long length;
ClientRect item([IsIndex, Default=Undefined] optional unsigned long index);
getter ClientRect item([IsIndex, Default=Undefined] optional unsigned long index);
// FIXME: Fix list behavior to allow custom exceptions to be thrown.
};
......@@ -32,10 +32,9 @@
Conditional=CSS_REGIONS,
InterfaceName=WebKitNamedFlowCollection,
JSGenerateToJSObject,
IndexedGetter,
ImplementationLacksVTable
] interface DOMNamedFlowCollection {
readonly attribute unsigned long length;
WebKitNamedFlow item(unsigned long index);
getter WebKitNamedFlow item(unsigned long index);
getter WebKitNamedFlow namedItem(DOMString name);
};
......@@ -24,13 +24,12 @@
*/
[
IndexedGetter,
JSCustomToNativeObject,
JSNoStaticTables,
ImplementationLacksVTable
] interface DOMStringList {
readonly attribute unsigned long length;
[TreatReturnedNullStringAs=Null] DOMString item([Default=Undefined] optional unsigned long index);
[TreatReturnedNullStringAs=Null] getter DOMString item([Default=Undefined] optional unsigned long index);
boolean contains([Default=Undefined] optional DOMString string);
};
......@@ -31,12 +31,11 @@
[
NoInterfaceObject,
Conditional=DATA_TRANSFER_ITEMS,
IndexedGetter,
JSGenerateToNativeObject,
ImplementationLacksVTable
] interface DataTransferItemList {
readonly attribute long length;
DataTransferItem item([Default=Undefined] optional unsigned long index);
getter DataTransferItem item([Default=Undefined] optional unsigned long index);
void clear();
void add(File? file);
......
......@@ -20,7 +20,6 @@
[
GenerateIsReachable=ImplElementRoot,
IndexedGetter,
ImplementationLacksVTable
] interface NamedNodeMap {
......@@ -30,7 +29,7 @@
[RaisesException] Node removeNamedItem([Default=Undefined] optional DOMString name);
Node item([Default=Undefined] optional unsigned long index);
getter Node item([Default=Undefined] optional unsigned long index);
readonly attribute unsigned long length;
......
......@@ -20,11 +20,10 @@
[
CustomIsReachable,
IndexedGetter,
SkipVTableValidation
] interface NodeList {
Node item([IsIndex,Default=Undefined] optional unsigned long index);
getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
getter (Node or unsigned long) (DOMString name);
readonly attribute unsigned long length;
......
......@@ -30,12 +30,11 @@
[
Conditional=MICRODATA,
IndexedGetter,
JSGenerateToJSObject
] interface PropertyNodeList : NodeList {
sequence<MicroDataItemValue> getValues();
Node item(unsigned long index);
getter Node item(unsigned long index);
readonly attribute unsigned long length;
};
......@@ -25,10 +25,9 @@
[
Conditional=TOUCH_EVENTS,
IndexedGetter,
ImplementationLacksVTable
] interface TouchList {
readonly attribute unsigned long length;
Touch item(unsigned long index);
getter Touch item(unsigned long index);
};
......@@ -24,11 +24,10 @@
*/
[
IndexedGetter,
JSNoStaticTables,
ImplementationLacksVTable
] interface FileList {
readonly attribute unsigned long length;
File item(unsigned long index);
getter File item(unsigned long index);
};
......@@ -23,10 +23,11 @@
*/
[
IndexedGetter,
JSGenerateToJSObject,
SkipVTableValidation,
] interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
[TreatReturnedNullStringAs=Null] getter DOMString (unsigned long index);
};
......@@ -24,11 +24,10 @@
[
GenerateIsReachable=ImplElementRoot,
IndexedGetter,
SkipVTableValidation
] interface DOMTokenList {
readonly attribute unsigned long length;
[TreatReturnedNullStringAs=Null] DOMString item(unsigned long index);
[TreatReturnedNullStringAs=Null] getter DOMString item(unsigned long index);
[RaisesException] boolean contains(DOMString token);
[RaisesException] void add(DOMString... tokens);
[RaisesException] void remove(DOMString... tokens);
......
......@@ -24,13 +24,12 @@
*/
[
IndexedGetter,
CustomCall,
MasqueradesAsUndefined,
GenerateIsReachable=ImplOwnerNodeRoot,
] interface HTMLAllCollection {
readonly attribute unsigned long length;
[Custom] Node item([Default=Undefined] optional unsigned long index);
[Custom] getter Node item([Default=Undefined] optional unsigned long index);
[Custom] getter Node namedItem(DOMString name);
// FIXME: This should return an HTMLAllCollection.
NodeList tags(DOMString name);
......
......@@ -19,13 +19,12 @@
*/
[
IndexedGetter,
CustomToJSObject,
GenerateIsReachable=ImplOwnerNodeRoot,
ObjCPolymorphic,
] interface HTMLCollection {
readonly attribute unsigned long length;
Node item([Default=Undefined] optional unsigned long index);
getter Node item([Default=Undefined] optional unsigned long index);
getter Node namedItem([Default=Undefined] optional DOMString name);
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
......
......@@ -19,8 +19,8 @@
*/
[
IndexedGetter,
GenerateIsReachable=ImplOwnerNodeRoot,
] interface HTMLFormControlsCollection : HTMLCollection {
getter Node ([Default=Undefined] optional unsigned long index);
[Custom] getter Node namedItem([Default=Undefined] optional DOMString name);
};
......@@ -19,7 +19,6 @@
*/
[
IndexedGetter,
CustomNamedGetter
] interface HTMLFormElement : HTMLElement {
[Reflect=accept_charset] attribute DOMString acceptCharset;
......@@ -35,6 +34,8 @@
readonly attribute HTMLCollection elements;
readonly attribute long length;
getter Element (unsigned long index);
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
[ImplementedAs=submitFromJavaScript] void submit();
#else
......
......@@ -31,10 +31,9 @@
[
Conditional=MICRODATA,
JSGenerateToJSObject,
IndexedGetter
] interface HTMLPropertiesCollection : HTMLCollection {
readonly attribute unsigned long length;
Node item(unsigned long index);
getter Node item(unsigned long index);
readonly attribute DOMStringList names;
[ImplementedAs=propertyNodeList] getter PropertyNodeList namedItem(DOMString name);
......
......@@ -19,7 +19,6 @@
*/
[
IndexedGetter,
CustomIndexedSetter,
] interface HTMLSelectElement : HTMLElement {
attribute [Reflect] boolean autofocus;
......@@ -40,7 +39,7 @@
#else
[SetterRaisesException] attribute unsigned long length;
#endif
Node item([IsIndex,Default=Undefined] optional unsigned long index);
getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
Node namedItem([Default=Undefined] optional DOMString name);
[ObjCLegacyUnnamedParameters, RaisesException] void add([Default=Undefined] optional HTMLElement element,
[Default=Undefined] optional HTMLElement before);
......
......@@ -26,7 +26,8 @@
[
NoInterfaceObject,
JSGenerateToJSObject,
IndexedGetter,
] interface RadioNodeList : NodeList {
attribute DOMString value;
getter Node ([IsIndex,Default=Undefined] optional unsigned long index);
};
......@@ -27,7 +27,6 @@
[
GlobalContext=WindowAndWorker,
ConstructorTemplate=TypedArray,