Commit f1942458 authored by jl@opera.com's avatar jl@opera.com

IDL: Support optional argument default value syntax

Adds support for parsing default values of different types, but
only handles null default values when generating code.

Replaces existing

  [Default=Null] optional SomeInterface arg
  [Default=NullString] optional DOMString arg

with the now equivalent

  optional SomeInterface arg = null
  optional DOMString arg = null

in IDL files, and drops support for those [Default] attributes.

No changes to generated code.

BUG=258153

Review URL: https://codereview.chromium.org/312683005

git-svn-id: svn://svn.chromium.org/blink/trunk@176200 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3e858e50
...@@ -46,7 +46,7 @@ ConstructorCallWith=ExecutionContext|Document ...@@ -46,7 +46,7 @@ ConstructorCallWith=ExecutionContext|Document
Custom=|Getter|Setter|LegacyCallAsFunction|ToV8|VisitDOMWrapper|Wrap|PropertyGetter|PropertyEnumerator|PropertyQuery Custom=|Getter|Setter|LegacyCallAsFunction|ToV8|VisitDOMWrapper|Wrap|PropertyGetter|PropertyEnumerator|PropertyQuery
CustomConstructor CustomConstructor
CustomElementCallbacks CustomElementCallbacks
Default=Null|NullString|Undefined Default=Undefined
DependentLifetime DependentLifetime
DeprecateAs=* DeprecateAs=*
DoNotCheckConstants DoNotCheckConstants
......
...@@ -393,6 +393,59 @@ class IdlConstant(TypedObject): ...@@ -393,6 +393,59 @@ class IdlConstant(TypedObject):
self.extended_attributes = {} self.extended_attributes = {}
################################################################################
# Literals
################################################################################
class IdlLiteral(object):
def __init__(self, idl_type, value):
self.idl_type = idl_type
self.value = value
self.is_null = False
def __str__(self):
if self.idl_type == 'DOMString':
return 'String("%s")' % self.value
if self.idl_type == 'integer':
return '%d' % self.value
if self.idl_type == 'float':
return '%g' % self.value
if self.idl_type == 'boolean':
return 'true' if self.value else 'false'
raise ValueError('Unsupported literal type: %s' % self.idl_type)
class IdlLiteralNull(IdlLiteral):
def __init__(self):
self.idl_type = 'NULL'
self.value = None
self.is_null = True
def __str__(self):
return 'nullptr'
def default_node_to_idl_literal(node):
# FIXME: This code is unnecessarily complicated due to the rather
# inconsistent way the upstream IDL parser outputs default values.
# http://crbug.com/374178
idl_type = node.GetProperty('TYPE')
if idl_type == 'DOMString':
value = node.GetProperty('NAME')
if '"' in value or '\\' in value:
raise ValueError('Unsupported string value: %r' % value)
return IdlLiteral(idl_type, value)
if idl_type == 'integer':
return IdlLiteral(idl_type, int(node.GetProperty('NAME')))
if idl_type == 'float':
return IdlLiteral(idl_type, float(node.GetProperty('VALUE')))
if idl_type == 'boolean':
return IdlLiteral(idl_type, node.GetProperty('VALUE'))
if idl_type == 'NULL':
return IdlLiteralNull()
raise ValueError('Unrecognized default value type: %s' % idl_type)
################################################################################ ################################################################################
# Operations # Operations
################################################################################ ################################################################################
...@@ -475,6 +528,7 @@ class IdlArgument(TypedObject): ...@@ -475,6 +528,7 @@ class IdlArgument(TypedObject):
self.is_optional = node.GetProperty('OPTIONAL') # syntax: (optional T) self.is_optional = node.GetProperty('OPTIONAL') # syntax: (optional T)
self.is_variadic = False # syntax: (T...) self.is_variadic = False # syntax: (T...)
self.name = node.GetName() self.name = node.GetName()
self.default_value = None
children = node.GetChildren() children = node.GetChildren()
for child in children: for child in children:
...@@ -488,6 +542,8 @@ class IdlArgument(TypedObject): ...@@ -488,6 +542,8 @@ class IdlArgument(TypedObject):
if child_name != '...': if child_name != '...':
raise ValueError('Unrecognized Argument node; expected "...", got "%s"' % child_name) raise ValueError('Unrecognized Argument node; expected "...", got "%s"' % child_name)
self.is_variadic = child.GetProperty('ELLIPSIS') or False self.is_variadic = child.GetProperty('ELLIPSIS') or False
elif child_class == 'Default':
self.default_value = default_node_to_idl_literal(child)
else: else:
raise ValueError('Unrecognized node class: %s' % child_class) raise ValueError('Unrecognized node class: %s' % child_class)
......
...@@ -181,8 +181,11 @@ def generate_argument(interface, method, argument, index): ...@@ -181,8 +181,11 @@ def generate_argument(interface, method, argument, index):
used_as_argument=True, used_as_argument=True,
used_as_variadic_argument=argument.is_variadic), used_as_variadic_argument=argument.is_variadic),
'cpp_value': this_cpp_value, 'cpp_value': this_cpp_value,
# FIXME: check that the default value's type is compatible with the argument's
'default_value': str(argument.default_value) if argument.default_value else None,
'enum_validation_expression': idl_type.enum_validation_expression, 'enum_validation_expression': idl_type.enum_validation_expression,
'has_default': 'Default' in extended_attributes, # FIXME: remove once [Default] removed and just use argument.default_value
'has_default': 'Default' in extended_attributes or argument.default_value,
'has_event_listener_argument': any( 'has_event_listener_argument': any(
argument_so_far for argument_so_far in method.arguments[:index] argument_so_far for argument_so_far in method.arguments[:index]
if argument_so_far.idl_type.name == 'EventListener'), if argument_so_far.idl_type.name == 'EventListener'),
...@@ -298,9 +301,10 @@ def v8_value_to_local_cpp_value(argument, index): ...@@ -298,9 +301,10 @@ def v8_value_to_local_cpp_value(argument, index):
name = argument.name name = argument.name
if argument.is_variadic: if argument.is_variadic:
return v8_value_to_local_cpp_variadic_value(argument, index) return v8_value_to_local_cpp_variadic_value(argument, index)
# [Default=NullString] # FIXME: This special way of handling string arguments with null defaults
# can go away once we fully support default values.
if (argument.is_optional and idl_type.name in ('String', 'ByteString') and if (argument.is_optional and idl_type.name in ('String', 'ByteString') and
extended_attributes.get('Default') == 'NullString'): argument.default_value and argument.default_value.is_null):
v8_value = 'argumentOrNull(info, %s)' % index v8_value = 'argumentOrNull(info, %s)' % index
else: else:
v8_value = 'info[%s]' % index v8_value = 'info[%s]' % index
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
TestInterfaceEmpty testInterfaceEmptyArg, TestInterfaceEmpty testInterfaceEmptyArg,
long longArg, long longArg,
[Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg, [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg,
[Default=NullString] optional DOMString defaultNullStringOptionalStringArg, optional DOMString defaultNullStringOptionalStringArg = null,
[Default=Undefined] optional Dictionary defaultUndefinedOptionalDictionaryArg, [Default=Undefined] optional Dictionary defaultUndefinedOptionalDictionaryArg,
optional DOMString optionalStringArg), optional DOMString optionalStringArg),
] interface TestInterfaceConstructor2 { ] interface TestInterfaceConstructor2 {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
[Default=Undefined] optional boolean defaultUndefinedOptionalBooleanArg, [Default=Undefined] optional boolean defaultUndefinedOptionalBooleanArg,
[Default=Undefined] optional long defaultUndefinedOptionalLongArg, [Default=Undefined] optional long defaultUndefinedOptionalLongArg,
[Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg, [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg,
[Default=NullString] optional DOMString defaultNullStringOptionalstringArg, optional DOMString defaultNullStringOptionalstringArg = null,
optional DOMString optionalStringArg), optional DOMString optionalStringArg),
RaisesException=Constructor, RaisesException=Constructor,
] interface TestInterfaceNamedConstructor { ] interface TestInterfaceNamedConstructor {
......
...@@ -379,6 +379,16 @@ interface TestObject { ...@@ -379,6 +379,16 @@ interface TestObject {
// Optional arguments: exceptional case // Optional arguments: exceptional case
void voidMethodOptionalDictionaryArg(optional Dictionary optionalDictionaryArg); void voidMethodOptionalDictionaryArg(optional Dictionary optionalDictionaryArg);
// Optional arguments with defaults
void voidMethodDefaultStringArg(optional DOMString defaultStringArg = "foo");
void voidMethodDefaultNullStringArg(optional DOMString defaultStringArg = null);
void voidMethodDefaultLongArg(optional long defaultLongArg = 10);
void voidMethodDefaultDoubleArg(optional double defaultDoubleArg = 0.5);
void voidMethodDefaultTrueBooleanArg(optional boolean defaultBooleanArg = true);
void voidMethodDefaultFalseBooleanArg(optional boolean defaultBooleanArg = false);
void voidMethodDefaultNullableStringArg(optional DOMString? defaultStringArg = null);
void voidMethodDefaultNullableTestInterfaceArg(optional TestInterface? defaultTestInterfaceArg = null);
// Variadic operations // Variadic operations
void voidMethodVariadicStringArg(DOMString... variadicStringArgs); void voidMethodVariadicStringArg(DOMString... variadicStringArgs);
void voidMethodStringArgVariadicStringArg(DOMString stringArg, DOMString... variadicStringArgs); void voidMethodStringArgVariadicStringArg(DOMString stringArg, DOMString... variadicStringArgs);
...@@ -401,7 +411,7 @@ interface TestObject { ...@@ -401,7 +411,7 @@ interface TestObject {
void overloadedMethodF(optional DOMString stringArg); void overloadedMethodF(optional DOMString stringArg);
void overloadedMethodF(double doubleArg); void overloadedMethodF(double doubleArg);
void overloadedMethodG(long longArg); void overloadedMethodG(long longArg);
void overloadedMethodG([Default=Null] TestInterfaceEmpty? testInterfaceEmptyOrNullArg); void overloadedMethodG(optional TestInterfaceEmpty? testInterfaceEmptyOrNullArg = null);
void overloadedMethodH(TestInterface testInterfaceArg); void overloadedMethodH(TestInterface testInterfaceArg);
void overloadedMethodH(TestInterfaceEmpty testInterfaceEmptyArg); void overloadedMethodH(TestInterfaceEmpty testInterfaceEmptyArg);
void overloadedMethodI(DOMString stringArg); void overloadedMethodI(DOMString stringArg);
...@@ -422,7 +432,6 @@ interface TestObject { ...@@ -422,7 +432,6 @@ interface TestObject {
void voidMethodDefaultUndefinedTestInterfaceEmptyArg([Default=Undefined] optional TestInterfaceEmpty defaultUndefinedTestInterfaceEmptyArg); void voidMethodDefaultUndefinedTestInterfaceEmptyArg([Default=Undefined] optional TestInterfaceEmpty defaultUndefinedTestInterfaceEmptyArg);
void voidMethodDefaultUndefinedLongArg([Default=Undefined] optional long defaultUndefinedLongArg); void voidMethodDefaultUndefinedLongArg([Default=Undefined] optional long defaultUndefinedLongArg);
void voidMethodDefaultUndefinedStringArg([Default=Undefined] optional DOMString defaultUndefinedStringArg); void voidMethodDefaultUndefinedStringArg([Default=Undefined] optional DOMString defaultUndefinedStringArg);
void voidMethodDefaultNullStringStringArg([Default=NullString] optional DOMString defaultNullStringStringArg);
// [EnforceRange] // [EnforceRange]
void voidMethodEnforceRangeLongArg([EnforceRange] long enforceRangeLongArg); void voidMethodEnforceRangeLongArg([EnforceRange] long enforceRangeLongArg);
// [TreatNullAs], [TreatUndefinedAs] // [TreatNullAs], [TreatUndefinedAs]
......
...@@ -494,7 +494,7 @@ float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState) ...@@ -494,7 +494,7 @@ float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
{ {
// Handle [Default=NullString] // Handle null default value.
if (value.IsEmpty()) if (value.IsEmpty())
return String(); return String();
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
[TreatReturnedNullStringAs=Null] DOMString getPropertyPriority([Default=Undefined] optional DOMString propertyName); [TreatReturnedNullStringAs=Null] DOMString getPropertyPriority([Default=Undefined] optional DOMString propertyName);
[RaisesException] void setProperty([Default=Undefined] optional DOMString propertyName, [RaisesException] void setProperty([Default=Undefined] optional DOMString propertyName,
[TreatNullAs=NullString,Default=Undefined] optional DOMString value, [TreatNullAs=NullString,Default=Undefined] optional DOMString value,
[TreatNullAs=NullString,Default=NullString] optional DOMString priority); [TreatNullAs=NullString] optional DOMString priority = null);
readonly attribute unsigned long length; readonly attribute unsigned long length;
getter DOMString item([Default=Undefined] optional unsigned long index); getter DOMString item([Default=Undefined] optional unsigned long index);
......
...@@ -41,8 +41,8 @@ enum FontFaceSetLoadStatus { "loading", "loaded" }; ...@@ -41,8 +41,8 @@ enum FontFaceSetLoadStatus { "loading", "loaded" };
attribute EventHandler onloadingdone; attribute EventHandler onloadingdone;
attribute EventHandler onloadingerror; attribute EventHandler onloadingerror;
[RaisesException] boolean check(DOMString font, [Default=NullString] optional DOMString text); [RaisesException] boolean check(DOMString font, optional DOMString text = null);
[CallWith=ScriptState] Promise load(DOMString font, [Default=NullString] optional DOMString text); [CallWith=ScriptState] Promise load(DOMString font, optional DOMString text = null);
[CallWith=ScriptState] Promise ready(); [CallWith=ScriptState] Promise ready();
[RaisesException] void add(FontFace fontFace); [RaisesException] void add(FontFace fontFace);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// Introduced in DOM Level ?: // Introduced in DOM Level ?:
[ [
Constructor([Default=NullString] optional DOMString cssValue), Constructor(optional DOMString cssValue = null),
ImplementedAs=CSSMatrix, ImplementedAs=CSSMatrix,
RaisesException=Constructor, RaisesException=Constructor,
WillBeGarbageCollected WillBeGarbageCollected
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
[ [
Constructor([Default=NullString] optional DOMString data), Constructor(optional DOMString data = null),
ConstructorCallWith=Document, ConstructorCallWith=Document,
] interface Comment : CharacterData { ] interface Comment : CharacterData {
}; };
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
[ [
Constructor(DOMString name, [Default=NullString] optional DOMString message), Constructor(DOMString name, optional DOMString message = null),
WillBeGarbageCollected WillBeGarbageCollected
] interface DOMError { ] interface DOMError {
readonly attribute DOMString name; readonly attribute DOMString name;
......
...@@ -39,5 +39,5 @@ ...@@ -39,5 +39,5 @@
// HTMLDOMImplementation interface from DOM Level 2 HTML // HTMLDOMImplementation interface from DOM Level 2 HTML
HTMLDocument createHTMLDocument([Default=NullString] optional DOMString title); HTMLDocument createHTMLDocument(optional DOMString title = null);
}; };
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
[ [
Constructor([Default=NullString] optional DOMString data), Constructor(optional DOMString data = null),
ConstructorCallWith=Document, ConstructorCallWith=Document,
Custom=Wrap, Custom=Wrap,
] interface Text : CharacterData { ] interface Text : CharacterData {
......
...@@ -42,17 +42,17 @@ ...@@ -42,17 +42,17 @@
[CallWith=ScriptArguments&ScriptState] void trace(); [CallWith=ScriptArguments&ScriptState] void trace();
[CallWith=ScriptArguments&ScriptState, ImplementedAs=assertCondition] void assert([Default=Undefined] optional boolean condition); [CallWith=ScriptArguments&ScriptState, ImplementedAs=assertCondition] void assert([Default=Undefined] optional boolean condition);
[CallWith=ScriptArguments&ScriptState] void count(); [CallWith=ScriptArguments&ScriptState] void count();
[DeprecateAs=ConsoleMarkTimeline] void markTimeline([Default=NullString] optional DOMString title); [DeprecateAs=ConsoleMarkTimeline] void markTimeline(optional DOMString title = null);
[CallWith=ScriptState] void profile([Default=NullString] optional DOMString title); [CallWith=ScriptState] void profile(optional DOMString title = null);
[CallWith=ScriptState] void profileEnd([Default=NullString] optional DOMString title); [CallWith=ScriptState] void profileEnd(optional DOMString title = null);
void time([Default=NullString] optional DOMString title); void time(optional DOMString title = null);
[CallWith=ScriptState] void timeEnd([Default=NullString] optional DOMString title); [CallWith=ScriptState] void timeEnd(optional DOMString title = null);
void timeStamp([Default=NullString] optional DOMString title); void timeStamp(optional DOMString title = null);
[CallWith=ScriptState] void timeline([Default=NullString] optional DOMString title); [CallWith=ScriptState] void timeline(optional DOMString title = null);
[CallWith=ScriptState] void timelineEnd([Default=NullString] optional DOMString title); [CallWith=ScriptState] void timelineEnd(optional DOMString title = null);
[CallWith=ScriptArguments&ScriptState] void group(); [CallWith=ScriptArguments&ScriptState] void group();
[CallWith=ScriptArguments&ScriptState] void groupCollapsed(); [CallWith=ScriptArguments&ScriptState] void groupCollapsed();
......
...@@ -69,9 +69,9 @@ ...@@ -69,9 +69,9 @@
void alert(); void alert();
void alert(DOMString message); void alert(DOMString message);
boolean confirm([Default=NullString] optional DOMString message); boolean confirm(optional DOMString message = null);
[TreatReturnedNullStringAs=Null] DOMString prompt([Default=NullString] optional DOMString message, [TreatReturnedNullStringAs=Null] DOMString prompt(optional DOMString message = null,
[Default=NullString] optional DOMString defaultValue); optional DOMString defaultValue = null);
boolean find([Default=Undefined] optional DOMString string, boolean find([Default=Undefined] optional DOMString string,
[Default=Undefined] optional boolean caseSensitive, [Default=Undefined] optional boolean caseSensitive,
......
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
[ [
RuntimeEnabled=Media, RuntimeEnabled=Media,
NamedConstructor=Audio([Default=NullString] optional DOMString src) NamedConstructor=Audio(optional DOMString src = null)
] interface HTMLAudioElement : HTMLMediaElement { ] interface HTMLAudioElement : HTMLMediaElement {
}; };
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
] interface HTMLDialogElement : HTMLElement { ] interface HTMLDialogElement : HTMLElement {
[Reflect] attribute boolean open; [Reflect] attribute boolean open;
attribute DOMString returnValue; attribute DOMString returnValue;
[RaisesException] void close([Default=NullString] optional DOMString returnValue); [RaisesException] void close(optional DOMString returnValue = null);
void show(); void show();
[RaisesException] void showModal(); [RaisesException] void showModal();
}; };
......
...@@ -85,7 +85,7 @@ interface HTMLInputElement : HTMLElement { ...@@ -85,7 +85,7 @@ interface HTMLInputElement : HTMLElement {
[RaisesException] void setRangeText(DOMString replacement, [RaisesException] void setRangeText(DOMString replacement,
unsigned long start, unsigned long start,
unsigned long end, unsigned long end,
[Default=NullString] optional DOMString selectionMode); optional DOMString selectionMode = null);
[RaisesException, ImplementedAs=setSelectionRangeForBinding] [RaisesException, ImplementedAs=setSelectionRangeForBinding]
void setSelectionRange([Default=Undefined] optional long start, void setSelectionRange([Default=Undefined] optional long start,
......
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
*/ */
[ [
NamedConstructor=Option([Default=NullString] optional DOMString data, [Default=NullString] optional DOMString value, [Default=Undefined] optional boolean defaultSelected, [Default=Undefined] optional boolean selected), NamedConstructor=Option(optional DOMString data = null,
optional DOMString value = null,
[Default=Undefined] optional boolean defaultSelected,
[Default=Undefined] optional boolean selected),
RaisesException=Constructor RaisesException=Constructor
] interface HTMLOptionElement : HTMLElement { ] interface HTMLOptionElement : HTMLElement {
[Reflect] attribute boolean disabled; [Reflect] attribute boolean disabled;
......
...@@ -38,7 +38,7 @@ interface HTMLSelectElement : HTMLElement { ...@@ -38,7 +38,7 @@ interface HTMLSelectElement : HTMLElement {
getter Element item(unsigned long index); getter Element item(unsigned long index);
Element namedItem([Default=Undefined] optional DOMString name); Element namedItem([Default=Undefined] optional DOMString name);
// FIXME: should be union type http://crbug.com/240176 // FIXME: should be union type http://crbug.com/240176
[RaisesException, TypeChecking=Interface] void add(HTMLElement element, [Default=Null] optional HTMLElement? before); [RaisesException, TypeChecking=Interface] void add(HTMLElement element, optional HTMLElement? before = null);
[ImplementedAs=addBeforeOptionAtIndex, RaisesException, TypeChecking=Interface] void add(HTMLElement element, long before); [ImplementedAs=addBeforeOptionAtIndex, RaisesException, TypeChecking=Interface] void add(HTMLElement element, long before);
[RaisesException] void remove(); // ChildNode overload [RaisesException] void remove(); // ChildNode overload
void remove(long index); void remove(long index);
......
...@@ -56,7 +56,7 @@ interface HTMLTextAreaElement : HTMLElement { ...@@ -56,7 +56,7 @@ interface HTMLTextAreaElement : HTMLElement {
[RaisesException] void setRangeText(DOMString replacement, [RaisesException] void setRangeText(DOMString replacement,
unsigned long start, unsigned long start,
unsigned long end, unsigned long end,
[Default=NullString] optional DOMString selectionMode); optional DOMString selectionMode = null);
void setSelectionRange([Default=Undefined] optional long start, void setSelectionRange([Default=Undefined] optional long start,
[Default=Undefined] optional long end, [Default=Undefined] optional long end,
......
...@@ -48,5 +48,5 @@ ...@@ -48,5 +48,5 @@
attribute ByteString testByteString; attribute ByteString testByteString;
void setTestByteString(ByteString byteString); void setTestByteString(ByteString byteString);
[ImplementedAs=setTestByteString] void setTestByteStringDefaultNull([Default=NullString] optional ByteString byteString); [ImplementedAs=setTestByteString] void setTestByteStringDefaultNull(optional ByteString byteString = null);
}; };
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
[MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntries(); [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntries();
[MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByType(DOMString entryType); [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByType(DOMString entryType);
[MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType); [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, optional DOMString entryType = null);
[MeasureAs=PrefixedPerformanceClearResourceTimings] void webkitClearResourceTimings(); [MeasureAs=PrefixedPerformanceClearResourceTimings] void webkitClearResourceTimings();
[MeasureAs=PrefixedPerformanceSetResourceTimingBufferSize] void webkitSetResourceTimingBufferSize(unsigned long maxSize); [MeasureAs=PrefixedPerformanceSetResourceTimingBufferSize] void webkitSetResourceTimingBufferSize(unsigned long maxSize);
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
// See http://www.w3.org/TR/2012/CR-user-timing-20120726/ // See http://www.w3.org/TR/2012/CR-user-timing-20120726/
[RaisesException,MeasureAs=UnprefixedUserTiming] void mark(DOMString markName); [RaisesException,MeasureAs=UnprefixedUserTiming] void mark(DOMString markName);
[MeasureAs=UnprefixedUserTiming] void clearMarks([Default=NullString] optional DOMString markName); [MeasureAs=UnprefixedUserTiming] void clearMarks(optional DOMString markName = null);
[RaisesException,MeasureAs=UnprefixedUserTiming] void measure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark); [RaisesException,MeasureAs=UnprefixedUserTiming] void measure(DOMString measureName, optional DOMString startMark = null, optional DOMString endMark = null);
[MeasureAs=UnprefixedUserTiming] void clearMeasures([Default=NullString] optional DOMString measureName); [MeasureAs=UnprefixedUserTiming] void clearMeasures(optional DOMString measureName = null);
// See http://www.w3.org/TR/hr-time/ for details. // See http://www.w3.org/TR/hr-time/ for details.
double now(); double now();
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
[ [
ActiveDOMObject, ActiveDOMObject,
Constructor(DOMString scriptURL, [Default=NullString] optional DOMString name), Constructor(DOMString scriptURL, optional DOMString name = null),
ConstructorCallWith=ExecutionContext, ConstructorCallWith=ExecutionContext,
RaisesException=Constructor, RaisesException=Constructor,
RuntimeEnabled=SharedWorker, RuntimeEnabled=SharedWorker,
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
[ [
RuntimeEnabled=EncodingAPI, RuntimeEnabled=EncodingAPI,
Exposed=Window&Worker, Exposed=Window&Worker,
Constructor([Default=NullString] optional DOMString label, optional Dictionary options), Constructor(optional DOMString label = null, optional Dictionary options),
RaisesException=Constructor, RaisesException=Constructor,
GarbageCollected, GarbageCollected,
MeasureAs=TextDecoderConstructor MeasureAs=TextDecoderConstructor
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
[ [
RuntimeEnabled=EncodingAPI, RuntimeEnabled=EncodingAPI,
Exposed=Window&Worker, Exposed=Window&Worker,
Constructor([Default=NullString] optional DOMString utfLabel), Constructor(optional DOMString utfLabel = null),
RaisesException=Constructor, RaisesException=Constructor,
GarbageCollected, GarbageCollected,
MeasureAs=TextEncoderConstructor MeasureAs=TextEncoderConstructor
] interface TextEncoder { ] interface TextEncoder {
readonly attribute DOMString encoding; readonly attribute DOMString encoding;
[MeasureAs=TextEncoderEncode] Uint8Array encode([Default=NullString] optional DOMString input, optional Dictionary options); [MeasureAs=TextEncoderEncode] Uint8Array encode(optional DOMString input = null, optional Dictionary options);
}; };
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
partial interface HTMLMediaElement { partial interface HTMLMediaElement {
[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaGenerateKeyRequest] void webkitGenerateKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional Uint8Array initData); [RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaGenerateKeyRequest] void webkitGenerateKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional Uint8Array initData);
[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaAddKey] void webkitAddKey([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, Uint8Array key, optional Uint8Array initData, [Default=NullString] optional DOMString sessionId); [RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaAddKey] void webkitAddKey([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, Uint8Array key, optional Uint8Array initData, optional DOMString sessionId = null);
[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaCancelKeyRequest] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, [Default=NullString] optional DOMString sessionId); [RuntimeEnabled=PrefixedEncryptedMedia, RaisesException, MeasureAs=PrefixedMediaCancelKeyRequest] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional DOMString sessionId = null);
[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyadded; [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyadded;
[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyerror; [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyerror;
......
...@@ -35,5 +35,5 @@ ...@@ -35,5 +35,5 @@
[CallWith=ExecutionContext, RaisesException] MediaKeySession createSession(DOMString type, Uint8Array initData); [CallWith=ExecutionContext, RaisesException] MediaKeySession createSession(DOMString type, Uint8Array initData);
static boolean isTypeSupported(DOMString keySystem, [Default=NullString] optional DOMString contentType); static boolean isTypeSupported(DOMString keySystem, optional DOMString contentType = null);
}; };
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
[RaisesException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options); [RaisesException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options);
[RaisesException] void deleteObjectStore(DOMString name); [RaisesException] void deleteObjectStore(DOMString name);
// FIXME: should be union type http://crbug.com/240176 // FIXME: should be union type http://crbug.com/240176
[CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, [Default=NullString] optional DOMString mode); [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, optional DOMString mode = null);
[CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, [Default=NullString] optional DOMString mode); [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = null);
[CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMStringList storeNames, [Default=NullString] optional DOMString mode); [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMStringList storeNames, optional DOMString mode = null);
void close(); void close();
attribute EventHandler onabort; attribute EventHandler onabort;
attribute EventHandler onclose; attribute EventHandler onclose;
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
readonly attribute boolean unique; readonly attribute boolean unique;
readonly attribute boolean multiEntry; readonly attribute boolean multiEntry;
[CallWith=ScriptState, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); [CallWith=ScriptState, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, optional DOMString direction = null);
[CallWith=ScriptState, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); [CallWith=ScriptState, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any range, optional DOMString direction = null);
[CallWith=ScriptState, RaisesException] IDBRequest get(any key); [CallWith=ScriptState, RaisesException] IDBRequest get(any key);
[CallWith=ScriptState, RaisesException] IDBRequest getKey(any key); [CallWith=ScriptState, RaisesException] IDBRequest getKey(any key);
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
[CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); [CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key);
[CallWith=ScriptState, RaisesException] IDBRequest get(any key); [CallWith=ScriptState, RaisesException] IDBRequest get(any key);
[CallWith=ScriptState, RaisesException] IDBRequest clear(); [CallWith=ScriptState, RaisesException] IDBRequest clear();
[CallWith=ScriptState, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); [CallWith=ScriptState, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, optional DOMString direction = null);
[CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] IDBRequest openKeyCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); [CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] IDBRequest openKeyCursor([Default=Undefined] optional any range, optional DOMString direction = null);
// FIXME: should be union type http://crbug.com/240176 // FIXME: should be union type http://crbug.com/240176
[CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional Dictionary options); [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional Dictionary options);
[CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional Dictionary options); [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional Dictionary options);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
[ [
GarbageCollected, GarbageCollected,
Constructor([Default=NullString] optional DOMString text), Constructor(optional DOMString text = null),
ConstructorCallWith=ExecutionContext, ConstructorCallWith=ExecutionContext,
RuntimeEnabled=SpeechSynthesis, RuntimeEnabled=SpeechSynthesis,
] interface SpeechSynthesisUtterance : EventTarget { ] interface SpeechSynthesisUtterance : EventTarget {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment