Roll IDL to Dartium37 (r181268) This is the effect of running idlsync.py. R=terry@google.com Review URL: https://codereview.chromium.org//540533002 git-svn-id: http://dart.googlecode.com/svn/third_party/WebCore@39836 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/bindings/IDLExtendedAttributes.txt b/bindings/IDLExtendedAttributes.txt new file mode 100644 index 0000000..dafd683 --- /dev/null +++ b/bindings/IDLExtendedAttributes.txt
@@ -0,0 +1,112 @@ +# +# This file describes all Blink IDL extended attributes and allowed values. +# If any IDL file uses an extended attribute or values not listed below, the +# build will fail. +# If you would like to add a new extended attribute or value, please: +# (1) add the extended attribute or value to this file +# (2) add an explanation to the Blink IDL extended attributes document: +# http://www.chromium.org/blink/webidl/blink-idl-extended-attributes +# (3) add appropriate test cases to run-bindings-tests +# +# The syntax of this file is as follows: +# - One extended attribute per one line: Name and (optionally) Values. +# - "Attr" means that the Attr does not take a value, i.e. [Attr]. +# - "Attr=X" means that Attr takes a required value, which must be X; +# i.e. [Attr=X]. +# - "Attr=X|Y|Z" means that Attr takes a required value, and the valid +# values are X, Y, and Z, and combinations thereof; +# e.g. [Attr=X], [Attr=Y], [Attr=X|Z]. +# The separator must be | or &, so [Attr=X&Z] is also valid; the +# separator makes a difference for Conditional, but otherwise is simply +# a style convention. +# - "Attr=|X|Y|Z" means that Attr takes an optional value, whose valid +# values (if present) are X, Y, and Z, and combinations thereof; e.g. +# [Attr], [Attr=X], [Attr=Y], [Attr=X|Z], [Attr=X|Y|Z], [Attr=X&Z]. +# Note that including an empty value in the list, as in [Attr=X||Y], +# is NOT valid: the value is optional, but empty values are not allowed. +# - "Attr=*" means that Attr takes a required value, which can be +# arbitrary, and combinations thereof, e.g. [Attr=IndexedDB], +# [Attr=DeleteFunction], [Attr=X|Y]. +# - "Attr=|*" means that Attr takes an optional value, which can be +# arbitrary, e.g. [Attr], [Attr=X]. +# - "Attr=X|*" means that Attr takes an required value, which can be +# arbitrary, but that "X" is standard, e.g. [Attr=X], [Attr=Foo]. +# + +ActiveDOMObject +CachedAttribute=* +CallWith=ExecutionContext|ScriptState|ScriptArguments|ActiveWindow|FirstWindow|ThisValue +CheckSecurity=Frame|Node +Clamp +Conditional=* +Constructor +# FIXME: remove [ConstructorCallWith=Document], as can instead use +# [ConstructorCallWith=ExecutionContext] + toDocument(executionContext) +ConstructorCallWith=ExecutionContext|Document +Custom=|Getter|Setter|LegacyCallAsFunction|ToV8|VisitDOMWrapper|Wrap|PropertyGetter|PropertyEnumerator|PropertyQuery +CustomConstructor +CustomElementCallbacks +# Dartium specific attributes. +# DartCustom can have no value or New if New an additional method is added (V8 will not see this method) +DartCustom=|New|Setter|Getter +# DartName should have the alias name to be used to resolve. +DartName=* +# DartSuppress can have no value will suppress attribute/method, if attribute can also suppress +# just the DartSuppress=getter or DartSuppress=Setter +DartSuppress=|Getter|Setter +# No need to setup Dart API scope when a native function is invoked. +DartNoAutoScope +# End of Dartium attributes. +Default=Undefined +DependentLifetime +DeprecateAs=* +DoNotCheckConstants +DoNotCheckSecurity=|Setter +DoNotCheckSignature +EnforceRange +EventConstructor +ExposeJSAccessors +Exposed=* +GarbageCollected +Global=|* +Immutable +ImplementedAs=* +InitializedByEventConstructor +LegacyTreatAsPartialInterface +LogActivity=|GetterOnly|SetterOnly +LogAllWorlds +LogPreviousValue +MeasureAs=* +NamedConstructor=* +NoInterfaceObject +NotEnumerable +OverrideBuiltins +PartialInterfaceImplementedAs=* +# Valid values for [PerContextEnabled] are Context Features, in +# ContextFeatures::FeatureType in Source/core/dom/ContextFeatures.h +PerContextEnabled=* +PerWorldBindings +PrimaryGlobal=|* +PutForwards=* +RaisesException=|Getter|Setter|Constructor +ReadOnly +Reflect=|* +ReflectEmpty=* +ReflectInvalid=* +ReflectMissing=* +ReflectOnly=* +Replaceable +# Valid values for [RuntimeEnabled] are the Runtime Enabled Features, listed in +# Source/core/page/RuntimeEnabledFeatures.in +RuntimeEnabled=* +SetWrapperReferenceFrom=* +SetWrapperReferenceTo=* +SetterCallWith=ExecutionContext|ScriptArguments|ActiveWindow|FirstWindow +SpecialWrapFor=* +TreatNullAs=NullString +TreatReturnedNullStringAs=Null|Undefined +TreatUndefinedAs=NullString +TypeChecking=Interface|Nullable|Unrestricted +URL +Unforgeable +WillBeGarbageCollected
diff --git a/bindings/PRESUBMIT.py b/bindings/PRESUBMIT.py new file mode 100644 index 0000000..605322d --- /dev/null +++ b/bindings/PRESUBMIT.py
@@ -0,0 +1,74 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Blink bindings presubmit script + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into gcl. +""" + +# Changes to v8/ do not change generated code or tests, so exclude from +# _RunBindingsTests +BLACK_LIST = (r'.*\bv8[\\\/].*',) + +def _RunBindingsTests(input_api, output_api): + # Skip if nothing to do + source_filter = lambda x: input_api.FilterSourceFile( + x, black_list=input_api.DEFAULT_BLACK_LIST + BLACK_LIST) + if not input_api.AffectedFiles(file_filter=source_filter): + return [] + + if input_api.is_committing: + message_type = output_api.PresubmitError + else: + message_type = output_api.PresubmitPromptWarning + + pardir = input_api.os_path.pardir + run_bindings_tests_path = input_api.os_path.join(input_api.PresubmitLocalPath(), pardir, pardir, 'Tools', 'Scripts', 'run-bindings-tests') + cmd_name = 'run-bindings-tests' + if input_api.platform == 'win32': + # Windows needs some help. + cmd = [input_api.python_executable, run_bindings_tests_path] + else: + cmd = [run_bindings_tests_path] + test_cmd = input_api.Command( + name=cmd_name, + cmd=cmd, + kwargs={}, + message=message_type) + if input_api.verbose: + print('Running ' + cmd_name) + return input_api.RunTests([test_cmd]) + + +def CheckChangeOnUpload(input_api, output_api): + return _RunBindingsTests(input_api, output_api) + + +def CheckChangeOnCommit(input_api, output_api): + return _RunBindingsTests(input_api, output_api)
diff --git a/bindings/README b/bindings/README new file mode 100644 index 0000000..bf749b3 --- /dev/null +++ b/bindings/README
@@ -0,0 +1,9 @@ +This directory contains a copy of WebKit/WebCore IDL files. +See the attached LICENSE-* files in this directory. + +Please do not modify the files here. They are periodically copied +using the script: $DART_ROOT/sdk/lib/html/scripts/idlsync.py + +The current version corresponds to: +URL: http://src.chromium.org/blink/branches/dart/dartium +Current revision: 181268
diff --git a/bindings/__init__.py b/bindings/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bindings/__init__.py
diff --git a/bindings/dart/gyp/scripts/build_dart_snapshot.py b/bindings/dart/gyp/scripts/build_dart_snapshot.py new file mode 100755 index 0000000..323f38a --- /dev/null +++ b/bindings/dart/gyp/scripts/build_dart_snapshot.py
@@ -0,0 +1,116 @@ +#!/usr/bin/python +# +# Copyright (C) 2011 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# build_dart_snapshot.py generates two C++ files: DartSnapshot.cpp +# with a constant which is a snapshot of major DOM libs an +# DartResolver.cpp which is a resolver for dart:html library. + +import os.path +import subprocess +import sys + + +def main(args): + assert(len(args) >= 4) + dartPath = args[1] + dartSnapshotTemplateFile = args[2] + outputFilePath = args[3] + genSnapshotBinPath = args[4] + snapshottedLibPaths = args[5:] + + def path(*components): + return os.path.abspath(os.path.join(*components)) + + def dartName(path): + # Translates <dirs>/foo_dartium.dart into foo. + return (os.path.splitext(os.path.split(path)[1])[0] + .replace('_dartium', '')) + + snapshottedLibs = [(dartName(p), path(p)) + for p in snapshottedLibPaths] + + # Generate a Dart script to build the snapshot from. + snapshotScriptName = os.path.join(outputFilePath, 'snapshotScript.dart') + with file(snapshotScriptName, 'w') as snapshotScript: + snapshotScript.write('library snapshot;\n') + for name, _ in snapshottedLibs: + # Skip internal libraries - they should be indirectly imported via the public ones. + if not name.startswith('_'): + snapshotScript.write('import \'dart:%(name)s\' as %(name)s;\n' % {'name': name}) + + binarySnapshotFile = path(outputFilePath, 'DartSnapshot.bin') + + # Build a command to generate the snapshot bin file. + command = [ + 'python', + path(dartPath, 'runtime', 'tools', 'create_snapshot_bin.py'), + '--executable=%s' % path(genSnapshotBinPath), + '--output_bin=%s' % binarySnapshotFile, + '--script=%s' % snapshotScriptName, + ] + command.extend(['--url_mapping=dart:%s,%s' % lib for lib in snapshottedLibs]) + + pipe = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out, error = pipe.communicate() + if (pipe.returncode != 0): + raise Exception('Snapshot bin generation failed: %s/%s' % (out, error)) + + # Build a command to generate the snapshot file. + command = [ + 'python', + path(dartPath, 'runtime', 'tools', 'create_snapshot_file.py'), + '--input_cc=%s' % dartSnapshotTemplateFile, + '--input_bin=%s' % binarySnapshotFile, + '--output=%s' % path(outputFilePath, 'DartSnapshot.bytes'), + ] + + pipe = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out, error = pipe.communicate() + if (pipe.returncode != 0): + raise Exception('Snapshot file generation failed: %s/%s' % (out, error)) + + snapshotSizeInBytes = os.path.getsize(binarySnapshotFile) + productDir = os.path.dirname(genSnapshotBinPath) + snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt') + with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile: + snapshotSizeFile.write('%d\n' % snapshotSizeInBytes) + + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/create_resources.py b/bindings/dart/gyp/scripts/create_resources.py new file mode 100644 index 0000000..3b6b992 --- /dev/null +++ b/bindings/dart/gyp/scripts/create_resources.py
@@ -0,0 +1,116 @@ +# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. +# +# This python script creates string literals in a C++ source file from a C++ +# source template and one or more resource files. + +import os +import sys +from os.path import join +import time +from optparse import OptionParser +import re +from datetime import date + + +def makeResources(root_dir, input_files): + result = '' + resources = [] + + # Write each file's contents as a byte string constant. + for resource_file in input_files: + if root_dir and resource_file.startswith(root_dir): + resource_file_name = resource_file[len(root_dir):] + else: + resource_file_name = resource_file + resource_url = '/%s' % resource_file_name + result += '// %s\n' % resource_file + result += 'const char ' + resource_name = re.sub(r'(/|\.|-)', '_', resource_file_name) + '_' + result += resource_name + result += '[] = {\n ' + fileHandle = open(resource_file, 'rb') + lineCounter = 0 + for byte in fileHandle.read(): + result += r" '\x%02x'," % ord(byte) + lineCounter += 1 + if lineCounter == 10: + result += '\n ' + lineCounter = 0 + if lineCounter != 0: + result += '\n ' + result += ' 0\n};\n\n' + resources.append( + (resource_url, resource_name, os.stat(resource_file).st_size)) + + # Write the resource table. + result += 'Resources::resource_map_entry Resources::builtin_resources_[] = ' + result += '{\n' + for res in resources: + result += ' { "%s", %s, %d },\n' % res + result += '};\n\n' + result += 'const intptr_t Resources::builtin_resources_count_ ' + result += '= %d;\n' % len(resources) + return result + + +def makeFile(output_file, root_dir, input_files): + cc_text = ''' +// Copyright (c) %d, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +''' % date.today().year + cc_text += '#if defined(new)\n' + cc_text += '#undef new\n' + cc_text += '#endif\n\n' + cc_text += '#if defined(delete)\n' + cc_text += '#undef delete\n' + cc_text += '#endif\n\n' + cc_text += '#ifndef NDEBUG\n' + cc_text += '#define DEBUG\n' + cc_text += '#endif\n' + cc_text += '#include "bin/resources.h"\n\n' + cc_text += 'namespace dart {\n' + cc_text += 'namespace bin {\n' + cc_text += makeResources(root_dir, input_files) + cc_text += '} // namespace bin\n} // namespace dart\n' + open(output_file, 'w').write(cc_text) + return True + + +def main(args): + try: + # Parse input. + parser = OptionParser() + parser.add_option("--output", + action="store", type="string", + help="output file name") + parser.add_option("--root_prefix", + action="store", type="string", + help="root directory for resources") + (options, args) = parser.parse_args() + if not options.output: + sys.stderr.write('--output not specified\n') + return -1 + if len(args) == 0: + sys.stderr.write('No input files specified\n') + return -1 + + files = [] + for arg in args: + files.append(arg) + + if not makeFile(options.output, options.root_prefix, files): + return -1 + + return 0 + except Exception, inst: + sys.stderr.write('create_resources.py exception\n') + sys.stderr.write(str(inst)) + sys.stderr.write('\n') + return -1 + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py b/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py new file mode 100644 index 0000000..969ffa6 --- /dev/null +++ b/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py
@@ -0,0 +1,77 @@ +#!/usr/bin/python +# +# Copyright (C) 2011 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# dart_action_derivedsourceslist.py generates a single or several cpp files +# that include all Dart bindings cpp files generated from idls. +# +# usage: dart_action_derivedsourceslist.py IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ... +# +# Note that IDL_FILES_LIST is a text file containing the IDL file paths. + +import os.path +import re +import sys + +v8scriptPath = os.path.join(sys.path[0], '../../../../WebCore.gyp/scripts') +sys.path.append(v8scriptPath) + +# FIXME: there are couple of very ugly hacks like duplication of main code and +# regexp to rewrite V8 prefix to Dart. It all can be easily solved with minimal +# modifications to action_derivedsourcesallinone.py. +import action_derivedsourcesallinone as base + + +def main(args): + assert(len(args) > 3) + inOutBreakIndex = args.index('--') + inputFileName = args[1] + outputFileNames = args[inOutBreakIndex + 1:] + + inputFile = open(inputFileName, 'r') + idlFileNames = inputFile.read().split('\n') + inputFile.close() + + filesMetaData = base.extractMetaData(idlFileNames) + for fileName in outputFileNames: + partition = outputFileNames.index(fileName) + fileContents = base.generateContent(filesMetaData, partition, len(outputFileNames)) + # FIXME: ugly hack---change V8 prefix to Dart. + fileContents = re.sub('\n#include "bindings/V8', '\n#include "bindings/Dart', fileContents) + base.writeContent(fileContents, fileName) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/dart_html_lib_deps.py b/bindings/dart/gyp/scripts/dart_html_lib_deps.py new file mode 100644 index 0000000..ff534f0 --- /dev/null +++ b/bindings/dart/gyp/scripts/dart_html_lib_deps.py
@@ -0,0 +1,65 @@ +#!/usr/bin/python +# +# Copyright (C) 2012 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import fnmatch +import os +import sys + + +def printAllFilesRecursively(directory, pattern): + def matches(basename): return fnmatch.fnmatch(basename, pattern) + for root, _, files in os.walk(directory): + for basename in filter(matches, files): + # gyp operates correctly only on /, not Windows \. + print os.path.join(root, basename).replace(os.sep, '/') + + + +def main(args): + dart_html_lib_dir = args[1] + + deps = [ + ('idl', '*.idl'), + ('scripts', '*.py'), + ('src', '*.dart'), + ('templates', '*.*template'), + ] + + for directory, pattern in deps: + printAllFilesRecursively(os.path.join(dart_html_lib_dir, directory), pattern) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/generate_dart_bindings.py b/bindings/dart/gyp/scripts/generate_dart_bindings.py new file mode 100755 index 0000000..a57881d --- /dev/null +++ b/bindings/dart/gyp/scripts/generate_dart_bindings.py
@@ -0,0 +1,75 @@ +#!/usr/bin/python +# +# Copyright (C) 2012 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import glob +import os.path +import sys +import tempfile + +def main(args): + assert(len(args) == 6) + idlListFileName = args[1] + dartiumScriptDir = args[2] + dartScriptDir = args[3] + outputFilePath = args[4] + featureDefines = args[5] + + # Clear out any stale dart/lib/html/scripts/.pyc files that are lurking. + for f in glob.glob(os.path.join(dartScriptDir, '*.pyc')): + os.remove(f) + + baseDir = os.path.dirname(dartiumScriptDir) + idlListFile = open(idlListFileName, 'r') + idlFiles = [os.path.join(baseDir, fileName.strip()) for fileName in idlListFile] + idlListFile.close() + + def analyse(featureDef): + featureDef = featureDef.strip('"') + if '=' not in featureDef: return None + feature, status = featureDef.split('=') + if status == '1': + return feature + return None + + featureDefines = filter(None, map(analyse, featureDefines.split())) + + sys.path.insert(0, dartScriptDir) + import fremontcutbuilder + import dartdomgenerator + + database = fremontcutbuilder.build_database(idlFiles, tempfile.mkdtemp(), feature_defines=featureDefines) + database.Load() + dartdomgenerator.GenerateFromDatabase(database, None, outputFilePath) + database.Delete() + + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/scripts/__init__.py b/bindings/dart/scripts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bindings/dart/scripts/__init__.py
diff --git a/bindings/dart/scripts/code_generator_dart.py b/bindings/dart/scripts/code_generator_dart.py new file mode 100644 index 0000000..93a5f8d --- /dev/null +++ b/bindings/dart/scripts/code_generator_dart.py
@@ -0,0 +1,320 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate Blink C++ bindings (.h and .cpp files) for use by Dart:HTML. + +If run itself, caches Jinja templates (and creates dummy file for build, +since cache filenames are unpredictable and opaque). + +This module is *not* concurrency-safe without care: bytecode caching creates +a race condition on cache *write* (crashes if one process tries to read a +partially-written cache). However, if you pre-cache the templates (by running +the module itself), then you can parallelize compiling individual files, since +cache *reading* is safe. + +Input: An object of class IdlDefinitions, containing an IDL interface X +Output: DartX.h and DartX.cpp + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import os +import cPickle as pickle +import re +import sys + + +# Path handling for libraries and templates +# Paths have to be normalized because Jinja uses the exact template path to +# determine the hash used in the cache filename, and we need a pre-caching step +# to be concurrency-safe. Use absolute path because __file__ is absolute if +# module is imported, and relative if executed directly. +# If paths differ between pre-caching and individual file compilation, the cache +# is regenerated, which causes a race condition and breaks concurrent build, +# since some compile processes will try to read the partially written cache. +module_path, module_filename = os.path.split(os.path.realpath(__file__)) +third_party_dir = os.path.normpath(os.path.join( + module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)) +templates_dir = os.path.normpath(os.path.join(module_path, 'templates')) + +# Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching +module_pyname = os.path.splitext(module_filename)[0] + '.py' + +# jinja2 is in chromium's third_party directory. +# Insert at 1 so at front to override system libraries, and +# after path[0] == invoking script dir +sys.path.insert(1, third_party_dir) + +# Add the base compiler scripts to the path here as in compiler.py +dart_script_path = os.path.dirname(os.path.abspath(__file__)) +script_path = os.path.join(os.path.dirname(os.path.dirname(dart_script_path)), + 'scripts') +sys.path.extend([script_path]) + +import jinja2 + +import idl_types +from idl_types import IdlType +import dart_callback_interface +import dart_interface +import dart_types +from dart_utilities import DartUtilities +from utilities import write_pickle_file +from v8_globals import includes, interfaces + +# TODO(jacobr): remove this hacked together list. +INTERFACES_WITHOUT_RESOLVERS = frozenset([ + 'TypeConversions', + 'GCObservation', + 'InternalProfilers', + 'InternalRuntimeFlags', + 'InternalSettings', + 'InternalSettingsGenerated', + 'Internals', + 'LayerRect', + 'LayerRectList', + 'MallocStatistics', + 'TypeConversions']) + +class CodeGeneratorDart(object): + def __init__(self, interfaces_info, cache_dir): + interfaces_info = interfaces_info or {} + self.interfaces_info = interfaces_info + self.jinja_env = initialize_jinja_env(cache_dir) + + # Set global type info + idl_types.set_ancestors(dict( + (interface_name, interface_info['ancestors']) + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['ancestors'])) + IdlType.set_callback_interfaces(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['is_callback_interface'])) + IdlType.set_implemented_as_interfaces(dict( + (interface_name, interface_info['implemented_as']) + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['implemented_as'])) + IdlType.set_garbage_collected_types(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if 'GarbageCollected' in interface_info['inherited_extended_attributes'])) + IdlType.set_will_be_garbage_collected_types(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes'])) + + def generate_code(self, definitions, interface_name, idl_pickle_filename, + only_if_changed): + """Returns .h/.cpp code as (header_text, cpp_text).""" + try: + interface = definitions.interfaces[interface_name] + except KeyError: + raise Exception('%s not in IDL definitions' % interface_name) + + # Store other interfaces for introspection + interfaces.update(definitions.interfaces) + + # Set local type info + IdlType.set_callback_functions(definitions.callback_functions.keys()) + IdlType.set_enums((enum.name, enum.values) + for enum in definitions.enumerations.values()) + + # Select appropriate Jinja template and contents function + if interface.is_callback: + header_template_filename = 'callback_interface_h.template' + cpp_template_filename = 'callback_interface_cpp.template' + generate_contents = dart_callback_interface.generate_callback_interface + else: + header_template_filename = 'interface_h.template' + cpp_template_filename = 'interface_cpp.template' + generate_contents = dart_interface.generate_interface + header_template = self.jinja_env.get_template(header_template_filename) + cpp_template = self.jinja_env.get_template(cpp_template_filename) + + # Generate contents (input parameters for Jinja) + template_contents = generate_contents(interface) + template_contents['code_generator'] = module_pyname + + # Add includes for interface itself and any dependencies + interface_info = self.interfaces_info[interface_name] + template_contents['header_includes'].add(interface_info['include_path']) + template_contents['header_includes'] = sorted(template_contents['header_includes']) + includes.update(interface_info.get('dependencies_include_paths', [])) + + # Remove includes that are not needed for Dart and trigger fatal + # compile warnings if included. These IDL files need to be + # imported by Dart to generate the list of events but the + # associated header files do not contain any code used by Dart. + includes.discard('core/dom/GlobalEventHandlers.h') + includes.discard('core/frame/DOMWindowEventHandlers.h') + + template_contents['cpp_includes'] = sorted(includes) + + idl_world = {'interface': None, 'callback': None} + + # Load the pickle file for this IDL. + if os.path.isfile(idl_pickle_filename): + with open(idl_pickle_filename) as idl_pickle_file: + idl_global_data = pickle.load(idl_pickle_file) + idl_pickle_file.close() + idl_world['interface'] = idl_global_data['interface'] + idl_world['callback'] = idl_global_data['callback'] + + if 'interface_name' in template_contents: + interface_global = {'name': template_contents['interface_name'], + 'parent_interface': template_contents['parent_interface'], + 'is_active_dom_object': template_contents['is_active_dom_object'], + 'is_event_target': template_contents['is_event_target'], + 'has_resolver': template_contents['interface_name'] not in INTERFACES_WITHOUT_RESOLVERS, + 'is_node': template_contents['is_node'], + 'conditional_string': template_contents['conditional_string'], + } + idl_world['interface'] = interface_global + else: + callback_global = {'name': template_contents['cpp_class']} + idl_world['callback'] = callback_global + + write_pickle_file(idl_pickle_filename, idl_world, only_if_changed) + + # Render Jinja templates + header_text = header_template.render(template_contents) + cpp_text = cpp_template.render(template_contents) + return header_text, cpp_text + + # Generates global file for all interfaces. + def generate_globals(self, global_pickle_directories, output_directory): + header_template_filename = 'global_h.template' + cpp_template_filename = 'global_cpp.template' + + # Delete the global pickle file we'll rebuild from each pickle generated + # for each IDL file '(%s_globals.pickle) % interface_name'. + global_pickle_filename = os.path.join(output_directory, 'global.pickle') + if os.path.isfile(global_pickle_filename): + os.remove(global_pickle_filename) + + # List of all interfaces and callbacks for global code generation. + world = {'interfaces': [], 'callbacks': []} + + # Load all pickled data for each interface. + for pickle_directory in global_pickle_directories: + listing = os.listdir(pickle_directory) + for filename in listing: + if filename.endswith('_globals.pickle'): + idl_filename = os.path.join(pickle_directory, filename) + with open(idl_filename) as idl_pickle_file: + idl_world = pickle.load(idl_pickle_file) + if 'interface' in idl_world: + # FIXME: Why are some of these None? + if idl_world['interface']: + world['interfaces'].append(idl_world['interface']) + if 'callbacks' in idl_world: + # FIXME: Why are some of these None? + if idl_world['callbacks']: + world['callbacks'].append(idl_world['callback']) + idl_pickle_file.close() + + world['interfaces'] = sorted(world['interfaces'], key=lambda (x): x['name']) + world['callbacks'] = sorted(world['callbacks'], key=lambda (x): x['name']) + + template_contents = world + template_contents['code_generator'] = module_pyname + + header_template = self.jinja_env.get_template(header_template_filename) + header_text = header_template.render(template_contents) + + cpp_template = self.jinja_env.get_template(cpp_template_filename) + cpp_text = cpp_template.render(template_contents) + return header_text, cpp_text + + +def initialize_jinja_env(cache_dir): + jinja_env = jinja2.Environment( + loader=jinja2.FileSystemLoader(templates_dir), + # Bytecode cache is not concurrency-safe unless pre-cached: + # if pre-cached this is read-only, but writing creates a race condition. + # bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), + keep_trailing_newline=True, # newline-terminate generated files + lstrip_blocks=True, # so can indent control flow tags + trim_blocks=True) + jinja_env.filters.update({ + 'blink_capitalize': DartUtilities.capitalize, + 'conditional': conditional_if_endif, + 'runtime_enabled': runtime_enabled_if, + }) + return jinja_env + + +# [Conditional] +def conditional_if_endif(code, conditional_string): + # Jinja2 filter to generate if/endif directive blocks + if not conditional_string: + return code + return ('#if %s\n' % conditional_string + + code + + '#endif // %s\n' % conditional_string) + + +# [RuntimeEnabled] +def runtime_enabled_if(code, runtime_enabled_function_name): + if not runtime_enabled_function_name: + return code + # Indent if statement to level of original code + indent = re.match(' *', code).group(0) + return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + + ' %s' % code) + + +################################################################################ + +def main(argv): + # If file itself executed, cache templates + try: + cache_dir = argv[1] + dummy_filename = argv[2] + except IndexError as err: + print 'Usage: %s OUTPUT_DIR DUMMY_FILENAME' % argv[0] + return 1 + + # Cache templates + jinja_env = initialize_jinja_env(cache_dir) + template_filenames = [filename for filename in os.listdir(templates_dir) + # Skip .svn, directories, etc. + if filename.endswith(('.cpp', '.h', '.template'))] + for template_filename in template_filenames: + jinja_env.get_template(template_filename) + + # Create a dummy file as output for the build system, + # since filenames of individual cache files are unpredictable and opaque + # (they are hashes of the template path, which varies based on environment) + with open(dummy_filename, 'w') as dummy_file: + pass # |open| creates or touches the file + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/dart/scripts/compiler.py b/bindings/dart/scripts/compiler.py new file mode 100755 index 0000000..1f12119 --- /dev/null +++ b/bindings/dart/scripts/compiler.py
@@ -0,0 +1,122 @@ +#!/usr/bin/python +# Copyright (C) 2014 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Compile an .idl file to Dart bindings (.h and .cpp files). + +Design doc: ?????? +""" + +from optparse import OptionParser +import os +import sys + +dart_script_path = os.path.dirname(os.path.abspath(__file__)) +script_path = os.path.join(os.path.dirname(os.path.dirname(dart_script_path)), + 'scripts') +sys.path.extend([script_path]) + +from dart_compiler import IdlCompiler +from code_generator_dart import CodeGeneratorDart + + +def parse_options(): + parser = OptionParser() + parser.add_option('--output-directory') + parser.add_option('--interfaces-info-file') + parser.add_option('--write-file-only-if-changed', type='int', default='1') + parser.add_option('--generate-global', type='int') + parser.add_option("-p", "--global-pickle-directories", + action="store", + type='string', + dest="global_pickle_directories", + nargs=2, + help="Directories to load _globals.pickle files (max 2)") + + # ensure output comes last, so command line easy to parse via regexes + parser.disable_interspersed_args() + + options, args = parser.parse_args() + if options.output_directory is None: + parser.error('Must specify output directory using --output-directory.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + options.generate_global = bool(options.generate_global) + if len(args) != 1: + # parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args)) + return options, None + idl_filename = os.path.realpath(args[0]) + return options, idl_filename + + +def idl_filename_to_interface_name(idl_filename): + basename = os.path.basename(idl_filename) + interface_name, _ = os.path.splitext(basename) + return interface_name + + +class IdlCompilerDart(IdlCompiler): + def __init__(self, *args, **kwargs): + IdlCompiler.__init__(self, *args, **kwargs) + + interfaces_info = self.interfaces_info + self.output_directory = self.output_directory + + self.code_generator = CodeGeneratorDart(interfaces_info, self.output_directory) + + def compile_file(self, idl_filename): + interface_name = idl_filename_to_interface_name(idl_filename) + header_filename = os.path.join(self.output_directory, + 'Dart%s.h' % interface_name) + cpp_filename = os.path.join(self.output_directory, + 'Dart%s.cpp' % interface_name) + self.compile_and_write(idl_filename, (header_filename, cpp_filename)) + + def generate_global(self, global_pickle_directories): + global_header_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.h') + global_cpp_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.cpp') + self.generate_global_and_write(global_pickle_directories, + (global_header_filename, global_cpp_filename)) + + +def main(): + options, idl_filename = parse_options() + + if options.generate_global: + idl_compiler = IdlCompilerDart(options.output_directory, + interfaces_info_filename=options.interfaces_info_file, + only_if_changed=options.write_file_only_if_changed) + idl_compiler.generate_global(options.global_pickle_directories) + else: + idl_compiler = IdlCompilerDart(options.output_directory, + interfaces_info_filename=options.interfaces_info_file, + only_if_changed=options.write_file_only_if_changed) + idl_compiler.compile_file(idl_filename) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/dart/scripts/dart_attributes.py b/bindings/dart/scripts/dart_attributes.py new file mode 100644 index 0000000..6e295ca --- /dev/null +++ b/bindings/dart/scripts/dart_attributes.py
@@ -0,0 +1,459 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for attributes. + +Extends IdlType with property |constructor_type_name|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import idl_types +from idl_types import inherits_interface +from dart_interface import suppress_getter, suppress_setter +import dart_types +from dart_utilities import DartUtilities +from v8_globals import includes, interfaces + + +def generate_attribute(interface, attribute): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + + idl_type.add_includes_for_type() + + # [CheckSecurity] + is_check_security_for_node = 'CheckSecurity' in extended_attributes + if is_check_security_for_node: + includes.add('bindings/common/BindingSecurity.h') + # [Custom] + has_custom_getter = (('Custom' in extended_attributes and + extended_attributes['Custom'] in [None, 'Getter']) or + ('DartCustom' in extended_attributes and + extended_attributes['DartCustom'] in [None, 'Getter', 'New'])) + has_custom_setter = (not attribute.is_read_only and + (('Custom' in extended_attributes and + extended_attributes['Custom'] in [None, 'Setter']) or + ('DartCustom' in extended_attributes and + extended_attributes['DartCustom'] in [None, 'Setter', 'New']))) + + is_call_with_script_state = DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState') + + # [CustomElementCallbacks], [Reflect] + is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes + is_reflect = 'Reflect' in extended_attributes + if is_custom_element_callbacks or is_reflect: + includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + # [RaisesException], [RaisesException=Setter] + is_setter_raises_exception = ( + 'RaisesException' in extended_attributes and + extended_attributes['RaisesException'] in [None, 'Setter']) + # [StrictTypeChecking] + has_strict_type_checking = ( + ('StrictTypeChecking' in extended_attributes or + 'StrictTypeChecking' in interface.extended_attributes) and + idl_type.is_wrapper_type) + + if (base_idl_type == 'EventHandler' and + interface.name in ['Window', 'WorkerGlobalScope'] and + attribute.name == 'onerror'): + includes.add('bindings/v8/V8ErrorHandler.h') + + is_auto_scope = not 'DartNoAutoScope' in extended_attributes + contents = { + 'access_control_list': access_control_list(attribute), + 'activity_logging_world_list_for_getter': DartUtilities.activity_logging_world_list(attribute, 'Getter'), # [ActivityLogging] + 'activity_logging_world_list_for_setter': DartUtilities.activity_logging_world_list(attribute, 'Setter'), # [ActivityLogging] + 'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'), + 'conditional_string': DartUtilities.conditional_string(attribute), + 'constructor_type': idl_type.constructor_type_name + if is_constructor_attribute(attribute) else None, + 'cpp_name': DartUtilities.cpp_name(attribute), + 'cpp_type': idl_type.cpp_type, + 'deprecate_as': DartUtilities.deprecate_as(attribute), # [DeprecateAs] + 'enum_validation_expression': idl_type.enum_validation_expression, + 'has_custom_getter': has_custom_getter, + 'has_custom_setter': has_custom_setter, + 'has_strict_type_checking': has_strict_type_checking, + 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::ConversionContext::setConversionType + 'is_auto_scope': is_auto_scope, + 'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope), + 'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'), + 'is_call_with_script_state': is_call_with_script_state, + 'is_check_security_for_node': is_check_security_for_node, + 'is_custom_element_callbacks': is_custom_element_callbacks, + 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, + 'is_getter_raises_exception': ( # [RaisesException] + 'RaisesException' in extended_attributes and + extended_attributes['RaisesException'] in [None, 'Getter']), + 'is_partial_interface_member': 'PartialInterfaceImplementedAs' in extended_attributes, + 'is_initialized_by_event_constructor': + 'InitializedByEventConstructor' in extended_attributes, + 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), + 'is_nullable': attribute.idl_type.is_nullable, + 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, + 'is_read_only': attribute.is_read_only, + 'is_reflect': is_reflect, + 'is_replaceable': 'Replaceable' in attribute.extended_attributes, + 'is_setter_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'SetterCallWith', 'ExecutionContext'), + 'is_setter_raises_exception': is_setter_raises_exception, + 'has_setter_exception_state': ( + is_setter_raises_exception or has_strict_type_checking or + idl_type.is_integer_type), + 'is_static': attribute.is_static, + 'is_url': 'URL' in extended_attributes, + 'is_unforgeable': 'Unforgeable' in extended_attributes, + 'measure_as': DartUtilities.measure_as(attribute), # [MeasureAs] + 'name': attribute.name, + 'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(attribute), # [PerContextEnabled] + 'property_attributes': property_attributes(attribute), + 'put_forwards': 'PutForwards' in extended_attributes, + 'ref_ptr': 'RefPtrWillBeRawPtr' if idl_type.is_will_be_garbage_collected else 'RefPtr', + 'reflect_empty': extended_attributes.get('ReflectEmpty'), + 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), + 'reflect_missing': extended_attributes.get('ReflectMissing'), + 'reflect_only': extended_attributes['ReflectOnly'].split('|') + if 'ReflectOnly' in extended_attributes else None, + 'setter_callback': setter_callback_name(interface, attribute), + 'v8_type': dart_types.v8_type(base_idl_type), + 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] + 'world_suffixes': ['', 'ForMainWorld'] + if 'PerWorldBindings' in extended_attributes + else [''], # [PerWorldBindings] + } + + if is_constructor_attribute(attribute): + generate_constructor_getter(interface, attribute, contents) + return contents + if not has_custom_getter: + generate_getter(interface, attribute, contents) + # FIXME: We did not previously support the PutForwards attribute, so I am + # disabling it here for now to get things compiling. + # We may wish to revisit this. + # if ((not attribute.is_read_only or 'PutForwards' in extended_attributes)): + if (not attribute.is_read_only): + generate_setter(interface, attribute, contents) + + return contents + + +################################################################################ +# Getter +################################################################################ + +def generate_getter(interface, attribute, contents): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + name = attribute.name + + cpp_value = getter_expression(interface, attribute, contents) + # Normally we can inline the function call into the return statement to + # avoid the overhead of using a Ref<> temporary, but for some cases + # (nullable types, EventHandler, [CachedAttribute], or if there are + # exceptions), we need to use a local variable. + # FIXME: check if compilers are smart enough to inline this, and if so, + # always use a local variable (for readability and CG simplicity). + release = False + if (idl_type.is_nullable or + base_idl_type == 'EventHandler' or + 'CachedAttribute' in extended_attributes or + 'ReflectOnly' in extended_attributes or + contents['is_getter_raises_exception']): + contents['cpp_value_original'] = cpp_value + cpp_value = 'result' + # EventHandler has special handling + if base_idl_type != 'EventHandler' and idl_type.is_interface_type: + release = True + + dart_set_return_value = \ + idl_type.dart_set_return_value(cpp_value, + extended_attributes=extended_attributes, + script_wrappable='impl', + release=release, + for_main_world=False, + auto_scope=contents['is_auto_scope']) + + # TODO(terry): Should be able to eliminate suppress_getter as we move from + # IGNORE_MEMBERS to DartSuppress in the IDL. + suppress = (suppress_getter(interface.name, attribute.name) or + DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Getter')) + + contents.update({ + 'cpp_value': cpp_value, + 'dart_set_return_value': dart_set_return_value, + 'is_getter_suppressed': suppress, + }) + + +def getter_expression(interface, attribute, contents): + arguments = [] + idl_type = attribute.idl_type + this_getter_base_name = getter_base_name(interface, attribute, arguments) + getter_name = DartUtilities.scoped_name(interface, attribute, this_getter_base_name) + + arguments.extend(DartUtilities.call_with_arguments(attribute)) + if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and + not attribute.is_static): + # Pass by reference. + arguments.append('*receiver') + + # TODO(jacobr): refactor has_type_checking_nullable to better match v8. + has_type_checking_nullable = ( + (DartUtilities.has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or + DartUtilities.has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) and + idl_type.is_wrapper_type) + + if attribute.idl_type.is_nullable and not has_type_checking_nullable: + arguments.append('isNull') + if contents['is_getter_raises_exception']: + arguments.append('es') + return '%s(%s)' % (getter_name, ', '.join(arguments)) + + +CONTENT_ATTRIBUTE_GETTER_NAMES = { + 'boolean': 'hasAttribute', + 'long': 'getIntegralAttribute', + 'unsigned long': 'getUnsignedIntegralAttribute', +} + + +def getter_base_name(interface, attribute, arguments): + extended_attributes = attribute.extended_attributes + if 'Reflect' not in extended_attributes: + return DartUtilities.uncapitalize(DartUtilities.cpp_name(attribute)) + + content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower() + if content_attribute_name in ['class', 'id', 'name']: + # Special-case for performance optimization. + return 'get%sAttribute' % content_attribute_name.capitalize() + + arguments.append(scoped_content_attribute_name(interface, attribute)) + + base_idl_type = attribute.idl_type.base_type + if base_idl_type in CONTENT_ATTRIBUTE_GETTER_NAMES: + return CONTENT_ATTRIBUTE_GETTER_NAMES[base_idl_type] + if 'URL' in attribute.extended_attributes: + return 'getURLAttribute' + return 'getAttribute' + + +def is_keep_alive_for_gc(interface, attribute): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + return ( + # For readonly attributes, for performance reasons we keep the attribute + # wrapper alive while the owner wrapper is alive, because the attribute + # never changes. + (attribute.is_read_only and + idl_type.is_wrapper_type and + # There are some exceptions, however: + not( + # Node lifetime is managed by object grouping. + inherits_interface(interface.name, 'Node') or + inherits_interface(base_idl_type, 'Node') or + # A self-reference is unnecessary. + attribute.name == 'self' or + # FIXME: Remove these hard-coded hacks. + base_idl_type in ['EventTarget', 'Window'] or + base_idl_type.startswith(('HTML', 'SVG'))))) + + +################################################################################ +# Setter +################################################################################ + +def generate_setter(interface, attribute, contents): + def target_attribute(): + target_interface_name = attribute.idl_type.base_type + target_attribute_name = extended_attributes['PutForwards'] + target_interface = interfaces[target_interface_name] + try: + return next(attribute + for attribute in target_interface.attributes + if attribute.name == target_attribute_name) + except StopIteration: + raise Exception('[PutForward] target not found:\n' + 'Attribute "%s" is not present in interface "%s"' % + (target_attribute_name, target_interface_name)) + + extended_attributes = attribute.extended_attributes + interface_extended_attributes = interface.extended_attributes + + if 'PutForwards' in extended_attributes: + # Use target attribute in place of original attribute + attribute = target_attribute() + this_cpp_type = 'DartStringAdapter' + else: + this_cpp_type = contents['cpp_type'] + + idl_type = attribute.idl_type + + # TODO(terry): Should be able to eliminate suppress_setter as we move from + # IGNORE_MEMBERS to DartSuppress in the IDL. + suppress = (suppress_setter(interface.name, attribute.name) or + DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Setter')) + contents.update({ + 'is_setter_suppressed': suppress, + 'setter_lvalue': dart_types.check_reserved_name(attribute.name), + 'cpp_type': this_cpp_type, + 'local_cpp_type': idl_type.cpp_type_args(attribute.extended_attributes, used_as_argument=True), + 'cpp_setter': setter_expression(interface, attribute, contents), + 'dart_value_to_local_cpp_value': + attribute.idl_type.dart_value_to_local_cpp_value( + interface_extended_attributes, extended_attributes, attribute.name, False, 1, + contents['is_auto_scope']), + }) + + +def setter_expression(interface, attribute, contents): + extended_attributes = attribute.extended_attributes + arguments = DartUtilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith')) + + this_setter_base_name = setter_base_name(interface, attribute, arguments) + setter_name = DartUtilities.scoped_name(interface, attribute, this_setter_base_name) + + if ('PartialInterfaceImplementedAs' in extended_attributes and + not attribute.is_static): + arguments.append('*receiver') + idl_type = attribute.idl_type + if idl_type.base_type == 'EventHandler': + getter_name = DartUtilities.scoped_name(interface, attribute, DartUtilities.cpp_name(attribute)) + contents['event_handler_getter_expression'] = '%s(%s)' % ( + getter_name, ', '.join(arguments)) + # FIXME(vsm): Do we need to support this? If so, what's our analogue of + # V8EventListenerList? + arguments.append('nullptr') + # if (interface.name in ['Window', 'WorkerGlobalScope'] and + # attribute.name == 'onerror'): + # includes.add('bindings/v8/V8ErrorHandler.h') + # arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())') + # else: + # arguments.append('V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)') + else: + attribute_name = dart_types.check_reserved_name(attribute.name) + arguments.append(attribute_name) + if contents['is_setter_raises_exception']: + arguments.append('es') + + return '%s(%s)' % (setter_name, ', '.join(arguments)) + + +CONTENT_ATTRIBUTE_SETTER_NAMES = { + 'boolean': 'setBooleanAttribute', + 'long': 'setIntegralAttribute', + 'unsigned long': 'setUnsignedIntegralAttribute', +} + + +def setter_base_name(interface, attribute, arguments): + if 'Reflect' not in attribute.extended_attributes: + return 'set%s' % DartUtilities.capitalize(DartUtilities.cpp_name(attribute)) + arguments.append(scoped_content_attribute_name(interface, attribute)) + + base_idl_type = attribute.idl_type.base_type + if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: + return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] + return 'setAttribute' + + +def scoped_content_attribute_name(interface, attribute): + content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower() + namespace = 'SVGNames' if interface.name.startswith('SVG') else 'HTMLNames' + includes.add('%s.h' % namespace) + return 'WebCore::%s::%sAttr' % (namespace, content_attribute_name) + + +################################################################################ +# Attribute configuration +################################################################################ + +# [Replaceable] +def setter_callback_name(interface, attribute): + cpp_class_name = DartUtilities.cpp_name(interface) + extended_attributes = attribute.extended_attributes + if (('Replaceable' in extended_attributes and + 'PutForwards' not in extended_attributes) or + is_constructor_attribute(attribute)): + # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors + return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name) + # FIXME:disabling PutForwards for now since we didn't support it before + # if attribute.is_read_only and 'PutForwards' not in extended_attributes: + if attribute.is_read_only: + return '0' + return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name) + + +# [DoNotCheckSecurity], [Unforgeable] +def access_control_list(attribute): + extended_attributes = attribute.extended_attributes + access_control = [] + if 'DoNotCheckSecurity' in extended_attributes: + do_not_check_security = extended_attributes['DoNotCheckSecurity'] + if do_not_check_security == 'Setter': + access_control.append('v8::ALL_CAN_WRITE') + else: + access_control.append('v8::ALL_CAN_READ') + if (not attribute.is_read_only or + 'Replaceable' in extended_attributes): + access_control.append('v8::ALL_CAN_WRITE') + if 'Unforgeable' in extended_attributes: + access_control.append('v8::PROHIBITS_OVERWRITING') + return access_control or ['v8::DEFAULT'] + + +# [NotEnumerable], [Unforgeable] +def property_attributes(attribute): + extended_attributes = attribute.extended_attributes + property_attributes_list = [] + if ('NotEnumerable' in extended_attributes or + is_constructor_attribute(attribute)): + property_attributes_list.append('v8::DontEnum') + if 'Unforgeable' in extended_attributes: + property_attributes_list.append('v8::DontDelete') + return property_attributes_list or ['v8::None'] + + +################################################################################ +# Constructors +################################################################################ + +idl_types.IdlType.constructor_type_name = property( + # FIXME: replace this with a [ConstructorAttribute] extended attribute + lambda self: DartUtilities.strip_suffix(self.base_type, 'Constructor')) + + +def is_constructor_attribute(attribute): + # FIXME: replace this with [ConstructorAttribute] extended attribute + return attribute.idl_type.base_type.endswith('Constructor') + + +def generate_constructor_getter(interface, attribute, contents): + contents['needs_constructor_getter_callback'] = contents['measure_as'] or contents['deprecate_as']
diff --git a/bindings/dart/scripts/dart_callback_interface.py b/bindings/dart/scripts/dart_callback_interface.py new file mode 100644 index 0000000..9fb0cea --- /dev/null +++ b/bindings/dart/scripts/dart_callback_interface.py
@@ -0,0 +1,132 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for a callback interface. + +Extends IdlType with property |callback_cpp_type|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from idl_types import IdlType +import dart_types +from dart_utilities import DartUtilities +from v8_globals import includes + +CALLBACK_INTERFACE_H_INCLUDES = frozenset([ + 'bindings/dart/DartCallback.h', + 'bindings/dart/DartDOMWrapper.h', + 'bindings/v8/ActiveDOMCallback.h', +]) +CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([ + 'bindings/dart/DartBindingsCommonIncludes.h', + 'wtf/GetPtr.h', + 'wtf/RefPtr.h', +]) + +def cpp_type(idl_type): + # FIXME: remove this function by making callback types consistent + # (always use usual v8_types.cpp_type) + idl_type_name = idl_type.name + if idl_type_name == 'String': + return 'const String&' + if idl_type_name == 'void': + return 'void' + # Callbacks use raw pointers, so used_as_argument=True + usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True) + if usual_cpp_type.startswith(('Vector', 'HeapVector', 'WillBeHeapVector')): + return 'const %s&' % usual_cpp_type + return usual_cpp_type + +IdlType.callback_cpp_type = property(cpp_type) + + +def generate_callback_interface(callback_interface): + includes.clear() + includes.update(CALLBACK_INTERFACE_CPP_INCLUDES) + name = callback_interface.name + + methods = [generate_method(operation) + for operation in callback_interface.operations] + template_contents = { + 'conditional_string': DartUtilities.conditional_string(callback_interface), + 'cpp_class': name, + 'dart_class': dart_types.dart_type(callback_interface.name), + 'v8_class': DartUtilities.v8_class_name(callback_interface), + 'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES), + 'methods': methods, + } + return template_contents + + +def add_includes_for_operation(operation): + operation.idl_type.add_includes_for_type() + for argument in operation.arguments: + argument.idl_type.add_includes_for_type() + + +def generate_method(operation): + extended_attributes = operation.extended_attributes + idl_type = operation.idl_type + idl_type_str = str(idl_type) + if idl_type_str not in ['boolean', 'void']: + raise Exception('We only support callbacks that return boolean or void values.') + is_custom = 'Custom' in extended_attributes + if not is_custom: + add_includes_for_operation(operation) + call_with = extended_attributes.get('CallWith') + call_with_this_handle = DartUtilities.extended_attribute_value_contains(call_with, 'ThisValue') + contents = { + 'call_with_this_handle': call_with_this_handle, + 'cpp_type': idl_type.callback_cpp_type, + 'custom': is_custom, + 'idl_type': idl_type_str, + 'name': operation.name, + } + contents.update(generate_arguments_contents(operation.arguments, call_with_this_handle)) + return contents + + +def generate_arguments_contents(arguments, call_with_this_handle): + def generate_argument(argument): + creation_context = '<Dart%s>' % argument.idl_type.base_type + return { + 'handle': '%sHandle' % argument.name, + 'cpp_value_to_dart_value': argument.idl_type.cpp_value_to_dart_value(argument.name, + creation_context=creation_context), + } + + argument_declarations = [ + '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) + for argument in arguments] + if call_with_this_handle: + argument_declarations.insert(0, 'ScriptValue thisValue') + return { + 'argument_declarations': argument_declarations, + 'arguments': [generate_argument(argument) for argument in arguments], + }
diff --git a/bindings/dart/scripts/dart_compiler.py b/bindings/dart/scripts/dart_compiler.py new file mode 100755 index 0000000..83457d0 --- /dev/null +++ b/bindings/dart/scripts/dart_compiler.py
@@ -0,0 +1,131 @@ +#!/usr/bin/python +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Compile an .idl file to Blink C++ bindings (.h and .cpp files) for Dart:HTML. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import abc +from optparse import OptionParser +import os +import cPickle as pickle + +from idl_reader import IdlReader +from utilities import write_file + + +# TODO(terry): Temporary whitelist of IDL files to skip code generating. e.g., +# adding 'Animation.idl' to this list will skip that IDL file. +SKIP_IDL_FILES = [''] + + +def parse_options(): + parser = OptionParser() + parser.add_option('--idl-attributes-file', + help="location of bindings/IDLExtendedAttributes.txt") + parser.add_option('--output-directory') + parser.add_option('--interfaces-info-file') + parser.add_option('--write-file-only-if-changed', type='int') + # ensure output comes last, so command line easy to parse via regexes + parser.disable_interspersed_args() + + options, args = parser.parse_args() + if options.output_directory is None: + parser.error('Must specify output directory using --output-directory.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + if len(args) != 1: + parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args)) + idl_filename = os.path.realpath(args[0]) + return options, idl_filename + + +def idl_filename_to_interface_name(idl_filename): + basename = os.path.basename(idl_filename) + interface_name, _ = os.path.splitext(basename) + return interface_name + + +class IdlCompiler(object): + """Abstract Base Class for IDL compilers. + + In concrete classes: + * self.code_generator must be set, implementing generate_code() + (returning a list of output code), and + * compile_file() must be implemented (handling output filenames). + """ + __metaclass__ = abc.ABCMeta + + def __init__(self, output_directory, code_generator=None, + interfaces_info=None, interfaces_info_filename='', + only_if_changed=False): + """ + Args: + interfaces_info: + interfaces_info dict + (avoids auxiliary file in run-bindings-tests) + interfaces_info_file: filename of pickled interfaces_info + """ + self.code_generator = code_generator + if interfaces_info_filename: + with open(interfaces_info_filename) as interfaces_info_file: + interfaces_info = pickle.load(interfaces_info_file) + self.interfaces_info = interfaces_info + + self.only_if_changed = only_if_changed + self.output_directory = output_directory + self.reader = IdlReader(interfaces_info, output_directory) + + def compile_and_write(self, idl_filename, output_filenames): + interface_name = idl_filename_to_interface_name(idl_filename) + idl_pickle_filename = os.path.join(self.output_directory, + '%s_globals.pickle' % interface_name) + definitions = self.reader.read_idl_definitions(idl_filename) + output_code_list = self.code_generator.generate_code(definitions, + interface_name, + idl_pickle_filename, + self.only_if_changed) + + # TODO(terry): Temporary to disable code generating an IDL. + base_idl_filename = os.path.basename(idl_filename) + if base_idl_filename in SKIP_IDL_FILES: + print "----- Skipping %s -----" % base_idl_filename + else: + for output_code, output_filename in zip(output_code_list, output_filenames): + write_file(output_code, output_filename, self.only_if_changed) + + def generate_global_and_write(self, global_pickle_directories, output_filenames): + output_code_list = self.code_generator.generate_globals(global_pickle_directories, + self.output_directory) + for output_code, output_filename in zip(output_code_list, output_filenames): + write_file(output_code, output_filename, self.only_if_changed) + + @abc.abstractmethod + def compile_file(self, idl_filename): + pass
diff --git a/bindings/dart/scripts/dart_interface.py b/bindings/dart/scripts/dart_interface.py new file mode 100644 index 0000000..540c3ac --- /dev/null +++ b/bindings/dart/scripts/dart_interface.py
@@ -0,0 +1,1151 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for an interface. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from collections import defaultdict + +import idl_types +from idl_types import IdlType, inherits_interface +import dart_attributes +import dart_methods +import dart_types +from dart_utilities import DartUtilities +from v8_globals import includes + + +INTERFACE_H_INCLUDES = frozenset([ + 'bindings/dart/DartDOMWrapper.h', + 'platform/heap/Handle.h', +]) + +INTERFACE_CPP_INCLUDES = frozenset([ + 'DartUtilities.h', + 'wtf/GetPtr.h', + 'wtf/RefPtr.h', +]) + + +# TODO(terry): Temporary to not generate a method, getter/setter. Format is: +# +# interface_name.method_name +# interface_name.get:attribute_name +# interface_name.set:attribute_name +# +# Ultimate solution add a special attribute flag to IDL to signal +# don't generate IDL entry in Dart (e.g., DartNoGenerate)? +IGNORE_MEMBERS = frozenset([ + 'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation + 'CSSStyleDeclaration.getPropertyCSSValue', + 'CanvasRenderingContext2D.clearShadow', + 'CanvasRenderingContext2D.drawImageFromRect', + 'CanvasRenderingContext2D.setAlpha', + 'CanvasRenderingContext2D.setCompositeOperation', + 'CanvasRenderingContext2D.setFillColor', + 'CanvasRenderingContext2D.setLineCap', + 'CanvasRenderingContext2D.setLineJoin', + 'CanvasRenderingContext2D.setLineWidth', + 'CanvasRenderingContext2D.setMiterLimit', + 'CanvasRenderingContext2D.setShadow', + 'CanvasRenderingContext2D.setStrokeColor', + 'CharacterData.remove', + 'Window.call:blur', + 'Window.call:focus', + 'Window.clientInformation', + 'Window.createImageBitmap', + 'Window.get:frames', + 'Window.get:length', + 'Window.on:beforeUnload', + 'Window.on:webkitTransitionEnd', + 'Window.pagePopupController', + 'Window.prompt', + 'Window.webkitCancelAnimationFrame', + 'Window.webkitCancelRequestAnimationFrame', + 'Window.webkitIndexedDB', + 'Window.webkitRequestAnimationFrame', + 'Document.alinkColor', + 'HTMLDocument.all', + 'Document.applets', + 'Document.bgColor', + 'Document.clear', + 'Document.createAttribute', + 'Document.createAttributeNS', + 'Document.createComment', + 'Document.createExpression', + 'Document.createNSResolver', + 'Document.createProcessingInstruction', + 'Document.designMode', + 'Document.dir', + 'Document.evaluate', + 'Document.fgColor', + 'Document.get:URL', + 'Document.get:anchors', + 'Document.get:characterSet', + 'Document.get:compatMode', + 'Document.get:defaultCharset', + 'Document.get:doctype', + 'Document.get:documentURI', + 'Document.get:embeds', + 'Document.get:forms', + 'Document.get:inputEncoding', + 'Document.get:links', + 'Document.get:plugins', + 'Document.get:scripts', + 'Document.get:xmlEncoding', + 'Document.getElementsByTagNameNS', + 'Document.getOverrideStyle', + 'Document.getSelection', + 'Document.images', + 'Document.linkColor', + 'Document.location', + 'Document.on:wheel', + 'Document.open', + 'Document.register', + 'Document.set:domain', + 'Document.vlinkColor', + 'Document.webkitCurrentFullScreenElement', + 'Document.webkitFullScreenKeyboardInputAllowed', + 'Document.write', + 'Document.writeln', + 'Document.xmlStandalone', + 'Document.xmlVersion', + 'DocumentFragment.children', + 'DocumentType.*', + 'DOMException.code', + 'DOMException.ABORT_ERR', + 'DOMException.DATA_CLONE_ERR', + 'DOMException.DOMSTRING_SIZE_ERR', + 'DOMException.HIERARCHY_REQUEST_ERR', + 'DOMException.INDEX_SIZE_ERR', + 'DOMException.INUSE_ATTRIBUTE_ERR', + 'DOMException.INVALID_ACCESS_ERR', + 'DOMException.INVALID_CHARACTER_ERR', + 'DOMException.INVALID_MODIFICATION_ERR', + 'DOMException.INVALID_NODE_TYPE_ERR', + 'DOMException.INVALID_STATE_ERR', + 'DOMException.NAMESPACE_ERR', + 'DOMException.NETWORK_ERR', + 'DOMException.NOT_FOUND_ERR', + 'DOMException.NOT_SUPPORTED_ERR', + 'DOMException.NO_DATA_ALLOWED_ERR', + 'DOMException.NO_MODIFICATION_ALLOWED_ERR', + 'DOMException.QUOTA_EXCEEDED_ERR', + 'DOMException.SECURITY_ERR', + 'DOMException.SYNTAX_ERR', + 'DOMException.TIMEOUT_ERR', + 'DOMException.TYPE_MISMATCH_ERR', + 'DOMException.URL_MISMATCH_ERR', + 'DOMException.VALIDATION_ERR', + 'DOMException.WRONG_DOCUMENT_ERR', + 'Element.accessKey', + 'Element.dataset', + 'Element.get:classList', + 'Element.getAttributeNode', + 'Element.getAttributeNodeNS', + 'Element.getElementsByTagNameNS', + 'Element.innerText', + 'Element.on:wheel', + 'Element.outerText', + 'Element.removeAttributeNode', + 'Element.set:outerHTML', + 'Element.setAttributeNode', + 'Element.setAttributeNodeNS', + 'Element.webkitCreateShadowRoot', + 'Element.webkitMatchesSelector', + 'Element.webkitPseudo', + 'Element.webkitShadowRoot', + '=Event.returnValue', # Only suppress on Event, allow for BeforeUnloadEvent. + 'Event.srcElement', + 'EventSource.URL', + 'FontFace.ready', + 'FontFaceSet.load', + 'FontFaceSet.ready', + 'HTMLAnchorElement.charset', + 'HTMLAnchorElement.coords', + 'HTMLAnchorElement.rev', + 'HTMLAnchorElement.shape', + 'HTMLAnchorElement.text', + 'HTMLAppletElement.*', + 'HTMLAreaElement.noHref', + 'HTMLBRElement.clear', + 'HTMLBaseFontElement.*', + 'HTMLBodyElement.aLink', + 'HTMLBodyElement.background', + 'HTMLBodyElement.bgColor', + 'HTMLBodyElement.link', + 'HTMLBodyElement.on:beforeUnload', + 'HTMLBodyElement.text', + 'HTMLBodyElement.vLink', + 'HTMLDListElement.compact', + 'HTMLDirectoryElement.*', + 'HTMLDivElement.align', + 'HTMLFontElement.*', + 'HTMLFormControlsCollection.__getter__', + 'HTMLFormElement.get:elements', + 'HTMLFrameElement.*', + 'HTMLFrameSetElement.*', + 'HTMLHRElement.align', + 'HTMLHRElement.noShade', + 'HTMLHRElement.size', + 'HTMLHRElement.width', + 'HTMLHeadElement.profile', + 'HTMLHeadingElement.align', + 'HTMLHtmlElement.manifest', + 'HTMLHtmlElement.version', + 'HTMLIFrameElement.align', + 'HTMLIFrameElement.frameBorder', + 'HTMLIFrameElement.longDesc', + 'HTMLIFrameElement.marginHeight', + 'HTMLIFrameElement.marginWidth', + 'HTMLIFrameElement.scrolling', + 'HTMLImageElement.align', + 'HTMLImageElement.hspace', + 'HTMLImageElement.longDesc', + 'HTMLImageElement.name', + 'HTMLImageElement.vspace', + 'HTMLInputElement.align', + 'HTMLLegendElement.align', + 'HTMLLinkElement.charset', + 'HTMLLinkElement.rev', + 'HTMLLinkElement.target', + 'HTMLMarqueeElement.*', + 'HTMLMenuElement.compact', + 'HTMLMetaElement.scheme', + 'HTMLOListElement.compact', + 'HTMLObjectElement.align', + 'HTMLObjectElement.archive', + 'HTMLObjectElement.border', + 'HTMLObjectElement.codeBase', + 'HTMLObjectElement.codeType', + 'HTMLObjectElement.declare', + 'HTMLObjectElement.hspace', + 'HTMLObjectElement.standby', + 'HTMLObjectElement.vspace', + 'HTMLOptionElement.text', + 'HTMLOptionsCollection.*', + 'HTMLParagraphElement.align', + 'HTMLParamElement.type', + 'HTMLParamElement.valueType', + 'HTMLPreElement.width', + 'HTMLScriptElement.text', + 'HTMLSelectElement.options', + 'HTMLSelectElement.selectedOptions', + 'HTMLTableCaptionElement.align', + 'HTMLTableCellElement.abbr', + 'HTMLTableCellElement.align', + 'HTMLTableCellElement.axis', + 'HTMLTableCellElement.bgColor', + 'HTMLTableCellElement.ch', + 'HTMLTableCellElement.chOff', + 'HTMLTableCellElement.height', + 'HTMLTableCellElement.noWrap', + 'HTMLTableCellElement.scope', + 'HTMLTableCellElement.vAlign', + 'HTMLTableCellElement.width', + 'HTMLTableColElement.align', + 'HTMLTableColElement.ch', + 'HTMLTableColElement.chOff', + 'HTMLTableColElement.vAlign', + 'HTMLTableColElement.width', + 'HTMLTableElement.align', + 'HTMLTableElement.bgColor', + 'HTMLTableElement.cellPadding', + 'HTMLTableElement.cellSpacing', + 'HTMLTableElement.frame', + 'HTMLTableElement.rules', + 'HTMLTableElement.summary', + 'HTMLTableElement.width', + 'HTMLTableRowElement.align', + 'HTMLTableRowElement.bgColor', + 'HTMLTableRowElement.ch', + 'HTMLTableRowElement.chOff', + 'HTMLTableRowElement.vAlign', + 'HTMLTableSectionElement.align', + 'HTMLTableSectionElement.ch', + 'HTMLTableSectionElement.chOff', + 'HTMLTableSectionElement.vAlign', + 'HTMLTitleElement.text', + 'HTMLUListElement.compact', + 'HTMLUListElement.type', + 'Location.valueOf', + 'MessageEvent.ports', + 'MessageEvent.webkitInitMessageEvent', + 'MouseEvent.x', + 'MouseEvent.y', + 'Navigator.registerServiceWorker', + 'Navigator.unregisterServiceWorker', + 'Node.compareDocumentPosition', + 'Node.get:DOCUMENT_POSITION_CONTAINED_BY', + 'Node.get:DOCUMENT_POSITION_CONTAINS', + 'Node.get:DOCUMENT_POSITION_DISCONNECTED', + 'Node.get:DOCUMENT_POSITION_FOLLOWING', + 'Node.get:DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC', + 'Node.get:DOCUMENT_POSITION_PRECEDING', + 'Node.get:prefix', + 'Node.hasAttributes', + 'Node.isDefaultNamespace', + 'Node.isEqualNode', + 'Node.isSameNode', + 'Node.isSupported', + 'Node.lookupNamespaceURI', + 'Node.lookupPrefix', + 'Node.normalize', + 'Node.set:nodeValue', + 'NodeFilter.acceptNode', + 'NodeIterator.expandEntityReferences', + 'NodeIterator.filter', + 'Performance.webkitClearMarks', + 'Performance.webkitClearMeasures', + 'Performance.webkitGetEntries', + 'Performance.webkitGetEntriesByName', + 'Performance.webkitGetEntriesByType', + 'Performance.webkitMark', + 'Performance.webkitMeasure', + 'ShadowRoot.getElementsByTagNameNS', + 'SVGElement.getPresentationAttribute', + 'SVGElementInstance.on:wheel', + 'WheelEvent.wheelDelta', + 'Window.on:wheel', + 'WindowEventHandlers.on:beforeUnload', + 'WorkerGlobalScope.webkitIndexedDB', +# TODO(jacobr): should these be removed? + 'Document.close', + 'Document.hasFocus', +]) + + +def _suppress_method(interface_name, name): + name_to_find = '%s.%s' % (interface_name, name) + wildcard_name_to_find = '%s.*' % interface_name + return name_to_find in IGNORE_MEMBERS or wildcard_name_to_find in IGNORE_MEMBERS + + +# Both getter and setter are to be suppressed then the attribute is completely +# disappear. +def _suppress_attribute(interface_name, name): + return (suppress_getter(interface_name, name) and suppress_setter(interface_name, name)) + + +def suppress_getter(interface_name, name): + name_to_find = '%s.get:%s' % (interface_name, name) + wildcard_getter_to_find = '%s.get:*' % interface_name + return (name_to_find in IGNORE_MEMBERS or + _suppress_method(interface_name, name) or + wildcard_getter_to_find in IGNORE_MEMBERS) + + +def suppress_setter(interface_name, name): + name_to_find = '%s.set:%s' % (interface_name, name) + wildcard_setter_to_find = '%s.set:*' % interface_name + return (name_to_find in IGNORE_MEMBERS or + _suppress_method(interface_name, name) or + wildcard_setter_to_find in IGNORE_MEMBERS) + + +# To suppress an IDL method or attribute with a particular Extended Attribute +# w/o a value e.g, StrictTypeChecking would be an empty set +# 'StrictTypeChecking': frozenset([]), +IGNORE_EXTENDED_ATTRIBUTES = { +# 'RuntimeEnabled': frozenset(['ExperimentalCanvasFeatures']), +} + + +# Return True if the method / attribute should be suppressed. +def _suppress_extended_attributes(extended_attributes): + if 'DartSuppress' in extended_attributes and extended_attributes.get('DartSuppress') == None: + return True + + # TODO(terry): Eliminate this using DartSuppress extended attribute in the + # IDL files instead of the IGNORE_EXTENDED_ATTRIBUTES list. + for extended_attribute_name in extended_attributes: + ignore_extended_values = IGNORE_EXTENDED_ATTRIBUTES.get(extended_attribute_name) + if ignore_extended_values != None: + extended_attribute_value = extended_attributes.get(extended_attribute_name) + if ((not ignore_extended_values and extended_attribute_value == None) or + extended_attribute_value in ignore_extended_values): + return True + return False + + +def generate_interface(interface): + includes.clear() + includes.update(INTERFACE_CPP_INCLUDES) + header_includes = set(INTERFACE_H_INCLUDES) + + parent_interface = interface.parent + if parent_interface: + header_includes.update(dart_types.includes_for_interface(parent_interface)) + extended_attributes = interface.extended_attributes + + is_audio_buffer = inherits_interface(interface.name, 'AudioBuffer') + if is_audio_buffer: + includes.add('modules/webaudio/AudioBuffer.h') + + is_document = inherits_interface(interface.name, 'Document') + if is_document: + # FIXME(vsm): We probably need bindings/dart/DartController and + # core/frame/LocalFrame.h here. + includes.update(['DartDocument.h']) + + if inherits_interface(interface.name, 'DataTransferItemList'): + # FIXME(jacobr): this is a hack. + includes.update(['core/html/HTMLCollection.h']) + + + if inherits_interface(interface.name, 'EventTarget'): + includes.update(['DartEventListener.h']) + + # [ActiveDOMObject] + is_active_dom_object = 'ActiveDOMObject' in extended_attributes + + # [CheckSecurity] + is_check_security = 'CheckSecurity' in extended_attributes + if is_check_security: + includes.add('bindings/common/BindingSecurity.h') + + # [DependentLifetime] + is_dependent_lifetime = 'DependentLifetime' in extended_attributes + + # [MeasureAs] +# TODO(terry): Remove Me? +# is_measure_as = 'MeasureAs' in extended_attributes +# if is_measure_as: +# includes.add('core/frame/UseCounter.h') + + # [SetWrapperReferenceFrom] + reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') + if reachable_node_function: + # FIXME(vsm): We may need bindings/dart/DartGCController.h instead. + includes.update(['bindings/v8/V8GCController.h', + 'core/dom/Element.h']) + + # [SetWrapperReferenceTo] + set_wrapper_reference_to_list = [{ + 'name': argument.name, + # FIXME: properly should be: + # 'cpp_type': argument.idl_type.cpp_type_args(used_as_argument=True), + # (if type is non-wrapper type like NodeFilter, normally RefPtr) + # Raw pointers faster though, and NodeFilter hacky anyway. + 'cpp_type': argument.idl_type.implemented_as + '*', + 'idl_type': argument.idl_type, + 'v8_type': dart_types.v8_type(argument.idl_type.name), + } for argument in extended_attributes.get('SetWrapperReferenceTo', [])] + for set_wrapper_reference_to in set_wrapper_reference_to_list: + set_wrapper_reference_to['idl_type'].add_includes_for_type() + + # [SpecialWrapFor] + if 'SpecialWrapFor' in extended_attributes: + special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') + else: + special_wrap_for = [] + for special_wrap_interface in special_wrap_for: + dart_types.add_includes_for_interface(special_wrap_interface) + + # [Custom=Wrap], [SetWrapperReferenceFrom] + has_visit_dom_wrapper = ( + DartUtilities.has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or + reachable_node_function or + set_wrapper_reference_to_list) + + this_gc_type = DartUtilities.gc_type(interface) + + template_contents = { + 'conditional_string': DartUtilities.conditional_string(interface), # [Conditional] + 'cpp_class': DartUtilities.cpp_name(interface), + 'gc_type': this_gc_type, + 'has_custom_legacy_call_as_function': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] + 'has_custom_to_v8': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'ToV8'), # [Custom=ToV8] + 'has_custom_wrap': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'Wrap'), # [Custom=Wrap] + 'has_visit_dom_wrapper': has_visit_dom_wrapper, + 'header_includes': header_includes, + 'interface_name': interface.name, + 'is_active_dom_object': is_active_dom_object, + 'is_audio_buffer': is_audio_buffer, + 'is_check_security': is_check_security, + 'is_dependent_lifetime': is_dependent_lifetime, + 'is_document': is_document, + 'is_event_target': inherits_interface(interface.name, 'EventTarget'), + 'is_exception': interface.is_exception, + 'is_garbage_collected': this_gc_type == 'GarbageCollectedObject', + 'is_will_be_garbage_collected': this_gc_type == 'WillBeGarbageCollectedObject', + 'is_node': inherits_interface(interface.name, 'Node'), + 'measure_as': DartUtilities.measure_as(interface), # [MeasureAs] + 'parent_interface': parent_interface, + 'pass_cpp_type': dart_types.cpp_template_type( + dart_types.cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), + DartUtilities.cpp_name(interface)), + 'reachable_node_function': reachable_node_function, + 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(interface), # [RuntimeEnabled] + 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, + 'special_wrap_for': special_wrap_for, + 'dart_class': dart_types.dart_type(interface.name), + 'v8_class': DartUtilities.v8_class_name(interface), + 'wrapper_configuration': 'WrapperConfiguration::Dependent' + if (has_visit_dom_wrapper or + is_active_dom_object or + is_dependent_lifetime) + else 'WrapperConfiguration::Independent', + } + + # Constructors + constructors = [generate_constructor(interface, constructor) + for constructor in interface.constructors + # FIXME: shouldn't put named constructors with constructors + # (currently needed for Perl compatibility) + # Handle named constructors separately + if constructor.name == 'Constructor'] + generate_constructor_overloads(constructors) + + # [CustomConstructor] + custom_constructors = [generate_custom_constructor(interface, constructor) + for constructor in interface.custom_constructors] + + # [EventConstructor] + has_event_constructor = 'EventConstructor' in extended_attributes + any_type_attributes = [attribute for attribute in interface.attributes + if attribute.idl_type.name == 'Any'] + if has_event_constructor: + includes.add('bindings/common/Dictionary.h') + if any_type_attributes: + includes.add('bindings/v8/SerializedScriptValue.h') + + # [NamedConstructor] + named_constructor = generate_named_constructor(interface) + + if (constructors or custom_constructors or has_event_constructor or + named_constructor): + includes.add('core/frame/LocalDOMWindow.h') + + template_contents.update({ + 'any_type_attributes': any_type_attributes, + 'constructors': constructors, + 'custom_constructors': custom_constructors, + 'has_custom_constructor': bool(custom_constructors), + 'has_event_constructor': has_event_constructor, + 'interface_length': + interface_length(interface, constructors + custom_constructors), + 'is_constructor_call_with_document': DartUtilities.has_extended_attribute_value( + interface, 'ConstructorCallWith', 'Document'), # [ConstructorCallWith=Document] + 'is_constructor_call_with_execution_context': DartUtilities.has_extended_attribute_value( + interface, 'ConstructorCallWith', 'ExecutionContext'), # [ConstructorCallWith=ExeuctionContext] + 'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor', # [RaisesException=Constructor] + 'named_constructor': named_constructor, + }) + + # Constants + template_contents.update({ + 'constants': [generate_constant(constant) for constant in interface.constants], + 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, + }) + + # Attributes + attributes = [dart_attributes.generate_attribute(interface, attribute) + for attribute in interface.attributes + # Skip attributes in the IGNORE_MEMBERS list or if an + # extended attribute is in the IGNORE_EXTENDED_ATTRIBUTES. + if (not _suppress_attribute(interface.name, attribute.name) and + not dart_attributes.is_constructor_attribute(attribute) and + not _suppress_extended_attributes(attribute.extended_attributes) and + not ('DartSuppress' in attribute.extended_attributes and + attribute.extended_attributes.get('DartSuppress') == None))] + template_contents.update({ + 'attributes': attributes, + 'has_accessors': any(attribute['is_expose_js_accessors'] for attribute in attributes), + 'has_attribute_configuration': any( + not (attribute['is_expose_js_accessors'] or + attribute['is_static'] or + attribute['runtime_enabled_function'] or + attribute['per_context_enabled_function']) + for attribute in attributes), + 'has_constructor_attributes': any(attribute['constructor_type'] for attribute in attributes), + 'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function'] for attribute in attributes), + 'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes), + }) + + # Methods + methods = [dart_methods.generate_method(interface, method) + for method in interface.operations + # Skip anonymous special operations (methods name empty). + # Skip methods in our IGNORE_MEMBERS list. + # Skip methods w/ extended attributes in IGNORE_EXTENDED_ATTRIBUTES list. + if (method.name and + # TODO(terry): Eventual eliminate the IGNORE_MEMBERS in favor of DartSupress. + not _suppress_method(interface.name, method.name) and + not _suppress_extended_attributes(method.extended_attributes) and + not 'DartSuppress' in method.extended_attributes)] + generate_overloads(methods) + for method in methods: + method['do_generate_method_configuration'] = ( + method['do_not_check_signature'] and + not method['per_context_enabled_function'] and + # For overloaded methods, only generate one accessor + ('overload_index' not in method or method['overload_index'] == 1)) + + template_contents.update({ + 'has_origin_safe_method_setter': any( + method['is_check_security_for_frame'] and not method['is_read_only'] + for method in methods), + 'has_method_configuration': any(method['do_generate_method_configuration'] for method in methods), + 'has_per_context_enabled_methods': any(method['per_context_enabled_function'] for method in methods), + 'methods': methods, + }) + + template_contents.update({ + 'indexed_property_getter': indexed_property_getter(interface), + 'indexed_property_setter': indexed_property_setter(interface), + 'indexed_property_deleter': indexed_property_deleter(interface), + 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, + 'named_property_getter': named_property_getter(interface), + 'named_property_setter': named_property_setter(interface), + 'named_property_deleter': named_property_deleter(interface), + }) + + return template_contents + + +# [DeprecateAs], [Reflect], [RuntimeEnabled] +def generate_constant(constant): + # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted + # in C++. + if constant.idl_type.name == 'String': + value = '"%s"' % constant.value + else: + value = constant.value + + extended_attributes = constant.extended_attributes + return { + 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), + 'name': constant.name, + # FIXME: use 'reflected_name' as correct 'name' + 'reflected_name': extended_attributes.get('Reflect', constant.name), + 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(constant), + 'value': value, + } + + +################################################################################ +# Overloads +################################################################################ + +def generate_overloads(methods): + generate_overloads_by_type(methods, is_static=False) # Regular methods + generate_overloads_by_type(methods, is_static=True) + + +def generate_overloads_by_type(methods, is_static): + # Generates |overloads| template values and modifies |methods| in place; + # |is_static| flag used (instead of partitioning list in 2) because need to + # iterate over original list of methods to modify in place + method_counts = defaultdict(lambda: 0) + for method in methods: + if method['is_static'] != is_static: + continue + name = method['name'] + # FIXME(vsm): We don't seem to capture optional param + # overloads here. + method_counts[name] += 1 + + # Filter to only methods that are actually overloaded + overloaded_method_counts = dict((name, count) + for name, count in method_counts.iteritems() + if count > 1) + + # Add overload information only to overloaded methods, so template code can + # easily verify if a function is overloaded + method_overloads = defaultdict(list) + for method in methods: + name = method['name'] + if (method['is_static'] != is_static or + name not in overloaded_method_counts): + continue + # Overload index includes self, so first append, then compute index + method_overloads[name].append(method) + method.update({ + 'overload_index': len(method_overloads[name]), + 'overload_resolution_expression': overload_resolution_expression(method), + }) + # FIXME(vsm): Looks like we only handle optional parameters if + # the method is already overloaded. For a non-overloaded method + # with optional parameters, we never get here. + + # Resolution function is generated after last overloaded function; + # package necessary information into |method.overloads| for that method. + for method in methods: + if (method['is_static'] != is_static or + 'overload_index' not in method): + continue + name = method['name'] + if method['overload_index'] != overloaded_method_counts[name]: + continue + overloads = method_overloads[name] + minimum_number_of_required_arguments = min( + overload['number_of_required_arguments'] + for overload in overloads) + method['overloads'] = { + 'has_exception_state': bool(minimum_number_of_required_arguments), + 'methods': overloads, + 'minimum_number_of_required_arguments': minimum_number_of_required_arguments, + 'name': name, + } + + +def overload_resolution_expression(method): + # Expression is an OR of ANDs: each term in the OR corresponds to a + # possible argument count for a given method, with type checks. + # FIXME: Blink's overload resolution algorithm is incorrect, per: + # Implement WebIDL overload resolution algorithm. + # https://code.google.com/p/chromium/issues/detail?id=293561 + # + # Currently if distinguishing non-primitive type from primitive type, + # (e.g., sequence<DOMString> from DOMString or Dictionary from double) + # the method with a non-primitive type argument must appear *first* in the + # IDL file, since we're not adding a check to primitive types. + # FIXME: Once fixed, check IDLs, as usually want methods with primitive + # types to appear first (style-wise). + # + # Properly: + # 1. Compute effective overload set. + # 2. First check type list length. + # 3. If multiple entries for given length, compute distinguishing argument + # index and have check for that type. + arguments = method['arguments'] + overload_checks = [overload_check_expression(method, index) + # check *omitting* optional arguments at |index| and up: + # index 0 => argument_count 0 (no arguments) + # index 1 => argument_count 1 (index 0 argument only) + for index, argument in enumerate(arguments) + if argument['is_optional']] + # FIXME: this is wrong if a method has optional arguments and a variadic + # one, though there are not yet any examples of this + if not method['is_variadic']: + # Includes all optional arguments (len = last index + 1) + overload_checks.append(overload_check_expression(method, len(arguments))) + return ' || '.join('(%s)' % check for check in overload_checks) + + +def overload_check_expression(method, argument_count): + overload_checks = ['info.Length() == %s' % argument_count] + arguments = method['arguments'][:argument_count] + overload_checks.extend(overload_check_argument(index, argument) + for index, argument in + enumerate(arguments)) + return ' && '.join('(%s)' % check for check in overload_checks if check) + + +def overload_check_argument(index, argument): + def null_or_optional_check(): + # If undefined is passed for an optional argument, the argument should + # be treated as missing; otherwise undefined is not allowed. + + # FIXME(vsm): We need Dart specific checks here. + if idl_type.is_nullable: + if argument['is_optional']: + return 'isUndefinedOrNull(%s)' + return '%s->IsNull()' + if argument['is_optional']: + return '%s->IsUndefined()' + return None + + cpp_value = 'info[%s]' % index + idl_type = argument['idl_type_object'] + # FIXME(vsm): We need Dart specific checks for the rest of this method. + # FIXME: proper type checking, sharing code with attributes and methods + # FIXME(terry): StrictTypeChecking no longer supported; TypeChecking is + # new extended attribute. + if idl_type.name == 'String' and argument['is_strict_type_checking']: + return ' || '.join(['isUndefinedOrNull(%s)' % cpp_value, + '%s->IsString()' % cpp_value, + '%s->IsObject()' % cpp_value]) + if idl_type.array_or_sequence_type: + return '%s->IsArray()' % cpp_value + if idl_type.is_callback_interface: + return ' || '.join(['%s->IsNull()' % cpp_value, + '%s->IsFunction()' % cpp_value]) + if idl_type.is_wrapper_type: + type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.format(idl_type=idl_type.base_type, cpp_value=cpp_value) + if idl_type.is_nullable: + type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) + return type_check + if idl_type.is_interface_type: + # Non-wrapper types are just objects: we don't distinguish type + # We only allow undefined for non-wrapper types (notably Dictionary), + # as we need it for optional Dictionary arguments, but we don't want to + # change behavior of existing bindings for other types. + type_check = '%s->IsObject()' % cpp_value + added_check_template = null_or_optional_check() + if added_check_template: + type_check = ' || '.join([added_check_template % cpp_value, + type_check]) + return type_check + return None + + +################################################################################ +# Constructors +################################################################################ + +# [Constructor] +def generate_custom_constructor(interface, constructor): + return { + 'arguments': [custom_constructor_argument(argument, index) + for index, argument in enumerate(constructor.arguments)], + 'auto_scope': 'true', + 'is_auto_scope': True, + 'number_of_arguments': len(constructor.arguments), + 'number_of_required_arguments': + number_of_required_arguments(constructor), + } + + +# We don't need much from this - just the idl_type_objects and preproceed_type +# to use in generating the resolver strings. +def custom_constructor_argument(argument, index): + return { + 'idl_type_object': argument.idl_type, + 'preprocessed_type': argument.idl_type.preprocessed_type, + } + + +# [Constructor] +def generate_constructor(interface, constructor): + return { + 'argument_list': constructor_argument_list(interface, constructor), + # TODO(terry): Use dart_methods.generate_argument instead constructor_argument. + 'arguments': [constructor_argument(interface, argument, index) + for index, argument in enumerate(constructor.arguments)], + 'has_exception_state': + # [RaisesException=Constructor] + interface.extended_attributes.get('RaisesException') == 'Constructor' or + any(argument for argument in constructor.arguments + if argument.idl_type.name == 'SerializedScriptValue' or + argument.idl_type.is_integer_type), + 'is_constructor': True, + 'auto_scope': 'true', + 'is_auto_scope': True, + 'is_variadic': False, # Required for overload resolution + 'number_of_required_arguments': + number_of_required_arguments(constructor), + 'number_of_arguments': len(constructor.arguments), + } + + +def constructor_argument_list(interface, constructor): + # FIXME: unify with dart_methods.cpp_argument. + + def cpp_argument(argument): + argument_name = dart_types.check_reserved_name(argument.name) + idl_type = argument.idl_type + if idl_type.is_typed_array_type: + return '%s.get()' % argument_name + + return argument_name + + arguments = [] + # [ConstructorCallWith=ExecutionContext] + if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'ExecutionContext'): + arguments.append('context') + # [ConstructorCallWith=Document] + if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'Document'): + arguments.append('document') + + arguments.extend([cpp_argument(argument) for argument in constructor.arguments]) + + # [RaisesException=Constructor] + if interface.extended_attributes.get('RaisesException') == 'Constructor': + arguments.append('es') + + return arguments + + +# TODO(terry): Eliminate this function use dart_methods.generate_argument instead +# for all constructor arguments. +def constructor_argument(interface, argument, index): + idl_type = argument.idl_type + default_value = str(argument.default_value) if argument.default_value else None + + argument_content = { + 'cpp_type': idl_type.cpp_type_args(), + 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, used_as_argument=True), + # FIXME: check that the default value's type is compatible with the argument's + 'default_value': default_value, + # FIXME: remove once [Default] removed and just use argument.default_value + 'has_default': 'Default' in argument.extended_attributes or default_value, + 'idl_type_object': idl_type, + 'preprocessed_type': idl_type.preprocessed_type, + # Dictionary is special-cased, but arrays and sequences shouldn't be + 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, + 'index': index, + 'is_array_or_sequence_type': not not idl_type.array_or_sequence_type, + 'is_optional': argument.is_optional, + 'is_strict_type_checking': False, # Required for overload resolution + 'name': argument.name, + 'dart_value_to_local_cpp_value': dart_methods.dart_value_to_local_cpp_value(interface, argument, index), + } + return argument_content + + +def generate_constructor_overloads(constructors): + if len(constructors) <= 1: + return + for overload_index, constructor in enumerate(constructors): + constructor.update({ + 'overload_index': overload_index + 1, + 'overload_resolution_expression': + overload_resolution_expression(constructor), + }) + + +# [NamedConstructor] +def generate_named_constructor(interface): + extended_attributes = interface.extended_attributes + if 'NamedConstructor' not in extended_attributes: + return None + # FIXME: parser should return named constructor separately; + # included in constructors (and only name stored in extended attribute) + # for Perl compatibility + idl_constructor = interface.constructors[0] + constructor = generate_constructor(interface, idl_constructor) + # FIXME(vsm): We drop the name. We don't use this in Dart APIs right now. + # We probably need to encode this somehow to deal with conflicts. + # constructor['name'] = extended_attributes['NamedConstructor'] + return constructor + + +def number_of_required_arguments(constructor): + return len([argument for argument in constructor.arguments + if not (argument.is_optional and not (('Default' in argument.extended_attributes) or argument.default_value))]) + + +def interface_length(interface, constructors): + # Docs: http://heycam.github.io/webidl/#es-interface-call + if 'EventConstructor' in interface.extended_attributes: + return 1 + if not constructors: + return 0 + return min(constructor['number_of_required_arguments'] + for constructor in constructors) + + +################################################################################ +# Special operations (methods) +# http://heycam.github.io/webidl/#idl-special-operations +################################################################################ + +def property_getter(getter, cpp_arguments): + def is_null_expression(idl_type): + if idl_type.is_union_type: + return ' && '.join('!result%sEnabled' % i + for i, _ in enumerate(idl_type.member_types)) + if idl_type.name == 'String': + # FIXME(vsm): This looks V8 specific. + return 'result.isNull()' + if idl_type.is_interface_type: + return '!result' + return '' + + idl_type = getter.idl_type + extended_attributes = getter.extended_attributes + is_raises_exception = 'RaisesException' in extended_attributes + + # FIXME: make more generic, so can use dart_methods.cpp_value + cpp_method_name = 'receiver->%s' % DartUtilities.cpp_name(getter) + + if is_raises_exception: + cpp_arguments.append('es') + union_arguments = idl_type.union_arguments + if union_arguments: + cpp_arguments.extend(union_arguments) + + cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) + + return { + 'cpp_type': idl_type.cpp_type, + 'cpp_value': cpp_value, + 'is_custom': + 'Custom' in extended_attributes and + (not extended_attributes['Custom'] or + DartUtilities.has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), + 'is_custom_property_enumerator': DartUtilities.has_extended_attribute_value( + getter, 'Custom', 'PropertyEnumerator'), + 'is_custom_property_query': DartUtilities.has_extended_attribute_value( + getter, 'Custom', 'PropertyQuery'), + 'is_enumerable': 'NotEnumerable' not in extended_attributes, + 'is_null_expression': is_null_expression(idl_type), + 'is_raises_exception': is_raises_exception, + 'name': DartUtilities.cpp_name(getter), + 'union_arguments': union_arguments, + 'dart_set_return_value': idl_type.dart_set_return_value('result', + extended_attributes=extended_attributes, + script_wrappable='receiver', + release=idl_type.release)} + + +def property_setter(interface, setter): + idl_type = setter.arguments[1].idl_type + extended_attributes = setter.extended_attributes + interface_extended_attributes = interface.extended_attributes + is_raises_exception = 'RaisesException' in extended_attributes + return { + 'has_strict_type_checking': + 'StrictTypeChecking' in extended_attributes and + idl_type.is_wrapper_type, + 'idl_type': idl_type.base_type, + 'is_custom': 'Custom' in extended_attributes, + 'has_exception_state': is_raises_exception or + idl_type.is_integer_type, + 'is_raises_exception': is_raises_exception, + 'name': DartUtilities.cpp_name(setter), + 'dart_value_to_local_cpp_value': idl_type.dart_value_to_local_cpp_value( + interface_extended_attributes, extended_attributes, 'propertyValue', False), + } + + +def property_deleter(deleter): + idl_type = deleter.idl_type + if str(idl_type) != 'boolean': + raise Exception( + 'Only deleters with boolean type are allowed, but type is "%s"' % + idl_type) + extended_attributes = deleter.extended_attributes + return { + 'is_custom': 'Custom' in extended_attributes, + 'is_raises_exception': 'RaisesException' in extended_attributes, + 'name': DartUtilities.cpp_name(deleter), + } + + +################################################################################ +# Indexed properties +# http://heycam.github.io/webidl/#idl-indexed-properties +################################################################################ + +def indexed_property_getter(interface): + try: + # Find indexed property getter, if present; has form: + # getter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1) + getter = next( + method + for method in interface.operations + if ('getter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + getter.name = getter.name or 'anonymousIndexedGetter' + + return property_getter(getter, ['index']) + + +def indexed_property_setter(interface): + try: + # Find indexed property setter, if present; has form: + # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1, ARG_TYPE ARG2) + setter = next( + method + for method in interface.operations + if ('setter' in method.specials and + len(method.arguments) == 2 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + return property_setter(interface, setter) + + +def indexed_property_deleter(interface): + try: + # Find indexed property deleter, if present; has form: + # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG) + deleter = next( + method + for method in interface.operations + if ('deleter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + return property_deleter(deleter) + + +################################################################################ +# Named properties +# http://heycam.github.io/webidl/#idl-named-properties +################################################################################ + +def named_property_getter(interface): + try: + # Find named property getter, if present; has form: + # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1) + getter = next( + method + for method in interface.operations + if ('getter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + getter.name = getter.name or 'anonymousNamedGetter' + return property_getter(getter, ['propertyName']) + + +def named_property_setter(interface): + try: + # Find named property setter, if present; has form: + # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2) + setter = next( + method + for method in interface.operations + if ('setter' in method.specials and + len(method.arguments) == 2 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + return property_setter(interface, setter) + + +def named_property_deleter(interface): + try: + # Find named property deleter, if present; has form: + # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG) + deleter = next( + method + for method in interface.operations + if ('deleter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + return property_deleter(deleter)
diff --git a/bindings/dart/scripts/dart_methods.py b/bindings/dart/scripts/dart_methods.py new file mode 100644 index 0000000..0a59338 --- /dev/null +++ b/bindings/dart/scripts/dart_methods.py
@@ -0,0 +1,338 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for methods. + +Extends IdlType and IdlUnionType with property |union_arguments|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from idl_types import IdlType, IdlUnionType, inherits_interface +import dart_types +from dart_utilities import DartUtilities +from v8_globals import includes + + +def generate_method(interface, method): + arguments = method.arguments + extended_attributes = method.extended_attributes + idl_type = method.idl_type + is_static = method.is_static + name = method.name + + idl_type.add_includes_for_type() + this_cpp_value = cpp_value(interface, method, len(arguments)) + + def function_template(): + if is_static: + return 'functionTemplate' + if 'Unforgeable' in extended_attributes: + return 'instanceTemplate' + return 'prototypeTemplate' + + is_call_with_script_arguments = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptArguments') + if is_call_with_script_arguments: + includes.update(['bindings/v8/ScriptCallStackFactory.h', + 'core/inspector/ScriptArguments.h']) + is_call_with_script_state = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptState') + if is_call_with_script_state: + includes.add('bindings/dart/DartScriptState.h') + is_check_security_for_node = 'CheckSecurity' in extended_attributes + if is_check_security_for_node: + includes.add('bindings/common/BindingSecurity.h') + is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes + if is_custom_element_callbacks: + includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + + has_event_listener_argument = any( + argument for argument in arguments + if argument.idl_type.name == 'EventListener') + is_check_security_for_frame = ( + 'CheckSecurity' in interface.extended_attributes and + 'DoNotCheckSecurity' not in extended_attributes) + is_raises_exception = 'RaisesException' in extended_attributes + + if idl_type.union_arguments and len(idl_type.union_arguments) > 0: + this_cpp_type = [] + for cpp_type in idl_type.member_types: + this_cpp_type.append("RefPtr<%s>" % cpp_type) + else: + this_cpp_type = idl_type.cpp_type + + is_auto_scope = not 'DartNoAutoScope' in extended_attributes + method_data = { + 'activity_logging_world_list': DartUtilities.activity_logging_world_list(method), # [ActivityLogging] + 'arguments': [generate_argument(interface, method, argument, index) + for index, argument in enumerate(arguments)], + 'conditional_string': DartUtilities.conditional_string(method), + 'cpp_type': this_cpp_type, + 'cpp_value': this_cpp_value, + 'dart_name': extended_attributes.get('DartName'), + 'deprecate_as': DartUtilities.deprecate_as(method), # [DeprecateAs] + 'do_not_check_signature': not(is_static or + DartUtilities.has_extended_attribute(method, + ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', + 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), + 'function_template': function_template(), + 'idl_type': idl_type.base_type, + 'has_event_listener_argument': has_event_listener_argument, + 'has_exception_state': + has_event_listener_argument or + is_raises_exception or + is_check_security_for_frame or + any(argument for argument in arguments + if argument.idl_type.name == 'SerializedScriptValue' or + argument.idl_type.is_integer_type), + 'is_auto_scope': is_auto_scope, + 'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope), + 'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'), + 'is_call_with_script_arguments': is_call_with_script_arguments, + 'is_call_with_script_state': is_call_with_script_state, + 'is_check_security_for_frame': is_check_security_for_frame, + 'is_check_security_for_node': is_check_security_for_node, + 'is_custom': 'Custom' in extended_attributes or 'DartCustom' in extended_attributes, + 'is_custom_dart': 'DartCustom' in extended_attributes, + 'is_custom_dart_new': DartUtilities.has_extended_attribute_value(method, 'DartCustom', 'New'), + 'is_custom_element_callbacks': is_custom_element_callbacks, + 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, + 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes, + 'is_partial_interface_member': 'PartialInterfaceImplementedAs' in extended_attributes, + 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, + 'is_raises_exception': is_raises_exception, + 'is_read_only': 'ReadOnly' in extended_attributes, + 'is_static': is_static, + # FIXME(terry): StrictTypeChecking no longer supported; TypeChecking is + # new extended attribute. + 'is_strict_type_checking': + 'StrictTypeChecking' in extended_attributes or + 'StrictTypeChecking' in interface.extended_attributes, + 'is_variadic': arguments and arguments[-1].is_variadic, + 'measure_as': DartUtilities.measure_as(method), # [MeasureAs] + 'name': name, + 'number_of_arguments': len(arguments), + 'number_of_required_arguments': len([ + argument for argument in arguments + if not ((argument.is_optional and not ('Default' in argument.extended_attributes or argument.default_value)) or + argument.is_variadic)]), + 'number_of_required_or_variadic_arguments': len([ + argument for argument in arguments + if not argument.is_optional]), + 'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(method), # [PerContextEnabled] + 'property_attributes': property_attributes(method), + 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(method), # [RuntimeEnabled] + 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature', + 'suppressed': (arguments and arguments[-1].is_variadic), # FIXME: implement variadic + 'union_arguments': idl_type.union_arguments, + 'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value), + 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''], # [PerWorldBindings] + } + return method_data + + +def generate_argument(interface, method, argument, index): + extended_attributes = argument.extended_attributes + idl_type = argument.idl_type + this_cpp_value = cpp_value(interface, method, index) + is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type + use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garbage_collected + auto_scope = not 'DartNoAutoScope' in extended_attributes + this_has_default = 'Default' in extended_attributes + arg_index = index + 1 if not method.is_static else index + preprocessed_type = str(idl_type.preprocessed_type) + # FIXMEDART: handle the drift between preprocessed type names in 1847 and + # 1985 dartium builds in a more generic way. + if preprocessed_type == 'unrestricted float': + preprocessed_type = 'float' + if preprocessed_type == 'unrestricted double': + preprocessed_type = 'double' + argument_data = { + 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=use_heap_vector_type), + 'cpp_value': this_cpp_value, + 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, used_as_argument=True), + # 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, + # Ignore 'Default' in extended_attributes not exposed in dart:html. + 'has_default': False, + 'has_event_listener_argument': any( + argument_so_far for argument_so_far in method.arguments[:index] + if argument_so_far.idl_type.name == 'EventListener'), + 'idl_type_object': idl_type, + 'preprocessed_type': preprocessed_type, + # Dictionary is special-cased, but arrays and sequences shouldn't be + 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, + 'index': index, + 'is_array_or_sequence_type': not not idl_type.array_or_sequence_type, + 'is_clamp': 'Clamp' in extended_attributes, + 'is_callback_interface': idl_type.is_callback_interface, + 'is_nullable': idl_type.is_nullable, + # Only expose as optional if no default value. + 'is_optional': argument.is_optional and not (this_has_default or argument.default_value), + 'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes, + 'is_variadic_wrapper_type': is_variadic_wrapper_type, + 'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector', + 'is_wrapper_type': idl_type.is_wrapper_type, + 'name': argument.name, + 'dart_set_return_value_for_main_world': dart_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), + 'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value), + 'arg_index': arg_index, + 'dart_value_to_local_cpp_value': dart_value_to_local_cpp_value(interface, argument, arg_index, auto_scope), + } + return argument_data + + +################################################################################ +# Value handling +################################################################################ + +def cpp_value(interface, method, number_of_arguments): + def cpp_argument(argument): + argument_name = dart_types.check_reserved_name(argument.name) + idl_type = argument.idl_type + + if idl_type.is_typed_array_type: + return '%s.get()' % argument_name + + if idl_type.name == 'EventListener': + if (interface.name == 'EventTarget' and + method.name == 'removeEventListener'): + # FIXME: remove this special case by moving get() into + # EventTarget::removeEventListener + return '%s.get()' % argument_name + return argument.name + if (idl_type.is_callback_interface or + idl_type.name in ['NodeFilter', 'XPathNSResolver']): + # FIXME: remove this special case + return '%s.release()' % argument_name + return argument_name + + # Truncate omitted optional arguments + arguments = method.arguments[:number_of_arguments] + cpp_arguments = DartUtilities.call_with_arguments(method) + if ('PartialInterfaceImplementedAs' in method.extended_attributes and not method.is_static): + cpp_arguments.append('*receiver') + + cpp_arguments.extend(cpp_argument(argument) for argument in arguments) + this_union_arguments = method.idl_type.union_arguments + if this_union_arguments: + cpp_arguments.extend(this_union_arguments) + + if 'RaisesException' in method.extended_attributes: + cpp_arguments.append('es') + + cpp_method_name = DartUtilities.scoped_name(interface, method, DartUtilities.cpp_name(method)) + return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) + + +# Mapping of IDL type to DartUtilities helper types. +def dart_arg_type(argument_type): + if (argument_type.cpp_type == 'String'): + return 'DartStringAdapter' + + return argument_type.cpp_type + + +def dart_set_return_value(interface_name, method, cpp_value, for_main_world=False): + idl_type = method.idl_type + extended_attributes = method.extended_attributes + if idl_type.name == 'void': + return None + + release = False + + if idl_type.is_union_type: + release = idl_type.release + + # [CallWith=ScriptState], [RaisesException] +# TODO(terry): Disable ScriptState temporarily need to handle. +# if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or +# 'RaisesException' in extended_attributes or +# idl_type.is_union_type): +# cpp_value = 'result' # use local variable for value +# release = idl_type.release + + auto_scope = not 'DartNoAutoScope' in extended_attributes + script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' + return idl_type.dart_set_return_value(cpp_value, extended_attributes, + script_wrappable=script_wrappable, + release=release, + for_main_world=for_main_world, + auto_scope=auto_scope) + + +def dart_value_to_local_cpp_value(interface, argument, index, auto_scope=True): + extended_attributes = argument.extended_attributes + interface_extended_attributes = interface.extended_attributes + idl_type = argument.idl_type + name = argument.name + # TODO(terry): Variadic arguments are not handled but treated as one argument. + # if argument.is_variadic: + # vector_type = 'WillBeHeapVector' if idl_type.is_will_be_garbage_collected else 'Vector' + # return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArguments<{cpp_type}>(info, {index}))'.format( + # cpp_type=idl_type.cpp_type, name=name, index=index, vector_type=vector_type) + + # FIXME: V8 has some special logic around the addEventListener and + # removeEventListener methods that should be added in somewhere. + # There is also some logic in systemnative.py to force a null check + # for the useCapture argument of those same methods that we may need to + # pull over. + null_check = (argument.is_optional and \ + (idl_type.is_callback_interface or idl_type == 'Dictionary')) or \ + (argument.default_value and argument.default_value.is_null) + + return idl_type.dart_value_to_local_cpp_value( + interface_extended_attributes, extended_attributes, name, null_check, + index=index, auto_scope=auto_scope) + + +################################################################################ +# Auxiliary functions +################################################################################ + +# [NotEnumerable] +def property_attributes(method): + extended_attributes = method.extended_attributes + property_attributes_list = [] + if 'NotEnumerable' in extended_attributes: + property_attributes_list.append('v8::DontEnum') + if 'ReadOnly' in extended_attributes: + property_attributes_list.append('v8::ReadOnly') + if property_attributes_list: + property_attributes_list.insert(0, 'v8::DontDelete') + return property_attributes_list + + +def union_arguments(idl_type): + """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for union types, for use in setting return value""" + return [arg + for i in range(len(idl_type.member_types)) + for arg in ['result%sEnabled' % i, 'result%s' % i]] + +IdlType.union_arguments = property(lambda self: None) +IdlUnionType.union_arguments = property(union_arguments)
diff --git a/bindings/dart/scripts/dart_tests.py b/bindings/dart/scripts/dart_tests.py new file mode 100644 index 0000000..f0ad19b --- /dev/null +++ b/bindings/dart/scripts/dart_tests.py
@@ -0,0 +1,278 @@ +# Copyright (C) 2014 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +import fnmatch +import os +import shutil +import sys +import tempfile + +from webkitpy.common.checkout.scm.detection import detect_scm_system +from webkitpy.common.system import executive +from webkitpy.common.system.executive import ScriptError + +# Add Source path to PYTHONPATH to support function calls to bindings/scripts +# for compute_dependencies and idl_compiler +module_path = os.path.dirname(__file__) +source_path = os.path.normpath(os.path.join(module_path, os.pardir, + os.pardir, os.pardir, os.pardir, + 'Source')) +sys.path.append(source_path) + +from bindings.scripts.compute_interfaces_info import compute_interfaces_info, interfaces_info +from bindings.scripts.idl_compiler import IdlCompilerV8 + + +PASS_MESSAGE = 'All tests PASS!' +FAIL_MESSAGE = """Some tests FAIL! +To update the reference files, execute: + run-bindings-tests --reset-results + +If the failures are not due to your changes, test results may be out of sync; +please rebaseline them in a separate CL, after checking that tests fail in ToT. +In CL, please set: +NOTRY=true +TBR=(someone in Source/bindings/OWNERS or WATCHLISTS:bindings) +""" + +DEPENDENCY_IDL_FILES = set([ + 'SupportTestPartialInterface.idl', + 'TestImplements.idl', + 'TestImplements2.idl', + 'TestImplements3.idl', + 'TestPartialInterface.idl', + 'TestPartialInterfacePython.idl', + 'TestPartialInterfacePython2.idl', +]) + + +EXTENDED_ATTRIBUTES_FILE = 'bindings/IDLExtendedAttributes.txt' + +all_input_directory = '.' # Relative to Source/ +test_input_directory = os.path.join('bindings', 'tests', 'idls') +reference_directory = os.path.join('bindings', 'tests', 'results') + + +class ScopedTempFileProvider(object): + def __init__(self): + self.file_handles = [] + self.file_paths = [] + self.dir_paths = [] + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + for file_handle in self.file_handles: + os.close(file_handle) + for file_path in self.file_paths: + os.remove(file_path) + for dir_path in self.dir_paths: + # Temporary directories are used as output directories, so they + # contains unknown files (they aren't empty), hence use rmtree + shutil.rmtree(dir_path) + + def new_temp_file(self): + file_handle, file_path = tempfile.mkstemp() + self.file_handles.append(file_handle) + self.file_paths.append(file_path) + return file_handle, file_path + + def new_temp_dir(self): + dir_path = tempfile.mkdtemp() + self.dir_paths.append(dir_path) + return dir_path + + +class DartTests(object): + def __init__(self, reset_results, verbose, provider): + self.reset_results = reset_results + self.verbose = verbose + self.executive = executive.Executive() + self.provider = provider + self.idl_compiler = None + _, self.interfaces_info_filename = provider.new_temp_file() + # Generate output into the reference directory if resetting results, or + # a temp directory if not. + if reset_results: + self.output_directory = reference_directory + else: + self.output_directory = provider.new_temp_dir() + + def run_command(self, cmd): + output = self.executive.run_command(cmd) + if output: + print output + + def generate_from_idl(self, idl_file): + try: + idl_file_fullpath = os.path.realpath(idl_file) + self.idl_compiler.compile_file(idl_file_fullpath) + except ScriptError, e: + print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file) + print e.output + return e.exit_code + + return 0 + + def generate_interface_dependencies(self): + def idl_paths(directory): + return [os.path.join(directory, input_file) + for input_file in os.listdir(directory) + if input_file.endswith('.idl')] + + def idl_paths_recursive(directory): + idl_paths = [] + for dirpath, _, files in os.walk(directory): + idl_paths.extend(os.path.join(dirpath, filename) + for filename in fnmatch.filter(files, '*.idl')) + return idl_paths + + def write_list_file(idl_paths): + list_file, list_filename = self.provider.new_temp_file() + list_contents = ''.join(idl_path + '\n' + for idl_path in idl_paths) + os.write(list_file, list_contents) + return list_filename + + # We compute interfaces info for *all* IDL files, not just test IDL + # files, as code generator output depends on inheritance (both ancestor + # chain and inherited extended attributes), and some real interfaces + # are special-cased, such as Node. + # + # For example, when testing the behavior of interfaces that inherit + # from Node, we also need to know that these inherit from EventTarget, + # since this is also special-cased and Node inherits from EventTarget, + # but this inheritance information requires computing dependencies for + # the real Node.idl file. + try: + compute_interfaces_info(idl_paths_recursive(all_input_directory)) + + except ScriptError, e: + print 'ERROR: compute_interfaces_info.py' + print e.output + return e.exit_code + + return 0 + + def delete_cache_files(self): + # FIXME: Instead of deleting cache files, don't generate them. + cache_files = [os.path.join(self.output_directory, output_file) + for output_file in os.listdir(self.output_directory) + if (output_file in ('lextab.py', # PLY lex + 'lextab.pyc', + 'parsetab.pickle') or # PLY yacc + output_file.endswith('.cache'))] # Jinja + for cache_file in cache_files: + os.remove(cache_file) + + def identical_file(self, reference_filename, output_filename): + reference_basename = os.path.basename(reference_filename) + cmd = ['diff', + '-u', + '-N', + reference_filename, + output_filename] + try: + self.run_command(cmd) + except ScriptError, e: + # run_command throws an exception on diff (b/c non-zero exit code) + print 'FAIL: %s' % reference_basename + print e.output + return False + + if self.verbose: + print 'PASS: %s' % reference_basename + return True + + def identical_output_files(self): + file_pairs = [(os.path.join(reference_directory, output_file), + os.path.join(self.output_directory, output_file)) + for output_file in os.listdir(self.output_directory)] + return all([self.identical_file(reference_filename, output_filename) + for (reference_filename, output_filename) in file_pairs]) + + def no_excess_files(self): + generated_files = set(os.listdir(self.output_directory)) + generated_files.add('.svn') # Subversion working copy directory + excess_files = [output_file + for output_file in os.listdir(reference_directory) + if output_file not in generated_files] + if excess_files: + print ('Excess reference files! ' + '(probably cruft from renaming or deleting):\n' + + '\n'.join(excess_files)) + return False + return True + + def run_tests(self): + # Generate output, immediately dying on failure + if self.generate_interface_dependencies(): + return False + + self.idl_compiler = IdlCompilerV8(self.output_directory, + EXTENDED_ATTRIBUTES_FILE, + interfaces_info=interfaces_info, + only_if_changed=True) + + for input_filename in os.listdir(test_input_directory): + if not input_filename.endswith('.idl'): + continue + if input_filename in DEPENDENCY_IDL_FILES: + # Dependencies aren't built (they are used by the dependent) + if self.verbose: + print 'DEPENDENCY: %s' % input_filename + continue + + idl_path = os.path.join(test_input_directory, input_filename) + if self.generate_from_idl(idl_path): + return False + if self.reset_results and self.verbose: + print 'Reset results: %s' % input_filename + + self.delete_cache_files() + + # Detect all changes + passed = self.identical_output_files() + passed &= self.no_excess_files() + return passed + + def main(self): + current_scm = detect_scm_system(os.curdir) + os.chdir(os.path.join(current_scm.checkout_root, 'Source')) + + all_tests_passed = self.run_tests() + if all_tests_passed: + if self.verbose: + print + print PASS_MESSAGE + return 0 + print + print FAIL_MESSAGE + return -1 + + +def run_dart_tests(reset_results, verbose): + with ScopedTempFileProvider() as provider: + return DartTests(reset_results, verbose, provider).main()
diff --git a/bindings/dart/scripts/dart_types.py b/bindings/dart/scripts/dart_types.py new file mode 100644 index 0000000..1ca39fb --- /dev/null +++ b/bindings/dart/scripts/dart_types.py
@@ -0,0 +1,795 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Functions for type handling and type conversion (Blink/C++ <-> Dart:HTML). + +Extends IdlType and IdlUnionType with C++-specific properties, methods, and +class methods. + +Spec: +http://www.w3.org/TR/WebIDL/#es-type-mapping + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import posixpath +from idl_types import IdlType, IdlUnionType, TYPE_NAMES +import dart_attributes # for IdlType.constructor_type_name +from dart_utilities import DartUtilities +from v8_globals import includes + + +################################################################################ +# CPP -specific handling of IDL types for Dart:Blink +################################################################################ + +NON_WRAPPER_TYPES = frozenset([ + 'CompareHow', + 'Dictionary', + 'EventHandler', + 'EventListener', + 'MediaQueryListListener', + 'NodeFilter', + 'SerializedScriptValue', +]) +TYPED_ARRAYS = { + # (cpp_type, dart_type), used by constructor templates + 'ArrayBuffer': (None, 'ByteBuffer'), + 'ArrayBufferView': (None, 'ByteData'), + 'Float32Array': ('float', 'Float32List'), + 'Float64Array': ('double', 'Float64List'), + 'Int8Array': ('signed char', 'Int8List'), + 'Int16Array': ('short', 'Int16List'), + 'Int32Array': ('int', 'Int32List'), + 'Uint8Array': ('unsigned char', 'Uint8List'), + 'Uint8ClampedArray': ('unsigned char', 'Uint8ClampedList'), + 'Uint16Array': ('unsigned short', 'Uint16List'), + 'Uint32Array': ('unsigned int', 'Uint32List'), +} + +IdlType.is_typed_array_type = property( + lambda self: self.base_type in TYPED_ARRAYS) + + +IdlType.is_wrapper_type = property( + lambda self: (self.is_interface_type and + self.base_type not in NON_WRAPPER_TYPES)) + + +################################################################################ +# C++ types +################################################################################ + +CPP_TYPE_SAME_AS_IDL_TYPE = set([ + 'double', + 'float', + 'long long', + 'unsigned long long', +]) +CPP_INT_TYPES = set([ + 'byte', + 'long', + 'short', +]) +CPP_UNSIGNED_TYPES = set([ + 'octet', + 'unsigned int', + 'unsigned long', + 'unsigned short', +]) +CPP_SPECIAL_CONVERSION_RULES = { + 'CompareHow': 'Range::CompareHow', + 'Date': 'double', + 'Dictionary': 'Dictionary', + 'EventHandler': 'EventListener*', + 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', + 'Promise': 'ScriptPromise', + 'ScriptValue': 'ScriptValue', + # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345529 + 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', + 'boolean': 'bool', + 'unrestricted double': 'double', + 'unrestricted float': 'float', +} + + +def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_in_cpp_sequence=False): + """Returns C++ type corresponding to IDL type. + + |idl_type| argument is of type IdlType, while return value is a string + + Args: + idl_type: + IdlType + used_as_argument: + bool, True if idl_type's raw/primitive C++ type should be returned. + will_be_in_heap_object: + bool, True if idl_type will be part of a possibly heap allocated + object (e.g., appears as an element of a C++ heap vector type.) + The C++ type of an interface type changes, if so. + """ + extended_attributes = extended_attributes or {} + idl_type = idl_type.preprocessed_type + + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + vector_type = cpp_ptr_type('Vector', 'HeapVector', array_or_sequence_type.gc_type) + return cpp_template_type(vector_type, array_or_sequence_type.cpp_type_args(used_in_cpp_sequence=True)) + + # Simple types + base_idl_type = idl_type.base_type + + if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: + return base_idl_type + if base_idl_type in CPP_INT_TYPES: + return 'int' + if base_idl_type in CPP_UNSIGNED_TYPES: + return 'unsigned' + if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: + return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] + + if base_idl_type in NON_WRAPPER_TYPES: + return 'RefPtr<%s>' % base_idl_type + if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'): + if not used_as_argument: + return 'String' + return 'DartStringAdapter' + + if idl_type.is_typed_array_type and used_as_argument: + return 'RefPtr<%s>' % base_idl_type + if idl_type.is_callback_interface: + return 'OwnPtr<%s>' % base_idl_type + if idl_type.is_interface_type: + implemented_as_class = idl_type.implemented_as + if used_as_argument: + return implemented_as_class + '*' + new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' + ptr_type = cpp_ptr_type('RefPtr', new_type, idl_type.gc_type) + return cpp_template_type(ptr_type, implemented_as_class) + + # Default, assume native type is a pointer with same type name as idl type + return base_idl_type + '*' + + +def cpp_type_union(idl_type, extended_attributes=None, used_as_argument=False, will_be_in_heap_object=False): + return (member_type.cpp_type for member_type in idl_type.member_types) + +# Allow access as idl_type.cpp_type if no arguments +IdlType.cpp_type = property(cpp_type) +IdlUnionType.cpp_type = property(cpp_type_union) +IdlType.cpp_type_args = cpp_type +IdlUnionType.cpp_type_args = cpp_type_union + + +def cpp_template_type(template, inner_type): + """Returns C++ template specialized to type, with space added if needed.""" + if inner_type.endswith('>'): + format_string = '{template}<{inner_type} >' + else: + format_string = '{template}<{inner_type}>' + return format_string.format(template=template, inner_type=inner_type) + + +def cpp_ptr_type(old_type, new_type, gc_type): + if gc_type == 'GarbageCollectedObject': + return new_type + if gc_type == 'WillBeGarbageCollectedObject': + if old_type == 'Vector': + return 'WillBe' + new_type + return old_type + 'WillBe' + new_type + return old_type + + +def v8_type(interface_name): + return 'V8' + interface_name + + +def dart_type(interface_name): + return 'Dart' + str(interface_name) + + +# [ImplementedAs] +# This handles [ImplementedAs] on interface types, not [ImplementedAs] in the +# interface being generated. e.g., given: +# Foo.idl: interface Foo {attribute Bar bar}; +# Bar.idl: [ImplementedAs=Zork] interface Bar {}; +# when generating bindings for Foo, the [ImplementedAs] on Bar is needed. +# This data is external to Foo.idl, and hence computed as global information in +# compute_interfaces_info.py to avoid having to parse IDLs of all used interfaces. +IdlType.implemented_as_interfaces = {} + + +def implemented_as(idl_type): + base_idl_type = idl_type.base_type + if base_idl_type in IdlType.implemented_as_interfaces: + return IdlType.implemented_as_interfaces[base_idl_type] + return base_idl_type + + +IdlType.implemented_as = property(implemented_as) + +IdlType.set_implemented_as_interfaces = classmethod( + lambda cls, new_implemented_as_interfaces: + cls.implemented_as_interfaces.update(new_implemented_as_interfaces)) + +# [GarbageCollected] +IdlType.garbage_collected_types = set() + +IdlType.is_garbage_collected = property( + lambda self: self.base_type in IdlType.garbage_collected_types) + +IdlType.set_garbage_collected_types = classmethod( + lambda cls, new_garbage_collected_types: + cls.garbage_collected_types.update(new_garbage_collected_types)) + + +# [WillBeGarbageCollected] +IdlType.will_be_garbage_collected_types = set() + +IdlType.is_will_be_garbage_collected = property( + lambda self: self.base_type in IdlType.will_be_garbage_collected_types) + +IdlType.set_will_be_garbage_collected_types = classmethod( + lambda cls, new_will_be_garbage_collected_types: + cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected_types)) + + +def gc_type(idl_type): + if idl_type.is_garbage_collected: + return 'GarbageCollectedObject' + if idl_type.is_will_be_garbage_collected: + return 'WillBeGarbageCollectedObject' + return 'RefCountedObject' + +IdlType.gc_type = property(gc_type) + + +################################################################################ +# Includes +################################################################################ + +def includes_for_cpp_class(class_name, relative_dir_posix): + return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h')]) + +# TODO(terry): Will we need this group header for dart:blink? +INCLUDES_FOR_TYPE = { + 'object': set(), + 'CompareHow': set(), + 'Dictionary': set(['bindings/common/Dictionary.h']), + 'EventHandler': set(), + 'EventListener': set(), + 'HTMLCollection': set(['bindings/core/dart/DartHTMLCollection.h', + 'core/dom/ClassCollection.h', + 'core/dom/TagCollection.h', + 'core/html/HTMLCollection.h', + 'core/html/HTMLFormControlsCollection.h', + 'core/html/HTMLTableRowsCollection.h']), + 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), + 'NodeList': set(['bindings/core/dart/DartNodeList.h', + 'core/dom/NameNodeList.h', + 'core/dom/NodeList.h', + 'core/dom/StaticNodeList.h', + 'core/html/LabelsNodeList.h']), + 'Promise': set(), + 'SerializedScriptValue': set(), + 'ScriptValue': set(['bindings/dart/DartScriptValue.h']), +} + + +def includes_for_type(idl_type): + idl_type = idl_type.preprocessed_type + + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + return includes_for_type(array_or_sequence_type) + + # Simple types + base_idl_type = idl_type.base_type + if base_idl_type in INCLUDES_FOR_TYPE: + return INCLUDES_FOR_TYPE[base_idl_type] + if idl_type.is_basic_type: + return set() + if idl_type.is_typed_array_type: + # Typed array factory methods are already provided by DartUtilities.h. + return set([]) + if base_idl_type.endswith('ConstructorConstructor'): + # FIXME: rename to NamedConstructor + # FIXME: replace with a [NamedConstructorAttribute] extended attribute + # Ending with 'ConstructorConstructor' indicates a named constructor, + # and these do not have header files, as they are part of the generated + # bindings for the interface + return set() + if base_idl_type.endswith('Constructor'): + # FIXME: replace with a [ConstructorAttribute] extended attribute + base_idl_type = idl_type.constructor_type_name + return set(['Dart%s.h' % base_idl_type]) + +IdlType.includes_for_type = property(includes_for_type) +IdlUnionType.includes_for_type = property( + lambda self: set.union(*[includes_for_type(member_type) + for member_type in self.member_types])) + + +def add_includes_for_type(idl_type): + includes.update(idl_type.includes_for_type) + +IdlType.add_includes_for_type = add_includes_for_type +IdlUnionType.add_includes_for_type = add_includes_for_type + + +def includes_for_interface(interface_name): + return IdlType(interface_name).includes_for_type + + +def add_includes_for_interface(interface_name): + includes.update(includes_for_interface(interface_name)) + + +################################################################################ +# Dart -> C++ +################################################################################ + +# TODO(terry): Need to fix to handle getter/setters for onEvent. +DART_FIX_ME = 'DART_UNIMPLEMENTED(/* Conversion unimplemented*/);' + +# For a given IDL type, the DartHandle to C++ conversion. +DART_TO_CPP_VALUE = { + # Basic + 'Date': 'DartUtilities::dartToDate(args, {index}, exception)', + 'DOMString': 'DartUtilities::dartToString{null_check}(args, {index}, exception, {auto_scope})', + 'ByteString': 'DartUtilities::dartToByteString{null_check}(args, {index}, exception, {auto_scope})', + 'ScalarValueString': 'DartUtilities::dartToScalarValueString{null_check}(args, {index}, exception, {auto_scope})', + 'boolean': 'DartUtilities::dartToBool{null_check}(args, {index}, exception)', + 'float': 'static_cast<float>(DartUtilities::dartToDouble(args, {index}, exception))', + 'unrestricted float': 'static_cast<float>(DartUtilities::dartToDouble(args, {index}, exception))', + 'double': 'DartUtilities::dartToDouble(args, {index}, exception)', + 'unrestricted double': 'DartUtilities::dartToDouble(args, {index}, exception)', + # FIXME(vsm): Inconsistent with V8. + 'byte': 'DartUtilities::dartToUnsigned(args, {index}, exception)', + 'octet': 'DartUtilities::dartToUnsigned(args, {index}, exception)', + 'short': 'DartUtilities::dartToInt(args, {index}, exception)', + 'unsigned short': 'DartUtilities::dartToUnsigned(args, {index}, exception)', + 'long': 'DartUtilities::dartToInt(args, {index}, exception)', + 'unsigned long': 'DartUtilities::dartToUnsignedLongLong(args, {index}, exception)', + 'long long': 'DartUtilities::dartToLongLong(args, {index}, exception)', + 'unsigned long long': 'DartUtilities::dartToUnsignedLongLong(args, {index}, exception)', + # Interface types + 'CompareHow': 'static_cast<Range::CompareHow>(0) /* FIXME, DART_TO_CPP_VALUE[CompareHow] */', + 'Dictionary': 'DartUtilities::dartToDictionary{null_check}(args, {index}, exception)', + 'EventTarget': '0 /* FIXME, DART_TO_CPP_VALUE[EventTarget] */', + 'MediaQueryListListener': 'nullptr /* FIXME, DART_TO_CPP_VALUE[MediaQueryListener] */', + 'NodeFilter': 'nullptr /* FIXME, DART_TO_CPP_VALUE[NodeFilter] */', + 'Promise': 'nullptr /* FIXME, DART_TO_CPP_VALUE[Promise] */', + 'SerializedScriptValue': 'nullptr /* FIXME, DART_TO_CPP_VALUE[SerializedScriptValue] */', + 'ScriptValue': 'DartUtilities::dartToScriptValue{null_check}(args, {index})', + # FIXME(vsm): Why don't we have an entry for Window? V8 does. + # I think I removed this as the Window object is more special in V8 - it's the + # global context as well. Do we need to special case it? + 'XPathNSResolver': 'nullptr /* FIXME, DART_TO_CPP_VALUE[XPathNSResolver] */', + # FIXME(vsm): This is an enum type (defined in StorageQuota.idl). + # We should handle it automatically, but map to a String for now. + 'StorageType': 'DartUtilities::dartToString(args, {index}, exception, {auto_scope})', +} + + +def dart_value_to_cpp_value(idl_type, interface_extended_attributes, extended_attributes, variable_name, + null_check, index, auto_scope=True): + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + return dart_value_to_cpp_value_array_or_sequence(array_or_sequence_type, variable_name, index) + + # Simple types + idl_type = idl_type.preprocessed_type + add_includes_for_type(idl_type) + base_idl_type = idl_type.base_type + + if 'EnforceRange' in extended_attributes: + arguments = ', '.join([variable_name, 'EnforceRange', 'exceptionState']) + elif idl_type.is_integer_type: # NormalConversion + arguments = ', '.join([variable_name, 'es']) + else: + arguments = variable_name + + if base_idl_type in DART_TO_CPP_VALUE: + cpp_expression_format = DART_TO_CPP_VALUE[base_idl_type] + elif idl_type.is_typed_array_type: + # FIXME(vsm): V8 generates a type check here as well. Do we need one? + # FIXME(vsm): When do we call the externalized version? E.g., see + # bindings/dart/custom/DartWaveShaperNodeCustom.cpp - it calls + # DartUtilities::dartToExternalizedArrayBufferView instead. + # V8 always converts null here + cpp_expression_format = ('DartUtilities::dartTo{idl_type}WithNullCheck(args, {index}, exception)') + elif idl_type.is_callback_interface: + cpp_expression_format = ('Dart{idl_type}::create{null_check}(args, {index}, exception)') + else: + cpp_expression_format = ('Dart{idl_type}::toNative{null_check}(args, {index}, exception)') + + # We allow the calling context to force a null check to handle + # some cases that require calling context info. V8 handles all + # of this differently, and we may wish to reconsider this approach + null_check = 'WithNullCheck' \ + if null_check or allow_null(idl_type, interface_extended_attributes, extended_attributes) else '' + return cpp_expression_format.format(null_check=null_check, + arguments=arguments, + index=index, + idl_type=base_idl_type, + auto_scope=DartUtilities.bool_to_cpp(auto_scope)) + + +def dart_value_to_cpp_value_array_or_sequence(array_or_sequence_type, variable_name, index): + # Index is None for setters, index (starting at 0) for method arguments, + # and is used to provide a human-readable exception message + + if index is None: + index = 0 # special case, meaning "setter" +# else: +# index += 1 # human-readable index + if (array_or_sequence_type.is_interface_type and + array_or_sequence_type.name != 'Dictionary'): + this_cpp_type = array_or_sequence_type.cpp_type + ref_ptr_type = 'Member' if array_or_sequence_type.is_will_be_garbage_collected else 'RefPtr' + # FIXME(vsm): We're not using ref_ptr_type.... + expression_format = 'DartUtilities::toNativeVector<{cpp_type} >(args, {index}, {variable_name}, exception)' + add_includes_for_type(array_or_sequence_type) + else: + ref_ptr_type = None + this_cpp_type = array_or_sequence_type.cpp_type + expression_format = 'DartUtilities::toNativeVector<{cpp_type}>(args, {index}, {variable_name}, exception)' + expression = expression_format.format(array_or_sequence_type=array_or_sequence_type.name, + cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type, + variable_name=variable_name) + return expression + + +def dart_value_to_local_cpp_value(idl_type, interface_extended_attributes, extended_attributes, + variable_name, null_check, index=None, auto_scope=True): + """Returns an expression that converts a Dart value to a C++ value as a local value.""" + idl_type = idl_type.preprocessed_type + + cpp_value = dart_value_to_cpp_value( + idl_type, interface_extended_attributes, extended_attributes, + variable_name, null_check, index, auto_scope) + + return cpp_value + +IdlType.dart_value_to_local_cpp_value = dart_value_to_local_cpp_value +IdlUnionType.dart_value_to_local_cpp_value = dart_value_to_local_cpp_value + + +# Insure that we don't use C++ reserved names. Today on default is a problem. +def check_reserved_name(name): + return 'default_value' if (name == 'default') else name + + +################################################################################ +# C++ -> V8 +################################################################################ + +def preprocess_idl_type(idl_type): + if idl_type.is_enum: + # Enumerations are internally DOMStrings + return IdlType('DOMString') + if (idl_type.name == 'Any' or idl_type.is_callback_function): + return IdlType('ScriptValue') + return idl_type + +IdlType.preprocessed_type = property(preprocess_idl_type) +IdlUnionType.preprocessed_type = property(preprocess_idl_type) + + +def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes): + """Returns IDL type and value, with preliminary type conversions applied.""" + idl_type = idl_type.preprocessed_type + if idl_type.name == 'Promise': + idl_type = IdlType('ScriptValue') + # FIXME(vsm): V8 maps 'long long' and 'unsigned long long' to double + # as they are not representable in ECMAScript. Should we do the same? + + # HTML5 says that unsigned reflected attributes should be in the range + # [0, 2^31). When a value isn't in this range, a default value (or 0) + # should be returned instead. + extended_attributes = extended_attributes or {} + if ('Reflect' in extended_attributes and + idl_type.base_type in ['unsigned long', 'unsigned short']): + cpp_value = cpp_value.replace('getUnsignedIntegralAttribute', + 'getIntegralAttribute') + cpp_value = 'std::max(0, %s)' % cpp_value + return idl_type, cpp_value + + +def dart_conversion_type(idl_type, extended_attributes): + """Returns Dart conversion type, adding any additional includes. + + The Dart conversion type is used to select the C++ -> Dart conversion function + or setDart*ReturnValue function; it can be an idl_type, a cpp_type, or a + separate name for the type of conversion (e.g., 'DOMWrapper'). + """ + extended_attributes = extended_attributes or {} + + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + if array_or_sequence_type.is_interface_type: + add_includes_for_type(array_or_sequence_type) + return 'array' + + # Simple types + base_idl_type = idl_type.base_type + # Basic types, without additional includes + if base_idl_type in CPP_INT_TYPES or base_idl_type == 'long long': + return 'int' + if base_idl_type in CPP_UNSIGNED_TYPES or base_idl_type == 'unsigned long long': + return 'unsigned' + if base_idl_type == 'DOMString': + if 'TreatReturnedNullStringAs' not in extended_attributes: + return 'DOMString' + treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs'] + if treat_returned_null_string_as == 'Null': + return 'StringOrNull' + if treat_returned_null_string_as == 'Undefined': + return 'StringOrUndefined' + raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returned_null_string_as + if idl_type.is_basic_type or base_idl_type == 'ScriptValue': + return base_idl_type + + # Data type with potential additional includes + add_includes_for_type(idl_type) + if base_idl_type in DART_SET_RETURN_VALUE: # Special dartSetReturnValue treatment + return base_idl_type + + # Typed arrays don't have special Dart* classes for Dart. + if idl_type.is_typed_array_type: + if base_idl_type == 'ArrayBuffer': + return 'ArrayBuffer' + else: + return 'TypedList' + + # Pointer type + return 'DOMWrapper' + +IdlType.dart_conversion_type = dart_conversion_type + + +DART_SET_RETURN_VALUE = { + 'boolean': 'Dart_SetBooleanReturnValue(args, {cpp_value})', + 'int': 'DartUtilities::setDartIntegerReturnValue(args, {cpp_value})', + 'unsigned': 'DartUtilities::setDartUnsignedLongLongReturnValue(args, {cpp_value})', + 'DOMString': 'DartUtilities::setDartStringReturnValue(args, {cpp_value}, {auto_scope})', + # FIXME(terry): Need to handle checking to byte values > 255 throwing exception. + 'ByteString': 'DartUtilities::setDartByteStringReturnValue(args, {cpp_value}, {auto_scope})', + # FIXME(terry): Need to make valid unicode; match UTF-16 to U+FFFD REPLACEMENT CHARACTER. + 'ScalarValueString': 'DartUtilities::setDartScalarValueStringReturnValue(args, {cpp_value}, {auto_scope})', + # [TreatNullReturnValueAs] + 'StringOrNull': 'DartUtilities::setDartStringReturnValueWithNullCheck(args, {cpp_value}, {auto_scope})', + # FIXME(vsm): How should we handle undefined? + 'StringOrUndefined': 'DartUtilities::setDartStringReturnValue(args, {cpp_value}, {auto_scope})', + 'void': '', + # We specialize these as well in Dart. + 'float': 'Dart_SetDoubleReturnValue(args, {cpp_value})', + 'unrestricted float': 'Dart_SetDoubleReturnValue(args, {cpp_value})', + 'double': 'Dart_SetDoubleReturnValue(args, {cpp_value})', + 'unrestricted double': 'Dart_SetDoubleReturnValue(args, {cpp_value})', + # No special function, but instead convert value to Dart_Handle + # and then use general Dart_SetReturnValue. + 'array': 'Dart_SetReturnValue(args, {cpp_value})', + 'Date': 'Dart_SetReturnValue(args, {cpp_value})', + 'EventHandler': DART_FIX_ME, + 'ScriptValue': 'Dart_SetReturnValue(args, {cpp_value})', + 'SerializedScriptValue': DART_FIX_ME, + # DOMWrapper + # TODO(terry): Remove ForMainWorld stuff. + 'DOMWrapperForMainWorld': DART_FIX_ME, + # FIXME(vsm): V8 has a fast path. Do we? + 'DOMWrapperFast': 'Dart{type_name}::returnToDart(args, WTF::getPtr({cpp_value}), {auto_scope})', + 'DOMWrapperDefault': 'Dart{type_name}::returnToDart(args, {cpp_value}, {auto_scope})', + # Typed arrays don't have special Dart* classes for Dart. + 'ArrayBuffer': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferToDart({cpp_value}))', + 'TypedList': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferViewToDart({cpp_value}))', + 'Dictionary': DART_FIX_ME, +} + + +def dart_set_return_value(idl_type, cpp_value, + extended_attributes=None, script_wrappable='', + release=False, for_main_world=False, + auto_scope=True): + """Returns a statement that converts a C++ value to a Dart value and sets it as a return value. + + """ + def dom_wrapper_conversion_type(): + if not script_wrappable: + return 'DOMWrapperDefault' + if for_main_world: + return 'DOMWrapperForMainWorld' + return 'DOMWrapperFast' + + idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes) + this_dart_conversion_type = idl_type.dart_conversion_type(extended_attributes) + # SetReturn-specific overrides + if this_dart_conversion_type in ['Date', 'EventHandler', 'ScriptValue', 'SerializedScriptValue', 'array']: + # Convert value to Dart and then use general Dart_SetReturnValue + # FIXME(vsm): Why do we differ from V8 here? It doesn't have a + # creation_context. + creation_context = '' + if this_dart_conversion_type == 'array': + # FIXME: This is not right if the base type is a primitive, DOMString, etc. + # What is the right check for base type? + if idl_type.base_type not in DART_TO_CPP_VALUE: + creation_context = '<Dart%s>' % idl_type.base_type + + cpp_value = idl_type.cpp_value_to_dart_value(cpp_value, creation_context=creation_context, + extended_attributes=extended_attributes) + if this_dart_conversion_type == 'DOMWrapper': + this_dart_conversion_type = dom_wrapper_conversion_type() + + format_string = DART_SET_RETURN_VALUE[this_dart_conversion_type] + + if release: + cpp_value = '%s.release()' % cpp_value + statement = format_string.format(cpp_value=cpp_value, + type_name=idl_type.name, + script_wrappable=script_wrappable, + auto_scope=DartUtilities.bool_to_cpp(auto_scope)) + return statement + + +def dart_set_return_value_union(idl_type, cpp_value, extended_attributes=None, + script_wrappable='', release=False, for_main_world=False, + auto_scope=True): + """ + release: can be either False (False for all member types) or + a sequence (list or tuple) of booleans (if specified individually). + """ + + return [ + # FIXME(vsm): Why do we use 'result' instead of cpp_value as V8? + member_type.dart_set_return_value('result' + str(i), + extended_attributes, + script_wrappable, + release and release[i], + for_main_world, + auto_scope) + for i, member_type in + enumerate(idl_type.member_types)] + +IdlType.dart_set_return_value = dart_set_return_value +IdlUnionType.dart_set_return_value = dart_set_return_value_union + +IdlType.release = property(lambda self: self.is_interface_type) +IdlUnionType.release = property( + lambda self: [member_type.is_interface_type + for member_type in self.member_types]) + + +CPP_VALUE_TO_DART_VALUE = { + # Built-in types + # FIXME(vsm): V8 uses DateOrNull - do we need a null check? + 'Date': 'DartUtilities::dateToDart({cpp_value})', + 'DOMString': 'DartUtilities::stringToDartString({cpp_value})', + 'boolean': 'DartUtilities::boolToDart({cpp_value})', + 'int': 'DartUtilities::intToDart({cpp_value})', + 'unsigned': 'DartUtilities::unsignedLongLongToDart({cpp_value})', + 'float': 'DartUtilities::doubleToDart({cpp_value})', + 'unrestricted float': 'DartUtilities::doubleToDart({cpp_value})', + 'double': 'DartUtilities::doubleToDart({cpp_value})', + 'unrestricted double': 'DartUtilities::doubleToDart({cpp_value})', + # FIXME(vsm): Dart_Null? + 'void': '', + # Special cases + 'EventHandler': '-----OOPS TO DART-EVENT---', + # We need to generate the NullCheck version in some cases. + 'ScriptValue': 'DartUtilities::scriptValueToDart({cpp_value})', + 'SerializedScriptValue': 'DartUtilities::serializedScriptValueToDart({cpp_value})', + # General + 'array': 'DartDOMWrapper::vectorToDart{creation_context}({cpp_value})', + 'DOMWrapper': 'Dart{idl_type}::toDart({cpp_value})', +} + + +def cpp_value_to_dart_value(idl_type, cpp_value, creation_context='', extended_attributes=None): + """Returns an expression that converts a C++ value to a Dart value.""" + # the isolate parameter is needed for callback interfaces + idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes) + this_dart_conversion_type = idl_type.dart_conversion_type(extended_attributes) + format_string = CPP_VALUE_TO_DART_VALUE[this_dart_conversion_type] + statement = format_string.format( + cpp_value=cpp_value, creation_context=creation_context, + idl_type=idl_type.base_type) + return statement + +IdlType.cpp_value_to_dart_value = cpp_value_to_dart_value + + +# Override idl_type.name to not suffix orNull to the name, in Dart we always +# test for null e.g., +# +# bool isNull = false; +# TYPE* result = receiver->GETTER(isNull); +# if (isNull) +# return; +# +def dart_name(idl_type): + """Return type name. + + http://heycam.github.io/webidl/#dfn-type-name + """ + base_type = idl_type.base_type + base_type_name = TYPE_NAMES.get(base_type, base_type) + if idl_type.is_array: + return base_type_name + 'Array' + if idl_type.is_sequence: + return base_type_name + 'Sequence' + return base_type_name + +IdlType.name = property(dart_name) +IdlUnionType.name = property(dart_name) + + +def typechecked_interface(extended_attributes): + return ('TypeChecking' in extended_attributes and\ + DartUtilities.extended_attribute_value_contains(extended_attributes['TypeChecking'], 'Interface')) + + +def typechecked_argument(idl_type, interface_extended_attributes, extended_attributes): + return (idl_type.is_wrapper_type and + (typechecked_interface(interface_extended_attributes) or + (typechecked_interface(extended_attributes)))) + + +# If True use the WithNullCheck version when converting. +def allow_null(idl_type, interface_extended_attributes, extended_attributes): + if idl_type.base_type in ('DOMString', 'ByteString', 'ScalarValueString'): + # This logic is in cpp_types in v8_types.py, since they handle + # this using the V8StringResource type. We handle it here + if (extended_attributes.get('TreatNullAs') == 'NullString' or + extended_attributes.get('TreatUndefinedAs') == 'NullString'): + return True + + if extended_attributes.get('Default') == 'NullString': + return True + + if extended_attributes.get('Default') == 'Undefined': + return True + + if idl_type.is_nullable: + return True + + return False + else: + # This logic is implemented in the methods.cpp template in V8 + if (idl_type.is_nullable or + (not typechecked_argument(idl_type, interface_extended_attributes, extended_attributes))): + return True + + if extended_attributes.get('Default') == 'Undefined': + return True + + return False
diff --git a/bindings/dart/scripts/dart_utilities.py b/bindings/dart/scripts/dart_utilities.py new file mode 100644 index 0000000..f67437b --- /dev/null +++ b/bindings/dart/scripts/dart_utilities.py
@@ -0,0 +1,164 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Functions shared by various parts of the code generator. + +Extends IdlType and IdlUnion type with |enum_validation_expression| property. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + + +################################################################################ +# Utility function exposed for Dart CodeGenerator. Only 6 methods are special +# to Dart the rest delegate to the v8_utilities functions. +################################################################################ + + +import v8_types # Required +import v8_utilities + + +def _scoped_name(interface, definition, base_name): + # partial interfaces are implemented as separate classes, with their members + # implemented as static member functions + partial_interface_implemented_as = definition.extended_attributes.get('PartialInterfaceImplementedAs') + if partial_interface_implemented_as: + return '%s::%s' % (partial_interface_implemented_as, base_name) + if (definition.is_static or + definition.name in ('Constructor', 'NamedConstructor')): + return '%s::%s' % (v8_utilities.cpp_name(interface), base_name) + return 'receiver->%s' % base_name + + +def _bool_to_cpp(tf): + return "true" if tf else "false" + + +# [ActivityLogging] +def _activity_logging_world_list(member, access_type=None): + """Returns a set of world suffixes for which a definition member has activity logging, for specified access type. + + access_type can be 'Getter' or 'Setter' if only checking getting or setting. + """ + if 'ActivityLogging' not in member.extended_attributes: + return set() + activity_logging = member.extended_attributes['ActivityLogging'] + # [ActivityLogging=For*] (no prefix, starts with the worlds suffix) means + # "log for all use (method)/access (attribute)", otherwise check that value + # agrees with specified access_type (Getter/Setter). + has_logging = (activity_logging.startswith('For') or + (access_type and activity_logging.startswith(access_type))) + if not has_logging: + return set() +# TODO(terry): Remove Me? +# includes.add('bindings/v8/V8DOMActivityLogger.h') + if activity_logging.endswith('ForIsolatedWorlds'): + return set(['']) + return set(['', 'ForMainWorld']) # endswith('ForAllWorlds') + + +# [CallWith] +_CALL_WITH_ARGUMENTS = { + 'ScriptState': '&state', + 'ExecutionContext': 'context', + 'ScriptArguments': 'scriptArguments.release()', + 'ActiveWindow': 'DartUtilities::callingDomWindowForCurrentIsolate()', + 'FirstWindow': 'DartUtilities::enteredDomWindowForCurrentIsolate()', +} + +# List because key order matters, as we want arguments in deterministic order +_CALL_WITH_VALUES = [ + 'ScriptState', + 'ExecutionContext', + 'ScriptArguments', + 'ActiveWindow', + 'FirstWindow', +] + + +def _call_with_arguments(member, call_with_values=None): + # Optional parameter so setter can override with [SetterCallWith] + call_with_values = call_with_values or member.extended_attributes.get('CallWith') + if not call_with_values: + return [] + return [_CALL_WITH_ARGUMENTS[value] + for value in _CALL_WITH_VALUES + if v8_utilities.extended_attribute_value_contains(call_with_values, value)] + + +# [DeprecateAs] +def _deprecate_as(member): + extended_attributes = member.extended_attributes + if 'DeprecateAs' not in extended_attributes: + return None +# TODO(terry): Remove me? +# includes.add('core/frame/UseCounter.h') + return extended_attributes['DeprecateAs'] + + +# [MeasureAs] +def _measure_as(definition_or_member): + extended_attributes = definition_or_member.extended_attributes + if 'MeasureAs' not in extended_attributes: + return None +# TODO(terry): Remove Me? +# includes.add('core/frame/UseCounter.h') + return extended_attributes['MeasureAs'] + + +################################################################################ +# This is the monkey patched methods most delegate to v8_utilities but some are +# overridden in dart_utilities. +################################################################################ + + +class dart_utilities_monkey(): + def __init__(self): + self.base_class_name = 'dart_utilities' + +DartUtilities = dart_utilities_monkey() + +DartUtilities.activity_logging_world_list = _activity_logging_world_list +DartUtilities.bool_to_cpp = _bool_to_cpp +DartUtilities.call_with_arguments = _call_with_arguments +DartUtilities.capitalize = v8_utilities.capitalize +DartUtilities.conditional_string = v8_utilities.conditional_string +DartUtilities.cpp_name = v8_utilities.cpp_name +DartUtilities.deprecate_as = _deprecate_as +DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribute_value_contains +DartUtilities.gc_type = v8_utilities.gc_type +DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute +DartUtilities.has_extended_attribute_value = v8_utilities.has_extended_attribute_value +DartUtilities.measure_as = _measure_as +DartUtilities.per_context_enabled_function_name = v8_utilities.per_context_enabled_function_name +DartUtilities.runtime_enabled_function_name = v8_utilities.runtime_enabled_function_name +DartUtilities.scoped_name = _scoped_name +DartUtilities.strip_suffix = v8_utilities.strip_suffix +DartUtilities.uncapitalize = v8_utilities.uncapitalize +DartUtilities.v8_class_name = v8_utilities.v8_class_name
diff --git a/bindings/dart/scripts/idl_files.py b/bindings/dart/scripts/idl_files.py new file mode 100644 index 0000000..8a15e54 --- /dev/null +++ b/bindings/dart/scripts/idl_files.py
@@ -0,0 +1,750 @@ +# TODO(terry): Temporary file. Process will be driven by GYP not this file. +# List of IDL files from Source/core/core.gypi and Source/modules/modules.gypi + +import os + + +def full_path(paths, files): + full_paths = [] + for relative_file in files: + correct_relative_path = os.path.join(paths[0], paths[1], relative_file) + full_paths.append(os.path.realpath(correct_relative_path)) + return full_paths + + +# This list is copied from Source/core/core.gypi 'core_idl_files' +# Core IDL files bindings (.dart, .cpp and .h files) will be generated +core_idl_files = [ + 'animation/Animation.idl', + 'animation/AnimationEffect.idl', + 'animation/AnimationPlayer.idl', + 'animation/AnimationNode.idl', + 'animation/AnimationTimeline.idl', + 'animation/Timing.idl', + 'clipboard/DataTransfer.idl', + 'clipboard/DataTransferItem.idl', + 'clipboard/DataTransferItemList.idl', + 'css/CSS.idl', + 'css/CSSCharsetRule.idl', + 'css/CSSFontFaceLoadEvent.idl', + 'css/CSSFontFaceRule.idl', + 'css/CSSImportRule.idl', + 'css/CSSKeyframeRule.idl', + 'css/CSSKeyframesRule.idl', + 'css/CSSMediaRule.idl', + 'css/CSSPageRule.idl', + 'css/CSSPrimitiveValue.idl', + 'css/CSSRule.idl', + 'css/CSSRuleList.idl', + 'css/CSSStyleDeclaration.idl', + 'css/CSSStyleRule.idl', + 'css/CSSStyleSheet.idl', + 'css/CSSSupportsRule.idl', + 'css/CSSUnknownRule.idl', + 'css/CSSValue.idl', + 'css/CSSValueList.idl', + 'css/CSSViewportRule.idl', + 'css/Counter.idl', + 'css/FontFace.idl', + 'css/FontFaceSet.idl', + 'css/FontFaceSetForEachCallback.idl', + 'css/MediaList.idl', + 'css/MediaQueryList.idl', + 'css/RGBColor.idl', + 'css/Rect.idl', + 'css/StyleMedia.idl', + 'css/StyleSheet.idl', + 'css/StyleSheetList.idl', + 'css/WebKitCSSFilterRule.idl', + 'css/WebKitCSSFilterValue.idl', + 'css/WebKitCSSMatrix.idl', + 'css/WebKitCSSTransformValue.idl', + 'dom/Attr.idl', + 'dom/CDATASection.idl', + 'dom/CharacterData.idl', + 'dom/ClientRect.idl', + 'dom/ClientRectList.idl', + 'dom/Comment.idl', + 'dom/DOMError.idl', + 'dom/DOMException.idl', + 'dom/DOMImplementation.idl', + 'dom/DOMSettableTokenList.idl', + 'dom/DOMStringList.idl', + 'dom/DOMStringMap.idl', + 'dom/DOMTokenList.idl', + 'dom/Document.idl', + 'dom/DocumentFragment.idl', + 'dom/DocumentType.idl', + 'dom/Element.idl', + 'dom/MessageChannel.idl', + 'dom/MessagePort.idl', + 'dom/MutationObserver.idl', + 'dom/MutationRecord.idl', + 'dom/NamedNodeMap.idl', + 'dom/Node.idl', + 'dom/NodeFilter.idl', + 'dom/NodeIterator.idl', + 'dom/NodeList.idl', + 'dom/Notation.idl', + 'dom/ProcessingInstruction.idl', + 'dom/Range.idl', + 'dom/RequestAnimationFrameCallback.idl', + 'dom/StringCallback.idl', + 'dom/Text.idl', + 'dom/Touch.idl', + 'dom/TouchList.idl', + 'dom/TreeWalker.idl', + 'dom/URL.idl', + 'dom/XMLDocument.idl', + 'dom/shadow/ShadowRoot.idl', + 'events/AnimationPlayerEvent.idl', + 'events/ApplicationCacheErrorEvent.idl', + 'events/AutocompleteErrorEvent.idl', + 'events/BeforeUnloadEvent.idl', + 'events/CompositionEvent.idl', + 'events/CustomEvent.idl', + 'events/ErrorEvent.idl', + 'events/Event.idl', + 'events/EventTarget.idl', + 'events/FocusEvent.idl', + 'events/HashChangeEvent.idl', + 'events/KeyboardEvent.idl', + 'events/MessageEvent.idl', + 'events/MouseEvent.idl', + 'events/MutationEvent.idl', + 'events/OverflowEvent.idl', + 'events/PageTransitionEvent.idl', + 'events/PopStateEvent.idl', + 'events/ProgressEvent.idl', + 'events/ResourceProgressEvent.idl', + 'events/SecurityPolicyViolationEvent.idl', + 'events/TextEvent.idl', + 'events/TouchEvent.idl', + 'events/TransitionEvent.idl', + 'events/UIEvent.idl', + 'events/WebKitAnimationEvent.idl', + 'events/WheelEvent.idl', + 'fileapi/Blob.idl', + 'fileapi/File.idl', + 'fileapi/FileError.idl', + 'fileapi/FileList.idl', + 'fileapi/FileReader.idl', + 'fileapi/FileReaderSync.idl', + 'fileapi/Stream.idl', + 'frame/BarProp.idl', + 'frame/Console.idl', + 'frame/ConsoleBase.idl', + 'frame/History.idl', + 'frame/ImageBitmap.idl', + 'frame/Location.idl', + 'frame/Navigator.idl', + 'frame/Screen.idl', + 'frame/WebKitPoint.idl', + 'frame/Window.idl', + 'html/FormData.idl', + 'html/HTMLAllCollection.idl', + 'html/HTMLAnchorElement.idl', + 'html/HTMLAppletElement.idl', + 'html/HTMLAreaElement.idl', + 'html/HTMLAudioElement.idl', + 'html/HTMLBRElement.idl', + 'html/HTMLBaseElement.idl', + 'html/HTMLBodyElement.idl', + 'html/HTMLButtonElement.idl', + 'html/HTMLCanvasElement.idl', + 'html/HTMLCollection.idl', + 'html/HTMLContentElement.idl', + 'html/HTMLDListElement.idl', + 'html/HTMLDataListElement.idl', + 'html/HTMLDetailsElement.idl', + 'html/HTMLDialogElement.idl', + 'html/HTMLDirectoryElement.idl', + 'html/HTMLDivElement.idl', + 'html/HTMLDocument.idl', + 'html/HTMLElement.idl', + 'html/HTMLEmbedElement.idl', + 'html/HTMLFieldSetElement.idl', + 'html/HTMLFontElement.idl', + 'html/HTMLFormControlsCollection.idl', + 'html/HTMLFormElement.idl', + 'html/HTMLFrameElement.idl', + 'html/HTMLFrameSetElement.idl', + 'html/HTMLHRElement.idl', + 'html/HTMLHeadElement.idl', + 'html/HTMLHeadingElement.idl', + 'html/HTMLHtmlElement.idl', + 'html/HTMLIFrameElement.idl', + 'html/HTMLImageElement.idl', + 'html/HTMLInputElement.idl', + 'html/HTMLKeygenElement.idl', + 'html/HTMLLIElement.idl', + 'html/HTMLLabelElement.idl', + 'html/HTMLLegendElement.idl', + 'html/HTMLLinkElement.idl', + 'html/HTMLMapElement.idl', + 'html/HTMLMarqueeElement.idl', + 'html/HTMLMediaElement.idl', + 'html/HTMLMenuElement.idl', + 'html/HTMLMetaElement.idl', + 'html/HTMLMeterElement.idl', + 'html/HTMLModElement.idl', + 'html/HTMLOListElement.idl', + 'html/HTMLObjectElement.idl', + 'html/HTMLOptGroupElement.idl', + 'html/HTMLOptionElement.idl', + 'html/HTMLOptionsCollection.idl', + 'html/HTMLOutputElement.idl', + 'html/HTMLParagraphElement.idl', + 'html/HTMLParamElement.idl', + 'html/HTMLPictureElement.idl', + 'html/HTMLPreElement.idl', + 'html/HTMLProgressElement.idl', + 'html/HTMLQuoteElement.idl', + 'html/HTMLScriptElement.idl', + 'html/HTMLSelectElement.idl', + 'html/HTMLShadowElement.idl', + 'html/HTMLSourceElement.idl', + 'html/HTMLSpanElement.idl', + 'html/HTMLStyleElement.idl', + 'html/HTMLTableCaptionElement.idl', + 'html/HTMLTableCellElement.idl', + 'html/HTMLTableColElement.idl', + 'html/HTMLTableElement.idl', + 'html/HTMLTableRowElement.idl', + 'html/HTMLTableSectionElement.idl', + 'html/HTMLTemplateElement.idl', + 'html/HTMLTextAreaElement.idl', + 'html/HTMLTitleElement.idl', + 'html/HTMLTrackElement.idl', + 'html/HTMLUListElement.idl', + 'html/HTMLUnknownElement.idl', + 'html/HTMLVideoElement.idl', + 'html/ImageData.idl', + 'html/MediaController.idl', + 'html/MediaError.idl', + 'html/MediaKeyError.idl', + 'html/MediaKeyEvent.idl', + 'html/RadioNodeList.idl', + 'html/TextMetrics.idl', + 'html/TimeRanges.idl', + 'html/ValidityState.idl', + 'html/VoidCallback.idl', + 'html/canvas/ANGLEInstancedArrays.idl', + 'html/canvas/Canvas2DContextAttributes.idl', + 'html/canvas/CanvasGradient.idl', + 'html/canvas/CanvasPattern.idl', + 'html/canvas/CanvasRenderingContext2D.idl', + 'html/canvas/EXTBlendMinMax.idl', + 'html/canvas/EXTFragDepth.idl', + 'html/canvas/EXTShaderTextureLOD.idl', + 'html/canvas/EXTTextureFilterAnisotropic.idl', + 'html/canvas/OESElementIndexUint.idl', + 'html/canvas/OESStandardDerivatives.idl', + 'html/canvas/OESTextureFloat.idl', + 'html/canvas/OESTextureFloatLinear.idl', + 'html/canvas/OESTextureHalfFloat.idl', + 'html/canvas/OESTextureHalfFloatLinear.idl', + 'html/canvas/OESVertexArrayObject.idl', + 'html/canvas/Path2D.idl', + 'html/canvas/WebGLActiveInfo.idl', + 'html/canvas/WebGLBuffer.idl', + 'html/canvas/WebGLCompressedTextureATC.idl', + 'html/canvas/WebGLCompressedTextureETC1.idl', + 'html/canvas/WebGLCompressedTexturePVRTC.idl', + 'html/canvas/WebGLCompressedTextureS3TC.idl', + 'html/canvas/WebGLContextAttributes.idl', + 'html/canvas/WebGLContextEvent.idl', + 'html/canvas/WebGLDebugRendererInfo.idl', + 'html/canvas/WebGLDebugShaders.idl', + 'html/canvas/WebGLDepthTexture.idl', + 'html/canvas/WebGLDrawBuffers.idl', + 'html/canvas/WebGLFramebuffer.idl', + 'html/canvas/WebGLLoseContext.idl', + 'html/canvas/WebGLProgram.idl', + 'html/canvas/WebGLRenderbuffer.idl', + 'html/canvas/WebGLRenderingContext.idl', + 'html/canvas/WebGLShader.idl', + 'html/canvas/WebGLShaderPrecisionFormat.idl', + 'html/canvas/WebGLTexture.idl', + 'html/canvas/WebGLUniformLocation.idl', + 'html/canvas/WebGLVertexArrayObjectOES.idl', + 'html/ime/InputMethodContext.idl', + 'html/track/AudioTrack.idl', + 'html/track/AudioTrackList.idl', + 'html/track/TextTrack.idl', + 'html/track/TextTrackCue.idl', + 'html/track/TextTrackCueList.idl', + 'html/track/TextTrackList.idl', + 'html/track/TrackEvent.idl', + 'html/track/VideoTrack.idl', + 'html/track/VideoTrackList.idl', + 'html/track/vtt/VTTCue.idl', + 'html/track/vtt/VTTRegion.idl', + 'html/track/vtt/VTTRegionList.idl', + 'inspector/InjectedScriptHost.idl', + 'inspector/InspectorFrontendHost.idl', + 'inspector/InspectorOverlayHost.idl', + 'inspector/JavaScriptCallFrame.idl', + 'loader/appcache/ApplicationCache.idl', + 'page/EventSource.idl', + 'page/PagePopupController.idl', + 'page/Selection.idl', + 'plugins/MimeType.idl', + 'plugins/MimeTypeArray.idl', + 'plugins/Plugin.idl', + 'plugins/PluginArray.idl', + 'storage/Storage.idl', + 'storage/StorageEvent.idl', + 'svg/SVGAElement.idl', + 'svg/SVGAltGlyphDefElement.idl', + 'svg/SVGAltGlyphElement.idl', + 'svg/SVGAltGlyphItemElement.idl', + 'svg/SVGAngle.idl', + 'svg/SVGAnimateElement.idl', + 'svg/SVGAnimateMotionElement.idl', + 'svg/SVGAnimateTransformElement.idl', + 'svg/SVGAnimatedAngle.idl', + 'svg/SVGAnimatedBoolean.idl', + 'svg/SVGAnimatedEnumeration.idl', + 'svg/SVGAnimatedInteger.idl', + 'svg/SVGAnimatedLength.idl', + 'svg/SVGAnimatedLengthList.idl', + 'svg/SVGAnimatedNumber.idl', + 'svg/SVGAnimatedNumberList.idl', + 'svg/SVGAnimatedPreserveAspectRatio.idl', + 'svg/SVGAnimatedRect.idl', + 'svg/SVGAnimatedString.idl', + 'svg/SVGAnimatedTransformList.idl', + 'svg/SVGAnimationElement.idl', + 'svg/SVGCircleElement.idl', + 'svg/SVGClipPathElement.idl', + 'svg/SVGComponentTransferFunctionElement.idl', + 'svg/SVGCursorElement.idl', + 'svg/SVGDefsElement.idl', + 'svg/SVGDescElement.idl', + 'svg/SVGDiscardElement.idl', + 'svg/SVGElement.idl', + 'svg/SVGEllipseElement.idl', + 'svg/SVGFEBlendElement.idl', + 'svg/SVGFEColorMatrixElement.idl', + 'svg/SVGFEComponentTransferElement.idl', + 'svg/SVGFECompositeElement.idl', + 'svg/SVGFEConvolveMatrixElement.idl', + 'svg/SVGFEDiffuseLightingElement.idl', + 'svg/SVGFEDisplacementMapElement.idl', + 'svg/SVGFEDistantLightElement.idl', + 'svg/SVGFEDropShadowElement.idl', + 'svg/SVGFEFloodElement.idl', + 'svg/SVGFEFuncAElement.idl', + 'svg/SVGFEFuncBElement.idl', + 'svg/SVGFEFuncGElement.idl', + 'svg/SVGFEFuncRElement.idl', + 'svg/SVGFEGaussianBlurElement.idl', + 'svg/SVGFEImageElement.idl', + 'svg/SVGFEMergeElement.idl', + 'svg/SVGFEMergeNodeElement.idl', + 'svg/SVGFEMorphologyElement.idl', + 'svg/SVGFEOffsetElement.idl', + 'svg/SVGFEPointLightElement.idl', + 'svg/SVGFESpecularLightingElement.idl', + 'svg/SVGFESpotLightElement.idl', + 'svg/SVGFETileElement.idl', + 'svg/SVGFETurbulenceElement.idl', + 'svg/SVGFilterElement.idl', + 'svg/SVGFontElement.idl', + 'svg/SVGFontFaceElement.idl', + 'svg/SVGFontFaceFormatElement.idl', + 'svg/SVGFontFaceNameElement.idl', + 'svg/SVGFontFaceSrcElement.idl', + 'svg/SVGFontFaceUriElement.idl', + 'svg/SVGForeignObjectElement.idl', + 'svg/SVGGElement.idl', + 'svg/SVGGeometryElement.idl', + 'svg/SVGGlyphElement.idl', + 'svg/SVGGlyphRefElement.idl', + 'svg/SVGGradientElement.idl', + 'svg/SVGGraphicsElement.idl', + 'svg/SVGHKernElement.idl', + 'svg/SVGImageElement.idl', + 'svg/SVGLength.idl', + 'svg/SVGLengthList.idl', + 'svg/SVGLineElement.idl', + 'svg/SVGLinearGradientElement.idl', + 'svg/SVGMPathElement.idl', + 'svg/SVGMarkerElement.idl', + 'svg/SVGMaskElement.idl', + 'svg/SVGMatrix.idl', + 'svg/SVGMetadataElement.idl', + 'svg/SVGMissingGlyphElement.idl', + 'svg/SVGNumber.idl', + 'svg/SVGNumberList.idl', + 'svg/SVGPathElement.idl', + 'svg/SVGPathSeg.idl', + 'svg/SVGPathSegArcAbs.idl', + 'svg/SVGPathSegArcRel.idl', + 'svg/SVGPathSegClosePath.idl', + 'svg/SVGPathSegCurvetoCubicAbs.idl', + 'svg/SVGPathSegCurvetoCubicRel.idl', + 'svg/SVGPathSegCurvetoCubicSmoothAbs.idl', + 'svg/SVGPathSegCurvetoCubicSmoothRel.idl', + 'svg/SVGPathSegCurvetoQuadraticAbs.idl', + 'svg/SVGPathSegCurvetoQuadraticRel.idl', + 'svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl', + 'svg/SVGPathSegCurvetoQuadraticSmoothRel.idl', + 'svg/SVGPathSegLinetoAbs.idl', + 'svg/SVGPathSegLinetoHorizontalAbs.idl', + 'svg/SVGPathSegLinetoHorizontalRel.idl', + 'svg/SVGPathSegLinetoRel.idl', + 'svg/SVGPathSegLinetoVerticalAbs.idl', + 'svg/SVGPathSegLinetoVerticalRel.idl', + 'svg/SVGPathSegList.idl', + 'svg/SVGPathSegMovetoAbs.idl', + 'svg/SVGPathSegMovetoRel.idl', + 'svg/SVGPatternElement.idl', + 'svg/SVGPoint.idl', + 'svg/SVGPointList.idl', + 'svg/SVGPolygonElement.idl', + 'svg/SVGPolylineElement.idl', + 'svg/SVGPreserveAspectRatio.idl', + 'svg/SVGRadialGradientElement.idl', + 'svg/SVGRect.idl', + 'svg/SVGRectElement.idl', + 'svg/SVGRenderingIntent.idl', + 'svg/SVGSVGElement.idl', + 'svg/SVGScriptElement.idl', + 'svg/SVGSetElement.idl', + 'svg/SVGStopElement.idl', + 'svg/SVGStringList.idl', + 'svg/SVGStyleElement.idl', + 'svg/SVGSwitchElement.idl', + 'svg/SVGSymbolElement.idl', + 'svg/SVGTSpanElement.idl', + 'svg/SVGTextContentElement.idl', + 'svg/SVGTextElement.idl', + 'svg/SVGTextPathElement.idl', + 'svg/SVGTextPositioningElement.idl', + 'svg/SVGTitleElement.idl', + 'svg/SVGTransform.idl', + 'svg/SVGTransformList.idl', + 'svg/SVGUnitTypes.idl', + 'svg/SVGUseElement.idl', + 'svg/SVGVKernElement.idl', + 'svg/SVGViewElement.idl', + 'svg/SVGViewSpec.idl', + 'svg/SVGZoomEvent.idl', + 'timing/MemoryInfo.idl', + 'timing/Performance.idl', + 'timing/PerformanceEntry.idl', + 'timing/PerformanceMark.idl', + 'timing/PerformanceMeasure.idl', + 'timing/PerformanceNavigation.idl', + 'timing/PerformanceResourceTiming.idl', + 'timing/PerformanceTiming.idl', + 'workers/DedicatedWorkerGlobalScope.idl', + 'workers/SharedWorker.idl', + 'workers/SharedWorkerGlobalScope.idl', + 'workers/Worker.idl', + 'workers/WorkerConsole.idl', + 'workers/WorkerGlobalScope.idl', + 'workers/WorkerLocation.idl', + 'workers/WorkerNavigator.idl', + 'xml/DOMParser.idl', + 'xml/XMLHttpRequest.idl', + 'xml/XMLHttpRequestEventTarget.idl', + 'xml/XMLHttpRequestProgressEvent.idl', + 'xml/XMLHttpRequestUpload.idl', + 'xml/XMLSerializer.idl', + 'xml/XPathEvaluator.idl', + 'xml/XPathExpression.idl', + 'xml/XPathNSResolver.idl', + 'xml/XPathResult.idl', + 'xml/XSLTProcessor.idl', +] + + +def full_path_core_idl_files(): + return full_path(['Source', 'core'], core_idl_files) + + +# This list is copied from Source/core/core.gypi 'core_dependency_idl_files' +# 'partial interface' or target (right side of) 'implements' +core_dependency_idl_files = [ + 'animation/DocumentAnimation.idl', + 'animation/ElementAnimation.idl', + 'css/DocumentFontFaceSet.idl', + 'dom/ChildNode.idl', + 'dom/DocumentFullscreen.idl', + 'dom/GlobalEventHandlers.idl', + 'dom/ParentNode.idl', + 'dom/URLUtils.idl', + 'dom/URLUtilsReadOnly.idl', + 'events/EventListener.idl', + 'events/NavigatorEvents.idl', + 'frame/NavigatorCPU.idl', + 'frame/NavigatorID.idl', + 'frame/NavigatorLanguage.idl', + 'frame/NavigatorOnLine.idl', + 'frame/WindowBase64.idl', + 'frame/WindowEventHandlers.idl', + 'frame/WindowTimers.idl', + 'html/canvas/CanvasPathMethods.idl', + 'html/canvas/WebGLRenderingContextBase.idl', + 'page/WindowPagePopup.idl', + 'svg/SVGDocument.idl', + 'svg/SVGFilterPrimitiveStandardAttributes.idl', + 'svg/SVGFitToViewBox.idl', + 'svg/SVGTests.idl', + 'svg/SVGURIReference.idl', + 'svg/SVGZoomAndPan.idl', + 'workers/AbstractWorker.idl', + 'xml/DocumentXPathEvaluator.idl', +] + + +def full_path_core_dependency_idl_files(): + return full_path(['Source', 'core'], core_dependency_idl_files) + + +# This list is copied from Source/modules/modules.gypi 'modules_idl_files' +# Modules IDL files bindings (.dart, .cpp and .h files) will be generated +modules_idl_files = [ + 'battery/BatteryManager.idl', + 'crypto/AesKeyAlgorithm.idl', + 'crypto/Crypto.idl', + 'crypto/HmacKeyAlgorithm.idl', + 'crypto/Key.idl', + 'crypto/KeyAlgorithm.idl', + 'crypto/RsaHashedKeyAlgorithm.idl', + 'crypto/RsaKeyAlgorithm.idl', + 'crypto/SubtleCrypto.idl', + 'device_light/DeviceLightEvent.idl', + 'device_orientation/DeviceAcceleration.idl', + 'device_orientation/DeviceMotionEvent.idl', + 'device_orientation/DeviceOrientationEvent.idl', + 'device_orientation/DeviceRotationRate.idl', + 'encoding/TextDecoder.idl', + 'encoding/TextEncoder.idl', + 'encryptedmedia/MediaKeyMessageEvent.idl', + 'encryptedmedia/MediaKeyNeededEvent.idl', + 'encryptedmedia/MediaKeySession.idl', + 'encryptedmedia/MediaKeys.idl', + 'filesystem/DOMFileSystem.idl', + 'filesystem/DOMFileSystemSync.idl', + 'filesystem/DirectoryEntry.idl', + 'filesystem/DirectoryEntrySync.idl', + 'filesystem/DirectoryReader.idl', + 'filesystem/DirectoryReaderSync.idl', + 'filesystem/EntriesCallback.idl', + 'filesystem/Entry.idl', + 'filesystem/EntryCallback.idl', + 'filesystem/EntrySync.idl', + 'filesystem/ErrorCallback.idl', + 'filesystem/FileCallback.idl', + 'filesystem/FileEntry.idl', + 'filesystem/FileEntrySync.idl', + 'filesystem/FileSystemCallback.idl', + 'filesystem/FileWriter.idl', + 'filesystem/FileWriterCallback.idl', + 'filesystem/FileWriterSync.idl', + 'filesystem/Metadata.idl', + 'filesystem/MetadataCallback.idl', + 'gamepad/Gamepad.idl', + 'gamepad/GamepadButton.idl', + 'gamepad/GamepadEvent.idl', + 'gamepad/GamepadList.idl', + 'gamepad/WebKitGamepad.idl', + 'gamepad/WebKitGamepadList.idl', + 'geolocation/Coordinates.idl', + 'geolocation/Geolocation.idl', + 'geolocation/Geoposition.idl', + 'geolocation/PositionCallback.idl', + 'geolocation/PositionError.idl', + 'geolocation/PositionErrorCallback.idl', + 'indexeddb/IDBCursor.idl', + 'indexeddb/IDBCursorWithValue.idl', + 'indexeddb/IDBDatabase.idl', + 'indexeddb/IDBFactory.idl', + 'indexeddb/IDBIndex.idl', + 'indexeddb/IDBKeyRange.idl', + 'indexeddb/IDBObjectStore.idl', + 'indexeddb/IDBOpenDBRequest.idl', + 'indexeddb/IDBRequest.idl', + 'indexeddb/IDBTransaction.idl', + 'indexeddb/IDBVersionChangeEvent.idl', + 'mediasource/MediaSource.idl', + 'mediasource/SourceBuffer.idl', + 'mediasource/SourceBufferList.idl', + 'mediasource/VideoPlaybackQuality.idl', + 'mediastream/MediaDeviceInfo.idl', + 'mediastream/MediaDeviceInfoCallback.idl', + 'mediastream/MediaStream.idl', + 'mediastream/MediaStreamEvent.idl', + 'mediastream/MediaStreamTrack.idl', + 'mediastream/MediaStreamTrackEvent.idl', + 'mediastream/MediaStreamTrackSourcesCallback.idl', + 'mediastream/NavigatorUserMediaError.idl', + 'mediastream/NavigatorUserMediaErrorCallback.idl', + 'mediastream/NavigatorUserMediaSuccessCallback.idl', + 'mediastream/RTCDTMFSender.idl', + 'mediastream/RTCDTMFToneChangeEvent.idl', + 'mediastream/RTCDataChannel.idl', + 'mediastream/RTCDataChannelEvent.idl', + 'mediastream/RTCErrorCallback.idl', + 'mediastream/RTCIceCandidate.idl', + 'mediastream/RTCIceCandidateEvent.idl', + 'mediastream/RTCPeerConnection.idl', + 'mediastream/RTCSessionDescription.idl', + 'mediastream/RTCSessionDescriptionCallback.idl', + 'mediastream/RTCStatsCallback.idl', + 'mediastream/RTCStatsReport.idl', + 'mediastream/RTCStatsResponse.idl', + 'mediastream/SourceInfo.idl', + 'netinfo/NetworkInformation.idl', + 'notifications/Notification.idl', + 'notifications/NotificationPermissionCallback.idl', + 'performance/WorkerPerformance.idl', + 'push_messaging/PushEvent.idl', + 'push_messaging/PushManager.idl', + 'push_messaging/PushRegistration.idl', + 'quota/DeprecatedStorageInfo.idl', + 'quota/DeprecatedStorageQuota.idl', + 'quota/StorageErrorCallback.idl', + 'quota/StorageInfo.idl', + 'quota/StorageQuota.idl', + 'quota/StorageQuotaCallback.idl', + 'quota/StorageUsageCallback.idl', + 'serviceworkers/Client.idl', + 'serviceworkers/FetchEvent.idl', + 'serviceworkers/HeaderMap.idl', + 'serviceworkers/HeaderMapForEachCallback.idl', + 'serviceworkers/InstallEvent.idl', + 'serviceworkers/InstallPhaseEvent.idl', + 'serviceworkers/Request.idl', + 'serviceworkers/Response.idl', + 'serviceworkers/ServiceWorker.idl', + 'serviceworkers/ServiceWorkerClients.idl', + 'serviceworkers/ServiceWorkerContainer.idl', + 'serviceworkers/ServiceWorkerGlobalScope.idl', + 'speech/SpeechGrammar.idl', + 'speech/SpeechGrammarList.idl', + 'speech/SpeechRecognition.idl', + 'speech/SpeechRecognitionAlternative.idl', + 'speech/SpeechRecognitionError.idl', + 'speech/SpeechRecognitionEvent.idl', + 'speech/SpeechRecognitionResult.idl', + 'speech/SpeechRecognitionResultList.idl', + 'speech/SpeechSynthesis.idl', + 'speech/SpeechSynthesisEvent.idl', + 'speech/SpeechSynthesisUtterance.idl', + 'speech/SpeechSynthesisVoice.idl', + 'webaudio/AnalyserNode.idl', + 'webaudio/AudioBuffer.idl', + 'webaudio/AudioBufferCallback.idl', + 'webaudio/AudioBufferSourceNode.idl', + 'webaudio/AudioContext.idl', + 'webaudio/AudioDestinationNode.idl', + 'webaudio/AudioListener.idl', + 'webaudio/AudioNode.idl', + 'webaudio/AudioParam.idl', + 'webaudio/AudioProcessingEvent.idl', + 'webaudio/AudioSourceNode.idl', + 'webaudio/BiquadFilterNode.idl', + 'webaudio/ChannelMergerNode.idl', + 'webaudio/ChannelSplitterNode.idl', + 'webaudio/ConvolverNode.idl', + 'webaudio/DelayNode.idl', + 'webaudio/DynamicsCompressorNode.idl', + 'webaudio/GainNode.idl', + 'webaudio/MediaElementAudioSourceNode.idl', + 'webaudio/MediaStreamAudioDestinationNode.idl', + 'webaudio/MediaStreamAudioSourceNode.idl', + 'webaudio/OfflineAudioCompletionEvent.idl', + 'webaudio/OfflineAudioContext.idl', + 'webaudio/OscillatorNode.idl', + 'webaudio/PannerNode.idl', + 'webaudio/PeriodicWave.idl', + 'webaudio/ScriptProcessorNode.idl', + 'webaudio/WaveShaperNode.idl', + 'webdatabase/Database.idl', + 'webdatabase/DatabaseCallback.idl', + 'webdatabase/DatabaseSync.idl', + 'webdatabase/SQLError.idl', + 'webdatabase/SQLResultSet.idl', + 'webdatabase/SQLResultSetRowList.idl', + 'webdatabase/SQLStatementCallback.idl', + 'webdatabase/SQLStatementErrorCallback.idl', + 'webdatabase/SQLTransaction.idl', + 'webdatabase/SQLTransactionCallback.idl', + 'webdatabase/SQLTransactionErrorCallback.idl', + 'webdatabase/SQLTransactionSync.idl', + 'webdatabase/SQLTransactionSyncCallback.idl', + 'webmidi/MIDIAccess.idl', + 'webmidi/MIDIConnectionEvent.idl', + 'webmidi/MIDIErrorCallback.idl', + 'webmidi/MIDIInput.idl', + 'webmidi/MIDIMessageEvent.idl', + 'webmidi/MIDIOutput.idl', + 'webmidi/MIDIPort.idl', + 'webmidi/MIDISuccessCallback.idl', + 'websockets/CloseEvent.idl', + 'websockets/WebSocket.idl', +] + + +def full_path_modules_idl_files(): + return full_path(['Source', 'modules'], modules_idl_files) + + +# This list is copied from Source/modules/modules.gypi +# 'modules_dependency_idl_files'. +# 'partial interface' or target (right side of) 'implements' +modules_dependency_idl_files = [ + 'battery/NavigatorBattery.idl', + 'beacon/NavigatorBeacon.idl', + 'crypto/WindowCrypto.idl', + 'crypto/WorkerGlobalScopeCrypto.idl', + 'device_light/WindowDeviceLight.idl', + 'device_orientation/WindowDeviceMotion.idl', + 'device_orientation/WindowDeviceOrientation.idl', + 'donottrack/NavigatorDoNotTrack.idl', + 'encryptedmedia/HTMLMediaElementEncryptedMedia.idl', + 'filesystem/DataTransferItemFileSystem.idl', + 'filesystem/HTMLInputElementFileSystem.idl', + 'filesystem/InspectorFrontendHostFileSystem.idl', + 'filesystem/WindowFileSystem.idl', + 'filesystem/WorkerGlobalScopeFileSystem.idl', + 'gamepad/NavigatorGamepad.idl', + 'geolocation/NavigatorGeolocation.idl', + 'imagebitmap/ImageBitmapFactories.idl', + 'imagebitmap/WindowImageBitmapFactories.idl', + 'indexeddb/WindowIndexedDatabase.idl', + 'indexeddb/WorkerGlobalScopeIndexedDatabase.idl', + 'mediasource/HTMLVideoElementMediaSource.idl', + 'mediasource/URLMediaSource.idl', + 'mediastream/NavigatorMediaStream.idl', + 'mediastream/URLMediaStream.idl', + 'mediastream/WindowMediaStream.idl', + 'navigatorcontentutils/NavigatorContentUtils.idl', + 'netinfo/NavigatorNetworkInformation.idl', + 'netinfo/WorkerNavigatorNetworkInformation.idl', + 'performance/SharedWorkerPerformance.idl', + 'performance/WorkerGlobalScopePerformance.idl', + 'push_messaging/NavigatorPushManager.idl', + 'push_messaging/ServiceWorkerGlobalScopePush.idl', + 'quota/NavigatorStorageQuota.idl', + 'quota/WindowQuota.idl', + 'quota/WorkerNavigatorStorageQuota.idl', + 'screen_orientation/ScreenOrientation.idl', + 'serviceworkers/NavigatorServiceWorker.idl', + 'speech/WindowSpeech.idl', + 'speech/WindowSpeechSynthesis.idl', + 'vibration/NavigatorVibration.idl', + 'webaudio/WindowWebAudio.idl', + 'webdatabase/WindowWebDatabase.idl', + 'webdatabase/WorkerGlobalScopeWebDatabase.idl', + 'webmidi/NavigatorWebMIDI.idl', +] + + +def full_path_modules_dependency_idl_files(): + return full_path(['Source', 'modules'], modules_dependency_idl_files)
diff --git a/bindings/dart/scripts/test/__init__.py b/bindings/dart/scripts/test/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bindings/dart/scripts/test/__init__.py
diff --git a/bindings/dart/scripts/test/main.py b/bindings/dart/scripts/test/main.py new file mode 100755 index 0000000..db3c00a --- /dev/null +++ b/bindings/dart/scripts/test/main.py
@@ -0,0 +1,247 @@ +#!/usr/bin/python +# Copyright (C) 2010 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +import traceback + +import fnmatch +from optparse import OptionParser +import os +import shutil +import sys +import tempfile + +import compute_interfaces_info_individual +from compute_interfaces_info_individual import compute_info_individual, info_individual +import compute_interfaces_info_overall +from compute_interfaces_info_overall import compute_interfaces_info_overall, interfaces_info +from compiler import IdlCompilerDart + +# TODO(terry): Temporary solution list of IDLs to parse and IDL as dependencies. +from idl_files import full_path_core_idl_files, full_path_core_dependency_idl_files, full_path_modules_idl_files, full_path_modules_dependency_idl_files + +#from dart_tests import run_dart_tests + + +EXTENDED_ATTRIBUTES_FILE = 'bindings/IDLExtendedAttributes.txt' + +idl_compiler = None + + +def parse_options(): + parser = OptionParser() + + parser.add_option("--output-directory", + action="store", + type="string", + dest="output_directory", + help="Generate output to a known directory") + parser.add_option("-v", "--verbose", + action="store_true", + dest="verbose", + default=False, + help="Show all information messages") + parser.add_option("-k", "--keep", + action="store_true", + dest="keep", + default=False, + help="Don't delete the temporary directory on exit") + parser.add_option("--compute-idls", type='int', help="Compile IDLs interfaces and dependencies (GYP)") + parser.add_option('--globals-only', type='int', help="Generate the globals") + + options, args = parser.parse_args() + + options.compute_idls = bool(options.compute_idls) + options.globals_only = bool(options.globals_only) + + return options + + +class ScopedTempFileProvider(object): + def __init__(self, keep=False): + self.keep = keep + self.dir_paths = [] + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + if not self.keep: + for dir_path in self.dir_paths: + # Temporary directories are used as output directories, so they + # contains unknown files (they aren't empty), hence use rmtree + shutil.rmtree(dir_path) + + def new_temp_dir(self): + dir_path = tempfile.mkdtemp() + self.dir_paths.append(dir_path) + return dir_path + + +class DirectoryProvider(object): + def __init__(self, path=""): + self.dir_path = path + + def __enter__(self): + return self + + def new_temp_dir(self): + return self.dir_path + + +def idl_paths_recursive(directory): + idl_paths = [] + for dirpath, _, files in os.walk(directory): + idl_paths.extend(os.path.join(dirpath, filename) + for filename in fnmatch.filter(files, '*.idl')) + return idl_paths + + +class Build(): + def __init__(self, provider): + self.output_directory = provider.new_temp_dir() + + attrib_file = os.path.join('Source', EXTENDED_ATTRIBUTES_FILE) + # Create compiler. + self.idl_compiler = IdlCompilerDart(self.output_directory, + attrib_file, + interfaces_info=interfaces_info, + only_if_changed=True) + + def format_exception(self, e): + exception_list = traceback.format_stack() + exception_list = exception_list[:-2] + exception_list.extend(traceback.format_tb(sys.exc_info()[2])) + exception_list.extend(traceback.format_exception_only(sys.exc_info()[0], sys.exc_info()[1])) + + exception_str = "Traceback (most recent call last):\n" + exception_str += "".join(exception_list) + # Removing the last \n + exception_str = exception_str[:-1] + + return exception_str + + def generate_from_idl(self, idl_file): + try: + idl_file_fullpath = os.path.realpath(idl_file) + self.idl_compiler.compile_file(idl_file_fullpath) + except Exception as err: + print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file) + print err + print + print 'Stack Dump:' + print self.format_exception(err) + + return 1 + + def generate_global(self): + try: + self.idl_compiler.generate_global() + except Exception as err: + print 'ERROR: idl_compiler.py generate global' + print err + print + print 'Stack Dump:' + print self.format_exception(err) + + return 1 + + return 0 + + +def main(argv): + ''' + Runs Dart IDL code generator; IDL files. IDL files same as GYP files in + Source/bindings/core/core.gypi and Source/bindings/modules/modules.gypi (see + idl_files.py on list of files). + + To run the PYTHONPATH should have the directories: + + Source/bindings/scripts + Source/bindings/scripts/dart + ''' + + options = parse_options() + + if options.compute_idls: + # TODO(terry): Assumes CWD is third_party/WebKit so any call to + # full_path_NNNN is prefixing 'Source/core' to path. + core_idls = full_path_core_idl_files() + core_dependency_idls = full_path_core_dependency_idl_files() + modules_idls = full_path_modules_idl_files() + modules_dependency_idls = full_path_modules_dependency_idl_files() + + all_interfaces = core_idls + modules_idls + all_dependencies = core_dependency_idls + modules_dependency_idls + all_files = all_interfaces + all_dependencies + + # 2-stage computation: individual, then overall + for idl_filename in all_files: + compute_info_individual(idl_filename, 'dart') + info_individuals = [info_individual()] + compute_interfaces_info_overall(info_individuals) + + # Compile just IDLs with interfaces (no dependencies). + if (options.output_directory == None): + with ScopedTempFileProvider(keep=options.keep) as provider: + build = Build(provider) + else: + provider = DirectoryProvider(path=options.output_directory) + build = Build(provider) + + if options.verbose and options.keep: + print 'Output directory %s created' % build.output_directory + + # Compile IDLs + for filename in all_interfaces: + if not filename.endswith('.idl'): + continue + if build.generate_from_idl(filename): + return False + + if options.verbose: + print '%s IDLs with interfaces processed' % len(all_interfaces) + + if options.verbose and not options.keep: + print 'Output directory %s deleted' % build.output_directory + + if options.globals_only: + if (options.output_directory == None): + with ScopedTempFileProvider(keep=options.keep) as provider: + build = Build(provider) + else: + provider = DirectoryProvider(path=options.output_directory) + build = Build(provider) + + if options.verbose: + print 'Generating global...' + + build.generate_global() + + if options.verbose: + print 'Created DartWebkitClassIds .h/.cpp' + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/scripts/__init__.py b/bindings/scripts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bindings/scripts/__init__.py
diff --git a/bindings/scripts/aggregate_generated_bindings.py b/bindings/scripts/aggregate_generated_bindings.py new file mode 100755 index 0000000..abb2b81 --- /dev/null +++ b/bindings/scripts/aggregate_generated_bindings.py
@@ -0,0 +1,236 @@ +#!/usr/bin/python +# +# Copyright (C) 2009 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generate aggregate .cpp files that include multiple V8 binding .cpp files. + +This can be a single output file, to preserve symbol space; or multiple output +files, to reduce maximum compilation unit size and allow parallel compilation. + +Usage: +aggregate_generated_bindings.py COMPONENT_DIR IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ... + +COMPONENT_DIR is the relative directory of a component, e.g., 'core', 'modules'. +IDL_FILES_LIST is a text file containing the IDL file paths, so the command +line doesn't exceed OS length limits. +OUTPUT_FILE1 etc. are filenames of output files. + +Design doc: http://www.chromium.org/developers/design-documents/idl-build +""" + +import errno +import os +import re +import subprocess +import sys + +from utilities import idl_filename_to_interface_name + +# A regexp for finding Conditional attributes in interface definitions. +CONDITIONAL_PATTERN = re.compile( + r'\[' + r'[^\]]*' + r'Conditional=([\_0-9a-zA-Z&|]*)' + r'[^\]]*' + r'\]\s*' + r'((callback|partial)\s+)?' + r'interface\s+' + r'\w+\s*' + r'(:\s*\w+\s*)?' + r'{', + re.MULTILINE) + +COPYRIGHT_TEMPLATE = """/* + * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. + * + * This file was generated by the action_derivedsourcesallinone.py script. + * + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +""" + + +def format_conditional(conditional): + """Wraps conditional with ENABLE() and replace '&','|' with '&&','||' if + more than one conditional is specified.""" + def wrap_with_enable(s): + if s in ['|', '&']: + return s * 2 + return 'ENABLE(' + s + ')' + return ' '.join(map(wrap_with_enable, conditional)) + + +def extract_conditional(idl_file_path): + """Find [Conditional] interface extended attribute.""" + with open(idl_file_path) as idl_file: + idl_contents = idl_file.read() + + match = CONDITIONAL_PATTERN.search(idl_contents) + if not match: + return None + conditional = match.group(1) + return re.split('([|&])', conditional) + + +def extract_meta_data(file_paths): + """Extracts conditional and interface name from each IDL file.""" + meta_data_list = [] + + for file_path in file_paths: + if not file_path.endswith('.idl'): + print 'WARNING: non-IDL file passed: "%s"' % file_path + continue + if not os.path.exists(file_path): + print 'WARNING: file not found: "%s"' % file_path + continue + + # Extract interface name from file name + interface_name = idl_filename_to_interface_name(file_path) + + meta_data = { + 'conditional': extract_conditional(file_path), + 'name': interface_name, + } + meta_data_list.append(meta_data) + + return meta_data_list + + +def generate_content(component_dir, files_meta_data_this_partition, prefix): + # Add fixed content. + output = [COPYRIGHT_TEMPLATE, + '#define NO_IMPLICIT_ATOMICSTRING\n\n'] + + # List all includes segmented by if and endif. + prev_conditional = None + files_meta_data_this_partition.sort(key=lambda e: e['conditional']) + for meta_data in files_meta_data_this_partition: + conditional = meta_data['conditional'] + if prev_conditional != conditional: + if prev_conditional: + output.append('#endif\n') + if conditional: + output.append('\n#if %s\n' % format_conditional(conditional)) + prev_conditional = conditional + + output.append('#include "bindings/%s/%s/%s%s.cpp"\n' % + (component_dir, prefix.lower(), prefix, meta_data['name'])) + + if prev_conditional: + output.append('#endif\n') + + return ''.join(output) + + +def write_content(content, output_file_name): + parent_path, file_name = os.path.split(output_file_name) + if not os.path.exists(parent_path): + print 'Creating directory: %s' % parent_path + os.makedirs(parent_path) + with open(output_file_name, 'w') as f: + f.write(content) + + +def resolve_cygpath(cygdrive_names): + if not cygdrive_names: + return [] + cmd = ['cygpath', '-f', '-', '-wa'] + process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + idl_file_names = [] + for file_name in cygdrive_names: + process.stdin.write('%s\n' % file_name) + process.stdin.flush() + idl_file_names.append(process.stdout.readline().rstrip()) + process.stdin.close() + process.wait() + return idl_file_names + + +def main(args): + if len(args) <= 4: + raise Exception('Expected at least 5 arguments.') + if (args[1] == '--dart'): + component_dir = args[2] + input_file_name = args[3] + prefix = 'Dart' + else: + component_dir = args[1] + input_file_name = args[2] + prefix = 'V8' + in_out_break_index = args.index('--') + output_file_names = args[in_out_break_index + 1:] + + with open(input_file_name) as input_file: + file_names = sorted([os.path.realpath(line.rstrip('\n')) + for line in input_file]) + idl_file_names = [file_name for file_name in file_names + if not file_name.startswith('/cygdrive')] + cygdrive_names = [file_name for file_name in file_names + if file_name.startswith('/cygdrive')] + idl_file_names.extend(resolve_cygpath(cygdrive_names)) + + files_meta_data = extract_meta_data(idl_file_names) + total_partitions = len(output_file_names) + for partition, file_name in enumerate(output_file_names): + files_meta_data_this_partition = [ + meta_data for meta_data in files_meta_data + if hash(meta_data['name']) % total_partitions == partition] + file_contents = generate_content(component_dir, + files_meta_data_this_partition, + prefix) + write_content(file_contents, file_name) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/scripts/blink_idl_lexer.py b/bindings/scripts/blink_idl_lexer.py new file mode 100644 index 0000000..bbde342 --- /dev/null +++ b/bindings/scripts/blink_idl_lexer.py
@@ -0,0 +1,127 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Lexer for Blink IDL. + +The lexer uses the PLY (Python Lex-Yacc) library to build a tokenizer which +understands the Blink dialect of Web IDL and produces a token stream suitable +for the Blink IDL parser. + +Blink IDL is identical to Web IDL at the token level, but the base lexer +does not discard comments. We need to override (and not include comments in +the token stream), as otherwise comments must be explicitly included in the +phrase grammar of the parser. + +FIXME: Change base lexer to discard comments, and simply used the base +lexer, eliminating this separate lexer. + +Web IDL: + http://www.w3.org/TR/WebIDL/ +Web IDL Grammar: + http://www.w3.org/TR/WebIDL/#idl-grammar +PLY: + http://www.dabeaz.com/ply/ + +Design doc: +http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end +""" + +# Disable attribute validation, as lint can't import parent class to check +# pylint: disable=E1101 + +import os.path +import sys + +# PLY is in Chromium src/third_party/ply +module_path, module_name = os.path.split(__file__) +third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir) +# Insert at front to override system libraries, and after path[0] == script dir +sys.path.insert(1, third_party) +from ply import lex + +# Base lexer is in Chromium src/tools/idl_parser +tools_dir = os.path.join(third_party, os.pardir, 'tools') +sys.path.append(tools_dir) +from idl_parser.idl_lexer import IDLLexer + +REMOVE_TOKENS = ['COMMENT'] + + +class BlinkIDLLexer(IDLLexer): + # ignore comments + def t_COMMENT(self, t): + r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' + self.AddLines(t.value.count('\n')) + + # Analogs to _AddToken/_AddTokens in base lexer + # Needed to remove COMMENT token, since comments ignored + def _RemoveToken(self, token): + if token in self.tokens: + self.tokens.remove(token) + + def _RemoveTokens(self, tokens): + for token in tokens: + self._RemoveToken(token) + + def __init__(self, debug=False, optimize=True, outputdir=None): + if debug: + # Turn off optimization and caching to help debugging + optimize = False + outputdir = None + if outputdir: + # Need outputdir in path because lex imports the cached lex table + # as a Python module + sys.path.append(outputdir) + + IDLLexer.__init__(self) + # Overrides to parent class + self._RemoveTokens(REMOVE_TOKENS) + # Optimized mode substantially decreases startup time (by disabling + # error checking), and also allows use of Python's optimized mode. + # See: Optimized Mode + # http://www.dabeaz.com/ply/ply.html#ply_nn15 + self._lexobj = lex.lex(object=self, + debug=debug, + optimize=optimize, + outputdir=outputdir) + + +################################################################################ + +def main(argv): + # If file itself executed, build and cache lex table + try: + outputdir = argv[1] + except IndexError as err: + print 'Usage: %s OUTPUT_DIR' % argv[0] + return 1 + lexer = BlinkIDLLexer(outputdir=outputdir) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/scripts/blink_idl_parser.py b/bindings/scripts/blink_idl_parser.py new file mode 100644 index 0000000..6b205f2 --- /dev/null +++ b/bindings/scripts/blink_idl_parser.py
@@ -0,0 +1,446 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Parser for Blink IDL. + +The parser uses the PLY (Python Lex-Yacc) library to build a set of parsing +rules which understand the Blink dialect of Web IDL. +It derives from a standard Web IDL parser, overriding rules where Blink IDL +differs syntactically or semantically from the base parser, or where the base +parser diverges from the Web IDL standard. + +Web IDL: + http://www.w3.org/TR/WebIDL/ +Web IDL Grammar: + http://www.w3.org/TR/WebIDL/#idl-grammar +PLY: + http://www.dabeaz.com/ply/ + +Design doc: +http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end +""" + +# Disable check for line length and Member as Function due to how grammar rules +# are defined with PLY +# +# pylint: disable=R0201 +# pylint: disable=C0301 +# +# Disable attribute validation, as lint can't import parent class to check +# pylint: disable=E1101 + +import os.path +import sys + +# PLY is in Chromium src/third_party/ply +module_path, module_name = os.path.split(__file__) +third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir) +# Insert at front to override system libraries, and after path[0] == script dir +sys.path.insert(1, third_party) +from ply import yacc + +# Base parser is in Chromium src/tools/idl_parser +tools_dir = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, 'tools') +sys.path.append(tools_dir) +from idl_parser.idl_parser import IDLParser, ListFromConcat +from idl_parser.idl_parser import ParseFile as parse_file + +from blink_idl_lexer import BlinkIDLLexer + + +# Explicitly set starting symbol to rule defined only in base parser. +# BEWARE that the starting symbol should NOT be defined in both the base parser +# and the derived one, as otherwise which is used depends on which line number +# is lower, which is fragile. Instead, either use one in base parser or +# create a new symbol, so that this is unambiguous. +# FIXME: unfortunately, this doesn't work in PLY 3.4, so need to duplicate the +# rule below. +STARTING_SYMBOL = 'Definitions' + +# We ignore comments (and hence don't need 'Top') but base parser preserves them +# FIXME: Upstream: comments should be removed in base parser +REMOVED_RULES = ['Top', # [0] + 'Comments', # [0.1] + 'CommentsRest', # [0.2] + ] + +# Remove rules from base class +# FIXME: add a class method upstream: @classmethod IDLParser._RemoveRules +for rule in REMOVED_RULES: + production_name = 'p_' + rule + delattr(IDLParser, production_name) + + +class BlinkIDLParser(IDLParser): + # [1] + # FIXME: Need to duplicate rule for starting symbol here, with line number + # *lower* than in the base parser (idl_parser.py). + # This is a bug in PLY: it determines starting symbol by lowest line number. + # This can be overridden by the 'start' parameter, but as of PLY 3.4 this + # doesn't work correctly. + def p_Definitions(self, p): + """Definitions : ExtendedAttributeList Definition Definitions + | """ + if len(p) > 1: + p[2].AddChildren(p[1]) + p[0] = ListFromConcat(p[2], p[3]) + + # Below are grammar rules used by yacc, given by functions named p_<RULE>. + # * The docstring is the production rule in BNF (grammar). + # * The body is the yacc action (semantics). + # + # The PLY framework builds the actual low-level parser by introspecting this + # parser object, selecting all attributes named p_<RULE> as grammar rules. + # It extracts the docstrings and uses them as the production rules, building + # the table of a LALR parser, and uses the body of the functions as actions. + # + # Reference: + # http://www.dabeaz.com/ply/ply.html#ply_nn23 + # + # Review of yacc: + # Yacc parses a token stream, internally producing a Concrete Syntax Tree + # (CST), where each node corresponds to a production rule in the grammar. + # At each node, it runs an action, which is usually "produce a node in the + # Abstract Syntax Tree (AST)" or "ignore this node" (for nodes in the CST + # that aren't included in the AST, since only needed for parsing). + # + # The rules use pseudo-variables; in PLY syntax: + # p[0] is the left side: assign return value to p[0] instead of returning, + # p[1] ... p[n] are the right side: the values can be accessed, and they + # can be modified. + # (In yacc these are $$ and $1 ... $n.) + # + # The rules can look cryptic at first, but there are a few standard + # transforms from the CST to AST. With these in mind, the actions should + # be reasonably legible. + # + # * Ignore production + # Discard this branch. Primarily used when one alternative is empty. + # + # Sample code: + # if len(p) > 1: + # p[0] = ... + # # Note no assignment if len(p) == 1 + # + # * Eliminate singleton production + # Discard this node in the CST, pass the next level down up the tree. + # Used to ignore productions only necessary for parsing, but not needed + # in the AST. + # + # Sample code: + # p[0] = p[1] + # + # * Build node + # The key type of rule. In this parser, produces object of class IDLNode. + # There are several helper functions: + # * BuildProduction: actually builds an IDLNode, based on a production. + # * BuildAttribute: builds an IDLAttribute, which is a temporary + # object to hold a name-value pair, which is then + # set as a Property of the IDLNode when the IDLNode + # is built. + # * BuildNamed: Same as BuildProduction, and sets the 'NAME' property. + # * BuildTrue: BuildAttribute with value True, for flags. + # See base idl_parser.py for definitions and more examples of use. + # + # Sample code: + # # Build node of type NodeType, with value p[1], and children. + # p[0] = self.BuildProduction('NodeType', p, 1, children) + # + # # Build named node of type NodeType, with name and value p[1]. + # # (children optional) + # p[0] = self.BuildNamed('NodeType', p, 1) + # + # # Make a list + # # Used if one node has several children. + # children = ListFromConcat(p[2], p[3]) + # p[0] = self.BuildProduction('NodeType', p, 1, children) + # + # # Also used to collapse the right-associative tree + # # produced by parsing a list back into a single list. + # """Foos : Foo Foos + # |""" + # if len(p) > 1: + # p[0] = ListFromConcat(p[1], p[2]) + # + # # Add children. + # # Primarily used to add attributes, produced via BuildTrue. + # # p_StaticAttribute + # """StaticAttribute : STATIC Attribute""" + # p[2].AddChildren(self.BuildTrue('STATIC')) + # p[0] = p[2] + # + # Numbering scheme for the rules is: + # [1] for Web IDL spec (or additions in base parser) + # These should all be upstreamed to the base parser. + # [b1] for Blink IDL changes (overrides Web IDL) + # [b1.1] for Blink IDL additions, auxiliary rules for [b1] + # Numbers are as per Candidate Recommendation 19 April 2012: + # http://www.w3.org/TR/2012/CR-WebIDL-20120419/ + + # [3] Override action, since we distinguish callbacks + # FIXME: Upstream + def p_CallbackOrInterface(self, p): + """CallbackOrInterface : CALLBACK CallbackRestOrInterface + | Interface""" + if len(p) > 2: + p[2].AddChildren(self.BuildTrue('CALLBACK')) + p[0] = p[2] + else: + p[0] = p[1] + + # [b27] Add strings, more 'Literal' productions + # 'Literal's needed because integers and strings are both internally strings + def p_ConstValue(self, p): + """ConstValue : BooleanLiteral + | FloatLiteral + | IntegerLiteral + | StringLiteral + | null""" + # Standard is (no 'string', fewer 'Literal's): + # ConstValue : BooleanLiteral + # | FloatLiteral + # | integer + # | NULL + p[0] = p[1] + + # [b27.1] + def p_IntegerLiteral(self, p): + """IntegerLiteral : integer""" + p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'integer'), + self.BuildAttribute('NAME', p[1])) + + # [b27.2] + def p_StringLiteral(self, p): + """StringLiteral : string""" + p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'DOMString'), + self.BuildAttribute('NAME', p[1])) + + # [b47] + def p_ExceptionMember(self, p): + """ExceptionMember : Const + | ExceptionField + | Attribute + | ExceptionOperation""" + # Standard is (no Attribute, no ExceptionOperation): + # ExceptionMember : Const + # | ExceptionField + # FIXME: In DOMException.idl, Attributes should be changed to + # ExceptionFields, and Attribute removed from this rule. + p[0] = p[1] + + # [b47.1] + def p_ExceptionOperation(self, p): + """ExceptionOperation : Type identifier '(' ')' ';'""" + # Needed to handle one case in DOMException.idl: + # // Override in a Mozilla compatible format + # [NotEnumerable] DOMString toString(); + # Limited form of Operation to prevent others from being added. + # FIXME: Should be a stringifier instead. + p[0] = self.BuildNamed('ExceptionOperation', p, 2, p[1]) + + # Extended attributes + # [b49] Override base parser: remove comment field, since comments stripped + # FIXME: Upstream + def p_ExtendedAttributeList(self, p): + """ExtendedAttributeList : '[' ExtendedAttribute ExtendedAttributes ']' + | '[' ']' + | """ + if len(p) > 3: + items = ListFromConcat(p[2], p[3]) + p[0] = self.BuildProduction('ExtAttributes', p, 1, items) + + # [b50] Allow optional trailing comma + # Blink-only, marked as WONTFIX in Web IDL spec: + # https://www.w3.org/Bugs/Public/show_bug.cgi?id=22156 + def p_ExtendedAttributes(self, p): + """ExtendedAttributes : ',' ExtendedAttribute ExtendedAttributes + | ',' + |""" + if len(p) > 3: + p[0] = ListFromConcat(p[2], p[3]) + + # [b51] Add ExtendedAttributeIdentAndOrIdent + def p_ExtendedAttribute(self, p): + """ExtendedAttribute : ExtendedAttributeNoArgs + | ExtendedAttributeArgList + | ExtendedAttributeIdent + | ExtendedAttributeIdentList + | ExtendedAttributeStringLiteralList + | ExtendedAttributeNamedArgList""" + p[0] = p[1] + + # [59] + # FIXME: Upstream UnionType + def p_UnionType(self, p): + """UnionType : '(' UnionMemberType OR UnionMemberType UnionMemberTypes ')'""" + members = ListFromConcat(p[2], p[4], p[5]) + p[0] = self.BuildProduction('UnionType', p, 1, members) + + # [60] + def p_UnionMemberType(self, p): + """UnionMemberType : NonAnyType + | UnionType TypeSuffix + | ANY '[' ']' TypeSuffix""" + if len(p) == 2: + p[0] = self.BuildProduction('Type', p, 1, p[1]) + elif len(p) == 3: + p[0] = self.BuildProduction('Type', p, 1, ListFromConcat(p[1], p[2])) + else: + any_node = ListFromConcat(self.BuildProduction('Any', p, 1), p[4]) + p[0] = self.BuildProduction('Type', p, 1, any_node) + + # [61] + def p_UnionMemberTypes(self, p): + """UnionMemberTypes : OR UnionMemberType UnionMemberTypes + |""" + if len(p) > 2: + p[0] = ListFromConcat(p[2], p[3]) + + # [70] Override base parser to remove non-standard sized array + # FIXME: Upstream + def p_TypeSuffix(self, p): + """TypeSuffix : '[' ']' TypeSuffix + | '?' TypeSuffixStartingWithArray + |""" + if len(p) == 4: + p[0] = self.BuildProduction('Array', p, 1, p[3]) + elif len(p) == 3: + p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) + + # [b76.1] Add support for compound Extended Attribute values (A&B and A|B) + def p_ExtendedAttributeIdentList(self, p): + """ExtendedAttributeIdentList : identifier '=' identifier '&' IdentAndList + | identifier '=' identifier '|' IdentOrList""" + value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5]) + p[0] = self.BuildNamed('ExtAttribute', p, 1, value) + + # [b76.2] A&B&C + def p_IdentAndList(self, p): + """IdentAndList : identifier '&' IdentAndList + | identifier""" + if len(p) > 3: + p[0] = p[1] + p[2] + p[3] + else: + p[0] = p[1] + + # [b76.3] A|B|C + def p_IdentOrList(self, p): + """IdentOrList : identifier '|' IdentOrList + | identifier""" + if len(p) > 3: + p[0] = p[1] + p[2] + p[3] + else: + p[0] = p[1] + + # Blink extension: Add support for compound Extended Attribute values over string literals ("A"|"B") + def p_ExtendedAttributeStringLiteralList(self, p): + """ExtendedAttributeStringLiteralList : identifier '=' StringLiteralOrList""" + value = self.BuildAttribute('VALUE', p[3]) + p[0] = self.BuildNamed('ExtAttribute', p, 1, value) + + # Blink extension: one or more string literals. The values aren't propagated as literals, + # but their by their value only. + def p_StringLiteralOrList(self, p): + """StringLiteralOrList : StringLiteral '|' StringLiteralOrList + | StringLiteral""" + def unwrap_string(ls): + """Reach in and grab the string literal's "NAME".""" + return ls[1].value + + if len(p) > 3: + p[0] = unwrap_string(p[1]) + p[2] + p[3] + else: + p[0] = unwrap_string(p[1]) + + def __init__(self, + # common parameters + debug=False, + # idl_parser parameters + lexer=None, verbose=False, mute_error=False, + # yacc parameters + outputdir='', optimize=True, write_tables=False, + picklefile=None): + if debug: + # Turn off optimization and caching, and write out tables, + # to help debugging + optimize = False + outputdir = None + picklefile = None + write_tables = True + if outputdir: + picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle') + + lexer = lexer or BlinkIDLLexer(debug=debug, + outputdir=outputdir, + optimize=optimize) + self.lexer = lexer + self.tokens = lexer.KnownTokens() + # Using SLR (instead of LALR) generates the table faster, + # but produces the same output. This is ok b/c Web IDL (and Blink IDL) + # is an SLR grammar (as is often the case for simple LL(1) grammars). + # + # Optimized mode substantially decreases startup time (by disabling + # error checking), and also allows use of Python's optimized mode. + # See: Using Python's Optimized Mode + # http://www.dabeaz.com/ply/ply.html#ply_nn38 + # + # |picklefile| allows simpler importing than |tabmodule| (parsetab.py), + # as we don't need to modify sys.path; virtually identical speed. + # See: CHANGES, Version 3.2 + # http://ply.googlecode.com/svn/trunk/CHANGES + self.yaccobj = yacc.yacc(module=self, + start=STARTING_SYMBOL, + method='SLR', + debug=debug, + optimize=optimize, + write_tables=write_tables, + picklefile=picklefile) + self.parse_debug = debug + self.verbose = verbose + self.mute_error = mute_error + self._parse_errors = 0 + self._parse_warnings = 0 + self._last_error_msg = None + self._last_error_lineno = 0 + self._last_error_pos = 0 + + +################################################################################ + +def main(argv): + # If file itself executed, cache parse table + try: + outputdir = argv[1] + except IndexError as err: + print 'Usage: %s OUTPUT_DIR' % argv[0] + return 1 + parser = BlinkIDLParser(outputdir=outputdir) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/scripts/code_generator_v8.py b/bindings/scripts/code_generator_v8.py new file mode 100644 index 0000000..778a87e --- /dev/null +++ b/bindings/scripts/code_generator_v8.py
@@ -0,0 +1,222 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate Blink V8 bindings (.h and .cpp files). + +If run itself, caches Jinja templates (and creates dummy file for build, +since cache filenames are unpredictable and opaque). + +This module is *not* concurrency-safe without care: bytecode caching creates +a race condition on cache *write* (crashes if one process tries to read a +partially-written cache). However, if you pre-cache the templates (by running +the module itself), then you can parallelize compiling individual files, since +cache *reading* is safe. + +Input: An object of class IdlDefinitions, containing an IDL interface X +Output: V8X.h and V8X.cpp + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import os +import posixpath +import re +import sys + +# Path handling for libraries and templates +# Paths have to be normalized because Jinja uses the exact template path to +# determine the hash used in the cache filename, and we need a pre-caching step +# to be concurrency-safe. Use absolute path because __file__ is absolute if +# module is imported, and relative if executed directly. +# If paths differ between pre-caching and individual file compilation, the cache +# is regenerated, which causes a race condition and breaks concurrent build, +# since some compile processes will try to read the partially written cache. +module_path, module_filename = os.path.split(os.path.realpath(__file__)) +third_party_dir = os.path.normpath(os.path.join( + module_path, os.pardir, os.pardir, os.pardir, os.pardir)) +templates_dir = os.path.normpath(os.path.join( + module_path, os.pardir, 'templates')) +# Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching +module_pyname = os.path.splitext(module_filename)[0] + '.py' + +# jinja2 is in chromium's third_party directory. +# Insert at 1 so at front to override system libraries, and +# after path[0] == invoking script dir +sys.path.insert(1, third_party_dir) +import jinja2 + +import idl_types +from idl_types import IdlType +import v8_callback_interface +from v8_globals import includes, interfaces +import v8_interface +import v8_types +from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name + + +class CodeGeneratorV8(object): + def __init__(self, interfaces_info, cache_dir): + interfaces_info = interfaces_info or {} + self.interfaces_info = interfaces_info + self.jinja_env = initialize_jinja_env(cache_dir) + + # Set global type info + idl_types.set_ancestors(dict( + (interface_name, interface_info['ancestors']) + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['ancestors'])) + IdlType.set_callback_interfaces(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['is_callback_interface'])) + IdlType.set_implemented_as_interfaces(dict( + (interface_name, interface_info['implemented_as']) + for interface_name, interface_info in interfaces_info.iteritems() + if interface_info['implemented_as'])) + IdlType.set_garbage_collected_types(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if 'GarbageCollected' in interface_info['inherited_extended_attributes'])) + IdlType.set_will_be_garbage_collected_types(set( + interface_name + for interface_name, interface_info in interfaces_info.iteritems() + if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes'])) + v8_types.set_component_dirs(dict( + (interface_name, interface_info['component_dir']) + for interface_name, interface_info in interfaces_info.iteritems())) + + def generate_code(self, definitions, interface_name): + """Returns .h/.cpp code as (header_text, cpp_text).""" + try: + interface = definitions.interfaces[interface_name] + except KeyError: + raise Exception('%s not in IDL definitions' % interface_name) + + # Store other interfaces for introspection + interfaces.update(definitions.interfaces) + + # Set local type info + IdlType.set_callback_functions(definitions.callback_functions.keys()) + IdlType.set_enums((enum.name, enum.values) + for enum in definitions.enumerations.values()) + + # Select appropriate Jinja template and contents function + if interface.is_callback: + header_template_filename = 'callback_interface.h' + cpp_template_filename = 'callback_interface.cpp' + generate_contents = v8_callback_interface.generate_callback_interface + else: + header_template_filename = 'interface.h' + cpp_template_filename = 'interface.cpp' + generate_contents = v8_interface.generate_interface + header_template = self.jinja_env.get_template(header_template_filename) + cpp_template = self.jinja_env.get_template(cpp_template_filename) + + # Generate contents (input parameters for Jinja) + template_contents = generate_contents(interface) + template_contents['code_generator'] = module_pyname + + # Add includes for interface itself and any dependencies + interface_info = self.interfaces_info[interface_name] + template_contents['header_includes'].add(interface_info['include_path']) + template_contents['header_includes'] = sorted(template_contents['header_includes']) + includes.update(interface_info.get('dependencies_include_paths', [])) + template_contents['cpp_includes'] = sorted(includes) + + # Render Jinja templates + header_text = header_template.render(template_contents) + cpp_text = cpp_template.render(template_contents) + return header_text, cpp_text + + +def initialize_jinja_env(cache_dir): + jinja_env = jinja2.Environment( + loader=jinja2.FileSystemLoader(templates_dir), + # Bytecode cache is not concurrency-safe unless pre-cached: + # if pre-cached this is read-only, but writing creates a race condition. + bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), + keep_trailing_newline=True, # newline-terminate generated files + lstrip_blocks=True, # so can indent control flow tags + trim_blocks=True) + jinja_env.filters.update({ + 'blink_capitalize': capitalize, + 'conditional': conditional_if_endif, + 'runtime_enabled': runtime_enabled_if, + }) + return jinja_env + + +# [Conditional] +def conditional_if_endif(code, conditional_string): + # Jinja2 filter to generate if/endif directive blocks + if not conditional_string: + return code + return ('#if %s\n' % conditional_string + + code + + '#endif // %s\n' % conditional_string) + + +# [RuntimeEnabled] +def runtime_enabled_if(code, runtime_enabled_function_name): + if not runtime_enabled_function_name: + return code + # Indent if statement to level of original code + indent = re.match(' *', code).group(0) + return ('%sif (%s()) {\n' % (indent, runtime_enabled_function_name) + + ' %s\n' % '\n '.join(code.splitlines()) + + '%s}\n' % indent) + + +################################################################################ + +def main(argv): + # If file itself executed, cache templates + try: + cache_dir = argv[1] + dummy_filename = argv[2] + except IndexError as err: + print 'Usage: %s CACHE_DIR DUMMY_FILENAME' % argv[0] + return 1 + + # Cache templates + jinja_env = initialize_jinja_env(cache_dir) + template_filenames = [filename for filename in os.listdir(templates_dir) + # Skip .svn, directories, etc. + if filename.endswith(('.cpp', '.h'))] + for template_filename in template_filenames: + jinja_env.get_template(template_filename) + + # Create a dummy file as output for the build system, + # since filenames of individual cache files are unpredictable and opaque + # (they are hashes of the template path, which varies based on environment) + with open(dummy_filename, 'w') as dummy_file: + pass # |open| creates or touches the file + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/bindings/scripts/compute_global_objects.py b/bindings/scripts/compute_global_objects.py new file mode 100755 index 0000000..93d2eed --- /dev/null +++ b/bindings/scripts/compute_global_objects.py
@@ -0,0 +1,113 @@ +#!/usr/bin/python +# +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Compute global objects. + +Global objects are defined by interfaces with [Global] or [PrimaryGlobal] on +their definition: http://heycam.github.io/webidl/#Global + +Design document: http://www.chromium.org/developers/design-documents/idl-build +""" + +import optparse +import os +import cPickle as pickle +import sys + +from utilities import get_file_contents, idl_filename_to_interface_name, get_interface_extended_attributes_from_idl, read_file_to_list, read_pickle_files, write_pickle_file + +GLOBAL_EXTENDED_ATTRIBUTES = frozenset([ + 'Global', + 'PrimaryGlobal', +]) + + +def parse_options(): + usage = 'Usage: %prog [options] [GlobalObjectsComponent.pickle]... [GlobalObjects.pickle]' + parser = optparse.OptionParser(usage=usage) + parser.add_option('--idl-files-list', help='file listing IDL files') + parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') + + options, args = parser.parse_args() + + if options.idl_files_list is None: + parser.error('Must specify a file listing IDL files using --idl-files-list.') + if options.write_file_only_if_changed is None: + parser.error('Must specify whether output files are only written if changed using --write-file-only-if-changed.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + if not args: + parser.error('Must specify an output pickle filename as argument, ' + 'optionally preceeded by input pickle filenames.') + + return options, args + + +def dict_union(dicts): + return dict((k, v) for d in dicts for k, v in d.iteritems()) + + +def idl_file_to_global_names(idl_filename): + """Returns global names, if any, for an IDL file. + + If the [Global] or [PrimaryGlobal] extended attribute is declared with an + identifier list argument, then those identifiers are the interface's global + names; otherwise, the interface has a single global name, which is the + interface's identifier (http://heycam.github.io/webidl/#Global). + """ + interface_name = idl_filename_to_interface_name(idl_filename) + full_path = os.path.realpath(idl_filename) + idl_file_contents = get_file_contents(full_path) + extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) + + global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection( + extended_attributes.iterkeys()) + if not global_keys: + return + if len(global_keys) > 1: + raise ValueError('The [Global] and [PrimaryGlobal] extended attributes ' + 'MUST NOT be declared on the same interface.') + global_key = next(iter(global_keys)) + + global_value = extended_attributes[global_key] + if global_value: + # FIXME: In spec names are comma-separated, which makes parsing very + # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959). + return global_value.split('&') + return [interface_name] + + +def idl_files_to_interface_name_global_names(idl_files): + """Yields pairs (interface_name, global_names) found in IDL files.""" + for idl_filename in idl_files: + interface_name = idl_filename_to_interface_name(idl_filename) + global_names = idl_file_to_global_names(idl_filename) + if global_names: + yield interface_name, global_names + + +################################################################################ + +def main(): + options, args = parse_options() + # args = Input1, Input2, ..., Output + output_global_objects_filename = args.pop() + interface_name_global_names = dict_union( + existing_interface_name_global_names + for existing_interface_name_global_names in read_pickle_files(args)) + + # Input IDL files are passed in a file, due to OS command line length + # limits. This is generated at GYP time, which is ok b/c files are static. + idl_files = read_file_to_list(options.idl_files_list) + interface_name_global_names.update( + idl_files_to_interface_name_global_names(idl_files)) + + write_pickle_file(output_global_objects_filename, + interface_name_global_names, + options.write_file_only_if_changed) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/compute_interfaces_info_individual.py b/bindings/scripts/compute_interfaces_info_individual.py new file mode 100755 index 0000000..c3671d9 --- /dev/null +++ b/bindings/scripts/compute_interfaces_info_individual.py
@@ -0,0 +1,192 @@ +#!/usr/bin/python +# +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Compute global interface information for individual IDL files. + +Auxiliary module for compute_interfaces_info_overall, which consolidates +this individual information, computing info that spans multiple files +(dependencies and ancestry). + +This distinction is so that individual interface info can be computed +separately for each component (avoiding duplicated reading of individual +files), then consolidated using *only* the info visible to a given component. + +Design doc: http://www.chromium.org/developers/design-documents/idl-build +""" + +from collections import defaultdict +import optparse +import os +import posixpath +import sys + +from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl + +module_path = os.path.dirname(__file__) +source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) + +# Global variables (filled in and exported) +interfaces_info = {} +partial_interface_files = defaultdict(lambda: { + 'full_paths': [], + 'include_paths': [], +}) + + +def parse_options(): + usage = 'Usage: %prog [options] [generated1.idl]...' + parser = optparse.OptionParser(usage=usage) + parser.add_option('--component-dir', help='component directory') + parser.add_option('--idl-files-list', help='file listing IDL files') + parser.add_option('--interfaces-info-file', help='output pickle file') + parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') + + options, args = parser.parse_args() + if options.component_dir is None: + parser.error('Must specify a component directory using --component-dir.') + if options.interfaces_info_file is None: + parser.error('Must specify an output file using --interfaces-info-file.') + if options.idl_files_list is None: + parser.error('Must specify a file listing IDL files using --idl-files-list.') + if options.write_file_only_if_changed is None: + parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + return options, args + + +################################################################################ +# Computations +################################################################################ + +def include_path(idl_filename, implemented_as=None): + """Returns relative path to header file in POSIX format; used in includes. + + POSIX format is used for consistency of output, so reference tests are + platform-independent. + """ + relative_path_local = os.path.relpath(idl_filename, source_path) + relative_dir_local = os.path.dirname(relative_path_local) + relative_dir_posix = relative_dir_local.replace(os.path.sep, posixpath.sep) + + # IDL file basename is used even if only a partial interface file + idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) + cpp_class_name = implemented_as or idl_file_basename + + return posixpath.join(relative_dir_posix, cpp_class_name + '.h') + + +def add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path=None): + paths_dict = partial_interface_files[partial_interface_name] + paths_dict['full_paths'].append(full_path) + if this_include_path: + paths_dict['include_paths'].append(this_include_path) + + +def compute_info_individual(idl_filename, component_dir): + full_path = os.path.realpath(idl_filename) + idl_file_contents = get_file_contents(full_path) + + extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) + implemented_as = extended_attributes.get('ImplementedAs') + this_include_path = include_path(idl_filename, implemented_as) + + # Handle partial interfaces + partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents) + if partial_interface_name: + add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path) + return + + # If not a partial interface, the basename is the interface name + interface_name = idl_filename_to_interface_name(idl_filename) + + # 'implements' statements can be included in either the file for the + # implement*ing* interface (lhs of 'implements') or implement*ed* interface + # (rhs of 'implements'). Store both for now, then merge to implement*ing* + # interface later. + left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name) + + interfaces_info[interface_name] = { + 'component_dir': component_dir, + 'extended_attributes': extended_attributes, + 'full_path': full_path, + 'implemented_as': implemented_as, + 'implemented_by_interfaces': left_interfaces, # private, merged to next + 'implements_interfaces': right_interfaces, + 'include_path': this_include_path, + # FIXME: temporary private field, while removing old treatement of + # 'implements': http://crbug.com/360435 + 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes, + 'is_callback_interface': is_callback_interface_from_idl(idl_file_contents), + 'parent': get_parent_interface(idl_file_contents), + # Interfaces that are referenced (used as types) and that we introspect + # during code generation (beyond interface-level data ([ImplementedAs], + # is_callback_interface, ancestors, and inherited extended attributes): + # deep dependencies. + # These cause rebuilds of referrers, due to the dependency, so these + # should be minimized; currently only targets of [PutForwards]. + 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents), + } + + +def info_individual(): + """Returns info packaged as a dict.""" + return { + 'interfaces_info': interfaces_info, + # Can't pickle defaultdict, convert to dict + 'partial_interface_files': dict(partial_interface_files), + } + + +################################################################################ + +def main(): + options, args = parse_options() + + # Static IDL files are passed in a file (generated at GYP time), due to OS + # command line length limits + idl_files = read_file_to_list(options.idl_files_list) + # Generated IDL files are passed at the command line, since these are in the + # build directory, which is determined at build time, not GYP time, so these + # cannot be included in the file listing static files + idl_files.extend(args) + + # Compute information for individual files + # Information is stored in global variables interfaces_info and + # partial_interface_files. + for idl_filename in idl_files: + compute_info_individual(idl_filename, options.component_dir) + + write_pickle_file(options.interfaces_info_file, + info_individual(), + options.write_file_only_if_changed) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/compute_interfaces_info_overall.py b/bindings/scripts/compute_interfaces_info_overall.py new file mode 100755 index 0000000..658ccfa --- /dev/null +++ b/bindings/scripts/compute_interfaces_info_overall.py
@@ -0,0 +1,264 @@ +#!/usr/bin/python +# +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Compute global interface information, including public information, dependencies, and inheritance. + +Computed data is stored in a global variable, |interfaces_info|, and written as +output (concretely, exported as a pickle). This is then used by the IDL compiler +itself, so it does not need to compute global information itself, and so that +inter-IDL dependencies are clear, since they are all computed here. + +The |interfaces_info| pickle is a *global* dependency: any changes cause a full +rebuild. This is to avoid having to compute which public data is visible by +which IDL files on a file-by-file basis, which is very complex for little +benefit. +|interfaces_info| should thus only contain data about an interface that +contains paths or is needed by *other* interfaces, e.g., path data (to abstract +the compiler from OS-specific file paths) or public data (to avoid having to +read other interfaces unnecessarily). +It should *not* contain full information about an interface (e.g., all +extended attributes), as this would cause unnecessary rebuilds. + +|interfaces_info| is a dict, keyed by |interface_name|. + +Current keys are: +* dependencies: + 'implements_interfaces': targets of 'implements' statements + 'referenced_interfaces': reference interfaces that are introspected + (currently just targets of [PutForwards]) + +* inheritance: + 'ancestors': all ancestor interfaces + 'inherited_extended_attributes': inherited extended attributes + (all controlling memory management) + +* public: + 'is_callback_interface': bool, callback interface or not + 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) + +* paths: + 'full_path': path to the IDL file, so can lookup an IDL by interface name + 'include_path': path for use in C++ #include directives + 'dependencies_full_paths': paths to dependencies (for merging into main) + 'dependencies_include_paths': paths for use in C++ #include directives + +Note that all of these are stable information, unlikely to change without +moving or deleting files (hence requiring a full rebuild anyway) or significant +code changes (for inherited extended attributes). + +Design doc: http://www.chromium.org/developers/design-documents/idl-build +""" + +from collections import defaultdict +import cPickle as pickle +import optparse +import sys + +from utilities import read_pickle_files, write_pickle_file + +INHERITED_EXTENDED_ATTRIBUTES = set([ + 'ActiveDOMObject', + 'DependentLifetime', + 'GarbageCollected', + 'WillBeGarbageCollected', +]) + +# Main variable (filled in and exported) +interfaces_info = {} + +# Auxiliary variables (not visible to future build steps) +partial_interface_files = defaultdict(lambda: { + 'full_paths': [], + 'include_paths': [], +}) +parent_interfaces = {} +inherited_extended_attributes_by_interface = {} # interface name -> extended attributes + + +class IdlInterfaceFileNotFoundError(Exception): + """Raised if the IDL file implementing an interface cannot be found.""" + pass + + +def parse_options(): + usage = 'Usage: %prog [InfoIndividual.pickle]... [Info.pickle]' + parser = optparse.OptionParser(usage=usage) + parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') + + options, args = parser.parse_args() + if options.write_file_only_if_changed is None: + parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + return options, args + + +def dict_of_dicts_of_lists_update_or_append(existing, other): + """Updates an existing dict of dicts of lists, or appends to lists if key already present. + + Needed for merging partial_interface_files across components. + """ + for key, value in other.iteritems(): + if key not in existing: + existing[key] = value + continue + existing_value = existing[key] + for inner_key, inner_value in value.iteritems(): + existing_value[inner_key].extend(inner_value) + + +################################################################################ +# Computations +################################################################################ + +def compute_inheritance_info(interface_name): + """Compute inheritance information, namely ancestors and inherited extended attributes.""" + def generate_ancestors(interface_name): + while interface_name in parent_interfaces: + interface_name = parent_interfaces[interface_name] + yield interface_name + + ancestors = list(generate_ancestors(interface_name)) + inherited_extended_attributes = inherited_extended_attributes_by_interface[interface_name] + for ancestor in ancestors: + # Ancestors may not be present, notably if an ancestor is a generated + # IDL file and we are running this script from run-bindings-tests, + # where we don't generate these files. + ancestor_extended_attributes = inherited_extended_attributes_by_interface.get(ancestor, {}) + inherited_extended_attributes.update(ancestor_extended_attributes) + + interfaces_info[interface_name].update({ + 'ancestors': ancestors, + 'inherited_extended_attributes': inherited_extended_attributes, + }) + + +def compute_interfaces_info_overall(info_individuals): + """Compute information about IDL files. + + Information is stored in global interfaces_info. + """ + for info in info_individuals: + # No overlap between interface names, so ok to use dict.update + interfaces_info.update(info['interfaces_info']) + # Interfaces in one component may have partial interfaces in + # another component. This is ok (not a layering violation), since + # partial interfaces are used to *extend* interfaces. + # We thus need to update or append if already present + dict_of_dicts_of_lists_update_or_append( + partial_interface_files, info['partial_interface_files']) + + # Record inheritance information individually + for interface_name, interface_info in interfaces_info.iteritems(): + extended_attributes = interface_info['extended_attributes'] + inherited_extended_attributes_by_interface[interface_name] = dict( + (key, value) + for key, value in extended_attributes.iteritems() + if key in INHERITED_EXTENDED_ATTRIBUTES) + parent = interface_info['parent'] + if parent: + parent_interfaces[interface_name] = parent + + # Once all individual files handled, can compute inheritance information + # and dependencies + + # Compute inheritance info + for interface_name in interfaces_info: + compute_inheritance_info(interface_name) + + # Compute dependencies + # Move implements info from implement*ed* interface (rhs of 'implements') + # to implement*ing* interface (lhs of 'implements'). + # Note that moving an 'implements' statement between implementing and + # implemented files does not change the info (or hence cause a rebuild)! + for right_interface_name, interface_info in interfaces_info.iteritems(): + for left_interface_name in interface_info['implemented_by_interfaces']: + interfaces_info[left_interface_name]['implements_interfaces'].append(right_interface_name) + del interface_info['implemented_by_interfaces'] + + # An IDL file's dependencies are partial interface files that extend it, + # and files for other interfaces that this interfaces implements. + for interface_name, interface_info in interfaces_info.iteritems(): + partial_interface_paths = partial_interface_files[interface_name] + partial_interfaces_full_paths = partial_interface_paths['full_paths'] + # Partial interface definitions each need an include, as they are + # implemented in separate classes from the main interface. + partial_interfaces_include_paths = partial_interface_paths['include_paths'] + + implemented_interfaces = interface_info['implements_interfaces'] + try: + implemented_interfaces_info = [ + interfaces_info[interface] + for interface in implemented_interfaces] + except KeyError as key_name: + raise IdlInterfaceFileNotFoundError('Could not find the IDL file where the following implemented interface is defined: %s' % key_name) + implemented_interfaces_full_paths = [ + implemented_interface_info['full_path'] + for implemented_interface_info in implemented_interfaces_info] + # Implemented interfaces don't need includes, as this is handled in + # the Blink implementation (they are implemented on |impl| itself, + # hence header is included in implementing class). + # However, they are needed for legacy implemented interfaces that + # are being treated as partial interfaces, until we remove these. + # http://crbug.com/360435 + implemented_interfaces_include_paths = [ + implemented_interface_info['include_path'] + for implemented_interface_info in implemented_interfaces_info + if implemented_interface_info['is_legacy_treat_as_partial_interface']] + + interface_info.update({ + 'dependencies_full_paths': (partial_interfaces_full_paths + + implemented_interfaces_full_paths), + 'dependencies_include_paths': (partial_interfaces_include_paths + + implemented_interfaces_include_paths), + }) + + # Clean up temporary private information + for interface_info in interfaces_info.itervalues(): + del interface_info['extended_attributes'] + del interface_info['is_legacy_treat_as_partial_interface'] + del interface_info['parent'] + + +################################################################################ + +def main(): + options, args = parse_options() + # args = Input1, Input2, ..., Output + interfaces_info_filename = args.pop() + info_individuals = read_pickle_files(args) + + compute_interfaces_info_overall(info_individuals) + write_pickle_file(interfaces_info_filename, + interfaces_info, + options.write_file_only_if_changed) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/generate_event_interfaces.py b/bindings/scripts/generate_event_interfaces.py new file mode 100755 index 0000000..b222cb4 --- /dev/null +++ b/bindings/scripts/generate_event_interfaces.py
@@ -0,0 +1,122 @@ +#!/usr/bin/python +# +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate event interfaces .in file (EventInterfaces.in). + +The event interfaces .in file contains a list of all Event interfaces, i.e., +all interfaces that inherit from Event, including Event itself, +together with certain extended attributes. + +Paths are in POSIX format, and relative to Source/. + +This list is used in core/ to generate EventFactory and EventNames. +The .in format is documented in build/scripts/in_file.py. +""" + +from optparse import OptionParser +import os +import posixpath +import sys + +from utilities import get_file_contents, read_file_to_list, write_file, get_interface_extended_attributes_from_idl + +EXPORTED_EXTENDED_ATTRIBUTES = ( + 'Conditional', + 'ImplementedAs', + 'RuntimeEnabled', +) +module_path = os.path.dirname(os.path.realpath(__file__)) +source_dir = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) + + +def parse_options(): + parser = OptionParser() + parser.add_option('--event-idl-files-list', help='file listing event IDL files') + parser.add_option('--event-interfaces-file', help='output file') + parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') + parser.add_option('--suffix', help='specify a suffix to the namespace, i.e., "Modules". Default is None.') + + options, args = parser.parse_args() + if options.event_idl_files_list is None: + parser.error('Must specify a file listing event IDL files using --event-idl-files-list.') + if options.event_interfaces_file is None: + parser.error('Must specify an output file using --event-interfaces-file.') + if options.write_file_only_if_changed is None: + parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + if args: + parser.error('No arguments allowed, but %d given.' % len(args)) + return options + + +def write_event_interfaces_file(event_idl_files, destination_filename, only_if_changed, suffix): + def extended_attribute_string(name, value): + if name == 'RuntimeEnabled': + value += 'Enabled' + return name + '=' + value + + def interface_line(full_path): + relative_path_local, _ = os.path.splitext(os.path.relpath(full_path, source_dir)) + relative_path_posix = relative_path_local.replace(os.sep, posixpath.sep) + + idl_file_contents = get_file_contents(full_path) + extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) + extended_attributes_list = [ + extended_attribute_string(name, extended_attributes[name]) + for name in EXPORTED_EXTENDED_ATTRIBUTES + if name in extended_attributes] + + return '%s %s\n' % (relative_path_posix, + ', '.join(extended_attributes_list)) + + lines = ['namespace="Event"\n'] + if suffix: + lines.append('suffix="' + suffix + '"\n') + lines.append('\n') + interface_lines = [interface_line(event_idl_file) + for event_idl_file in event_idl_files] + interface_lines.sort() + lines.extend(interface_lines) + write_file(''.join(lines), destination_filename, only_if_changed) + + +################################################################################ + +def main(): + options = parse_options() + event_idl_files = read_file_to_list(options.event_idl_files_list) + write_event_interfaces_file(event_idl_files, + options.event_interfaces_file, + options.write_file_only_if_changed, + options.suffix) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/generate_global_constructors.py b/bindings/scripts/generate_global_constructors.py new file mode 100755 index 0000000..81838fe --- /dev/null +++ b/bindings/scripts/generate_global_constructors.py
@@ -0,0 +1,184 @@ +#!/usr/bin/python +# +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generates interface properties on global objects. + +Concretely these are implemented as "constructor attributes", meaning +"attributes whose name ends with Constructor" (special-cased by code generator), +hence "global constructors" for short. + +For reference on global objects, see: +http://heycam.github.io/webidl/#Global +http://heycam.github.io/webidl/#Exposed + +Design document: http://www.chromium.org/developers/design-documents/idl-build +""" + +import itertools +import optparse +import os +import cPickle as pickle +import re +import sys + +from collections import defaultdict +from utilities import get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl + +interface_name_to_global_names = {} +global_name_to_constructors = defaultdict(list) + + +HEADER_FORMAT = """// Stub header file for {{idl_basename}} +// Required because the IDL compiler assumes that a corresponding header file +// exists for each IDL file. +""" + +def parse_options(): + parser = optparse.OptionParser() + parser.add_option('--idl-files-list', help='file listing IDL files') + parser.add_option('--global-objects-file', help='pickle file of global objects') + parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') + + options, args = parser.parse_args() + + if options.idl_files_list is None: + parser.error('Must specify a file listing IDL files using --idl-files-list.') + if options.global_objects_file is None: + parser.error('Must specify a pickle file of global objects using --global-objects-file.') + if options.write_file_only_if_changed is None: + parser.error('Must specify whether output files are only written if changed using --write-file-only-if-changed.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + + return options, args + + +def flatten_list(iterable): + return list(itertools.chain.from_iterable(iterable)) + + +def interface_name_to_constructors(interface_name): + """Returns constructors for an interface.""" + global_names = interface_name_to_global_names[interface_name] + return flatten_list(global_name_to_constructors[global_name] + for global_name in global_names) + + +def record_global_constructors(idl_filename): + interface_name = idl_filename_to_interface_name(idl_filename) + full_path = os.path.realpath(idl_filename) + idl_file_contents = get_file_contents(full_path) + extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) + + # An interface property is produced for every non-callback interface + # that does not have [NoInterfaceObject]. + # Callback interfaces with constants also have interface properties, + # but there are none of these in Blink. + # http://heycam.github.io/webidl/#es-interfaces + if (is_callback_interface_from_idl(idl_file_contents) or + 'NoInterfaceObject' in extended_attributes): + return + + # The [Exposed] extended attribute MUST take an identifier list. Each + # identifier in the list MUST be a global name. An interface or interface + # member the extended attribute applies to will be exposed only on objects + # associated with ECMAScript global environments whose global object + # implements an interface that has a matching global name. + # FIXME: In spec names are comma-separated, but that makes parsing very + # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959). + exposed_global_names = extended_attributes.get('Exposed', 'Window').split('&') + new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes) + for exposed_global_name in exposed_global_names: + global_name_to_constructors[exposed_global_name].extend(new_constructors_list) + + +def generate_global_constructors_list(interface_name, extended_attributes): + extended_attributes_list = [ + name + '=' + extended_attributes[name] + for name in 'Conditional', 'PerContextEnabled', 'RuntimeEnabled' + if name in extended_attributes] + if extended_attributes_list: + extended_string = '[%s] ' % ', '.join(extended_attributes_list) + else: + extended_string = '' + + attribute_string = 'attribute {interface_name}Constructor {interface_name}'.format(interface_name=interface_name) + attributes_list = [extended_string + attribute_string] + + # In addition to the usual interface property, for every [NamedConstructor] + # extended attribute on an interface, a corresponding property MUST exist + # on the ECMAScript global object. + # http://heycam.github.io/webidl/#NamedConstructor + if 'NamedConstructor' in extended_attributes: + named_constructor = extended_attributes['NamedConstructor'] + # Extract function name, namely everything before opening '(' + constructor_name = re.sub(r'\(.*', '', named_constructor) + # Note the reduplicated 'ConstructorConstructor' + # FIXME: rename to NamedConstructor + attribute_string = 'attribute %sConstructorConstructor %s' % (interface_name, constructor_name) + attributes_list.append(extended_string + attribute_string) + + return attributes_list + + +def write_global_constructors_partial_interface(interface_name, idl_filename, constructor_attributes_list, only_if_changed): + # FIXME: replace this with a simple Jinja template + lines = (['partial interface %s {\n' % interface_name] + + [' %s;\n' % constructor_attribute + # FIXME: sort by interface name (not first by extended attributes) + for constructor_attribute in sorted(constructor_attributes_list)] + + ['};\n']) + write_file(''.join(lines), idl_filename, only_if_changed) + header_filename = os.path.splitext(idl_filename)[0] + '.h' + idl_basename = os.path.basename(idl_filename) + write_file(HEADER_FORMAT.format(idl_basename=idl_basename), + header_filename, only_if_changed) + + +################################################################################ + +def main(): + options, args = parse_options() + + # Input IDL files are passed in a file, due to OS command line length + # limits. This is generated at GYP time, which is ok b/c files are static. + idl_files = read_file_to_list(options.idl_files_list) + + # Output IDL files (to generate) are passed at the command line, since + # these are in the build directory, which is determined at build time, not + # GYP time. + # These are passed as pairs of GlobalObjectName, GlobalObject.idl + interface_name_idl_filename = [(args[i], args[i + 1]) + for i in range(0, len(args), 2)] + + with open(options.global_objects_file) as global_objects_file: + interface_name_to_global_names.update(pickle.load(global_objects_file)) + + for idl_filename in idl_files: + record_global_constructors(idl_filename) + + # Check for [Exposed] / [Global] mismatch. + known_global_names = frozenset(itertools.chain.from_iterable(interface_name_to_global_names.values())) + exposed_global_names = frozenset(global_name_to_constructors) + if not exposed_global_names.issubset(known_global_names): + unknown_global_names = exposed_global_names.difference(known_global_names) + raise ValueError('The following global names were used in ' + '[Exposed=xxx] but do not match any [Global] / ' + '[PrimaryGlobal] interface: %s' + % list(unknown_global_names)) + + # Write partial interfaces containing constructor attributes for each + # global interface. + for interface_name, idl_filename in interface_name_idl_filename: + constructors = interface_name_to_constructors(interface_name) + write_global_constructors_partial_interface( + interface_name, + idl_filename, + constructors, + options.write_file_only_if_changed) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/idl_compiler.py b/bindings/scripts/idl_compiler.py new file mode 100755 index 0000000..6728aff --- /dev/null +++ b/bindings/scripts/idl_compiler.py
@@ -0,0 +1,143 @@ +#!/usr/bin/python +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Compile an .idl file to Blink V8 bindings (.h and .cpp files). + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import abc +from optparse import OptionParser +import os +import cPickle as pickle +import sys + +from code_generator_v8 import CodeGeneratorV8 +from idl_reader import IdlReader +from utilities import write_file + + +def parse_options(): + parser = OptionParser() + parser.add_option('--cache-directory', + help='cache directory, defaults to output directory') + parser.add_option('--output-directory') + parser.add_option('--interfaces-info-file') + parser.add_option('--write-file-only-if-changed', type='int') + # ensure output comes last, so command line easy to parse via regexes + parser.disable_interspersed_args() + + options, args = parser.parse_args() + if options.output_directory is None: + parser.error('Must specify output directory using --output-directory.') + options.write_file_only_if_changed = bool(options.write_file_only_if_changed) + if len(args) != 1: + parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args)) + idl_filename = os.path.realpath(args[0]) + return options, idl_filename + + +def idl_filename_to_interface_name(idl_filename): + basename = os.path.basename(idl_filename) + interface_name, _ = os.path.splitext(basename) + return interface_name + + +class IdlCompiler(object): + """Abstract Base Class for IDL compilers. + + In concrete classes: + * self.code_generator must be set, implementing generate_code() + (returning a list of output code), and + * compile_file() must be implemented (handling output filenames). + """ + __metaclass__ = abc.ABCMeta + + def __init__(self, output_directory, cache_directory='', + code_generator=None, interfaces_info=None, + interfaces_info_filename='', only_if_changed=False): + """ + Args: + interfaces_info: + interfaces_info dict + (avoids auxiliary file in run-bindings-tests) + interfaces_info_file: filename of pickled interfaces_info + """ + cache_directory = cache_directory or output_directory + self.cache_directory = cache_directory + self.code_generator = code_generator + if interfaces_info_filename: + with open(interfaces_info_filename) as interfaces_info_file: + interfaces_info = pickle.load(interfaces_info_file) + self.interfaces_info = interfaces_info + self.only_if_changed = only_if_changed + self.output_directory = output_directory + self.reader = IdlReader(interfaces_info, cache_directory) + + def compile_and_write(self, idl_filename, output_filenames): + interface_name = idl_filename_to_interface_name(idl_filename) + definitions = self.reader.read_idl_definitions(idl_filename) + output_code_list = self.code_generator.generate_code( + definitions, interface_name) + for output_code, output_filename in zip(output_code_list, + output_filenames): + write_file(output_code, output_filename, self.only_if_changed) + + @abc.abstractmethod + def compile_file(self, idl_filename): + pass + + +class IdlCompilerV8(IdlCompiler): + def __init__(self, *args, **kwargs): + IdlCompiler.__init__(self, *args, **kwargs) + self.code_generator = CodeGeneratorV8(self.interfaces_info, + self.cache_directory) + + def compile_file(self, idl_filename): + interface_name = idl_filename_to_interface_name(idl_filename) + header_filename = os.path.join(self.output_directory, + 'V8%s.h' % interface_name) + cpp_filename = os.path.join(self.output_directory, + 'V8%s.cpp' % interface_name) + self.compile_and_write(idl_filename, (header_filename, cpp_filename)) + + +def main(): + options, idl_filename = parse_options() + idl_compiler = IdlCompilerV8( + options.output_directory, + cache_directory=options.cache_directory, + interfaces_info_filename=options.interfaces_info_file, + only_if_changed=options.write_file_only_if_changed) + idl_compiler.compile_file(idl_filename) + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/bindings/scripts/idl_definitions.py b/bindings/scripts/idl_definitions.py new file mode 100644 index 0000000..50664ba --- /dev/null +++ b/bindings/scripts/idl_definitions.py
@@ -0,0 +1,756 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Blink IDL Intermediate Representation (IR) classes. + +Classes are primarily constructors, which build an IdlDefinitions object +(and various contained objects) from an AST (produced by blink_idl_parser). + +This is in two steps: +* Constructors walk the AST, creating objects. +* Typedef resolution. + +Typedefs are all resolved here, and not stored in IR. + +Typedef resolution uses some auxiliary classes and OOP techniques to make this +a generic call, via the resolve_typedefs() method. + +Class hierarchy (mostly containment, '<' for inheritance): + +IdlDefinitions + IdlCallbackFunction < TypedObject + IdlEnum :: FIXME: remove, just use a dict for enums + IdlInterface + IdlAttribute < TypedObject + IdlConstant < TypedObject + IdlOperation < TypedObject + IdlArgument < TypedObject + IdlException < IdlInterface + (same contents as IdlInterface) + +TypedObject :: mixin for typedef resolution + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import abc + +from idl_types import IdlType, IdlUnionType + +SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER'] +STANDARD_TYPEDEFS = { + # http://www.w3.org/TR/WebIDL/#common-DOMTimeStamp + 'DOMTimeStamp': 'unsigned long long', +} + + +################################################################################ +# TypedObject (mixin for typedef resolution) +################################################################################ + +class TypedObject(object): + """Object with a type, such as an Attribute or Operation (return value). + + The type can be an actual type, or can be a typedef, which must be resolved + before passing data to the code generator. + """ + __metaclass__ = abc.ABCMeta + idl_type = None + + def resolve_typedefs(self, typedefs): + """Resolve typedefs to actual types in the object.""" + # Constructors don't have their own return type, because it's the + # interface itself. + if not self.idl_type: + return + # Need to re-assign self.idl_type, not just mutate idl_type, + # since type(idl_type) may change. + self.idl_type = self.idl_type.resolve_typedefs(typedefs) + + +################################################################################ +# Definitions (main container class) +################################################################################ + +class IdlDefinitions(object): + def __init__(self, node): + """Args: node: AST root node, class == 'File'""" + self.callback_functions = {} + self.dictionaries = {} + self.enumerations = {} + self.interfaces = {} + + node_class = node.GetClass() + if node_class != 'File': + raise ValueError('Unrecognized node class: %s' % node_class) + + typedefs = dict((typedef_name, IdlType(type_name)) + for typedef_name, type_name in + STANDARD_TYPEDEFS.iteritems()) + + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Interface': + interface = IdlInterface(child) + self.interfaces[interface.name] = interface + elif child_class == 'Exception': + exception = IdlException(child) + # For simplicity, treat exceptions as interfaces + self.interfaces[exception.name] = exception + elif child_class == 'Typedef': + type_name = child.GetName() + typedefs[type_name] = typedef_node_to_type(child) + elif child_class == 'Enum': + enumeration = IdlEnum(child) + self.enumerations[enumeration.name] = enumeration + elif child_class == 'Callback': + callback_function = IdlCallbackFunction(child) + self.callback_functions[callback_function.name] = callback_function + elif child_class == 'Implements': + # Implements is handled at the interface merging step + pass + elif child_class == 'Dictionary': + dictionary = IdlDictionary(child) + self.dictionaries[dictionary.name] = dictionary + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + # Typedefs are not stored in IR: + # Resolve typedefs with the actual types and then discard the Typedefs. + # http://www.w3.org/TR/WebIDL/#idl-typedefs + self.resolve_typedefs(typedefs) + + def resolve_typedefs(self, typedefs): + for callback_function in self.callback_functions.itervalues(): + callback_function.resolve_typedefs(typedefs) + for interface in self.interfaces.itervalues(): + interface.resolve_typedefs(typedefs) + + def update(self, other): + """Update with additional IdlDefinitions.""" + for interface_name, new_interface in other.interfaces.iteritems(): + if not new_interface.is_partial: + # Add as new interface + self.interfaces[interface_name] = new_interface + continue + + # Merge partial to existing interface + try: + self.interfaces[interface_name].merge(new_interface) + except KeyError: + raise Exception('Tried to merge partial interface for {0}, ' + 'but no existing interface by that name' + .format(interface_name)) + + # Merge callbacks and enumerations + self.enumerations.update(other.enumerations) + self.callback_functions.update(other.callback_functions) + + +################################################################################ +# Callback Functions +################################################################################ + +class IdlCallbackFunction(TypedObject): + def __init__(self, node): + children = node.GetChildren() + num_children = len(children) + if num_children != 2: + raise ValueError('Expected 2 children, got %s' % num_children) + type_node, arguments_node = children + arguments_node_class = arguments_node.GetClass() + if arguments_node_class != 'Arguments': + raise ValueError('Expected Arguments node, got %s' % arguments_node_class) + + self.name = node.GetName() + self.idl_type = type_node_to_type(type_node) + self.arguments = arguments_node_to_arguments(arguments_node) + + def resolve_typedefs(self, typedefs): + TypedObject.resolve_typedefs(self, typedefs) + for argument in self.arguments: + argument.resolve_typedefs(typedefs) + + +################################################################################ +# Dictionary +################################################################################ + +class IdlDictionary(object): + def __init__(self, node): + self.parent = None + self.name = node.GetName() + self.members = [] + for child in node.GetChildren(): + child_class = child.GetClass() + if child_class == 'Inherit': + self.parent = child.GetName() + elif child_class == 'Key': + self.members.append(IdlDictionaryMember(child)) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + +class IdlDictionaryMember(object): + def __init__(self, node): + self.default_value = None + self.extended_attributes = {} + self.idl_type = None + self.name = node.GetName() + for child in node.GetChildren(): + child_class = child.GetClass() + if child_class == 'Type': + self.idl_type = type_node_to_type(child) + elif child_class == 'Default': + self.default_value = child.GetProperty('VALUE') + elif child_class == 'ExtAttributes': + self.extended_attributes = ext_attributes_node_to_extended_attributes(child) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + +################################################################################ +# Enumerations +################################################################################ + +class IdlEnum(object): + # FIXME: remove, just treat enums as a dictionary + def __init__(self, node): + self.name = node.GetName() + self.values = [] + for child in node.GetChildren(): + self.values.append(child.GetName()) + + +################################################################################ +# Interfaces and Exceptions +################################################################################ + +class IdlInterface(object): + def __init__(self, node=None): + self.attributes = [] + self.constants = [] + self.constructors = [] + self.custom_constructors = [] + self.extended_attributes = {} + self.operations = [] + self.parent = None + if not node: # Early exit for IdlException.__init__ + return + + self.is_callback = node.GetProperty('CALLBACK') or False + self.is_exception = False + # FIXME: uppercase 'Partial' => 'PARTIAL' in base IDL parser + self.is_partial = node.GetProperty('Partial') or False + self.name = node.GetName() + + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Attribute': + self.attributes.append(IdlAttribute(child)) + elif child_class == 'Const': + self.constants.append(IdlConstant(child)) + elif child_class == 'ExtAttributes': + extended_attributes = ext_attributes_node_to_extended_attributes(child) + self.constructors, self.custom_constructors = ( + extended_attributes_to_constructors(extended_attributes)) + clear_constructor_attributes(extended_attributes) + self.extended_attributes = extended_attributes + elif child_class == 'Operation': + self.operations.append(IdlOperation(child)) + elif child_class == 'Inherit': + self.parent = child.GetName() + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + def resolve_typedefs(self, typedefs): + for attribute in self.attributes: + attribute.resolve_typedefs(typedefs) + for constant in self.constants: + constant.resolve_typedefs(typedefs) + for constructor in self.constructors: + constructor.resolve_typedefs(typedefs) + for custom_constructor in self.custom_constructors: + custom_constructor.resolve_typedefs(typedefs) + for operation in self.operations: + operation.resolve_typedefs(typedefs) + + def merge(self, other): + """Merge in another interface's members (e.g., partial interface)""" + self.attributes.extend(other.attributes) + self.constants.extend(other.constants) + self.operations.extend(other.operations) + + +class IdlException(IdlInterface): + # Properly exceptions and interfaces are distinct, and thus should inherit a + # common base class (say, "IdlExceptionOrInterface"). + # However, there is only one exception (DOMException), and new exceptions + # are not expected. Thus it is easier to implement exceptions as a + # restricted subclass of interfaces. + # http://www.w3.org/TR/WebIDL/#idl-exceptions + def __init__(self, node): + # Exceptions are similar to Interfaces, but simpler + IdlInterface.__init__(self) + self.is_callback = False + self.is_exception = True + self.is_partial = False + self.name = node.GetName() + + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Attribute': + attribute = IdlAttribute(child) + self.attributes.append(attribute) + elif child_class == 'Const': + self.constants.append(IdlConstant(child)) + elif child_class == 'ExtAttributes': + self.extended_attributes = ext_attributes_node_to_extended_attributes(child) + elif child_class == 'ExceptionOperation': + self.operations.append(IdlOperation.from_exception_operation_node(child)) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + +################################################################################ +# Attributes +################################################################################ + +class IdlAttribute(TypedObject): + def __init__(self, node): + self.is_read_only = node.GetProperty('READONLY') or False + self.is_static = node.GetProperty('STATIC') or False + self.name = node.GetName() + # Defaults, overridden below + self.idl_type = None + self.extended_attributes = {} + + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Type': + self.idl_type = type_node_to_type(child) + elif child_class == 'ExtAttributes': + self.extended_attributes = ext_attributes_node_to_extended_attributes(child) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + +################################################################################ +# Constants +################################################################################ + +class IdlConstant(TypedObject): + def __init__(self, node): + children = node.GetChildren() + num_children = len(children) + if num_children < 2 or num_children > 3: + raise ValueError('Expected 2 or 3 children, got %s' % num_children) + type_node = children[0] + value_node = children[1] + value_node_class = value_node.GetClass() + if value_node_class != 'Value': + raise ValueError('Expected Value node, got %s' % value_node_class) + + self.name = node.GetName() + # ConstType is more limited than Type, so subtree is smaller and + # we don't use the full type_node_to_type function. + self.idl_type = type_node_inner_to_type(type_node) + self.value = value_node.GetName() + + if num_children == 3: + ext_attributes_node = children[2] + self.extended_attributes = ext_attributes_node_to_extended_attributes(ext_attributes_node) + else: + 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 +################################################################################ + +class IdlOperation(TypedObject): + def __init__(self, node=None): + self.arguments = [] + self.extended_attributes = {} + self.specials = [] + self.is_constructor = False + + if not node: + self.is_static = False + return + self.name = node.GetName() # FIXME: should just be: or '' + # FIXME: AST should use None internally + if self.name == '_unnamed_': + self.name = '' + + self.is_static = node.GetProperty('STATIC') or False + property_dictionary = node.GetProperties() + for special_keyword in SPECIAL_KEYWORD_LIST: + if special_keyword in property_dictionary: + self.specials.append(special_keyword.lower()) + + self.idl_type = None + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Arguments': + self.arguments = arguments_node_to_arguments(child) + elif child_class == 'Type': + self.idl_type = type_node_to_type(child) + elif child_class == 'ExtAttributes': + self.extended_attributes = ext_attributes_node_to_extended_attributes(child) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + @classmethod + def from_exception_operation_node(cls, node): + # Needed to handle one case in DOMException.idl: + # // Override in a Mozilla compatible format + # [NotEnumerable] DOMString toString(); + # FIXME: can we remove this? replace with a stringifier? + operation = cls() + operation.name = node.GetName() + children = node.GetChildren() + if len(children) < 1 or len(children) > 2: + raise ValueError('ExceptionOperation node with %s children, expected 1 or 2' % len(children)) + + type_node = children[0] + operation.idl_type = type_node_to_type(type_node) + + if len(children) > 1: + ext_attributes_node = children[1] + operation.extended_attributes = ext_attributes_node_to_extended_attributes(ext_attributes_node) + + return operation + + @classmethod + def constructor_from_arguments_node(cls, name, arguments_node): + constructor = cls() + constructor.name = name + constructor.arguments = arguments_node_to_arguments(arguments_node) + constructor.is_constructor = True + return constructor + + def resolve_typedefs(self, typedefs): + TypedObject.resolve_typedefs(self, typedefs) + for argument in self.arguments: + argument.resolve_typedefs(typedefs) + + +################################################################################ +# Arguments +################################################################################ + +class IdlArgument(TypedObject): + def __init__(self, node): + self.extended_attributes = {} + self.idl_type = None + self.is_optional = node.GetProperty('OPTIONAL') # syntax: (optional T) + self.is_variadic = False # syntax: (T...) + self.name = node.GetName() + self.default_value = None + + children = node.GetChildren() + for child in children: + child_class = child.GetClass() + if child_class == 'Type': + self.idl_type = type_node_to_type(child) + elif child_class == 'ExtAttributes': + self.extended_attributes = ext_attributes_node_to_extended_attributes(child) + elif child_class == 'Argument': + child_name = child.GetName() + if child_name != '...': + raise ValueError('Unrecognized Argument node; expected "...", got "%s"' % child_name) + self.is_variadic = child.GetProperty('ELLIPSIS') or False + elif child_class == 'Default': + self.default_value = default_node_to_idl_literal(child) + else: + raise ValueError('Unrecognized node class: %s' % child_class) + + +def arguments_node_to_arguments(node): + # [Constructor] and [CustomConstructor] without arguments (the bare form) + # have None instead of an arguments node, but have the same meaning as using + # an empty argument list, [Constructor()], so special-case this. + # http://www.w3.org/TR/WebIDL/#Constructor + if node is None: + return [] + return [IdlArgument(argument_node) + for argument_node in node.GetChildren()] + + +################################################################################ +# Extended attributes +################################################################################ + +def ext_attributes_node_to_extended_attributes(node): + """ + Returns: + Dictionary of {ExtAttributeName: ExtAttributeValue}. + Value is usually a string, with three exceptions: + Constructors: value is a list of Arguments nodes, corresponding to + possible signatures of the constructor. + CustomConstructors: value is a list of Arguments nodes, corresponding to + possible signatures of the custom constructor. + NamedConstructor: value is a Call node, corresponding to the single + signature of the named constructor. + """ + # Primarily just make a dictionary from the children. + # The only complexity is handling various types of constructors: + # Constructors and Custom Constructors can have duplicate entries due to + # overloading, and thus are stored in temporary lists. + # However, Named Constructors cannot be overloaded, and thus do not have + # a list. + # FIXME: move Constructor logic into separate function, instead of modifying + # extended attributes in-place. + constructors = [] + custom_constructors = [] + extended_attributes = {} + + def child_node(extended_attribute_node): + children = extended_attribute_node.GetChildren() + if not children: + return None + if len(children) > 1: + raise ValueError('ExtAttributes node with %s children, expected at most 1' % len(children)) + return children[0] + + extended_attribute_node_list = node.GetChildren() + for extended_attribute_node in extended_attribute_node_list: + name = extended_attribute_node.GetName() + child = child_node(extended_attribute_node) + child_class = child and child.GetClass() + if name == 'Constructor': + if child_class and child_class != 'Arguments': + raise ValueError('Constructor only supports Arguments as child, but has child of class: %s' % child_class) + constructors.append(child) + elif name == 'CustomConstructor': + if child_class and child_class != 'Arguments': + raise ValueError('[CustomConstructor] only supports Arguments as child, but has child of class: %s' % child_class) + custom_constructors.append(child) + elif name == 'NamedConstructor': + if child_class and child_class != 'Call': + raise ValueError('[NamedConstructor] only supports Call as child, but has child of class: %s' % child_class) + extended_attributes[name] = child + elif name == 'SetWrapperReferenceTo': + if not child: + raise ValueError('[SetWrapperReferenceTo] requires a child, but has none.') + if child_class != 'Arguments': + raise ValueError('[SetWrapperReferenceTo] only supports Arguments as child, but has child of class: %s' % child_class) + extended_attributes[name] = arguments_node_to_arguments(child) + elif child: + raise ValueError('ExtAttributes node with unexpected children: %s' % name) + else: + value = extended_attribute_node.GetProperty('VALUE') + extended_attributes[name] = value + + # Store constructors and custom constructors in special list attributes, + # which are deleted later. Note plural in key. + if constructors: + extended_attributes['Constructors'] = constructors + if custom_constructors: + extended_attributes['CustomConstructors'] = custom_constructors + + return extended_attributes + + +def extended_attributes_to_constructors(extended_attributes): + """Returns constructors and custom_constructors (lists of IdlOperations). + + Auxiliary function for IdlInterface.__init__. + """ + + constructor_list = extended_attributes.get('Constructors', []) + constructors = [ + IdlOperation.constructor_from_arguments_node('Constructor', arguments_node) + for arguments_node in constructor_list] + + custom_constructor_list = extended_attributes.get('CustomConstructors', []) + custom_constructors = [ + IdlOperation.constructor_from_arguments_node('CustomConstructor', arguments_node) + for arguments_node in custom_constructor_list] + + if 'NamedConstructor' in extended_attributes: + # FIXME: support overloaded named constructors, and make homogeneous + name = 'NamedConstructor' + call_node = extended_attributes['NamedConstructor'] + extended_attributes['NamedConstructor'] = call_node.GetName() + children = call_node.GetChildren() + if len(children) != 1: + raise ValueError('NamedConstructor node expects 1 child, got %s.' % len(children)) + arguments_node = children[0] + named_constructor = IdlOperation.constructor_from_arguments_node('NamedConstructor', arguments_node) + # FIXME: should return named_constructor separately; appended for Perl + constructors.append(named_constructor) + + return constructors, custom_constructors + + +def clear_constructor_attributes(extended_attributes): + # Deletes Constructor*s* (plural), sets Constructor (singular) + if 'Constructors' in extended_attributes: + del extended_attributes['Constructors'] + extended_attributes['Constructor'] = None + if 'CustomConstructors' in extended_attributes: + del extended_attributes['CustomConstructors'] + extended_attributes['CustomConstructor'] = None + + +################################################################################ +# Types +################################################################################ + +def type_node_to_type(node): + children = node.GetChildren() + if len(children) < 1 or len(children) > 2: + raise ValueError('Type node expects 1 or 2 children (type + optional array []), got %s (multi-dimensional arrays are not supported).' % len(children)) + + type_node_child = children[0] + + if len(children) == 2: + array_node = children[1] + array_node_class = array_node.GetClass() + if array_node_class != 'Array': + raise ValueError('Expected Array node as TypeSuffix, got %s node.' % array_node_class) + # FIXME: use IdlArrayType instead of is_array, once have that + is_array = True + else: + is_array = False + + is_nullable = node.GetProperty('NULLABLE') or False # syntax: T? + + return type_node_inner_to_type(type_node_child, is_array=is_array, is_nullable=is_nullable) + + +def type_node_inner_to_type(node, is_array=False, is_nullable=False): + # FIXME: remove is_array and is_nullable once have IdlArrayType and IdlNullableType + node_class = node.GetClass() + # Note Type*r*ef, not Typedef, meaning the type is an identifier, thus + # either a typedef shorthand (but not a Typedef declaration itself) or an + # interface type. We do not distinguish these, and just use the type name. + if node_class in ['PrimitiveType', 'Typeref']: + # unrestricted syntax: unrestricted double | unrestricted float + is_unrestricted = node.GetProperty('UNRESTRICTED') or False + return IdlType(node.GetName(), is_array=is_array, is_nullable=is_nullable, is_unrestricted=is_unrestricted) + elif node_class == 'Any': + return IdlType('any', is_array=is_array, is_nullable=is_nullable) + elif node_class == 'Sequence': + if is_array: + raise ValueError('Arrays of sequences are not supported') + return sequence_node_to_type(node, is_nullable=is_nullable) + elif node_class == 'UnionType': + if is_array: + raise ValueError('Arrays of unions are not supported') + return union_type_node_to_idl_union_type(node, is_nullable=is_nullable) + raise ValueError('Unrecognized node class: %s' % node_class) + + +def sequence_node_to_type(node, is_nullable=False): + children = node.GetChildren() + if len(children) != 1: + raise ValueError('Sequence node expects exactly 1 child, got %s' % len(children)) + sequence_child = children[0] + sequence_child_class = sequence_child.GetClass() + if sequence_child_class != 'Type': + raise ValueError('Unrecognized node class: %s' % sequence_child_class) + element_type = type_node_to_type(sequence_child).base_type + return IdlType(element_type, is_sequence=True, is_nullable=is_nullable) + + +def typedef_node_to_type(node): + children = node.GetChildren() + if len(children) != 1: + raise ValueError('Typedef node with %s children, expected 1' % len(children)) + child = children[0] + child_class = child.GetClass() + if child_class != 'Type': + raise ValueError('Unrecognized node class: %s' % child_class) + return type_node_to_type(child) + + +def union_type_node_to_idl_union_type(node, is_nullable=False): + member_types = [type_node_to_type(member_type_node) + for member_type_node in node.GetChildren()] + return IdlUnionType(member_types, is_nullable=is_nullable)
diff --git a/bindings/scripts/idl_reader.py b/bindings/scripts/idl_reader.py new file mode 100644 index 0000000..450c73d --- /dev/null +++ b/bindings/scripts/idl_reader.py
@@ -0,0 +1,109 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Read an IDL file or complete IDL interface, producing an IdlDefinitions object. + +Design doc: +http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end +""" + +import os + +import blink_idl_parser +from blink_idl_parser import BlinkIDLParser +from idl_definitions import IdlDefinitions +from idl_validator import EXTENDED_ATTRIBUTES_RELATIVE_PATH, IDLInvalidExtendedAttributeError, IDLExtendedAttributeValidator +from interface_dependency_resolver import InterfaceDependencyResolver + + +class IdlReader(object): + def __init__(self, interfaces_info=None, outputdir=''): + self.extended_attribute_validator = IDLExtendedAttributeValidator() + + if interfaces_info: + self.interface_dependency_resolver = InterfaceDependencyResolver(interfaces_info, self) + else: + self.interface_dependency_resolver = None + + self.parser = BlinkIDLParser(outputdir=outputdir) + + def read_idl_definitions(self, idl_filename): + """Returns an IdlDefinitions object for an IDL file, including all dependencies.""" + definitions = self.read_idl_file(idl_filename) + if not self.interface_dependency_resolver: + return definitions + self.interface_dependency_resolver.resolve_dependencies(definitions) + return definitions + + def read_idl_file(self, idl_filename): + """Returns an IdlDefinitions object for an IDL file, without any dependencies. + + The IdlDefinitions object is guaranteed to contain a single + IdlInterface; it may also contain other definitions, such as + callback functions and enumerations.""" + ast = blink_idl_parser.parse_file(self.parser, idl_filename) + if not ast: + raise Exception('Failed to parse %s' % idl_filename) + definitions = IdlDefinitions(ast) + + # Validate file contents with filename convention + # The Blink IDL filenaming convention is that the file + # <interface_name>.idl MUST contain exactly 1 interface (or exception), + # and the interface name must agree with the file's basename, + # unless it is a partial interface. + # (e.g., 'partial interface Foo' can be in FooBar.idl). + number_of_interfaces = len(definitions.interfaces) + if number_of_interfaces != 1: + raise Exception( + 'Expected exactly 1 interface in file {0}, but found {1}' + .format(idl_filename, number_of_interfaces)) + interface = next(definitions.interfaces.itervalues()) + idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) + if not interface.is_partial and interface.name != idl_file_basename: + raise Exception( + 'Interface name "{0}" disagrees with IDL file basename "{1}".' + .format(interface.name, idl_file_basename)) + + # Validate extended attributes + if not self.extended_attribute_validator: + return definitions + + try: + self.extended_attribute_validator.validate_extended_attributes(definitions) + except IDLInvalidExtendedAttributeError as error: + raise IDLInvalidExtendedAttributeError(""" +IDL ATTRIBUTE ERROR in file: +%s: + %s +If you want to add a new IDL extended attribute, please add it to: + %s +and add an explanation to the Blink IDL documentation at: + http://www.chromium.org/blink/webidl/blink-idl-extended-attributes + """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) + + return definitions
diff --git a/bindings/scripts/idl_types.py b/bindings/scripts/idl_types.py new file mode 100644 index 0000000..e488e33 --- /dev/null +++ b/bindings/scripts/idl_types.py
@@ -0,0 +1,321 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""IDL type handling. + +Classes: +IdlType +IdlUnionType +""" + +from collections import defaultdict + + +################################################################################ +# IDL types +################################################################################ + +INTEGER_TYPES = frozenset([ + # http://www.w3.org/TR/WebIDL/#dfn-integer-type + 'byte', + 'octet', + 'short', + 'unsigned short', + # int and unsigned are not IDL types + 'long', + 'unsigned long', + 'long long', + 'unsigned long long', +]) +NUMERIC_TYPES = (INTEGER_TYPES | frozenset([ + # http://www.w3.org/TR/WebIDL/#dfn-numeric-type + 'float', + 'unrestricted float', + 'double', + 'unrestricted double', +])) +# http://www.w3.org/TR/WebIDL/#dfn-primitive-type +PRIMITIVE_TYPES = (frozenset(['boolean']) | NUMERIC_TYPES) +BASIC_TYPES = (PRIMITIVE_TYPES | frozenset([ + # Built-in, non-composite, non-object data types + # http://heycam.github.io/webidl/#idl-types + 'DOMString', + 'ByteString', + 'Date', + # http://heycam.github.io/webidl/#es-type-mapping + 'void', + # http://encoding.spec.whatwg.org/#type-scalarvaluestring + 'ScalarValueString', +])) +TYPE_NAMES = { + # http://heycam.github.io/webidl/#dfn-type-name + 'any': 'Any', + 'boolean': 'Boolean', + 'byte': 'Byte', + 'octet': 'Octet', + 'short': 'Short', + 'unsigned short': 'UnsignedShort', + 'long': 'Long', + 'unsigned long': 'UnsignedLong', + 'long long': 'LongLong', + 'unsigned long long': 'UnsignedLongLong', + 'float': 'Float', + 'unrestricted float': 'UnrestrictedFloat', + 'double': 'Double', + 'unrestricted double': 'UnrestrictedDouble', + 'DOMString': 'String', + 'ByteString': 'ByteString', + 'ScalarValueString': 'ScalarValueString', + 'object': 'Object', + 'Date': 'Date', +} + + +################################################################################ +# Inheritance +################################################################################ + +ancestors = defaultdict(list) # interface_name -> ancestors + +def inherits_interface(interface_name, ancestor_name): + return (interface_name == ancestor_name or + ancestor_name in ancestors[interface_name]) + + +def set_ancestors(new_ancestors): + ancestors.update(new_ancestors) + + +################################################################################ +# IdlType +################################################################################ + +class IdlType(object): + # FIXME: incorporate Nullable, etc. + # FIXME: use nested types: IdlArrayType, IdlNullableType, IdlSequenceType + # to support types like short?[] vs. short[]?, instead of treating these + # as orthogonal properties (via flags). + callback_functions = set() + callback_interfaces = set() + enums = {} # name -> values + + def __init__(self, base_type, is_array=False, is_sequence=False, is_nullable=False, is_unrestricted=False): + if is_array and is_sequence: + raise ValueError('Array of Sequences are not allowed.') + if is_unrestricted: + self.base_type = 'unrestricted %s' % base_type + else: + self.base_type = base_type + self.is_array = is_array + self.is_sequence = is_sequence + self.is_nullable = is_nullable + + def __str__(self): + type_string = self.base_type + if self.is_array: + return type_string + '[]' + if self.is_sequence: + return 'sequence<%s>' % type_string + if self.is_nullable: + # FIXME: Dictionary::ConversionContext::setConversionType can't + # handle the '?' in nullable types (passes nullability separately). + # Update that function to handle nullability from the type name, + # simplifying its signature. + # return type_string + '?' + return type_string + return type_string + + # FIXME: rename to native_array_element_type and move to v8_types.py + @property + def array_or_sequence_type(self): + return self.array_type or self.sequence_type + + # FIXME: rename to array_element_type + @property + def array_type(self): + return self.is_array and IdlType(self.base_type) + + # FIXME: rename to sequence_element_type + @property + def sequence_type(self): + return self.is_sequence and IdlType(self.base_type) + + @property + def is_basic_type(self): + return self.base_type in BASIC_TYPES and not self.array_or_sequence_type + + @property + def is_callback_function(self): + return self.base_type in IdlType.callback_functions + + @property + def is_callback_interface(self): + return self.base_type in IdlType.callback_interfaces + + @property + def is_composite_type(self): + return (self.name == 'Any' or + self.array_type or + self.sequence_type or + self.is_union_type) + + @property + def is_enum(self): + # FIXME: add an IdlEnumType class and a resolve_enums step at end of + # IdlDefinitions constructor + return self.name in IdlType.enums + + @property + def enum_values(self): + return IdlType.enums[self.name] + + @property + def is_integer_type(self): + return self.base_type in INTEGER_TYPES and not self.array_or_sequence_type + + @property + def is_numeric_type(self): + return self.base_type in NUMERIC_TYPES and not self.array_or_sequence_type + + @property + def is_primitive_type(self): + return self.base_type in PRIMITIVE_TYPES and not self.array_or_sequence_type + + @property + def is_interface_type(self): + # Anything that is not another type is an interface type. + # http://www.w3.org/TR/WebIDL/#idl-types + # http://www.w3.org/TR/WebIDL/#idl-interface + # In C++ these are RefPtr or PassRefPtr types. + return not(self.is_basic_type or + self.is_composite_type or + self.is_callback_function or + self.is_enum or + self.name == 'Object' or + self.name == 'Promise') # Promise will be basic in future + + @property + def is_union_type(self): + return isinstance(self, IdlUnionType) + + @property + def name(self): + """Return type name. + + http://heycam.github.io/webidl/#dfn-type-name + """ + base_type = self.base_type + base_type_name = TYPE_NAMES.get(base_type, base_type) + if self.is_array: + return base_type_name + 'Array' + if self.is_sequence: + return base_type_name + 'Sequence' + if self.is_nullable: + return base_type_name + 'OrNull' + return base_type_name + + @classmethod + def set_callback_functions(cls, new_callback_functions): + cls.callback_functions.update(new_callback_functions) + + @classmethod + def set_callback_interfaces(cls, new_callback_interfaces): + cls.callback_interfaces.update(new_callback_interfaces) + + @classmethod + def set_enums(cls, new_enums): + cls.enums.update(new_enums) + + def resolve_typedefs(self, typedefs): + if self.base_type not in typedefs: + return self + new_type = typedefs[self.base_type] + if type(new_type) != type(self): + # If type changes, need to return a different object, + # since can't change type(self) + return new_type + # If type doesn't change, just mutate self to avoid a new object + # FIXME: a bit ugly; use __init__ instead of setting flags + self.base_type = new_type.base_type + # handle array both in use and in typedef itself: + # typedef Type TypeDef; + # TypeDef[] ... + # and: + # typedef Type[] TypeArray + # TypeArray ... + self.is_array |= new_type.is_array + self.is_sequence |= new_type.is_sequence + return self + + +################################################################################ +# IdlUnionType +################################################################################ + +class IdlUnionType(object): + # http://heycam.github.io/webidl/#idl-union + # FIXME: derive from IdlType, instead of stand-alone class, to reduce + # duplication. + def __init__(self, member_types, is_nullable=False): + self.member_types = member_types + self.is_nullable = is_nullable + + @property + def array_or_sequence_type(self): + return False + + @property + def array_type(self): + return False + + @property + def is_array(self): + # We do not support arrays of union types + return False + + @property + def base_type(self): + return None + + @property + def is_basic_type(self): + return False + + @property + def is_callback_function(self): + return False + + @property + def is_enum(self): + return False + + @property + def is_integer_type(self): + return False + + @property + def is_numeric_type(self): + return False + + @property + def is_primitivee_type(self): + return False + + @property + def is_sequence(self): + # We do not support sequences of union types + return False + + @property + def is_union_type(self): + return True + + @property + def name(self): + return 'Or'.join(member_type.name for member_type in self.member_types) + + def resolve_typedefs(self, typedefs): + self.member_types = [ + typedefs.get(member_type, member_type) + for member_type in self.member_types] + return self
diff --git a/bindings/scripts/idl_validator.py b/bindings/scripts/idl_validator.py new file mode 100644 index 0000000..e527442 --- /dev/null +++ b/bindings/scripts/idl_validator.py
@@ -0,0 +1,108 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Validate extended attributes. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Extended-attribute-validation +""" + + +import os.path +import re + +module_path = os.path.dirname(__file__) +source_path = os.path.join(module_path, os.pardir, os.pardir) +EXTENDED_ATTRIBUTES_RELATIVE_PATH = os.path.join('bindings', + 'IDLExtendedAttributes.txt') +EXTENDED_ATTRIBUTES_FILENAME = os.path.join(source_path, + EXTENDED_ATTRIBUTES_RELATIVE_PATH) + +class IDLInvalidExtendedAttributeError(Exception): + pass + + +class IDLExtendedAttributeValidator(object): + def __init__(self): + self.valid_extended_attributes = read_extended_attributes_file() + + def validate_extended_attributes(self, definitions): + # FIXME: this should be done when parsing the file, rather than after. + for interface in definitions.interfaces.itervalues(): + self.validate_extended_attributes_node(interface) + for attribute in interface.attributes: + self.validate_extended_attributes_node(attribute) + for operation in interface.operations: + self.validate_extended_attributes_node(operation) + for argument in operation.arguments: + self.validate_extended_attributes_node(argument) + + def validate_extended_attributes_node(self, node): + for name, values_string in node.extended_attributes.iteritems(): + self.validate_name_values_string(name, values_string) + + def validate_name_values_string(self, name, values_string): + if name not in self.valid_extended_attributes: + raise IDLInvalidExtendedAttributeError( + 'Unknown extended attribute [%s]' % name) + valid_values = self.valid_extended_attributes[name] + if values_string is None and None not in valid_values: + raise IDLInvalidExtendedAttributeError( + 'Missing required argument for extended attribute [%s]' % name) + if '*' in valid_values: # wildcard, any (non-empty) value ok + return + if values_string is None: + values = set([None]) + else: + values = set(re.split('[|&]', values_string)) + invalid_values = values - valid_values + if invalid_values: + invalid_value = invalid_values.pop() + raise IDLInvalidExtendedAttributeError( + 'Invalid value "%s" found in extended attribute [%s=%s]' % + (invalid_value, name, values_string)) + + +def read_extended_attributes_file(): + def extended_attribute_name_values(): + with open(EXTENDED_ATTRIBUTES_FILENAME) as extended_attributes_file: + for line in extended_attributes_file: + line = line.strip() + if not line or line.startswith('#'): + continue + name, _, values_string = map(str.strip, line.partition('=')) + value_list = [value.strip() for value in values_string.split('|')] + yield name, value_list + + valid_extended_attributes = {} + for name, value_list in extended_attribute_name_values(): + if not value_list: + valid_extended_attributes[name] = set([None]) + continue + valid_extended_attributes[name] = set([value if value else None + for value in value_list]) + return valid_extended_attributes
diff --git a/bindings/scripts/interface_dependency_resolver.py b/bindings/scripts/interface_dependency_resolver.py new file mode 100644 index 0000000..c65d3f6 --- /dev/null +++ b/bindings/scripts/interface_dependency_resolver.py
@@ -0,0 +1,179 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Resolve interface dependencies, producing a merged IdlDefinitions object. + +This library computes interface dependencies (partial interfaces and +implements), reads the dependency files, and merges them to the IdlDefinitions +for the main IDL file, producing an IdlDefinitions object representing the +entire interface. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Dependency-resolution +""" + +import os.path + +# The following extended attributes can be applied to a dependency interface, +# and are then applied to the individual members when merging. +# Note that this moves the extended attribute from the interface to the member, +# which changes the semantics and yields different code than the same extended +# attribute on the main interface. +DEPENDENCY_EXTENDED_ATTRIBUTES = set([ + 'Conditional', + 'PerContextEnabled', + 'RuntimeEnabled', +]) + + +class InterfaceDependencyResolver(object): + def __init__(self, interfaces_info, reader): + """Initialize dependency resolver. + + Args: + interfaces_info: + dict of interfaces information, from compute_dependencies.py + reader: + IdlReader, used for reading dependency files + """ + self.interfaces_info = interfaces_info + self.reader = reader + + def resolve_dependencies(self, definitions): + """Resolve dependencies, merging them into IDL definitions of main file. + + Dependencies consist of 'partial interface' for the same interface as + in the main file, and other interfaces that this interface 'implements'. + These are merged into the main IdlInterface, as the main IdlInterface + implements all these members. + + Referenced interfaces are added to IdlDefinitions, but not merged into + the main IdlInterface, as these are only referenced (their members are + introspected, but not implemented in this interface). + + Inherited extended attributes are also added to the main IdlInterface. + + Modifies definitions in place by adding parsed dependencies. + + Args: + definitions: IdlDefinitions object, modified in place + """ + target_interface = next(definitions.interfaces.itervalues()) + interface_name = target_interface.name + interface_info = self.interfaces_info[interface_name] + + if 'inherited_extended_attributes' in interface_info: + target_interface.extended_attributes.update( + interface_info['inherited_extended_attributes']) + + merge_interface_dependencies(definitions, + target_interface, + interface_info['dependencies_full_paths'], + self.reader) + + for referenced_interface_name in interface_info['referenced_interfaces']: + referenced_definitions = self.reader.read_idl_definitions( + self.interfaces_info[referenced_interface_name]['full_path']) + definitions.update(referenced_definitions) + + +def merge_interface_dependencies(definitions, target_interface, dependency_idl_filenames, reader): + """Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface. + + No return: modifies target_interface in place. + """ + # Sort so order consistent, so can compare output from run to run. + for dependency_idl_filename in sorted(dependency_idl_filenames): + dependency_definitions = reader.read_idl_file(dependency_idl_filename) + dependency_interface = next(dependency_definitions.interfaces.itervalues()) + dependency_interface_basename, _ = os.path.splitext(os.path.basename(dependency_idl_filename)) + + transfer_extended_attributes(dependency_interface, + dependency_interface_basename) + definitions.update(dependency_definitions) # merges partial interfaces + if not dependency_interface.is_partial: + # Implemented interfaces (non-partial dependencies) are also merged + # into the target interface, so Code Generator can just iterate + # over one list (and not need to handle 'implements' itself). + target_interface.merge(dependency_interface) + + +def transfer_extended_attributes(dependency_interface, dependency_interface_basename): + """Transfer extended attributes from dependency interface onto members. + + Merging consists of storing certain interface-level data in extended + attributes of the *members* (because there is no separate dependency + interface post-merging). + + The data storing consists of: + * applying certain extended attributes from the dependency interface + to its members + * storing the C++ class of the implementation in an internal + extended attribute of each member, [PartialInterfaceImplementedAs] + + No return: modifies dependency_interface in place. + """ + merged_extended_attributes = dict( + (key, value) + for key, value in dependency_interface.extended_attributes.iteritems() + if key in DEPENDENCY_EXTENDED_ATTRIBUTES) + + # A partial interface's members are implemented as static member functions + # in a separate C++ class. This class name is stored in + # [PartialInterfaceImplementedAs] which defaults to the basename of + # dependency IDL file. + # This class name can be overridden by [ImplementedAs] on the partial + # interface definition. + # + # Note that implemented interfaces do *not* need [ImplementedAs], since + # they are implemented on the C++ object |impl| itself, just like members of + # the main interface definition, so the bindings do not need to know in + # which class implemented interfaces are implemented. + # + # Currently [LegacyTreatAsPartialInterface] can be used to have partial + # interface behavior on implemented interfaces, but this is being removed + # as legacy cruft: + # FIXME: Remove [LegacyTreatAsPartialInterface] + # http://crbug.com/360435 + # + # Note that [ImplementedAs] is used with different meanings on interfaces + # and members: + # for Blink class name and function name (or constant name), respectively. + # Thus we do not want to copy this from the interface to the member, but + # instead extract it and handle it separately. + if (dependency_interface.is_partial or + 'LegacyTreatAsPartialInterface' in dependency_interface.extended_attributes): + merged_extended_attributes['PartialInterfaceImplementedAs'] = ( + dependency_interface.extended_attributes.get( + 'ImplementedAs', dependency_interface_basename)) + + for attribute in dependency_interface.attributes: + attribute.extended_attributes.update(merged_extended_attributes) + for constant in dependency_interface.constants: + constant.extended_attributes.update(merged_extended_attributes) + for operation in dependency_interface.operations: + operation.extended_attributes.update(merged_extended_attributes)
diff --git a/bindings/scripts/utilities.py b/bindings/scripts/utilities.py new file mode 100644 index 0000000..0aeabc2 --- /dev/null +++ b/bindings/scripts/utilities.py
@@ -0,0 +1,171 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions (file reading, simple IDL parsing by regexes) for IDL build. + +Design doc: http://www.chromium.org/developers/design-documents/idl-build +""" + +import os +import cPickle as pickle +import re +import string + + +class IdlBadFilenameError(Exception): + """Raised if an IDL filename disagrees with the interface name in the file.""" + pass + + +def idl_filename_to_interface_name(idl_filename): + # interface name is the root of the basename: InterfaceName.idl + return os.path.splitext(os.path.basename(idl_filename))[0] + + +################################################################################ +# Basic file reading/writing +################################################################################ + +def get_file_contents(filename): + with open(filename) as f: + return f.read() + + +def read_file_to_list(filename): + """Returns a list of (stripped) lines for a given filename.""" + with open(filename) as f: + return [line.rstrip('\n') for line in f] + + +def read_pickle_files(pickle_filenames): + for pickle_filename in pickle_filenames: + with open(pickle_filename) as pickle_file: + yield pickle.load(pickle_file) + + +def write_file(new_text, destination_filename, only_if_changed): + if only_if_changed and os.path.isfile(destination_filename): + with open(destination_filename) as destination_file: + if destination_file.read() == new_text: + return + with open(destination_filename, 'w') as destination_file: + destination_file.write(new_text) + + +def write_pickle_file(pickle_filename, data, only_if_changed): + if only_if_changed and os.path.isfile(pickle_filename): + with open(pickle_filename) as pickle_file: + try: + if pickle.load(pickle_file) == data: + return + except (EOFError, pickle.UnpicklingError): + # If trouble unpickling, overwrite + pass + with open(pickle_filename, 'w') as pickle_file: + pickle.dump(data, pickle_file) + + +################################################################################ +# IDL parsing +# +# We use regular expressions for parsing; this is incorrect (Web IDL is not a +# regular language), but simple and sufficient in practice. +# Leading and trailing context (e.g. following '{') used to avoid false matches. +################################################################################ + +def get_partial_interface_name_from_idl(file_contents): + match = re.search(r'partial\s+interface\s+(\w+)\s*{', file_contents) + return match and match.group(1) + + +def get_implements_from_idl(file_contents, interface_name): + """Returns lists of implementing and implemented interfaces. + + Rule is: identifier-A implements identifier-B; + i.e., implement*ing* implements implement*ed*; + http://www.w3.org/TR/WebIDL/#idl-implements-statements + + Returns two lists of interfaces: identifier-As and identifier-Bs. + An 'implements' statements can be present in the IDL file for either the + implementing or the implemented interface, but not other files. + """ + implements_re = (r'^\s*' + r'(\w+)\s+' + r'implements\s+' + r'(\w+)\s*' + r';') + implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE) + implements_pairs = [match.groups() for match in implements_matches] + + foreign_implements = [pair for pair in implements_pairs + if interface_name not in pair] + if foreign_implements: + left, right = foreign_implements.pop() + raise IdlBadFilenameError( + 'implements statement found in unrelated IDL file.\n' + 'Statement is:\n' + ' %s implements %s;\n' + 'but filename is unrelated "%s.idl"' % + (left, right, interface_name)) + + return ( + [left for left, right in implements_pairs if right == interface_name], + [right for left, right in implements_pairs if left == interface_name]) + + +def is_callback_interface_from_idl(file_contents): + match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents) + return bool(match) + + +def get_parent_interface(file_contents): + match = re.search(r'interface\s+' + r'\w+\s*' + r':\s*(\w+)\s*' + r'{', + file_contents) + return match and match.group(1) + + +def get_interface_extended_attributes_from_idl(file_contents): + # Strip comments + # re.compile needed b/c Python 2.6 doesn't support flags in re.sub + single_line_comment_re = re.compile(r'//.*$', flags=re.MULTILINE) + block_comment_re = re.compile(r'/\*.*?\*/', flags=re.MULTILINE | re.DOTALL) + file_contents = re.sub(single_line_comment_re, '', file_contents) + file_contents = re.sub(block_comment_re, '', file_contents) + + match = re.search(r'\[(.*)\]\s*' + r'((callback|partial)\s+)?' + r'(interface|exception)\s+' + r'\w+\s*' + r'(:\s*\w+\s*)?' + r'{', + file_contents, flags=re.DOTALL) + if not match: + return {} + + extended_attributes_string = match.group(1) + extended_attributes = {} + # FIXME: this splitting is WRONG: it fails on ExtendedAttributeArgList like + # 'NamedConstructor=Foo(a, b)' + parts = [extended_attribute.strip() + for extended_attribute in extended_attributes_string.split(',') + # Discard empty parts, which may exist due to trailing comma + if extended_attribute.strip()] + for part in parts: + name, _, value = map(string.strip, part.partition('=')) + extended_attributes[name] = value + return extended_attributes + + +def get_put_forward_interfaces_from_idl(file_contents): + put_forwards_pattern = (r'\[[^\]]*PutForwards=[^\]]*\]\s+' + r'readonly\s+' + r'attribute\s+' + r'(\w+)') + return sorted(set(match.group(1) + for match in re.finditer(put_forwards_pattern, + file_contents, + flags=re.DOTALL)))
diff --git a/bindings/scripts/v8_attributes.py b/bindings/scripts/v8_attributes.py new file mode 100644 index 0000000..6dcb2d5 --- /dev/null +++ b/bindings/scripts/v8_attributes.py
@@ -0,0 +1,436 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for attributes. + +Extends IdlType with property |constructor_type_name|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import idl_types +from idl_types import inherits_interface +from v8_globals import includes, interfaces +import v8_types +import v8_utilities +from v8_utilities import capitalize, cpp_name, has_extended_attribute, has_extended_attribute_value, scoped_name, strip_suffix, uncapitalize + + +def generate_attribute(interface, attribute): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + + idl_type.add_includes_for_type() + + # [CheckSecurity] + is_check_security_for_node = 'CheckSecurity' in extended_attributes + if is_check_security_for_node: + includes.add('bindings/common/BindingSecurity.h') + # [Custom] + has_custom_getter = ('Custom' in extended_attributes and + extended_attributes['Custom'] in [None, 'Getter']) + has_custom_setter = (not attribute.is_read_only and + 'Custom' in extended_attributes and + extended_attributes['Custom'] in [None, 'Setter']) + # [CustomElementCallbacks], [Reflect] + is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes + is_reflect = 'Reflect' in extended_attributes + if is_custom_element_callbacks or is_reflect: + includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + # [PerWorldBindings] + if 'PerWorldBindings' in extended_attributes: + assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name) + # [RaisesException], [RaisesException=Setter] + is_setter_raises_exception = ( + 'RaisesException' in extended_attributes and + extended_attributes['RaisesException'] in [None, 'Setter']) + # [TypeChecking] + has_type_checking_interface = ( + (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or + has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) and + idl_type.is_wrapper_type) + has_type_checking_nullable = ( + (has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or + has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) and + idl_type.is_wrapper_type) + has_type_checking_unrestricted = ( + (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or + has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')) and + idl_type.name in ('Float', 'Double')) + + if (base_idl_type == 'EventHandler' and + interface.name in ['Window', 'WorkerGlobalScope'] and + attribute.name == 'onerror'): + includes.add('bindings/v8/V8ErrorHandler.h') + + contents = { + 'access_control_list': access_control_list(attribute), + 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_world_list(attribute, 'Getter'), # [ActivityLogging] + 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_world_list(attribute, 'Setter'), # [ActivityLogging] + 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in extended_attributes, # [ActivityLogging] + 'activity_logging_world_check': v8_utilities.activity_logging_world_check(attribute), # [ActivityLogging] + 'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'), + 'conditional_string': v8_utilities.conditional_string(attribute), + 'constructor_type': idl_type.constructor_type_name + if is_constructor_attribute(attribute) else None, + 'cpp_name': cpp_name(attribute), + 'cpp_type': idl_type.cpp_type, + 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value='original', creation_context='info.Holder()'), + 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] + 'enum_validation_expression': idl_type.enum_validation_expression, + 'has_custom_getter': has_custom_getter, + 'has_custom_setter': has_custom_setter, + 'has_setter_exception_state': + is_setter_raises_exception or has_type_checking_interface or + has_type_checking_nullable or has_type_checking_unrestricted or + idl_type.is_integer_type or + idl_type.name in ('ByteString', 'ScalarValueString'), + 'has_type_checking_interface': has_type_checking_interface, + 'has_type_checking_nullable': has_type_checking_nullable, + 'has_type_checking_unrestricted': has_type_checking_unrestricted, + 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::ConversionContext::setConversionType + 'is_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'), + 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState'), + 'is_check_security_for_node': is_check_security_for_node, + 'is_custom_element_callbacks': is_custom_element_callbacks, + 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, + 'is_getter_raises_exception': # [RaisesException] + 'RaisesException' in extended_attributes and + extended_attributes['RaisesException'] in (None, 'Getter'), + 'is_initialized_by_event_constructor': + 'InitializedByEventConstructor' in extended_attributes, + 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), + 'is_nullable': attribute.idl_type.is_nullable, + 'is_partial_interface_member': + 'PartialInterfaceImplementedAs' in extended_attributes, + 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, + 'is_read_only': attribute.is_read_only, + 'is_reflect': is_reflect, + 'is_replaceable': 'Replaceable' in attribute.extended_attributes, + 'is_setter_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'SetterCallWith', 'ExecutionContext'), + 'is_setter_raises_exception': is_setter_raises_exception, + 'is_static': attribute.is_static, + 'is_url': 'URL' in extended_attributes, + 'is_unforgeable': 'Unforgeable' in extended_attributes, + 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] + 'name': attribute.name, + 'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(attribute), # [PerContextEnabled] + 'property_attributes': property_attributes(attribute), + 'put_forwards': 'PutForwards' in extended_attributes, + 'reflect_empty': extended_attributes.get('ReflectEmpty'), + 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), + 'reflect_missing': extended_attributes.get('ReflectMissing'), + 'reflect_only': extended_attributes['ReflectOnly'].split('|') + if 'ReflectOnly' in extended_attributes else None, + 'setter_callback': setter_callback_name(interface, attribute), + 'v8_type': v8_types.v8_type(base_idl_type), + 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] + 'world_suffixes': ['', 'ForMainWorld'] + if 'PerWorldBindings' in extended_attributes + else [''], # [PerWorldBindings] + } + + if is_constructor_attribute(attribute): + generate_constructor_getter(interface, attribute, contents) + return contents + if not has_custom_getter: + generate_getter(interface, attribute, contents) + if (not has_custom_setter and + (not attribute.is_read_only or 'PutForwards' in extended_attributes)): + generate_setter(interface, attribute, contents) + + return contents + + +################################################################################ +# Getter +################################################################################ + +def generate_getter(interface, attribute, contents): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + + cpp_value = getter_expression(interface, attribute, contents) + # Normally we can inline the function call into the return statement to + # avoid the overhead of using a Ref<> temporary, but for some cases + # (nullable types, EventHandler, [CachedAttribute], or if there are + # exceptions), we need to use a local variable. + # FIXME: check if compilers are smart enough to inline this, and if so, + # always use a local variable (for readability and CG simplicity). + release = False + if (idl_type.is_nullable or + base_idl_type == 'EventHandler' or + 'CachedAttribute' in extended_attributes or + 'ReflectOnly' in extended_attributes or + contents['is_getter_raises_exception']): + contents['cpp_value_original'] = cpp_value + cpp_value = 'v8Value' + # EventHandler has special handling + if base_idl_type != 'EventHandler' and idl_type.is_interface_type: + release = True + + def v8_set_return_value_statement(for_main_world=False): + if contents['is_keep_alive_for_gc']: + return 'v8SetReturnValue(info, wrapper)' + return idl_type.v8_set_return_value(cpp_value, extended_attributes=extended_attributes, script_wrappable='impl', release=release, for_main_world=for_main_world) + + contents.update({ + 'cpp_value': cpp_value, + 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value=cpp_value, creation_context='info.Holder()'), + 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_main_world=True), + 'v8_set_return_value': v8_set_return_value_statement(), + }) + + +def getter_expression(interface, attribute, contents): + arguments = [] + this_getter_base_name = getter_base_name(interface, attribute, arguments) + getter_name = scoped_name(interface, attribute, this_getter_base_name) + + arguments.extend(v8_utilities.call_with_arguments( + attribute.extended_attributes.get('CallWith'))) + # Members of IDL partial interface definitions are implemented in C++ as + # static member functions, which for instance members (non-static members) + # take *impl as their first argument + if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and + not attribute.is_static): + arguments.append('*impl') + if attribute.idl_type.is_nullable and not contents['has_type_checking_nullable']: + arguments.append('isNull') + if contents['is_getter_raises_exception']: + arguments.append('exceptionState') + return '%s(%s)' % (getter_name, ', '.join(arguments)) + + +CONTENT_ATTRIBUTE_GETTER_NAMES = { + 'boolean': 'fastHasAttribute', + 'long': 'getIntegralAttribute', + 'unsigned long': 'getUnsignedIntegralAttribute', +} + + +def getter_base_name(interface, attribute, arguments): + extended_attributes = attribute.extended_attributes + if 'Reflect' not in extended_attributes: + return uncapitalize(cpp_name(attribute)) + + content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower() + if content_attribute_name in ['class', 'id', 'name']: + # Special-case for performance optimization. + return 'get%sAttribute' % content_attribute_name.capitalize() + + arguments.append(scoped_content_attribute_name(interface, attribute)) + + base_idl_type = attribute.idl_type.base_type + if base_idl_type in CONTENT_ATTRIBUTE_GETTER_NAMES: + return CONTENT_ATTRIBUTE_GETTER_NAMES[base_idl_type] + if 'URL' in attribute.extended_attributes: + return 'getURLAttribute' + return 'fastGetAttribute' + + +def is_keep_alive_for_gc(interface, attribute): + idl_type = attribute.idl_type + base_idl_type = idl_type.base_type + extended_attributes = attribute.extended_attributes + return ( + # For readonly attributes, for performance reasons we keep the attribute + # wrapper alive while the owner wrapper is alive, because the attribute + # never changes. + (attribute.is_read_only and + idl_type.is_wrapper_type and + # There are some exceptions, however: + not( + # Node lifetime is managed by object grouping. + inherits_interface(interface.name, 'Node') or + inherits_interface(base_idl_type, 'Node') or + # A self-reference is unnecessary. + attribute.name == 'self' or + # FIXME: Remove these hard-coded hacks. + base_idl_type in ['EventTarget', 'Window'] or + base_idl_type.startswith(('HTML', 'SVG'))))) + + +################################################################################ +# Setter +################################################################################ + +def generate_setter(interface, attribute, contents): + def target_attribute(): + target_interface_name = attribute.idl_type.base_type + target_attribute_name = extended_attributes['PutForwards'] + target_interface = interfaces[target_interface_name] + try: + return next(attribute + for attribute in target_interface.attributes + if attribute.name == target_attribute_name) + except StopIteration: + raise Exception('[PutForward] target not found:\n' + 'Attribute "%s" is not present in interface "%s"' % + (target_attribute_name, target_interface_name)) + + extended_attributes = attribute.extended_attributes + + if 'PutForwards' in extended_attributes: + # Use target attribute in place of original attribute + attribute = target_attribute() + + contents.update({ + 'cpp_setter': setter_expression(interface, attribute, contents), + 'v8_value_to_local_cpp_value': attribute.idl_type.v8_value_to_local_cpp_value(extended_attributes, 'v8Value', 'cppValue'), + }) + + +def setter_expression(interface, attribute, contents): + extended_attributes = attribute.extended_attributes + arguments = v8_utilities.call_with_arguments( + extended_attributes.get('SetterCallWith') or + extended_attributes.get('CallWith')) + + this_setter_base_name = setter_base_name(interface, attribute, arguments) + setter_name = scoped_name(interface, attribute, this_setter_base_name) + + # Members of IDL partial interface definitions are implemented in C++ as + # static member functions, which for instance members (non-static members) + # take *impl as their first argument + if ('PartialInterfaceImplementedAs' in extended_attributes and + not attribute.is_static): + arguments.append('*impl') + idl_type = attribute.idl_type + if idl_type.base_type == 'EventHandler': + getter_name = scoped_name(interface, attribute, cpp_name(attribute)) + contents['event_handler_getter_expression'] = '%s(%s)' % ( + getter_name, ', '.join(arguments)) + if (interface.name in ['Window', 'WorkerGlobalScope'] and + attribute.name == 'onerror'): + includes.add('bindings/v8/V8ErrorHandler.h') + arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(v8Value, true, V8ScriptState::current(info.GetIsolate()))') + else: + arguments.append('V8EventListenerList::getEventListener(V8ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') + elif idl_type.is_interface_type and not idl_type.array_type: + # FIXME: should be able to eliminate WTF::getPtr in most or all cases + arguments.append('WTF::getPtr(cppValue)') + else: + arguments.append('cppValue') + if contents['is_setter_raises_exception']: + arguments.append('exceptionState') + + return '%s(%s)' % (setter_name, ', '.join(arguments)) + + +CONTENT_ATTRIBUTE_SETTER_NAMES = { + 'boolean': 'setBooleanAttribute', + 'long': 'setIntegralAttribute', + 'unsigned long': 'setUnsignedIntegralAttribute', +} + + +def setter_base_name(interface, attribute, arguments): + if 'Reflect' not in attribute.extended_attributes: + return 'set%s' % capitalize(cpp_name(attribute)) + arguments.append(scoped_content_attribute_name(interface, attribute)) + + base_idl_type = attribute.idl_type.base_type + if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: + return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] + return 'setAttribute' + + +def scoped_content_attribute_name(interface, attribute): + content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower() + namespace = 'SVGNames' if interface.name.startswith('SVG') else 'HTMLNames' + includes.add('%s.h' % namespace) + return '%s::%sAttr' % (namespace, content_attribute_name) + + +################################################################################ +# Attribute configuration +################################################################################ + +# [Replaceable] +def setter_callback_name(interface, attribute): + cpp_class_name = cpp_name(interface) + extended_attributes = attribute.extended_attributes + if (('Replaceable' in extended_attributes and + 'PutForwards' not in extended_attributes) or + is_constructor_attribute(attribute)): + # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors + return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name) + if attribute.is_read_only and 'PutForwards' not in extended_attributes: + return '0' + return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name) + + +# [DoNotCheckSecurity], [Unforgeable] +def access_control_list(attribute): + extended_attributes = attribute.extended_attributes + access_control = [] + if 'DoNotCheckSecurity' in extended_attributes: + do_not_check_security = extended_attributes['DoNotCheckSecurity'] + if do_not_check_security == 'Setter': + access_control.append('v8::ALL_CAN_WRITE') + else: + access_control.append('v8::ALL_CAN_READ') + if (not attribute.is_read_only or + 'Replaceable' in extended_attributes): + access_control.append('v8::ALL_CAN_WRITE') + if 'Unforgeable' in extended_attributes: + access_control.append('v8::PROHIBITS_OVERWRITING') + return access_control or ['v8::DEFAULT'] + + +# [NotEnumerable], [Unforgeable] +def property_attributes(attribute): + extended_attributes = attribute.extended_attributes + property_attributes_list = [] + if ('NotEnumerable' in extended_attributes or + is_constructor_attribute(attribute)): + property_attributes_list.append('v8::DontEnum') + if 'Unforgeable' in extended_attributes: + property_attributes_list.append('v8::DontDelete') + return property_attributes_list or ['v8::None'] + + +################################################################################ +# Constructors +################################################################################ + +idl_types.IdlType.constructor_type_name = property( + # FIXME: replace this with a [ConstructorAttribute] extended attribute + lambda self: strip_suffix(self.base_type, 'Constructor')) + + +def is_constructor_attribute(attribute): + # FIXME: replace this with [ConstructorAttribute] extended attribute + return attribute.idl_type.base_type.endswith('Constructor') + + +def generate_constructor_getter(interface, attribute, contents): + contents['needs_constructor_getter_callback'] = contents['measure_as'] or contents['deprecate_as']
diff --git a/bindings/scripts/v8_callback_interface.py b/bindings/scripts/v8_callback_interface.py new file mode 100644 index 0000000..b1e21d9 --- /dev/null +++ b/bindings/scripts/v8_callback_interface.py
@@ -0,0 +1,135 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for a callback interface. + +Extends IdlType with property |callback_cpp_type|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from idl_types import IdlType +from v8_globals import includes +import v8_types +import v8_utilities + +CALLBACK_INTERFACE_H_INCLUDES = frozenset([ + 'bindings/v8/ActiveDOMCallback.h', + 'bindings/v8/DOMWrapperWorld.h', + 'bindings/v8/ScopedPersistent.h', +]) +CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([ + 'bindings/v8/V8Binding.h', + 'bindings/v8/V8Callback.h', + 'core/dom/ExecutionContext.h', + 'wtf/Assertions.h', + 'wtf/GetPtr.h', + 'wtf/RefPtr.h', +]) + + +def cpp_type(idl_type): + # FIXME: remove this function by making callback types consistent + # (always use usual v8_types.cpp_type) + idl_type_name = idl_type.name + if idl_type_name == 'String': + return 'const String&' + if idl_type_name == 'void': + return 'void' + # Callbacks use raw pointers, so used_as_argument=True + usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True) + if usual_cpp_type.startswith(('Vector', 'HeapVector', 'WillBeHeapVector')): + return 'const %s&' % usual_cpp_type + return usual_cpp_type + +IdlType.callback_cpp_type = property(cpp_type) + + +def generate_callback_interface(callback_interface): + includes.clear() + includes.update(CALLBACK_INTERFACE_CPP_INCLUDES) + return { + 'conditional_string': v8_utilities.conditional_string(callback_interface), + 'cpp_class': callback_interface.name, + 'v8_class': v8_utilities.v8_class_name(callback_interface), + 'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES), + 'methods': [generate_method(operation) + for operation in callback_interface.operations + if not v8_utilities.dart_custom_method(operation.extended_attributes)], + } + + +def add_includes_for_operation(operation): + operation.idl_type.add_includes_for_type() + for argument in operation.arguments: + argument.idl_type.add_includes_for_type() + + +def generate_method(operation): + extended_attributes = operation.extended_attributes + idl_type = operation.idl_type + idl_type_str = str(idl_type) + if idl_type_str not in ['boolean', 'void']: + raise Exception('We only support callbacks that return boolean or void values.') + is_custom = 'Custom' in extended_attributes + if not is_custom: + add_includes_for_operation(operation) + call_with = extended_attributes.get('CallWith') + call_with_this_handle = v8_utilities.extended_attribute_value_contains(call_with, 'ThisValue') + contents = { + 'call_with_this_handle': call_with_this_handle, + 'cpp_type': idl_type.callback_cpp_type, + 'custom': is_custom, + 'idl_type': idl_type_str, + 'name': operation.name, + } + contents.update(generate_arguments_contents(operation.arguments, call_with_this_handle)) + return contents + + +def generate_arguments_contents(arguments, call_with_this_handle): + def generate_argument(argument): + return { + 'handle': '%sHandle' % argument.name, + # FIXME: setting creation_context=v8::Handle<v8::Object>() is + # wrong, as toV8 then implicitly uses the current context, which + # causes leaks between isolated worlds if a different context is + # used. + 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value( + argument.name, isolate='isolate', + creation_context='m_scriptState->context()->Global()'), + } + + argument_declarations = ['ScriptValue thisValue'] if call_with_this_handle else [] + argument_declarations.extend( + '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) + for argument in arguments) + return { + 'argument_declarations': argument_declarations, + 'arguments': [generate_argument(argument) for argument in arguments], + }
diff --git a/bindings/scripts/v8_globals.py b/bindings/scripts/v8_globals.py new file mode 100644 index 0000000..9ca2a35 --- /dev/null +++ b/bindings/scripts/v8_globals.py
@@ -0,0 +1,32 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Module to share global variables (includes and interfaces) across modules.""" + +includes = set() +interfaces = {}
diff --git a/bindings/scripts/v8_interface.py b/bindings/scripts/v8_interface.py new file mode 100644 index 0000000..02f0860 --- /dev/null +++ b/bindings/scripts/v8_interface.py
@@ -0,0 +1,1089 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# coding=utf-8 +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for an interface. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from collections import defaultdict +import itertools +from operator import itemgetter + +import idl_types +from idl_types import IdlType, inherits_interface +import v8_attributes +from v8_globals import includes +import v8_methods +import v8_types +from v8_types import cpp_ptr_type, cpp_template_type +import v8_utilities +from v8_utilities import capitalize, conditional_string, cpp_name, gc_type, has_extended_attribute_value, runtime_enabled_function_name + + +INTERFACE_H_INCLUDES = frozenset([ + 'bindings/v8/V8Binding.h', + 'bindings/v8/V8DOMWrapper.h', + 'bindings/v8/WrapperTypeInfo.h', + 'platform/heap/Handle.h', +]) +INTERFACE_CPP_INCLUDES = frozenset([ + 'bindings/v8/V8ExceptionState.h', + 'bindings/v8/V8DOMConfiguration.h', + 'bindings/v8/V8HiddenValue.h', + 'bindings/v8/V8ObjectConstructor.h', + 'core/dom/ContextFeatures.h', + 'core/dom/Document.h', + 'platform/RuntimeEnabledFeatures.h', + 'platform/TraceEvent.h', + 'wtf/GetPtr.h', + 'wtf/RefPtr.h', +]) + + +def generate_interface(interface): + includes.clear() + includes.update(INTERFACE_CPP_INCLUDES) + header_includes = set(INTERFACE_H_INCLUDES) + + parent_interface = interface.parent + if parent_interface: + header_includes.update(v8_types.includes_for_interface(parent_interface)) + extended_attributes = interface.extended_attributes + + is_audio_buffer = inherits_interface(interface.name, 'AudioBuffer') + if is_audio_buffer: + includes.add('modules/webaudio/AudioBuffer.h') + + is_document = inherits_interface(interface.name, 'Document') + if is_document: + includes.update(['bindings/v8/ScriptController.h', + 'bindings/v8/V8WindowShell.h', + 'core/frame/LocalFrame.h']) + + # [ActiveDOMObject] + is_active_dom_object = 'ActiveDOMObject' in extended_attributes + + # [CheckSecurity] + is_check_security = 'CheckSecurity' in extended_attributes + if is_check_security: + includes.add('bindings/common/BindingSecurity.h') + + # [DependentLifetime] + is_dependent_lifetime = 'DependentLifetime' in extended_attributes + + # [MeasureAs] + is_measure_as = 'MeasureAs' in extended_attributes + if is_measure_as: + includes.add('core/frame/UseCounter.h') + + # [SetWrapperReferenceFrom] + reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') + if reachable_node_function: + includes.update(['bindings/v8/V8GCController.h', + 'core/dom/Element.h']) + + # [SetWrapperReferenceTo] + set_wrapper_reference_to_list = [{ + 'name': argument.name, + # FIXME: properly should be: + # 'cpp_type': argument.idl_type.cpp_type_args(used_as_argument=True), + # (if type is non-wrapper type like NodeFilter, normally RefPtr) + # Raw pointers faster though, and NodeFilter hacky anyway. + 'cpp_type': argument.idl_type.implemented_as + '*', + 'idl_type': argument.idl_type, + 'v8_type': v8_types.v8_type(argument.idl_type.name), + } for argument in extended_attributes.get('SetWrapperReferenceTo', [])] + for set_wrapper_reference_to in set_wrapper_reference_to_list: + set_wrapper_reference_to['idl_type'].add_includes_for_type() + + # [SpecialWrapFor] + if 'SpecialWrapFor' in extended_attributes: + special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') + else: + special_wrap_for = [] + for special_wrap_interface in special_wrap_for: + v8_types.add_includes_for_interface(special_wrap_interface) + + # [Custom=Wrap], [SetWrapperReferenceFrom] + has_visit_dom_wrapper = ( + has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or + reachable_node_function or + set_wrapper_reference_to_list) + + this_gc_type = gc_type(interface) + + template_contents = { + 'conditional_string': conditional_string(interface), # [Conditional] + 'cpp_class': cpp_name(interface), + 'gc_type': this_gc_type, + 'has_custom_legacy_call_as_function': has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] + 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'ToV8'), # [Custom=ToV8] + 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wrap'), # [Custom=Wrap] + 'has_visit_dom_wrapper': has_visit_dom_wrapper, + 'header_includes': header_includes, + 'interface_name': interface.name, + 'is_active_dom_object': is_active_dom_object, + 'is_audio_buffer': is_audio_buffer, + 'is_check_security': is_check_security, + 'is_dependent_lifetime': is_dependent_lifetime, + 'is_document': is_document, + 'is_event_target': inherits_interface(interface.name, 'EventTarget'), + 'is_exception': interface.is_exception, + 'is_node': inherits_interface(interface.name, 'Node'), + 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] + 'parent_interface': parent_interface, + 'pass_cpp_type': cpp_template_type( + cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), + cpp_name(interface)), + 'reachable_node_function': reachable_node_function, + 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] + 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, + 'special_wrap_for': special_wrap_for, + 'v8_class': v8_utilities.v8_class_name(interface), + 'wrapper_configuration': 'WrapperConfiguration::Dependent' + if (has_visit_dom_wrapper or + is_active_dom_object or + is_dependent_lifetime) + else 'WrapperConfiguration::Independent', + } + + # Constructors + constructors = [generate_constructor(interface, constructor) + for constructor in interface.constructors + # FIXME: shouldn't put named constructors with constructors + # (currently needed for Perl compatibility) + # Handle named constructors separately + if constructor.name == 'Constructor'] + if len(constructors) > 1: + template_contents['constructor_overloads'] = generate_overloads(constructors) + + # [CustomConstructor] + custom_constructors = [{ # Only needed for computing interface length + 'number_of_required_arguments': + number_of_required_arguments(constructor), + } for constructor in interface.custom_constructors] + + # [EventConstructor] + has_event_constructor = 'EventConstructor' in extended_attributes + any_type_attributes = [attribute for attribute in interface.attributes + if attribute.idl_type.name == 'Any'] + if has_event_constructor: + includes.add('bindings/common/Dictionary.h') + if any_type_attributes: + includes.add('bindings/v8/SerializedScriptValue.h') + + # [NamedConstructor] + named_constructor = generate_named_constructor(interface) + + if (constructors or custom_constructors or has_event_constructor or + named_constructor): + includes.add('bindings/v8/V8ObjectConstructor.h') + includes.add('core/frame/LocalDOMWindow.h') + + template_contents.update({ + 'any_type_attributes': any_type_attributes, + 'constructors': constructors, + 'has_custom_constructor': bool(custom_constructors), + 'has_event_constructor': has_event_constructor, + 'interface_length': + interface_length(interface, constructors + custom_constructors), + 'is_constructor_call_with_document': has_extended_attribute_value( + interface, 'ConstructorCallWith', 'Document'), # [ConstructorCallWith=Document] + 'is_constructor_call_with_execution_context': has_extended_attribute_value( + interface, 'ConstructorCallWith', 'ExecutionContext'), # [ConstructorCallWith=ExeuctionContext] + 'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor', # [RaisesException=Constructor] + 'named_constructor': named_constructor, + }) + + # Constants + template_contents.update({ + 'constants': [generate_constant(constant) for constant in interface.constants], + 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, + }) + + # Attributes + attributes = [v8_attributes.generate_attribute(interface, attribute) + for attribute in interface.attributes + if not v8_utilities.dart_custom_method(attribute.extended_attributes)] + template_contents.update({ + 'attributes': attributes, + 'has_accessors': any(attribute['is_expose_js_accessors'] for attribute in attributes), + 'has_attribute_configuration': any( + not (attribute['is_expose_js_accessors'] or + attribute['is_static'] or + attribute['runtime_enabled_function'] or + attribute['per_context_enabled_function']) + for attribute in attributes), + 'has_constructor_attributes': any(attribute['constructor_type'] for attribute in attributes), + 'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function'] for attribute in attributes), + 'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes), + }) + + # Methods + methods = [v8_methods.generate_method(interface, method) + for method in interface.operations + if (method.name and # Skip anonymous special operations (methods) + not v8_utilities.dart_custom_method(method.extended_attributes))] + generate_method_overloads(methods) + + per_context_enabled_methods = [] + custom_registration_methods = [] + method_configuration_methods = [] + + for method in methods: + # Skip all but one method in each set of overloaded methods. + if 'overload_index' in method and 'overloads' not in method: + continue + + if 'overloads' in method: + overloads = method['overloads'] + per_context_enabled_function = overloads['per_context_enabled_function_all'] + runtime_enabled_function = overloads['runtime_enabled_function_all'] + has_custom_registration = overloads['has_custom_registration_all'] + else: + per_context_enabled_function = method['per_context_enabled_function'] + runtime_enabled_function = method['runtime_enabled_function'] + has_custom_registration = method['has_custom_registration'] + + if per_context_enabled_function: + per_context_enabled_methods.append(method) + continue + if runtime_enabled_function or has_custom_registration: + custom_registration_methods.append(method) + continue + method_configuration_methods.append(method) + + for method in methods: + # The value of the Function object’s “length” property is a Number + # determined as follows: + # 1. Let S be the effective overload set for regular operations (if the + # operation is a regular operation) or for static operations (if the + # operation is a static operation) with identifier id on interface I and + # with argument count 0. + # 2. Return the length of the shortest argument list of the entries in S. + # FIXME: This calculation doesn't take into account whether runtime + # enabled overloads are actually enabled, so length may be incorrect. + # E.g., [RuntimeEnabled=Foo] void f(); void f(long x); + # should have length 1 if Foo is not enabled, but length 0 if it is. + method['length'] = (method['overloads']['minarg'] if 'overloads' in method else + method['number_of_required_arguments']) + + template_contents.update({ + 'custom_registration_methods': custom_registration_methods, + 'has_origin_safe_method_setter': any( + method['is_check_security_for_frame'] and not method['is_read_only'] + for method in methods), + 'method_configuration_methods': method_configuration_methods, + 'per_context_enabled_methods': per_context_enabled_methods, + 'methods': methods, + }) + + template_contents.update({ + 'indexed_property_getter': indexed_property_getter(interface), + 'indexed_property_setter': indexed_property_setter(interface), + 'indexed_property_deleter': indexed_property_deleter(interface), + 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, + 'named_property_getter': named_property_getter(interface), + 'named_property_setter': named_property_setter(interface), + 'named_property_deleter': named_property_deleter(interface), + }) + + return template_contents + + +# [DeprecateAs], [Reflect], [RuntimeEnabled] +def generate_constant(constant): + # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted + # in C++. + if constant.idl_type.name == 'String': + value = '"%s"' % constant.value + else: + value = constant.value + + extended_attributes = constant.extended_attributes + return { + 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), + 'name': constant.name, + # FIXME: use 'reflected_name' as correct 'name' + 'reflected_name': extended_attributes.get('Reflect', constant.name), + 'runtime_enabled_function': runtime_enabled_function_name(constant), + 'value': value, + } + + +################################################################################ +# Overloads +################################################################################ + +def generate_method_overloads(methods): + # Regular methods + generate_overloads_by_type([method for method in methods + if not method['is_static']]) + # Static methods + generate_overloads_by_type([method for method in methods + if method['is_static']]) + + +def generate_overloads_by_type(methods): + """Generates |method.overload*| template values. + + Called separately for static and non-static (regular) methods, + as these are overloaded separately. + Modifies |method| in place for |method| in |methods|. + Doesn't change the |methods| list itself (only the values, i.e. individual + methods), so ok to treat these separately. + """ + # Add overload information only to overloaded methods, so template code can + # easily verify if a function is overloaded + for name, overloads in method_overloads_by_name(methods): + # Resolution function is generated after last overloaded function; + # package necessary information into |method.overloads| for that method. + overloads[-1]['overloads'] = generate_overloads(overloads) + overloads[-1]['overloads']['name'] = name + + +def method_overloads_by_name(methods): + """Returns generator of overloaded methods by name: [name, [method]]""" + # Filter to only methods that are actually overloaded + method_counts = Counter(method['name'] for method in methods) + overloaded_method_names = set(name + for name, count in method_counts.iteritems() + if count > 1) + overloaded_methods = [method for method in methods + if method['name'] in overloaded_method_names] + + # Group by name (generally will be defined together, but not necessarily) + return sort_and_groupby(overloaded_methods, itemgetter('name')) + + +def generate_overloads(overloads): + """Returns |overloads| template values for a single name. + + Sets |method.overload_index| in place for |method| in |overloads| + and returns dict of overall overload template values. + """ + assert len(overloads) > 1 # only apply to overloaded names + for index, method in enumerate(overloads, 1): + method['overload_index'] = index + + effective_overloads_by_length = effective_overload_set_by_length(overloads) + lengths = [length for length, _ in effective_overloads_by_length] + name = overloads[0].get('name', '<constructor>') + + # Check and fail if all overloads with the shortest acceptable arguments + # list are runtime enabled, since we would otherwise set 'length' on the + # function object to an incorrect value when none of those overloads were + # actually enabled at runtime. The exception is if all overloads are + # controlled by the same runtime enabled feature, in which case there would + # be no function object at all if it is not enabled. + shortest_overloads = effective_overloads_by_length[0][1] + if (all(method.get('runtime_enabled_function') + for method, _, _ in shortest_overloads) and + not common_value(overloads, 'runtime_enabled_function')): + raise ValueError('Function.length of %s depends on runtime enabled features' % name) + + # Check and fail if overloads disagree on any of the extended attributes + # that affect how the method should be registered. + # Skip the check for overloaded constructors, since they don't support any + # of the extended attributes in question. + if not overloads[0].get('is_constructor'): + overload_extended_attributes = [ + method['custom_registration_extended_attributes'] + for method in overloads] + for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES: + if common_key(overload_extended_attributes, extended_attribute) is None: + raise ValueError('Overloads of %s have conflicting extended attribute %s' + % (name, extended_attribute)) + + return { + 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [DeprecateAs] + 'length_tests_methods': length_tests_methods(effective_overloads_by_length), + 'minarg': lengths[0], + # 1. Let maxarg be the length of the longest type list of the + # entries in S. + 'maxarg': lengths[-1], + 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] + 'has_custom_registration_all': common_value(overloads, 'has_custom_registration'), + 'per_context_enabled_function_all': common_value(overloads, 'per_context_enabled_function'), # [PerContextEnabled] + 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled_function'), # [RuntimeEnabled] + 'valid_arities': lengths + # Only need to report valid arities if there is a gap in the + # sequence of possible lengths, otherwise invalid length means + # "not enough arguments". + if lengths[-1] - lengths[0] != len(lengths) - 1 else None, + } + + +def effective_overload_set(F): + """Returns the effective overload set of an overloaded function. + + An effective overload set is the set of overloaded functions + signatures + (type list of arguments, with optional and variadic arguments included or + not), and is used in the overload resolution algorithm. + + For example, given input [f1(optional long x), f2(DOMString s)], the output + is informally [f1(), f1(long), f2(DOMString)], and formally + [(f1, [], []), (f1, [long], [optional]), (f2, [DOMString], [required])]. + + Currently the optionality list is a list of |is_optional| booleans (True + means optional, False means required); to support variadics this needs to + be tri-valued as required, optional, or variadic. + + Formally: + An effective overload set represents the allowable invocations for a + particular operation, constructor (specified with [Constructor] or + [NamedConstructor]), legacy caller or callback function. + + An additional argument N (argument count) is needed when overloading + variadics, but we don't use that currently. + + Spec: http://heycam.github.io/webidl/#dfn-effective-overload-set + + Formally the input and output lists are sets, but methods are stored + internally as dicts, which can't be stored in a set because they are not + hashable, so we use lists instead. + + Arguments: + F: list of overloads for a given callable name. + + Returns: + S: list of tuples of the form (callable, type list, optionality list). + """ + # Code closely follows the algorithm in the spec, for clarity and + # correctness, and hence is not very Pythonic. + + # 1. Initialize S to ∅. + # (We use a list because we can't use a set, as noted above.) + S = [] + + # 2. Let F be a set with elements as follows, according to the kind of + # effective overload set: + # (Passed as argument, nothing to do.) + + # 3. & 4. (maxarg, m) are only needed for variadics, not used. + + # 5. For each operation, extended attribute or callback function X in F: + for X in F: # X is the "callable", F is the overloads. + arguments = X['arguments'] + # 1. Let n be the number of arguments X is declared to take. + n = len(arguments) + # 2. Let t0..n−1 be a list of types, where ti is the type of X’s + # argument at index i. + # (“type list”) + t = tuple(argument['idl_type_object'] for argument in arguments) + # 3. Let o0..n−1 be a list of optionality values, where oi is “variadic” + # if X’s argument at index i is a final, variadic argument, “optional” + # if the argument is optional, and “required” otherwise. + # (“optionality list”) + # (We’re just using a boolean for optional vs. required.) + o = tuple(argument['is_optional'] for argument in arguments) + # 4. Add to S the tuple <X, t0..n−1, o0..n−1>. + S.append((X, t, o)) + # 5. If X is declared to be variadic, then: + # (Not used, so not implemented.) + # 6. Initialize i to n−1. + i = n - 1 + # 7. While i ≥ 0: + # Spec bug (fencepost error); should be “While i > 0:” + # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25590 + while i > 0: + # 1. If argument i of X is not optional, then break this loop. + if not o[i]: + break + # 2. Otherwise, add to S the tuple <X, t0..i−1, o0..i−1>. + S.append((X, t[:i], o[:i])) + # 3. Set i to i−1. + i = i - 1 + # 8. If n > 0 and all arguments of X are optional, then add to S the + # tuple <X, (), ()> (where “()” represents the empty list). + if n > 0 and all(oi for oi in o): + S.append((X, [], [])) + # 6. The effective overload set is S. + return S + + +def effective_overload_set_by_length(overloads): + def type_list_length(entry): + # Entries in the effective overload set are 3-tuples: + # (callable, type list, optionality list) + return len(entry[1]) + + effective_overloads = effective_overload_set(overloads) + return list(sort_and_groupby(effective_overloads, type_list_length)) + + +def distinguishing_argument_index(entries): + """Returns the distinguishing argument index for a sequence of entries. + + Entries are elements of the effective overload set with the same number + of arguments (formally, same type list length), each a 3-tuple of the form + (callable, type list, optionality list). + + Spec: http://heycam.github.io/webidl/#dfn-distinguishing-argument-index + + If there is more than one entry in an effective overload set that has a + given type list length, then for those entries there must be an index i + such that for each pair of entries the types at index i are + distinguishable. + The lowest such index is termed the distinguishing argument index for the + entries of the effective overload set with the given type list length. + """ + # Only applicable “If there is more than one entry” + assert len(entries) > 1 + type_lists = [tuple(idl_type.name for idl_type in entry[1]) + for entry in entries] + type_list_length = len(type_lists[0]) + # Only applicable for entries that “[have] a given type list length” + assert all(len(type_list) == type_list_length for type_list in type_lists) + name = entries[0][0].get('name', 'Constructor') # for error reporting + + # The spec defines the distinguishing argument index by conditions it must + # satisfy, but does not give an algorithm. + # + # We compute the distinguishing argument index by first computing the + # minimum index where not all types are the same, and then checking that + # all types in this position are distinguishable (and the optionality lists + # up to this point are identical), since "minimum index where not all types + # are the same" is a *necessary* condition, and more direct to check than + # distinguishability. + types_by_index = (set(types) for types in zip(*type_lists)) + try: + # “In addition, for each index j, where j is less than the + # distinguishing argument index for a given type list length, the types + # at index j in all of the entries’ type lists must be the same” + index = next(i for i, types in enumerate(types_by_index) + if len(types) > 1) + except StopIteration: + raise ValueError('No distinguishing index found for %s, length %s:\n' + 'All entries have the same type list:\n' + '%s' % (name, type_list_length, type_lists[0])) + # Check optionality + # “and the booleans in the corresponding list indicating argument + # optionality must be the same.” + # FIXME: spec typo: optionality value is no longer a boolean + # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25628 + initial_optionality_lists = set(entry[2][:index] for entry in entries) + if len(initial_optionality_lists) > 1: + raise ValueError( + 'Invalid optionality lists for %s, length %s:\n' + 'Optionality lists differ below distinguishing argument index %s:\n' + '%s' + % (name, type_list_length, index, set(initial_optionality_lists))) + + # Check distinguishability + # http://heycam.github.io/webidl/#dfn-distinguishable + # Use names to check for distinct types, since objects are distinct + # FIXME: check distinguishability more precisely, for validation + distinguishing_argument_type_names = [type_list[index] + for type_list in type_lists] + if (len(set(distinguishing_argument_type_names)) != + len(distinguishing_argument_type_names)): + raise ValueError('Types in distinguishing argument are not distinct:\n' + '%s' % distinguishing_argument_type_names) + + return index + + +def length_tests_methods(effective_overloads_by_length): + """Returns sorted list of resolution tests and associated methods, by length. + + This builds the main data structure for the overload resolution loop. + For a given argument length, bindings test argument at distinguishing + argument index, in order given by spec: if it is compatible with + (optionality or) type required by an overloaded method, resolve to that + method. + + Returns: + [(length, [(test, method)])] + """ + return [(length, list(resolution_tests_methods(effective_overloads))) + for length, effective_overloads in effective_overloads_by_length] + + +def resolution_tests_methods(effective_overloads): + """Yields resolution test and associated method, in resolution order, for effective overloads of a given length. + + This is the heart of the resolution algorithm. + http://heycam.github.io/webidl/#dfn-overload-resolution-algorithm + + Note that a given method can be listed multiple times, with different tests! + This is to handle implicit type conversion. + + Returns: + [(test, method)] + """ + methods = [effective_overload[0] + for effective_overload in effective_overloads] + if len(methods) == 1: + # If only one method with a given length, no test needed + yield 'true', methods[0] + return + + # 6. If there is more than one entry in S, then set d to be the + # distinguishing argument index for the entries of S. + index = distinguishing_argument_index(effective_overloads) + # (7-9 are for handling |undefined| values for optional arguments before + # the distinguishing argument (as “missing”), so you can specify only some + # optional arguments. We don’t support this, so we skip these steps.) + # 10. If i = d, then: + # (d is the distinguishing argument index) + # 1. Let V be argi. + # Note: This is the argument that will be used to resolve which + # overload is selected. + cpp_value = 'info[%s]' % index + + # Extract argument and IDL type to simplify accessing these in each loop. + arguments = [method['arguments'][index] for method in methods] + arguments_methods = zip(arguments, methods) + idl_types = [argument['idl_type_object'] for argument in arguments] + idl_types_methods = zip(idl_types, methods) + + # We can’t do a single loop through all methods or simply sort them, because + # a method may be listed in multiple steps of the resolution algorithm, and + # which test to apply differs depending on the step. + # + # Instead, we need to go through all methods at each step, either finding + # first match (if only one test is allowed) or filtering to matches (if + # multiple tests are allowed), and generating an appropriate tests. + + # 2. If V is undefined, and there is an entry in S whose list of + # optionality values has “optional” at index i, then remove from S all + # other entries. + try: + method = next(method for argument, method in arguments_methods + if argument['is_optional']) + test = '%s->IsUndefined()' % cpp_value + yield test, method + except StopIteration: + pass + + # 3. Otherwise: if V is null or undefined, and there is an entry in S that + # has one of the following types at position i of its type list, + # • a nullable type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_nullable) + test = 'isUndefinedOrNull(%s)' % cpp_value + yield test, method + except StopIteration: + pass + + # 4. Otherwise: if V is a platform object – but not a platform array + # object – and there is an entry in S that has one of the following + # types at position i of its type list, + # • an interface type that V implements + # (Unlike most of these tests, this can return multiple methods, since we + # test if it implements an interface. Thus we need a for loop, not a next.) + # (We distinguish wrapper types from built-in interface types.) + for idl_type, method in ((idl_type, method) + for idl_type, method in idl_types_methods + if idl_type.is_wrapper_type): + test = 'V8{idl_type}::hasInstance({cpp_value}, isolate)'.format(idl_type=idl_type.base_type, cpp_value=cpp_value) + yield test, method + + # 8. Otherwise: if V is any kind of object except for a native Date object, + # a native RegExp object, and there is an entry in S that has one of the + # following types at position i of its type list, + # • an array type + # • a sequence type + # ... + # • a dictionary + try: + # FIXME: IDL dictionary not implemented, so use Blink Dictionary + # http://crbug.com/321462 + idl_type, method = next((idl_type, method) + for idl_type, method in idl_types_methods + if (idl_type.array_or_sequence_type or + idl_type.name == 'Dictionary')) + if idl_type.array_or_sequence_type: + # (We test for Array instead of generic Object to type-check.) + # FIXME: test for Object during resolution, then have type check for + # Array in overloaded method: http://crbug.com/262383 + test = '%s->IsArray()' % cpp_value + else: + # FIXME: should be '{1}->IsObject() && !{1}->IsDate() && !{1}->IsRegExp()'.format(cpp_value) + # FIXME: the IsDate and IsRegExp checks can be skipped if we've + # already generated tests for them. + test = '%s->IsObject()' % cpp_value + yield test, method + except StopIteration: + pass + + # (Check for exact type matches before performing automatic type conversion; + # only needed if distinguishing between primitive types.) + if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1: + # (Only needed if match in step 11, otherwise redundant.) + if any(idl_type.name == 'String' or idl_type.is_enum + for idl_type in idl_types): + # 10. Otherwise: if V is a Number value, and there is an entry in S + # that has one of the following types at position i of its type + # list, + # • a numeric type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_numeric_type) + test = '%s->IsNumber()' % cpp_value + yield test, method + except StopIteration: + pass + + # (Perform automatic type conversion, in order. If any of these match, + # that’s the end, and no other tests are needed.) To keep this code simple, + # we rely on the C++ compiler's dead code elimination to deal with the + # redundancy if both cases below trigger. + + # 11. Otherwise: if there is an entry in S that has one of the following + # types at position i of its type list, + # • DOMString + # • an enumeration type + # * ByteString + # Blink: ScalarValueString is a pending Web IDL addition + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.name in ('String', + 'ByteString', + 'ScalarValueString') or + idl_type.is_enum) + yield 'true', method + except StopIteration: + pass + + # 12. Otherwise: if there is an entry in S that has one of the following + # types at position i of its type list, + # • a numeric type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_numeric_type) + yield 'true', method + except StopIteration: + pass + + +################################################################################ +# Utility functions +################################################################################ + +def Counter(iterable): + # Once using Python 2.7, using collections.Counter + counter = defaultdict(lambda: 0) + for item in iterable: + counter[item] += 1 + return counter + + +def common(dicts, f): + """Returns common result of f across an iterable of dicts, or None. + + Call f for each dict and return its result if the same across all dicts. + """ + values = (f(d) for d in dicts) + first_value = next(values) + if all(value == first_value for value in values): + return first_value + return None + + +def common_key(dicts, key): + """Returns common presence of a key across an iterable of dicts, or None. + + True if all dicts have the key, False if none of the dicts have the key, + and None if some but not all dicts have the key. + """ + return common(dicts, lambda d: key in d) + + +def common_value(dicts, key): + """Returns common value of a key across an iterable of dicts, or None. + + Auxiliary function for overloads, so can consolidate an extended attribute + that appears with the same value on all items in an overload set. + """ + return common(dicts, lambda d: d.get(key)) + + +def sort_and_groupby(l, key=None): + """Returns a generator of (key, list), sorting and grouping list by key.""" + l.sort(key=key) + return ((k, list(g)) for k, g in itertools.groupby(l, key)) + + +################################################################################ +# Constructors +################################################################################ + +# [Constructor] +def generate_constructor(interface, constructor): + arguments_need_try_catch = any(v8_methods.argument_needs_try_catch(argument) + for argument in constructor.arguments) + + return { + 'arguments': [v8_methods.generate_argument(interface, constructor, argument, index) + for index, argument in enumerate(constructor.arguments)], + 'arguments_need_try_catch': arguments_need_try_catch, + 'cpp_type': cpp_template_type( + cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), + cpp_name(interface)), + 'cpp_value': v8_methods.cpp_value( + interface, constructor, len(constructor.arguments)), + 'has_exception_state': + # [RaisesException=Constructor] + interface.extended_attributes.get('RaisesException') == 'Constructor' or + any(argument for argument in constructor.arguments + if argument.idl_type.name == 'SerializedScriptValue' or + argument.idl_type.is_integer_type), + 'is_constructor': True, + 'is_named_constructor': False, + 'number_of_required_arguments': + number_of_required_arguments(constructor), + } + + +# [NamedConstructor] +def generate_named_constructor(interface): + extended_attributes = interface.extended_attributes + if 'NamedConstructor' not in extended_attributes: + return None + # FIXME: parser should return named constructor separately; + # included in constructors (and only name stored in extended attribute) + # for Perl compatibility + idl_constructor = interface.constructors[-1] + assert idl_constructor.name == 'NamedConstructor' + constructor = generate_constructor(interface, idl_constructor) + constructor.update({ + 'name': extended_attributes['NamedConstructor'], + 'is_named_constructor': True, + }) + return constructor + + +def number_of_required_arguments(constructor): + return len([argument for argument in constructor.arguments + if not argument.is_optional]) + + +def interface_length(interface, constructors): + # Docs: http://heycam.github.io/webidl/#es-interface-call + if 'EventConstructor' in interface.extended_attributes: + return 1 + if not constructors: + return 0 + return min(constructor['number_of_required_arguments'] + for constructor in constructors) + + +################################################################################ +# Special operations (methods) +# http://heycam.github.io/webidl/#idl-special-operations +################################################################################ + +def property_getter(getter, cpp_arguments): + def is_null_expression(idl_type): + if idl_type.is_union_type: + return ' && '.join('!result%sEnabled' % i + for i, _ in enumerate(idl_type.member_types)) + if idl_type.name == 'String': + return 'result.isNull()' + if idl_type.is_interface_type: + return '!result' + return '' + + idl_type = getter.idl_type + extended_attributes = getter.extended_attributes + is_raises_exception = 'RaisesException' in extended_attributes + + # FIXME: make more generic, so can use v8_methods.cpp_value + cpp_method_name = 'impl->%s' % cpp_name(getter) + + if is_raises_exception: + cpp_arguments.append('exceptionState') + union_arguments = idl_type.union_arguments + if union_arguments: + cpp_arguments.extend(union_arguments) + + cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) + + return { + 'cpp_type': idl_type.cpp_type, + 'cpp_value': cpp_value, + 'is_custom': + 'Custom' in extended_attributes and + (not extended_attributes['Custom'] or + has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), + 'is_custom_property_enumerator': has_extended_attribute_value( + getter, 'Custom', 'PropertyEnumerator'), + 'is_custom_property_query': has_extended_attribute_value( + getter, 'Custom', 'PropertyQuery'), + 'is_enumerable': 'NotEnumerable' not in extended_attributes, + 'is_null_expression': is_null_expression(idl_type), + 'is_raises_exception': is_raises_exception, + 'name': cpp_name(getter), + 'union_arguments': union_arguments, + 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_attributes=extended_attributes, script_wrappable='impl', release=idl_type.release), + } + + +def property_setter(setter): + idl_type = setter.arguments[1].idl_type + extended_attributes = setter.extended_attributes + is_raises_exception = 'RaisesException' in extended_attributes + return { + 'has_type_checking_interface': + has_extended_attribute_value(setter, 'TypeChecking', 'Interface') and + idl_type.is_wrapper_type, + 'idl_type': idl_type.base_type, + 'is_custom': 'Custom' in extended_attributes, + 'has_exception_state': is_raises_exception or + idl_type.is_integer_type, + 'is_raises_exception': is_raises_exception, + 'name': cpp_name(setter), + 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( + extended_attributes, 'v8Value', 'propertyValue'), + } + + +def property_deleter(deleter): + idl_type = deleter.idl_type + if str(idl_type) != 'boolean': + raise Exception( + 'Only deleters with boolean type are allowed, but type is "%s"' % + idl_type) + extended_attributes = deleter.extended_attributes + return { + 'is_custom': 'Custom' in extended_attributes, + 'is_raises_exception': 'RaisesException' in extended_attributes, + 'name': cpp_name(deleter), + } + + +################################################################################ +# Indexed properties +# http://heycam.github.io/webidl/#idl-indexed-properties +################################################################################ + +def indexed_property_getter(interface): + try: + # Find indexed property getter, if present; has form: + # getter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1) + getter = next( + method + for method in interface.operations + if ('getter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + return property_getter(getter, ['index']) + + +def indexed_property_setter(interface): + try: + # Find indexed property setter, if present; has form: + # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1, ARG_TYPE ARG2) + setter = next( + method + for method in interface.operations + if ('setter' in method.specials and + len(method.arguments) == 2 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + return property_setter(setter) + + +def indexed_property_deleter(interface): + try: + # Find indexed property deleter, if present; has form: + # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG) + deleter = next( + method + for method in interface.operations + if ('deleter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'unsigned long')) + except StopIteration: + return None + + return property_deleter(deleter) + + +################################################################################ +# Named properties +# http://heycam.github.io/webidl/#idl-named-properties +################################################################################ + +def named_property_getter(interface): + try: + # Find named property getter, if present; has form: + # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1) + getter = next( + method + for method in interface.operations + if ('getter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + getter.name = getter.name or 'anonymousNamedGetter' + return property_getter(getter, ['propertyName']) + + +def named_property_setter(interface): + try: + # Find named property setter, if present; has form: + # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2) + setter = next( + method + for method in interface.operations + if ('setter' in method.specials and + len(method.arguments) == 2 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + return property_setter(setter) + + +def named_property_deleter(interface): + try: + # Find named property deleter, if present; has form: + # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG) + deleter = next( + method + for method in interface.operations + if ('deleter' in method.specials and + len(method.arguments) == 1 and + str(method.arguments[0].idl_type) == 'DOMString')) + except StopIteration: + return None + + return property_deleter(deleter)
diff --git a/bindings/scripts/v8_methods.py b/bindings/scripts/v8_methods.py new file mode 100644 index 0000000..38baa7b --- /dev/null +++ b/bindings/scripts/v8_methods.py
@@ -0,0 +1,349 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Generate template values for methods. + +Extends IdlType and IdlUnionType with property |union_arguments|. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +from idl_types import IdlType, IdlUnionType, inherits_interface +from v8_globals import includes +import v8_types +import v8_utilities +from v8_utilities import has_extended_attribute_value + + +# Methods with any of these require custom method registration code in the +# interface's configure*Template() function. +CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ + 'DoNotCheckSecurity', + 'DoNotCheckSignature', + 'NotEnumerable', + 'ReadOnly', + 'Unforgeable', +]) + + +def argument_needs_try_catch(argument): + idl_type = argument.idl_type + base_type = not idl_type.array_or_sequence_type and idl_type.base_type + + return not ( + # These cases are handled by separate code paths in the + # generate_argument() macro in Source/bindings/templates/methods.cpp. + idl_type.is_callback_interface or + base_type == 'SerializedScriptValue' or + (argument.is_variadic and idl_type.is_wrapper_type) or + # String and enumeration arguments converted using one of the + # TOSTRING_* macros in Source/bindings/v8/V8BindingMacros.h don't + # use a v8::TryCatch. + (base_type == 'DOMString' and not argument.is_variadic)) + + +def generate_method(interface, method): + arguments = method.arguments + extended_attributes = method.extended_attributes + idl_type = method.idl_type + is_static = method.is_static + name = method.name + + idl_type.add_includes_for_type() + this_cpp_value = cpp_value(interface, method, len(arguments)) + + def function_template(): + if is_static: + return 'functionTemplate' + if 'Unforgeable' in extended_attributes: + return 'instanceTemplate' + return 'prototypeTemplate' + + is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWith', 'ScriptArguments') + if is_call_with_script_arguments: + includes.update(['bindings/v8/ScriptCallStackFactory.h', + 'core/inspector/ScriptArguments.h']) + is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') + if is_call_with_script_state: + includes.add('bindings/v8/V8ScriptState.h') + is_check_security_for_node = 'CheckSecurity' in extended_attributes + if is_check_security_for_node: + includes.add('bindings/common/BindingSecurity.h') + is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes + if is_custom_element_callbacks: + includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + + has_event_listener_argument = any( + argument for argument in arguments + if argument.idl_type.name == 'EventListener') + is_check_security_for_frame = ( + 'CheckSecurity' in interface.extended_attributes and + 'DoNotCheckSecurity' not in extended_attributes) + is_raises_exception = 'RaisesException' in extended_attributes + + arguments_need_try_catch = any(argument_needs_try_catch(argument) + for argument in arguments) + + return { + 'activity_logging_world_list': v8_utilities.activity_logging_world_list(method), # [ActivityLogging] + 'arguments': [generate_argument(interface, method, argument, index) + for index, argument in enumerate(arguments)], + 'arguments_need_try_catch': arguments_need_try_catch, + 'conditional_string': v8_utilities.conditional_string(method), + 'cpp_type': idl_type.cpp_type, + 'cpp_value': this_cpp_value, + 'custom_registration_extended_attributes': + CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( + extended_attributes.iterkeys()), + 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] + 'function_template': function_template(), + 'has_custom_registration': is_static or + v8_utilities.has_extended_attribute( + method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), + 'has_event_listener_argument': has_event_listener_argument, + 'has_exception_state': + has_event_listener_argument or + is_raises_exception or + is_check_security_for_frame or + any(argument for argument in arguments + if argument.idl_type.name in ('ByteString', + 'ScalarValueString', + 'SerializedScriptValue') or + argument.idl_type.is_integer_type), + 'idl_type': idl_type.base_type, + 'is_call_with_execution_context': has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'), + 'is_call_with_script_arguments': is_call_with_script_arguments, + 'is_call_with_script_state': is_call_with_script_state, + 'is_check_security_for_frame': is_check_security_for_frame, + 'is_check_security_for_node': is_check_security_for_node, + 'is_custom': 'Custom' in extended_attributes, + 'is_custom_element_callbacks': is_custom_element_callbacks, + 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, + 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes, + 'is_partial_interface_member': + 'PartialInterfaceImplementedAs' in extended_attributes, + 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, + 'is_raises_exception': is_raises_exception, + 'is_read_only': 'ReadOnly' in extended_attributes, + 'is_static': is_static, + 'is_variadic': arguments and arguments[-1].is_variadic, + 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] + 'name': name, + 'number_of_arguments': len(arguments), + 'number_of_required_arguments': len([ + argument for argument in arguments + if not (argument.is_optional or argument.is_variadic)]), + 'number_of_required_or_variadic_arguments': len([ + argument for argument in arguments + if not argument.is_optional]), + 'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(method), # [PerContextEnabled] + 'property_attributes': property_attributes(method), + 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(method), # [RuntimeEnabled] + 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature', + 'union_arguments': idl_type.union_arguments, + 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), + 'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), + 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''], # [PerWorldBindings] + } + + +def generate_argument(interface, method, argument, index): + extended_attributes = argument.extended_attributes + idl_type = argument.idl_type + this_cpp_value = cpp_value(interface, method, index) + is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type + + return { + 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes, + used_as_argument=True, + used_as_variadic_argument=argument.is_variadic), + '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, + # 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( + argument_so_far for argument_so_far in method.arguments[:index] + if argument_so_far.idl_type.name == 'EventListener'), + 'has_type_checking_interface': + (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or + has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and + idl_type.is_wrapper_type, + 'has_type_checking_unrestricted': + (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or + has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) and + idl_type.name in ('Float', 'Double'), + # Dictionary is special-cased, but arrays and sequences shouldn't be + 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, + 'idl_type_object': idl_type, + 'index': index, + 'is_clamp': 'Clamp' in extended_attributes, + 'is_callback_interface': idl_type.is_callback_interface, + 'is_nullable': idl_type.is_nullable, + 'is_optional': argument.is_optional, + 'is_variadic_wrapper_type': is_variadic_wrapper_type, + 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type), + 'is_wrapper_type': idl_type.is_wrapper_type, + 'name': argument.name, + 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), + 'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), + 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index), + } + + +################################################################################ +# Value handling +################################################################################ + +def cpp_value(interface, method, number_of_arguments): + def cpp_argument(argument): + idl_type = argument.idl_type + if idl_type.name == 'EventListener': + if (interface.name == 'EventTarget' and + method.name == 'removeEventListener'): + # FIXME: remove this special case by moving get() into + # EventTarget::removeEventListener + return '%s.get()' % argument.name + return argument.name + if (idl_type.is_callback_interface or + idl_type.name in ['NodeFilter', 'XPathNSResolver']): + # FIXME: remove this special case + return '%s.release()' % argument.name + return argument.name + + # Truncate omitted optional arguments + arguments = method.arguments[:number_of_arguments] + cpp_arguments = [] + if method.is_constructor: + call_with_values = interface.extended_attributes.get('ConstructorCallWith') + else: + call_with_values = method.extended_attributes.get('CallWith') + cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values)) + # Members of IDL partial interface definitions are implemented in C++ as + # static member functions, which for instance members (non-static members) + # take *impl as their first argument + if ('PartialInterfaceImplementedAs' in method.extended_attributes and + not method.is_static): + cpp_arguments.append('*impl') + cpp_arguments.extend(cpp_argument(argument) for argument in arguments) + this_union_arguments = method.idl_type and method.idl_type.union_arguments + if this_union_arguments: + cpp_arguments.extend(this_union_arguments) + + if ('RaisesException' in method.extended_attributes or + (method.is_constructor and + has_extended_attribute_value(interface, 'RaisesException', 'Constructor'))): + cpp_arguments.append('exceptionState') + + if method.name == 'Constructor': + base_name = 'create' + elif method.name == 'NamedConstructor': + base_name = 'createForJSConstructor' + else: + base_name = v8_utilities.cpp_name(method) + + cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) + return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) + + +def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False): + idl_type = method.idl_type + extended_attributes = method.extended_attributes + if not idl_type or idl_type.name == 'void': + # Constructors and void methods don't have a return type + return None + + release = False + # [CallWith=ScriptState], [RaisesException] + if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or + 'RaisesException' in extended_attributes or + idl_type.is_union_type): + cpp_value = 'result' # use local variable for value + release = idl_type.release + + script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' + return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_wrappable=script_wrappable, release=release, for_main_world=for_main_world) + + +def v8_value_to_local_cpp_variadic_value(argument, index): + assert argument.is_variadic + idl_type = argument.idl_type + + macro = 'TONATIVE_VOID_INTERNAL' + macro_args = [ + argument.name, + 'toNativeArguments<%s>(info, %s)' % (idl_type.cpp_type, index), + ] + + return '%s(%s)' % (macro, ', '.join(macro_args)) + + +def v8_value_to_local_cpp_value(argument, index): + extended_attributes = argument.extended_attributes + idl_type = argument.idl_type + name = argument.name + if argument.is_variadic: + return v8_value_to_local_cpp_variadic_value(argument, index) + # 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', 'ScalarValueString') and + argument.default_value and argument.default_value.is_null): + v8_value = 'argumentOrNull(info, %s)' % index + else: + v8_value = 'info[%s]' % index + return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, + name, index=index, declare_variable=False) + + +################################################################################ +# Auxiliary functions +################################################################################ + +# [NotEnumerable] +def property_attributes(method): + extended_attributes = method.extended_attributes + property_attributes_list = [] + if 'NotEnumerable' in extended_attributes: + property_attributes_list.append('v8::DontEnum') + if 'ReadOnly' in extended_attributes: + property_attributes_list.append('v8::ReadOnly') + if property_attributes_list: + property_attributes_list.insert(0, 'v8::DontDelete') + return property_attributes_list + + +def union_arguments(idl_type): + """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for union types, for use in setting return value""" + return [arg + for i in range(len(idl_type.member_types)) + for arg in ['result%sEnabled' % i, 'result%s' % i]] + +IdlType.union_arguments = property(lambda self: None) +IdlUnionType.union_arguments = property(union_arguments)
diff --git a/bindings/scripts/v8_types.py b/bindings/scripts/v8_types.py new file mode 100644 index 0000000..50e512b --- /dev/null +++ b/bindings/scripts/v8_types.py
@@ -0,0 +1,691 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Functions for type handling and type conversion (Blink/C++ <-> V8/JS). + +Extends IdlType and IdlUnionType with V8-specific properties, methods, and +class methods. + +Spec: +http://www.w3.org/TR/WebIDL/#es-type-mapping + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import posixpath + +from idl_types import IdlType, IdlUnionType +import v8_attributes # for IdlType.constructor_type_name +from v8_globals import includes + + +################################################################################ +# V8-specific handling of IDL types +################################################################################ + +NON_WRAPPER_TYPES = frozenset([ + 'CompareHow', + 'Dictionary', + 'EventHandler', + 'EventListener', + 'MediaQueryListListener', + 'NodeFilter', + 'SerializedScriptValue', +]) +TYPED_ARRAYS = { + # (cpp_type, v8_type), used by constructor templates + 'ArrayBuffer': None, + 'ArrayBufferView': None, + 'Float32Array': ('float', 'v8::kExternalFloatArray'), + 'Float64Array': ('double', 'v8::kExternalDoubleArray'), + 'Int8Array': ('signed char', 'v8::kExternalByteArray'), + 'Int16Array': ('short', 'v8::kExternalShortArray'), + 'Int32Array': ('int', 'v8::kExternalIntArray'), + 'Uint8Array': ('unsigned char', 'v8::kExternalUnsignedByteArray'), + 'Uint8ClampedArray': ('unsigned char', 'v8::kExternalPixelArray'), + 'Uint16Array': ('unsigned short', 'v8::kExternalUnsignedShortArray'), + 'Uint32Array': ('unsigned int', 'v8::kExternalUnsignedIntArray'), +} + +IdlType.is_typed_array_type = property( + lambda self: self.base_type in TYPED_ARRAYS) + + +IdlType.is_wrapper_type = property( + lambda self: (self.is_interface_type and + self.base_type not in NON_WRAPPER_TYPES)) + + +################################################################################ +# C++ types +################################################################################ + +CPP_TYPE_SAME_AS_IDL_TYPE = set([ + 'double', + 'float', + 'long long', + 'unsigned long long', +]) +CPP_INT_TYPES = set([ + 'byte', + 'long', + 'short', +]) +CPP_UNSIGNED_TYPES = set([ + 'octet', + 'unsigned int', + 'unsigned long', + 'unsigned short', +]) +CPP_SPECIAL_CONVERSION_RULES = { + 'CompareHow': 'Range::CompareHow', + 'Date': 'double', + 'Dictionary': 'Dictionary', + 'EventHandler': 'EventListener*', + 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', + 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', + 'Promise': 'ScriptPromise', + 'ScriptValue': 'ScriptValue', + # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345529 + 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', + 'boolean': 'bool', + 'unrestricted double': 'double', + 'unrestricted float': 'float', +} + + +def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): + """Returns C++ type corresponding to IDL type. + + |idl_type| argument is of type IdlType, while return value is a string + + Args: + idl_type: + IdlType + used_as_argument: + bool, True if idl_type's raw/primitive C++ type should be returned. + used_in_cpp_sequence: + bool, True if the C++ type is used as an element of an array or sequence. + """ + def string_mode(): + # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString', + # but we use NullString for performance. + if extended_attributes.get('TreatNullAs') != 'NullString': + return '' + if extended_attributes.get('TreatUndefinedAs') != 'NullString': + return 'WithNullCheck' + return 'WithUndefinedOrNullCheck' + + extended_attributes = extended_attributes or {} + idl_type = idl_type.preprocessed_type + + # Composite types + if used_as_variadic_argument: + array_or_sequence_type = idl_type + else: + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + vector_type = cpp_ptr_type('Vector', 'HeapVector', array_or_sequence_type.gc_type) + return cpp_template_type(vector_type, array_or_sequence_type.cpp_type_args(used_in_cpp_sequence=True)) + + # Simple types + base_idl_type = idl_type.base_type + + if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: + return base_idl_type + if base_idl_type in CPP_INT_TYPES: + return 'int' + if base_idl_type in CPP_UNSIGNED_TYPES: + return 'unsigned' + if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: + return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] + + if base_idl_type in NON_WRAPPER_TYPES: + return 'RefPtr<%s>' % base_idl_type + if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'): + if not used_as_argument: + return 'String' + return 'V8StringResource<%s>' % string_mode() + + if idl_type.is_typed_array_type and used_as_argument: + return base_idl_type + '*' + if idl_type.is_interface_type: + implemented_as_class = idl_type.implemented_as + if used_as_argument: + return implemented_as_class + '*' + new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' + ptr_type = cpp_ptr_type('RefPtr', new_type, idl_type.gc_type) + return cpp_template_type(ptr_type, implemented_as_class) + # Default, assume native type is a pointer with same type name as idl type + return base_idl_type + '*' + + +def cpp_type_union(idl_type, extended_attributes=None, used_as_argument=False): + return (member_type.cpp_type for member_type in idl_type.member_types) + + +# Allow access as idl_type.cpp_type if no arguments +IdlType.cpp_type = property(cpp_type) +IdlUnionType.cpp_type = property(cpp_type_union) +IdlType.cpp_type_args = cpp_type +IdlUnionType.cpp_type_args = cpp_type_union + + +def cpp_template_type(template, inner_type): + """Returns C++ template specialized to type, with space added if needed.""" + if inner_type.endswith('>'): + format_string = '{template}<{inner_type} >' + else: + format_string = '{template}<{inner_type}>' + return format_string.format(template=template, inner_type=inner_type) + + +def cpp_ptr_type(old_type, new_type, gc_type): + if gc_type == 'GarbageCollectedObject': + return new_type + if gc_type == 'WillBeGarbageCollectedObject': + if old_type == 'Vector': + return 'WillBe' + new_type + return old_type + 'WillBe' + new_type + return old_type + + +def v8_type(interface_name): + return 'V8' + interface_name + + +# [ImplementedAs] +# This handles [ImplementedAs] on interface types, not [ImplementedAs] in the +# interface being generated. e.g., given: +# Foo.idl: interface Foo {attribute Bar bar}; +# Bar.idl: [ImplementedAs=Zork] interface Bar {}; +# when generating bindings for Foo, the [ImplementedAs] on Bar is needed. +# This data is external to Foo.idl, and hence computed as global information in +# compute_interfaces_info.py to avoid having to parse IDLs of all used interfaces. +IdlType.implemented_as_interfaces = {} + + +def implemented_as(idl_type): + base_idl_type = idl_type.base_type + if base_idl_type in IdlType.implemented_as_interfaces: + return IdlType.implemented_as_interfaces[base_idl_type] + return base_idl_type + + +IdlType.implemented_as = property(implemented_as) + +IdlType.set_implemented_as_interfaces = classmethod( + lambda cls, new_implemented_as_interfaces: + cls.implemented_as_interfaces.update(new_implemented_as_interfaces)) + + +# [GarbageCollected] +IdlType.garbage_collected_types = set() + +IdlType.is_garbage_collected = property( + lambda self: self.base_type in IdlType.garbage_collected_types) + +IdlType.set_garbage_collected_types = classmethod( + lambda cls, new_garbage_collected_types: + cls.garbage_collected_types.update(new_garbage_collected_types)) + + +# [WillBeGarbageCollected] +IdlType.will_be_garbage_collected_types = set() + +IdlType.is_will_be_garbage_collected = property( + lambda self: self.base_type in IdlType.will_be_garbage_collected_types) + +IdlType.set_will_be_garbage_collected_types = classmethod( + lambda cls, new_will_be_garbage_collected_types: + cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected_types)) + + +def gc_type(idl_type): + if idl_type.is_garbage_collected: + return 'GarbageCollectedObject' + if idl_type.is_will_be_garbage_collected: + return 'WillBeGarbageCollectedObject' + return 'RefCountedObject' + +IdlType.gc_type = property(gc_type) + + +################################################################################ +# Includes +################################################################################ + +def includes_for_cpp_class(class_name, relative_dir_posix): + return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h')]) + + +INCLUDES_FOR_TYPE = { + 'object': set(), + 'CompareHow': set(), + 'Dictionary': set(['bindings/common/Dictionary.h']), + 'EventHandler': set(['bindings/v8/V8AbstractEventListener.h', + 'bindings/v8/V8EventListenerList.h']), + 'EventListener': set(['bindings/common/BindingSecurity.h', + 'bindings/v8/V8EventListenerList.h', + 'core/frame/LocalDOMWindow.h']), + 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', + 'core/dom/ClassCollection.h', + 'core/dom/TagCollection.h', + 'core/html/HTMLCollection.h', + 'core/html/HTMLFormControlsCollection.h', + 'core/html/HTMLTableRowsCollection.h']), + 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), + 'NodeList': set(['bindings/core/v8/V8NodeList.h', + 'core/dom/NameNodeList.h', + 'core/dom/NodeList.h', + 'core/dom/StaticNodeList.h', + 'core/html/LabelsNodeList.h']), + 'Promise': set(['bindings/v8/ScriptPromise.h']), + 'SerializedScriptValue': set(['bindings/v8/SerializedScriptValue.h']), + 'ScriptValue': set(['bindings/common/ScriptValue.h']), +} + + +def includes_for_type(idl_type): + idl_type = idl_type.preprocessed_type + + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + return includes_for_type(array_or_sequence_type) + + # Simple types + base_idl_type = idl_type.base_type + if base_idl_type in INCLUDES_FOR_TYPE: + return INCLUDES_FOR_TYPE[base_idl_type] + if idl_type.is_basic_type: + return set() + if idl_type.is_typed_array_type: + return set(['bindings/v8/custom/V8%sCustom.h' % base_idl_type]) + if base_idl_type.endswith('ConstructorConstructor'): + # FIXME: rename to NamedConstructor + # FIXME: replace with a [NamedConstructorAttribute] extended attribute + # Ending with 'ConstructorConstructor' indicates a named constructor, + # and these do not have header files, as they are part of the generated + # bindings for the interface + return set() + if base_idl_type.endswith('Constructor'): + # FIXME: replace with a [ConstructorAttribute] extended attribute + base_idl_type = idl_type.constructor_type_name + return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], + base_idl_type)]) + +IdlType.includes_for_type = property(includes_for_type) +IdlUnionType.includes_for_type = property( + lambda self: set.union(*[includes_for_type(member_type) + for member_type in self.member_types])) + + +def add_includes_for_type(idl_type): + includes.update(idl_type.includes_for_type) + +IdlType.add_includes_for_type = add_includes_for_type +IdlUnionType.add_includes_for_type = add_includes_for_type + + +def includes_for_interface(interface_name): + return IdlType(interface_name).includes_for_type + + +def add_includes_for_interface(interface_name): + includes.update(includes_for_interface(interface_name)) + +component_dir = {} + + +def set_component_dirs(new_component_dirs): + component_dir.update(new_component_dirs) + + +################################################################################ +# V8 -> C++ +################################################################################ + +V8_VALUE_TO_CPP_VALUE = { + # Basic + 'Date': 'toCoreDate({v8_value})', + 'DOMString': '{v8_value}', + 'ByteString': 'toByteString({arguments})', + 'ScalarValueString': 'toScalarValueString({arguments})', + 'boolean': '{v8_value}->BooleanValue()', + 'float': 'static_cast<float>({v8_value}->NumberValue())', + 'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())', + 'double': 'static_cast<double>({v8_value}->NumberValue())', + 'unrestricted double': 'static_cast<double>({v8_value}->NumberValue())', + 'byte': 'toInt8({arguments})', + 'octet': 'toUInt8({arguments})', + 'short': 'toInt16({arguments})', + 'unsigned short': 'toUInt16({arguments})', + 'long': 'toInt32({arguments})', + 'unsigned long': 'toUInt32({arguments})', + 'long long': 'toInt64({arguments})', + 'unsigned long long': 'toUInt64({arguments})', + # Interface types + 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', + 'Dictionary': 'Dictionary({v8_value}, info.GetIsolate())', + 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::Cast({v8_value})) : 0', + 'MediaQueryListListener': 'MediaQueryListListener::create(V8ScriptState::current(info.GetIsolate()), ScriptValue(V8ScriptState::current(info.GetIsolate()), {v8_value}))', + 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), V8ScriptState::current(info.GetIsolate()))', + 'Promise': 'ScriptPromise::cast(V8ScriptState::current(info.GetIsolate()), {v8_value})', + 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, info.GetIsolate())', + 'ScriptValue': 'ScriptValue(V8ScriptState::current(info.GetIsolate()), {v8_value})', + 'Window': 'toDOMWindow({v8_value}, info.GetIsolate())', + 'XPathNSResolver': 'toXPathNSResolver({v8_value}, info.GetIsolate())', +} + + +def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index): + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + return v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, index) + + # Simple types + idl_type = idl_type.preprocessed_type + add_includes_for_type(idl_type) + base_idl_type = idl_type.base_type + + if 'EnforceRange' in extended_attributes: + arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) + elif (idl_type.is_integer_type or # NormalConversion + idl_type.name in ('ByteString', 'ScalarValueString')): + arguments = ', '.join([v8_value, 'exceptionState']) + else: + arguments = v8_value + + if base_idl_type in V8_VALUE_TO_CPP_VALUE: + cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] + elif idl_type.is_typed_array_type: + cpp_expression_format = ( + '{v8_value}->Is{idl_type}() ? ' + 'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') + else: + cpp_expression_format = ( + 'V8{idl_type}::toNativeWithTypeCheck(info.GetIsolate(), {v8_value})') + + return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_type, v8_value=v8_value) + + +def v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, index): + # Index is None for setters, index (starting at 0) for method arguments, + # and is used to provide a human-readable exception message + if index is None: + index = 0 # special case, meaning "setter" + else: + index += 1 # human-readable index + if (array_or_sequence_type.is_interface_type and + array_or_sequence_type.name != 'Dictionary'): + this_cpp_type = None + ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', array_or_sequence_type.gc_type) + expression_format = '(to{ref_ptr_type}NativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))' + add_includes_for_type(array_or_sequence_type) + else: + ref_ptr_type = None + this_cpp_type = array_or_sequence_type.cpp_type + expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {index}, info.GetIsolate())' + expression = expression_format.format(array_or_sequence_type=array_or_sequence_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type, v8_value=v8_value) + return expression + + +def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True): + """Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" + this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, used_as_argument=True) + + idl_type = idl_type.preprocessed_type + cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index) + args = [variable_name, cpp_value] + if idl_type.base_type == 'DOMString' and not idl_type.array_or_sequence_type: + macro = 'TOSTRING_VOID' + elif (idl_type.is_integer_type or + idl_type.name in ('ByteString', 'ScalarValueString')): + macro = 'TONATIVE_VOID_EXCEPTIONSTATE' + args.append('exceptionState') + else: + macro = 'TONATIVE_VOID' + + # Macros come in several variants, to minimize expensive creation of + # v8::TryCatch. + suffix = '' + + if declare_variable: + args.insert(0, this_cpp_type) + else: + suffix += '_INTERNAL' + + return '%s(%s)' % (macro + suffix, ', '.join(args)) + + +IdlType.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value +IdlUnionType.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value + + +################################################################################ +# C++ -> V8 +################################################################################ + +def preprocess_idl_type(idl_type): + if idl_type.is_enum: + # Enumerations are internally DOMStrings + return IdlType('DOMString') + if (idl_type.name == 'Any' or idl_type.is_callback_function): + return IdlType('ScriptValue') + return idl_type + +IdlType.preprocessed_type = property(preprocess_idl_type) +IdlUnionType.preprocessed_type = property(preprocess_idl_type) + + +def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes): + """Returns IDL type and value, with preliminary type conversions applied.""" + idl_type = idl_type.preprocessed_type + if idl_type.name == 'Promise': + idl_type = IdlType('ScriptValue') + if idl_type.base_type in ['long long', 'unsigned long long']: + # long long and unsigned long long are not representable in ECMAScript; + # we represent them as doubles. + idl_type = IdlType('double', is_nullable=idl_type.is_nullable) + cpp_value = 'static_cast<double>(%s)' % cpp_value + # HTML5 says that unsigned reflected attributes should be in the range + # [0, 2^31). When a value isn't in this range, a default value (or 0) + # should be returned instead. + extended_attributes = extended_attributes or {} + if ('Reflect' in extended_attributes and + idl_type.base_type in ['unsigned long', 'unsigned short']): + cpp_value = cpp_value.replace('getUnsignedIntegralAttribute', + 'getIntegralAttribute') + cpp_value = 'std::max(0, %s)' % cpp_value + return idl_type, cpp_value + + +def v8_conversion_type(idl_type, extended_attributes): + """Returns V8 conversion type, adding any additional includes. + + The V8 conversion type is used to select the C++ -> V8 conversion function + or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a + separate name for the type of conversion (e.g., 'DOMWrapper'). + """ + extended_attributes = extended_attributes or {} + + # Composite types + array_or_sequence_type = idl_type.array_or_sequence_type + if array_or_sequence_type: + if array_or_sequence_type.is_interface_type: + add_includes_for_type(array_or_sequence_type) + return 'array' + + # Simple types + base_idl_type = idl_type.base_type + # Basic types, without additional includes + if base_idl_type in CPP_INT_TYPES: + return 'int' + if base_idl_type in CPP_UNSIGNED_TYPES: + return 'unsigned' + if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'): + if 'TreatReturnedNullStringAs' not in extended_attributes: + return base_idl_type + treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs'] + if treat_returned_null_string_as == 'Null': + return 'StringOrNull' + if treat_returned_null_string_as == 'Undefined': + return 'StringOrUndefined' + raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returned_null_string_as + if idl_type.is_basic_type or base_idl_type == 'ScriptValue': + return base_idl_type + + # Data type with potential additional includes + add_includes_for_type(idl_type) + if base_idl_type in V8_SET_RETURN_VALUE: # Special v8SetReturnValue treatment + return base_idl_type + + # Pointer type + return 'DOMWrapper' + +IdlType.v8_conversion_type = v8_conversion_type + + +V8_SET_RETURN_VALUE = { + 'boolean': 'v8SetReturnValueBool(info, {cpp_value})', + 'int': 'v8SetReturnValueInt(info, {cpp_value})', + 'unsigned': 'v8SetReturnValueUnsigned(info, {cpp_value})', + 'DOMString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())', + 'ByteString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())', + 'ScalarValueString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())', + # [TreatNullReturnValueAs] + 'StringOrNull': 'v8SetReturnValueStringOrNull(info, {cpp_value}, info.GetIsolate())', + 'StringOrUndefined': 'v8SetReturnValueStringOrUndefined(info, {cpp_value}, info.GetIsolate())', + 'void': '', + # No special v8SetReturnValue* function (set value directly) + 'float': 'v8SetReturnValue(info, {cpp_value})', + 'unrestricted float': 'v8SetReturnValue(info, {cpp_value})', + 'double': 'v8SetReturnValue(info, {cpp_value})', + 'unrestricted double': 'v8SetReturnValue(info, {cpp_value})', + # No special v8SetReturnValue* function, but instead convert value to V8 + # and then use general v8SetReturnValue. + 'array': 'v8SetReturnValue(info, {cpp_value})', + 'Date': 'v8SetReturnValue(info, {cpp_value})', + 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', + 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', + 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', + # DOMWrapper + 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({cpp_value}))', + 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {script_wrappable})', + 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', +} + + +def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False): + """Returns a statement that converts a C++ value to a V8 value and sets it as a return value. + + """ + def dom_wrapper_conversion_type(): + if not script_wrappable: + return 'DOMWrapperDefault' + if for_main_world: + return 'DOMWrapperForMainWorld' + return 'DOMWrapperFast' + + idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes) + this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) + # SetReturn-specific overrides + if this_v8_conversion_type in ['Date', 'EventHandler', 'ScriptValue', 'SerializedScriptValue', 'array']: + # Convert value to V8 and then use general v8SetReturnValue + cpp_value = idl_type.cpp_value_to_v8_value(cpp_value, extended_attributes=extended_attributes) + if this_v8_conversion_type == 'DOMWrapper': + this_v8_conversion_type = dom_wrapper_conversion_type() + + format_string = V8_SET_RETURN_VALUE[this_v8_conversion_type] + # FIXME: oilpan: Remove .release() once we remove all RefPtrs from generated code. + if release: + cpp_value = '%s.release()' % cpp_value + statement = format_string.format(cpp_value=cpp_value, script_wrappable=script_wrappable) + return statement + + +def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False): + """ + release: can be either False (False for all member types) or + a sequence (list or tuple) of booleans (if specified individually). + """ + + return [ + member_type.v8_set_return_value(cpp_value + str(i), + extended_attributes, + script_wrappable, + release and release[i], + for_main_world) + for i, member_type in + enumerate(idl_type.member_types)] + +IdlType.v8_set_return_value = v8_set_return_value +IdlUnionType.v8_set_return_value = v8_set_return_value_union + +IdlType.release = property(lambda self: self.is_interface_type) +IdlUnionType.release = property( + lambda self: [member_type.is_interface_type + for member_type in self.member_types]) + + +CPP_VALUE_TO_V8_VALUE = { + # Built-in types + 'Date': 'v8DateOrNaN({cpp_value}, {isolate})', + 'DOMString': 'v8String({isolate}, {cpp_value})', + 'ByteString': 'v8String({isolate}, {cpp_value})', + 'ScalarValueString': 'v8String({isolate}, {cpp_value})', + 'boolean': 'v8Boolean({cpp_value}, {isolate})', + 'int': 'v8::Integer::New({isolate}, {cpp_value})', + 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})', + 'float': 'v8::Number::New({isolate}, {cpp_value})', + 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})', + 'double': 'v8::Number::New({isolate}, {cpp_value})', + 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})', + 'void': 'v8Undefined()', + # Special cases + 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null({isolate}))', + 'ScriptValue': '{cpp_value}.v8Value()', + 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Handle<v8::Value>(v8::Null({isolate}))', + # General + 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})', + 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', +} + + +def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', creation_context='info.Holder()', extended_attributes=None): + """Returns an expression that converts a C++ value to a V8 value.""" + # the isolate parameter is needed for callback interfaces + idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes) + this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) + format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] + statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creation_context=creation_context) + return statement + +IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value
diff --git a/bindings/scripts/v8_utilities.py b/bindings/scripts/v8_utilities.py new file mode 100644 index 0000000..8067595 --- /dev/null +++ b/bindings/scripts/v8_utilities.py
@@ -0,0 +1,282 @@ +# Copyright (C) 2013 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Functions shared by various parts of the code generator. + +Extends IdlType and IdlUnion type with |enum_validation_expression| property. + +Design doc: http://www.chromium.org/developers/design-documents/idl-compiler +""" + +import re + +from idl_types import IdlType, IdlUnionType +import idl_types +from v8_globals import includes +import v8_types + +ACRONYMS = [ + 'CSSOM', # must come *before* CSS to match full acronym + 'CSS', + 'HTML', + 'IME', + 'JS', + 'SVG', + 'URL', + 'WOFF', + 'XML', + 'XSLT', +] + + +################################################################################ +# Extended attribute parsing +################################################################################ + +def extended_attribute_value_contains(extended_attribute_value, value): + return (extended_attribute_value and + value in re.split('[|&]', extended_attribute_value)) + + +def has_extended_attribute(definition_or_member, extended_attribute_list): + return any(extended_attribute in definition_or_member.extended_attributes + for extended_attribute in extended_attribute_list) + + +def has_extended_attribute_value(definition_or_member, name, value): + extended_attributes = definition_or_member.extended_attributes + return (name in extended_attributes and + extended_attribute_value_contains(extended_attributes[name], value)) + + +################################################################################ +# String handling +################################################################################ + +def capitalize(name): + """Capitalize first letter or initial acronym (used in setter names).""" + for acronym in ACRONYMS: + if name.startswith(acronym.lower()): + return name.replace(acronym.lower(), acronym) + return name[0].upper() + name[1:] + + +def strip_suffix(string, suffix): + if not suffix or not string.endswith(suffix): + return string + return string[:-len(suffix)] + + +def uncapitalize(name): + """Uncapitalizes first letter or initial acronym (used in method names). + + E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. + """ + for acronym in ACRONYMS: + if name.startswith(acronym): + return name.replace(acronym, acronym.lower()) + return name[0].lower() + name[1:] + + +################################################################################ +# C++ +################################################################################ + +def enum_validation_expression(idl_type): + # FIXME: Add IdlEnumType, move property to derived type, and remove this check + if not idl_type.is_enum: + return None + return ' || '.join(['string == "%s"' % enum_value + for enum_value in idl_type.enum_values]) +IdlType.enum_validation_expression = property(enum_validation_expression) + + +def scoped_name(interface, definition, base_name): + # partial interfaces are implemented as separate classes, with their members + # implemented as static member functions + partial_interface_implemented_as = definition.extended_attributes.get('PartialInterfaceImplementedAs') + if partial_interface_implemented_as: + return '%s::%s' % (partial_interface_implemented_as, base_name) + if (definition.is_static or + definition.name in ('Constructor', 'NamedConstructor')): + return '%s::%s' % (cpp_name(interface), base_name) + return 'impl->%s' % base_name + + +def v8_class_name(interface): + return v8_types.v8_type(interface.name) + + +################################################################################ +# Specific extended attributes +################################################################################ + +# [ActivityLogging] +def activity_logging_world_list(member, access_type=''): + """Returns a set of world suffixes for which a definition member has activity logging, for specified access type. + + access_type can be 'Getter' or 'Setter' if only checking getting or setting. + """ + extended_attributes = member.extended_attributes + if 'LogActivity' not in extended_attributes: + return set() + log_activity = extended_attributes['LogActivity'] + if log_activity and not log_activity.startswith(access_type): + return set() + + includes.add('bindings/v8/V8DOMActivityLogger.h') + if 'LogAllWorlds' in extended_attributes: + return set(['', 'ForMainWorld']) + return set(['']) # At minimum, include isolated worlds. + + +# [ActivityLogging] +def activity_logging_world_check(member): + """Returns if an isolated world check is required when generating activity + logging code. + + The check is required when there is no per-world binding code and logging is + required only for isolated world. + """ + extended_attributes = member.extended_attributes + if 'LogActivity' not in extended_attributes: + return False + if ('PerWorldBindings' not in extended_attributes and + 'LogAllWorlds' not in extended_attributes): + return True + return False + + +# [CallWith] +CALL_WITH_ARGUMENTS = { + 'ScriptState': 'scriptState', + 'ExecutionContext': 'executionContext', + 'ScriptArguments': 'scriptArguments.release()', + 'ActiveWindow': 'callingDOMWindow(info.GetIsolate())', + 'FirstWindow': 'enteredDOMWindow(info.GetIsolate())', + 'Document': 'document', +} +# List because key order matters, as we want arguments in deterministic order +CALL_WITH_VALUES = [ + 'ScriptState', + 'ExecutionContext', + 'ScriptArguments', + 'ActiveWindow', + 'FirstWindow', + 'Document', +] + + +def call_with_arguments(call_with_values): + if not call_with_values: + return [] + return [CALL_WITH_ARGUMENTS[value] + for value in CALL_WITH_VALUES + if extended_attribute_value_contains(call_with_values, value)] + + +# [Conditional] +def conditional_string(definition_or_member): + extended_attributes = definition_or_member.extended_attributes + if 'Conditional' not in extended_attributes: + return None + conditional = extended_attributes['Conditional'] + for operator in '&|': + if operator in conditional: + conditions = conditional.split(operator) + operator_separator = ' %s%s ' % (operator, operator) + return operator_separator.join('ENABLE(%s)' % expression for expression in sorted(conditions)) + return 'ENABLE(%s)' % conditional + + +# [DeprecateAs] +def deprecate_as(member): + extended_attributes = member.extended_attributes + if 'DeprecateAs' not in extended_attributes: + return None + includes.add('core/frame/UseCounter.h') + return extended_attributes['DeprecateAs'] + + +# [GarbageCollected], [WillBeGarbageCollected] +def gc_type(definition): + extended_attributes = definition.extended_attributes + if 'GarbageCollected' in extended_attributes: + return 'GarbageCollectedObject' + elif 'WillBeGarbageCollected' in extended_attributes: + return 'WillBeGarbageCollectedObject' + return 'RefCountedObject' + + +# [ImplementedAs] +def cpp_name(definition_or_member): + extended_attributes = definition_or_member.extended_attributes + if 'ImplementedAs' not in extended_attributes: + return definition_or_member.name + return extended_attributes['ImplementedAs'] + + +# [MeasureAs] +def measure_as(definition_or_member): + extended_attributes = definition_or_member.extended_attributes + if 'MeasureAs' not in extended_attributes: + return None + includes.add('core/frame/UseCounter.h') + return extended_attributes['MeasureAs'] + + +# [PerContextEnabled] +def per_context_enabled_function_name(definition_or_member): + extended_attributes = definition_or_member.extended_attributes + if 'PerContextEnabled' not in extended_attributes: + return None + feature_name = extended_attributes['PerContextEnabled'] + return 'ContextFeatures::%sEnabled' % uncapitalize(feature_name) + + +# [RuntimeEnabled] +def runtime_enabled_function_name(definition_or_member): + """Returns the name of the RuntimeEnabledFeatures function. + + The returned function checks if a method/attribute is enabled. + Given extended attribute RuntimeEnabled=FeatureName, return: + RuntimeEnabledFeatures::{featureName}Enabled + """ + extended_attributes = definition_or_member.extended_attributes + if 'RuntimeEnabled' not in extended_attributes: + return None + feature_name = extended_attributes['RuntimeEnabled'] + return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) + + +################################################################################ +# Dart Specific extended attributes +################################################################################ +def dart_custom_method(extended_attributes): + return ('DartCustom' in extended_attributes and + extended_attribute_value_contains(extended_attributes['DartCustom'], 'New'))
diff --git a/core/html/shadow/HTMLShadowElement.idl b/bindings/tests/idls/SVGTestInterface.idl similarity index 78% copy from core/html/shadow/HTMLShadowElement.idl copy to bindings/tests/idls/SVGTestInterface.idl index 44bc357..6c7511e 100644 --- a/core/html/shadow/HTMLShadowElement.idl +++ b/bindings/tests/idls/SVGTestInterface.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,7 +28,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface HTMLShadowElement : HTMLElement { - attribute boolean resetStyleInheritance; - [RuntimeEnabled=ShadowDOM] NodeList getDistributedNodes(); + +// This test files starts with 'SVG' because /^SVG/ is used as a check +// for SVG interfaces (to use SVGNames for [Reflect] attributes) +[ + DependentLifetime, +] interface SVGTestInterface { + [Reflect] attribute DOMString type; // Test SVGNames namespace + // [Immutable] attribute SVGPoint immutablePoint; // [Immutable] is a nop };
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestCallbackInterface.idl similarity index 61% copy from core/clipboard/Clipboard.idl copy to bindings/tests/idls/TestCallbackInterface.idl index 695f70d..cebfa19 100644 --- a/core/clipboard/Clipboard.idl +++ b/bindings/tests/idls/TestCallbackInterface.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,18 +26,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ -] interface Clipboard { - [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect; - [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed; - readonly attribute DOMString[] types; - readonly attribute FileList files; - - void clearData(optional DOMString type); - DOMString getData(DOMString type); - boolean setData(DOMString type, DOMString data); - [RaisesException] void setDragImage(Element image, long x, long y); - - readonly attribute DataTransferItemList items; +callback interface TestCallbackInterface { + void voidMethod(); + boolean booleanMethod(); + void voidMethodBooleanArg(boolean boolArg); + void voidMethodSequenceArg(sequence<TestInterfaceEmpty> sequenceArg); + void voidMethodFloatArg(float floatArg); + void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + void voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty testInterfaceEmptyArg, DOMString stringArg); + [CallWith=ThisValue] void callbackWithThisValueVoidMethodStringArg(DOMString stringArg); + [Custom] void customVoidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + // [WillBeGarbageCollected] + void voidMethodWillBeGarbageCollectedSequenceArg(sequence<TestInterfaceWillBeGarbageCollected> sequenceArg); + void voidMethodWillBeGarbageCollectedArrayArg(TestInterfaceWillBeGarbageCollected[] arrayArg); }; -
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestException.idl similarity index 71% copy from core/clipboard/Clipboard.idl copy to bindings/tests/idls/TestException.idl index 695f70d..a62191c 100644 --- a/core/clipboard/Clipboard.idl +++ b/bindings/tests/idls/TestException.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,17 +27,12 @@ */ [ -] interface Clipboard { - [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect; - [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed; - readonly attribute DOMString[] types; - readonly attribute FileList files; + DoNotCheckConstants, +] exception TestException { + readonly attribute unsigned short readonlyUnsignedShortAttribute; + readonly attribute DOMString readonlyStringAttribute; - void clearData(optional DOMString type); - DOMString getData(DOMString type); - boolean setData(DOMString type, DOMString data); - [RaisesException] void setDragImage(Element image, long x, long y); + const unsigned short UNSIGNED_SHORT_CONSTANT = 1; - readonly attribute DataTransferItemList items; + [NotEnumerable] DOMString toString(); }; -
diff --git a/bindings/tests/idls/TestImplements.idl b/bindings/tests/idls/TestImplements.idl new file mode 100644 index 0000000..e6e55db --- /dev/null +++ b/bindings/tests/idls/TestImplements.idl
@@ -0,0 +1,49 @@ +/* + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + NoInterfaceObject, // Always used on target of 'implements' +] interface TestImplements { + static readonly attribute long implementsStaticReadOnlyLongAttribute; + static attribute DOMString implementsStaticStringAttribute; + readonly attribute DOMString implementsReadonlyStringAttribute; + attribute DOMString implementsStringAttribute; + attribute Node implementsNodeAttribute; + attribute EventHandler implementsEventHandlerAttribute; + + void implementsVoidMethod(); + [CallWith=ExecutionContext, RaisesException] TestInterfaceEmpty implementsComplexMethod(DOMString strArg, TestInterfaceEmpty testInterfaceEmptyArg); + [Custom] void implementsCustomVoidMethod(); + static void implementsStaticVoidMethod(); + + const unsigned short IMPLEMENTS_CONSTANT_1 = 1; + [Reflect=IMPLEMENTS_REFLECT_CONSTANT] const unsigned short IMPLEMENTS_CONSTANT_2 = 2; + + [RuntimeEnabled=ImplementsFeatureName] attribute Node implementsRuntimeEnabledNodeAttribute; + [PerContextEnabled=ImplementsContextName] attribute Node implementsPerContextEnabledNodeAttribute; +};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestImplements2.idl similarity index 74% rename from modules/mediasource/WindowMediaSource.idl rename to bindings/tests/idls/TestImplements2.idl index ab65c2f..ce0e357 100644 --- a/modules/mediasource/WindowMediaSource.idl +++ b/bindings/tests/idls/TestImplements2.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,9 +29,13 @@ */ [ - RuntimeEnabled=WebKitMediaSource -] partial interface Window { - attribute WebKitMediaSourceConstructor WebKitMediaSource; - attribute WebKitSourceBufferConstructor WebKitSourceBuffer; - attribute WebKitSourceBufferListConstructor WebKitSourceBufferList; + LegacyTreatAsPartialInterface, // Conflicts with default implements behavior + NoInterfaceObject, // Always used on target of 'implements' + RuntimeEnabled=Implements2FeatureName, // conflicts with [RuntimeEnabled] on member +] interface TestImplements2 { + static attribute DOMString implements2StaticStringAttribute; + attribute DOMString implements2StringAttribute; + void implements2VoidMethod(); }; + +TestInterface implements TestImplements2;
diff --git a/bindings/tests/idls/TestImplements3.idl b/bindings/tests/idls/TestImplements3.idl new file mode 100644 index 0000000..4d18506 --- /dev/null +++ b/bindings/tests/idls/TestImplements3.idl
@@ -0,0 +1,14 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + LegacyTreatAsPartialInterface, // used by [ImplementedAs] + ImplementedAs=TestImplements3Implementation, // Conflicts with default implements class name + NoInterfaceObject, // Always used on target of 'implements' +] interface TestImplements3 { + attribute DOMString implements3StringAttribute; + static attribute DOMString implements3StaticStringAttribute; + void implements3VoidMethod(); + static void implements3StaticVoidMethod(); +};
diff --git a/bindings/tests/idls/TestInterface.idl b/bindings/tests/idls/TestInterface.idl new file mode 100644 index 0000000..479b016 --- /dev/null +++ b/bindings/tests/idls/TestInterface.idl
@@ -0,0 +1,76 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Test for interface extended attributes and special operations. +// Also used as a target by TestObject + +[ + ActiveDOMObject, + Conditional=CONDITION, + Custom=LegacyCallAsFunction|ToV8, + DoNotCheckConstants, + ImplementedAs=TestInterfaceImplementation, + RuntimeEnabled=FeatureName, + SetWrapperReferenceTo(TestInterface referencedName), + TypeChecking=Interface|Nullable|Unrestricted, +] interface TestInterface : TestInterfaceEmpty { + // members needed to test [ImplementedAs], as this affect attribute + // configuration and method configuration, and [TypeChecking] + // constants also needed for [DoNotCheckConstants] + const unsigned long UNSIGNED_LONG = 0; + [Reflect=CONST_CPP] const short CONST_JAVASCRIPT = 1; + + attribute TestInterface testInterfaceAttribute; // Self-referential interface type with [ImplementedAs] + attribute TestInterfaceConstructor testInterfaceConstructorAttribute; + attribute double doubleAttribute; + attribute float floatAttribute; + attribute unrestricted double unrestrictedDoubleAttribute; + attribute unrestricted float unrestrictedFloatAttribute; + static attribute DOMString staticStringAttribute; + + void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + void voidMethodDoubleArgFloatArg(double doubleArg, float floatArg); + void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestricted double unrestrictedDoubleArg, unrestricted float unrestrictedFloatArg); + [PerWorldBindings] void voidMethod(); + + // Anonymous indexed property operations + getter DOMString (unsigned long index); + setter DOMString (unsigned long index, DOMString value); + deleter boolean (unsigned long index); + + // Anonymous named property operations + getter DOMString (DOMString name); + setter DOMString (DOMString name, DOMString value); + deleter boolean (DOMString name); +}; + +TestInterface implements TestImplements; +// TestInterface implements TestImplements2; // at implement*ed* interface +TestInterface implements TestImplements3;
diff --git a/bindings/tests/idls/TestInterface2.idl b/bindings/tests/idls/TestInterface2.idl new file mode 100644 index 0000000..bf9c112 --- /dev/null +++ b/bindings/tests/idls/TestInterface2.idl
@@ -0,0 +1,52 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This is for interface extended attributes that interact with another extended +// attribute, and thus both cannot be tested at once; and for special +// operations, which need a separate interface to test on. +// The more *minor* extended attribute should be put in this file. + +[ + Constructor, // Test interaction with [Custom=Wrap] + Custom=Wrap, // Conflicts with and [Custom=ToV8], respectively + DependentLifetime, // Covered by [ActiveDOMObject] + SetWrapperReferenceFrom=ownerNode, // Conflicts with [SetWrapperReferenceTo] + SpecialWrapFor=TestInterface|TestInterfaceEmpty, // Conflicts with [Custom=ToV8] +] interface TestInterface2 { + // Indexed property operations with an identifier + [RaisesException] getter TestInterfaceEmpty item(unsigned long index); + [RaisesException] setter DOMString setItem(unsigned long index, DOMString value); + [RaisesException] deleter boolean deleteItem(unsigned long index); + + // Named property operations with an identifier + [RaisesException] getter TestInterfaceEmpty namedItem(DOMString name); + [RaisesException] setter DOMString setNamedItem(DOMString name, DOMString value); + [RaisesException] deleter boolean deleteNamedItem(DOMString name); +};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestInterface3.idl similarity index 66% copy from modules/mediasource/WindowMediaSource.idl copy to bindings/tests/idls/TestInterface3.idl index ab65c2f..6b90bda 100644 --- a/modules/mediasource/WindowMediaSource.idl +++ b/bindings/tests/idls/TestInterface3.idl
@@ -28,10 +28,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// This is for interface extended attributes that interact with another extended +// attribute, and thus both cannot be tested at once; and for special +// operations, which need a separate interface to test on. +// The more *minor* extended attribute should be put in this file. + [ - RuntimeEnabled=WebKitMediaSource -] partial interface Window { - attribute WebKitMediaSourceConstructor WebKitMediaSource; - attribute WebKitSourceBufferConstructor WebKitSourceBuffer; - attribute WebKitSourceBufferListConstructor WebKitSourceBufferList; + Custom=VisitDOMWrapper, // Conflict with [SetWrapperReferenceTo] and [SetWrapperReferenceFrom] +] interface TestInterface3 { + [Custom] getter boolean (unsigned long index); + [Custom] setter boolean (unsigned long index, Node value); + [Custom] deleter boolean (unsigned long index); + + [Custom=PropertyGetter|PropertyEnumerator|PropertyQuery] getter Node (DOMString name); + [Custom] setter Node (DOMString name, Node value); + [Custom] deleter boolean (DOMString name); };
diff --git a/bindings/tests/idls/TestInterfaceCheckSecurity.idl b/bindings/tests/idls/TestInterfaceCheckSecurity.idl new file mode 100644 index 0000000..0d20eb9 --- /dev/null +++ b/bindings/tests/idls/TestInterfaceCheckSecurity.idl
@@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + CheckSecurity=Frame, +] interface TestInterfaceCheckSecurity { + readonly attribute long longAttribute; + void voidMethod(); + + [DoNotCheckSecurity] attribute long doNotCheckSecurityLongAttribute; + [DoNotCheckSecurity] readonly attribute long doNotCheckSecurityReadonlyLongAttribute; // Separate read only attribute to check attribute configuration + [DoNotCheckSecurity=Setter] attribute long doNotCheckSecurityOnSetterLongAttribute; + [DoNotCheckSecurity, Replaceable] readonly attribute long doNotCheckSecurityReplaceableReadonlyLongAttribute; + + [DoNotCheckSecurity] void doNotCheckSecurityVoidMethod(); + [DoNotCheckSecurity, DoNotCheckSignature] void doNotCheckSecurityDoNotCheckSignatureVoidMethod(); + [DoNotCheckSecurity, PerWorldBindings] void doNotCheckSecurityPerWorldBindingsVoidMethod(); + [DoNotCheckSecurity, ReadOnly] void doNotCheckSecurityReadOnlyVoidMethod(); + [DoNotCheckSecurity, Unforgeable] void doNotCheckSecurityUnforgeableVoidMethod(); +};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestInterfaceConstructor.idl similarity index 70% copy from modules/mediasource/WindowMediaSource.idl copy to bindings/tests/idls/TestInterfaceConstructor.idl index ab65c2f..102754e 100644 --- a/modules/mediasource/WindowMediaSource.idl +++ b/bindings/tests/idls/TestInterfaceConstructor.idl
@@ -28,10 +28,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// Note that length == 0 and overloaded; need other tests for other cases. [ - RuntimeEnabled=WebKitMediaSource -] partial interface Window { - attribute WebKitMediaSourceConstructor WebKitMediaSource; - attribute WebKitSourceBufferConstructor WebKitSourceBuffer; - attribute WebKitSourceBufferListConstructor WebKitSourceBufferList; + Constructor, + Constructor( + double doubleArg, + DOMString stringArg, + TestInterfaceEmpty testInterfaceEmptyArg, + Dictionary dictionaryArg, + sequence<DOMString> sequenceStringArg, + sequence<Dictionary> sequenceDictionaryArg, + optional Dictionary optionalDictionaryArg, + [Default=Undefined] optional TestInterfaceEmpty optionalTestInterfaceEmptyArg), + ConstructorCallWith=ExecutionContext&Document, + MeasureAs=TestFeature, + RaisesException=Constructor, +] interface TestInterfaceConstructor { };
diff --git a/bindings/tests/idls/TestInterfaceConstructor2.idl b/bindings/tests/idls/TestInterfaceConstructor2.idl new file mode 100644 index 0000000..10057de --- /dev/null +++ b/bindings/tests/idls/TestInterfaceConstructor2.idl
@@ -0,0 +1,51 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Test for length > 0, overloaded constructor. +// Need separate tests for constructors with length == 0 and length > 0, +// and for overloaded vs. non-overloaded, if length > 0. +// length == 0, non-overloaded just omits a block and is not worth another test. +// +// Also includes some [Default] arguments (instead of in +// TestInterfaceConstructor.idl), otherwise overload resolution check string is +// extremely long and triggers a lint warning (line length). +[ + // 2 constructors with same type length, to test overload resolution + Constructor(DOMString stringArg), + Constructor(Dictionary dictionaryArg), + Constructor( + TestInterfaceEmpty testInterfaceEmptyArg, + long longArg, + [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg, + optional DOMString defaultNullStringOptionalStringArg = null, + [Default=Undefined] optional Dictionary defaultUndefinedOptionalDictionaryArg, + optional DOMString optionalStringArg), +] interface TestInterfaceConstructor2 { +};
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceConstructor3.idl similarity index 91% copy from modules/crypto/Algorithm.idl copy to bindings/tests/idls/TestInterfaceConstructor3.idl index a1373bd..19b6669 100644 --- a/modules/crypto/Algorithm.idl +++ b/bindings/tests/idls/TestInterfaceConstructor3.idl
@@ -28,9 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// Test for length > 0, non-overloaded constructor. [ - WillBeGarbageCollected, - NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; + Constructor(DOMString stringArg), +] interface TestInterfaceConstructor3 { };
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceCustomConstructor.idl similarity index 87% copy from modules/crypto/KeyPair.idl copy to bindings/tests/idls/TestInterfaceCustomConstructor.idl index a27de45..dba8b7a 100644 --- a/modules/crypto/KeyPair.idl +++ b/bindings/tests/idls/TestInterfaceCustomConstructor.idl
@@ -29,9 +29,8 @@ */ [ - WillBeGarbageCollected, - NoInterfaceObject -] interface KeyPair { - readonly attribute Key publicKey; - readonly attribute Key privateKey; + CustomConstructor, + CustomConstructor(TestInterfaceEmpty testInterfaceEmptyArg), + CustomConstructor(double doubleArg, optional double optionalDoubleArg), +] interface TestInterfaceCustomConstructor { };
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceDocument.idl similarity index 89% copy from modules/crypto/Algorithm.idl copy to bindings/tests/idls/TestInterfaceDocument.idl index a1373bd..2a687e8 100644 --- a/modules/crypto/Algorithm.idl +++ b/bindings/tests/idls/TestInterfaceDocument.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,9 +28,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - WillBeGarbageCollected, - NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; +interface TestInterfaceDocument : Document { };
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceEmpty.idl similarity index 92% rename from modules/crypto/Algorithm.idl rename to bindings/tests/idls/TestInterfaceEmpty.idl index a1373bd..d9474d5 100644 --- a/modules/crypto/Algorithm.idl +++ b/bindings/tests/idls/TestInterfaceEmpty.idl
@@ -28,9 +28,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - WillBeGarbageCollected, - NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; +interface TestInterfaceEmpty { };
diff --git a/bindings/tests/idls/TestInterfaceEventConstructor.idl b/bindings/tests/idls/TestInterfaceEventConstructor.idl new file mode 100644 index 0000000..e193a0d --- /dev/null +++ b/bindings/tests/idls/TestInterfaceEventConstructor.idl
@@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + EventConstructor, + RaisesException=Constructor, +] interface TestInterfaceEventConstructor : Event { + readonly attribute DOMString readonlyStringAttribute; + + [InitializedByEventConstructor] readonly attribute DOMString initializedByEventConstructorReadonlyStringAttribute; + [InitializedByEventConstructor] readonly attribute any initializedByEventConstructorReadonlyAnyAttribute; + [InitializedByEventConstructor] readonly attribute boolean initializedByEventConstructorReadonlyBooleanAttribute; + [InitializedByEventConstructor] readonly attribute long initializedByEventConstructorReadonlyLongAttribute; + [InitializedByEventConstructor] readonly attribute Uint8Array initializedByEventConstructorReadonlyUint8ArrayAttribute; + [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute; + [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty[] initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute; + [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty? initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute; + + [DeprecateAs=initializedByEventConstructorReadonlyStringAttribute, InitializedByEventConstructor] readonly attribute DOMString deprecatedInitializedByEventConstructorReadonlyStringAttribute; + [ImplementedAs=implementedAsName, InitializedByEventConstructor] readonly attribute DOMString implementedAsInitializedByEventConstructorReadonlyStringAttribute; + [DeprecateAs=initializedByEventConstructorReadonlyStringAttribute, ImplementedAs=deprecatedImplementedAsName, InitializedByEventConstructor] readonly attribute DOMString deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute; +};
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceEventTarget.idl similarity index 92% copy from modules/crypto/Algorithm.idl copy to bindings/tests/idls/TestInterfaceEventTarget.idl index a1373bd..742c6d7 100644 --- a/modules/crypto/Algorithm.idl +++ b/bindings/tests/idls/TestInterfaceEventTarget.idl
@@ -29,8 +29,7 @@ */ [ - WillBeGarbageCollected, - NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; + NamedConstructor=Name(), + ConstructorCallWith=Document, +] interface TestInterfaceEventTarget : EventTarget { };
diff --git a/bindings/tests/idls/TestInterfaceGarbageCollected.idl b/bindings/tests/idls/TestInterfaceGarbageCollected.idl new file mode 100644 index 0000000..55739a3 --- /dev/null +++ b/bindings/tests/idls/TestInterfaceGarbageCollected.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + Constructor(DOMString str), + GarbageCollected, +] interface TestInterfaceGarbageCollected : EventTarget { // Inherit from EventTarget to test order of internal fields + attribute TestInterfaceGarbageCollected attr1; + void func(TestInterfaceGarbageCollected arg); +};
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestInterfaceNamedConstructor.idl similarity index 61% copy from core/clipboard/Clipboard.idl copy to bindings/tests/idls/TestInterfaceNamedConstructor.idl index 695f70d..bc8a06b 100644 --- a/core/clipboard/Clipboard.idl +++ b/bindings/tests/idls/TestInterfaceNamedConstructor.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,17 +27,19 @@ */ [ -] interface Clipboard { - [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect; - [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed; - readonly attribute DOMString[] types; - readonly attribute FileList files; - - void clearData(optional DOMString type); - DOMString getData(DOMString type); - boolean setData(DOMString type, DOMString data); - [RaisesException] void setDragImage(Element image, long x, long y); - - readonly attribute DataTransferItemList items; + ActiveDOMObject, + NamedConstructor=Audio( + DOMString stringArg, + [Default=Undefined] optional boolean defaultUndefinedOptionalBooleanArg, + [Default=Undefined] optional long defaultUndefinedOptionalLongArg, + [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg, + optional DOMString defaultNullStringOptionalstringArg = null, + optional DOMString optionalStringArg), + ConstructorCallWith=Document, + RaisesException=Constructor, +] interface TestInterfaceNamedConstructor { + // An attribute of type {interface_name}ConstructorConstructor is generated + // in *Constructors.idl file, which is a partial interface for the global + // object, e.g. Window. We put this here to avoid another test file. + attribute TestNamedConstructorConstructor testNamedConstructorConstructorAttribute; }; -
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceNamedConstructor2.idl similarity index 89% rename from modules/crypto/KeyPair.idl rename to bindings/tests/idls/TestInterfaceNamedConstructor2.idl index a27de45..1494ffd 100644 --- a/modules/crypto/KeyPair.idl +++ b/bindings/tests/idls/TestInterfaceNamedConstructor2.idl
@@ -28,10 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// "Number of arguments" check varies if [RaisesException=Constructor] or not [ - WillBeGarbageCollected, - NoInterfaceObject -] interface KeyPair { - readonly attribute Key publicKey; - readonly attribute Key privateKey; + NamedConstructor=Audio(DOMString stringArg), +] interface TestInterfaceNamedConstructor2 { };
diff --git a/modules/mediasource/WebKitSourceBuffer.idl b/bindings/tests/idls/TestInterfaceNode.idl similarity index 65% rename from modules/mediasource/WebKitSourceBuffer.idl rename to bindings/tests/idls/TestInterfaceNode.idl index a22916a..25c62a5 100644 --- a/modules/mediasource/WebKitSourceBuffer.idl +++ b/bindings/tests/idls/TestInterfaceNode.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,22 +28,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - WillBeGarbageCollected, - NoInterfaceObject, - RuntimeEnabled=WebKitMediaSource -] interface WebKitSourceBuffer { +interface TestInterfaceNode : Node { + attribute DOMString stringAttribute; + readonly attribute TestInterfaceEmpty readonlyTestInterfaceEmptyAttribute; + attribute EventHandler eventHandlerAttribute; + [PerWorldBindings] readonly attribute TestInterfaceEmpty perWorldBindingsReadonlyTestInterfaceEmptyAttribute; + [Reflect] attribute DOMString reflectStringAttribute; + [Reflect, URL] attribute DOMString reflectUrlStringAttribute; - // Returns the time ranges buffered. - [RaisesException=Getter] readonly attribute TimeRanges buffered; - - // Applies an offset to media segment timestamps. - [RaisesException=Setter] attribute double timestampOffset; - - // Append segment data. - [RaisesException] void append(Uint8Array data); - - // Abort the current segment append sequence. - [RaisesException] void abort(); + TestInterfaceEmpty testInterfaceEmptyMethod(); + [PerWorldBindings] TestInterfaceEmpty perWorldBindingsTestInterfaceEmptyMethod(); + [PerWorldBindings] TestInterfaceEmpty perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optional boolean optionalBooleanArgument); }; -
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl similarity index 79% copy from modules/crypto/KeyPair.idl copy to bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl index a27de45..be955b0 100644 --- a/modules/crypto/KeyPair.idl +++ b/bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,9 +29,10 @@ */ [ + Constructor(DOMString str), + NamedConstructor=TestInterface(DOMString str), WillBeGarbageCollected, - NoInterfaceObject -] interface KeyPair { - readonly attribute Key publicKey; - readonly attribute Key privateKey; +] interface TestInterfaceWillBeGarbageCollected : EventTarget { // Inherit from EventTarget to test order of internal fields + attribute TestInterfaceWillBeGarbageCollected attr1; + void func(TestInterfaceWillBeGarbageCollected arg); };
diff --git a/bindings/tests/idls/TestNode.idl b/bindings/tests/idls/TestNode.idl new file mode 100644 index 0000000..301f7f0 --- /dev/null +++ b/bindings/tests/idls/TestNode.idl
@@ -0,0 +1,28 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +[ + Constructor, +] interface TestNode : Node { + // These attributes are needed to test [PutForwards] in TestObject.idl. + attribute DOMString href; + [RaisesException=Setter] attribute DOMString hrefThrows; + [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hrefCallWith; +};
diff --git a/bindings/tests/idls/TestObject.idl b/bindings/tests/idls/TestObject.idl new file mode 100644 index 0000000..8328c86 --- /dev/null +++ b/bindings/tests/idls/TestObject.idl
@@ -0,0 +1,528 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum TestEnum {"", "EnumValue1", "EnumValue2", "EnumValue3"}; + +callback VoidCallbackFunction = void (); +callback AnyCallbackFunctionOptionalAnyArg = any (optional any optionalAnyArg); + +dictionary TestDict { + boolean booleanMember; + long longMember1 = 1; +}; + +dictionary TestDictDerived : TestDict { + unsigned short unsignedShortMember; + float floatMember4 = 4.0; +}; + +// No extended attributes on the interface; those go in TestInterface.idl +interface TestObject { + // Constants + const unsigned short CONST_VALUE_0 = 0; + const unsigned short CONST_VALUE_1 = 1; + const unsigned short CONST_VALUE_2 = 2; + const unsigned short CONST_VALUE_4 = 4; + const unsigned short CONST_VALUE_8 = 8; + const short CONST_VALUE_9 = -1; + const DOMString CONST_VALUE_10 = "my constant string"; + const unsigned short CONST_VALUE_11 = 0xffffffff; + const unsigned short CONST_VALUE_12 = 0x01; + const unsigned short CONST_VALUE_13 = 0X20; + const unsigned short CONST_VALUE_14 = 0x1abc; + const unsigned short CONST_VALUE_15 = 010; + const unsigned short CONST_VALUE_16 = -010; + const unsigned short CONST_VALUE_16 = -0x1A; + const unsigned short CONST_VALUE_17 = -0X1a; + + // Extended attributes + [DeprecateAs=Constant] const short DEPRECATED_CONSTANT = 1; + [RuntimeEnabled=FeatureName] const short FEATURE_ENABLED_CONST = 1; + [Reflect=CONST_IMPL] const short CONST_JAVASCRIPT = 1; + + + // Attributes + // + // Naming convention: + // [ExtAttr] attribute Type extAttrTypeNameAttribute; + // E.g., + // [Foo] attribute DOMString? fooStringOrNullAttribute + // + // Type name reference: + // http://heycam.github.io/webidl/#dfn-type-name + // + // TestInterfaceEmpty is used as a stub interface type, for testing behavior + // that should not depend on particular type (beyond "interface or not"). + // read only + readonly attribute DOMString readonlyStringAttribute; + readonly attribute TestInterfaceEmpty readonlyTestInterfaceEmptyAttribute; + readonly attribute long readonlyLongAttribute; + // Basic types + attribute Date dateAttribute; + attribute DOMString stringAttribute; + attribute ByteString byteStringAttribute; + attribute ScalarValueString scalarValueStringAttribute; + attribute DOMTimeStamp domTimeStampAttribute; + attribute boolean booleanAttribute; + attribute byte byteAttribute; + attribute double doubleAttribute; + attribute float floatAttribute; + attribute long longAttribute; + attribute long long longLongAttribute; + attribute octet octetAttribute; + attribute short shortAttribute; + attribute unrestricted double unrestrictedDoubleAttribute; + attribute unrestricted float unrestrictedFloatAttribute; + attribute unsigned long unsignedLongAttribute; + attribute unsigned long long unsignedLongLongAttribute; + attribute unsigned short unsignedShortAttribute; + // Interface type + attribute TestInterfaceEmpty testInterfaceEmptyAttribute; + // Self-reference + attribute TestObject testObjectAttribute; + // Callback function type + attribute VoidCallbackFunction voidCallbackFunctionAttribute; + attribute AnyCallbackFunctionOptionalAnyArg anyCallbackFunctionOptionalAnyArgAttribute; + // Names that begin with an acronym + attribute long cssAttribute; + attribute long imeAttribute; + attribute long svgAttribute; + attribute long xmlAttribute; + // Non-wrapper types + attribute NodeFilter nodeFilterAttribute; + attribute SerializedScriptValue serializedScriptValueAttribute; + attribute any anyAttribute; + // Custom type conversions + attribute Promise promiseAttribute; + attribute Window windowAttribute; + // DOM Node types + attribute Document documentAttribute; + attribute DocumentFragment documentFragmentAttribute; + attribute DocumentType documentTypeAttribute; + attribute Element elementAttribute; + attribute Node nodeAttribute; + attribute ShadowRoot shadowRootAttribute; + // Typed arrays + attribute ArrayBuffer arrayBufferAttribute; + attribute Float32Array float32ArrayAttribute; + attribute Uint8Array uint8ArrayAttribute; + // Exceptions for is_keep_alive_for_gc + readonly attribute TestInterfaceEmpty self; + readonly attribute EventTarget readonlyEventTargetAttribute; + readonly attribute EventTarget? readonlyEventTargetOrNullAttribute; + readonly attribute Window readonlyWindowAttribute; + readonly attribute HTMLCollection htmlCollectionAttribute; + readonly attribute HTMLElement htmlElementAttribute; + // Arrays + attribute DOMString[] stringArrayAttribute; + attribute TestInterfaceEmpty[] testInterfaceEmptyArrayAttribute; + attribute float[] floatArrayAttribute; + // Nullable attributes + attribute DOMString? stringOrNullAttribute; + attribute long? longOrNullAttribute; + attribute TestInterface? testInterfaceOrNullAttribute; + // Enumerations + attribute TestEnum testEnumAttribute; + // Static attributes + static attribute DOMString staticStringAttribute; + static attribute long staticLongAttribute; + // Exceptional type + attribute EventHandler eventHandlerAttribute; + + // Extended attributes + [LogActivity, LogAllWorlds] attribute long activityLoggingAccessForAllWorldsLongAttribute; + [LogActivity=GetterOnly, LogAllWorlds] attribute long activityLoggingGetterForAllWorldsLongAttribute; + [LogActivity=SetterOnly, LogAllWorlds] attribute long activityLoggingSetterForAllWorldsLongAttribute; + [CachedAttribute=isValueDirty] attribute any cachedAttributeAnyAttribute; + [CachedAttribute=isArrayDirty] attribute DOMString[] cachedArrayAttribute; + [CallWith=ExecutionContext] attribute any callWithExecutionContextAnyAttribute; + [CallWith=ScriptState] attribute any callWithScriptStateAnyAttribute; + [CallWith=ExecutionContext|ScriptState] attribute any callWithExecutionContextAndScriptStateAnyAttribute; + [CheckSecurity=Node] readonly attribute Document checkSecurityForNodeReadonlyDocumentAttribute; // All uses are read only + [Conditional=CONDITION] attribute long conditionalLongAttribute; + [Conditional=CONDITION_1&CONDITION_2] attribute long conditionalAndLongAttribute; + [Conditional=CONDITION_1|CONDITION_2] attribute long conditionalOrLongAttribute; + // Constructors: FIXME: replace suffix with [ConstructorAttribute] + attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute; + [DeprecateAs=deprecatedTestInterfaceEmptyConstructorAttribute] attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute; + [MeasureAs=FeatureName] attribute TestInterfaceEmptyConstructor measureAsFeatureNameTestInterfaceEmptyConstructorAttribute; + [Custom] attribute object customObjectAttribute; + [Custom=Getter] attribute long customGetterLongAttribute; + [Custom=Getter] readonly attribute object customGetterReadonlyObjectAttribute; + [Custom=Setter] attribute long customSetterLongAttribute; + [Conditional=CONDITION, Custom] attribute long customLongAttribute; + [CustomElementCallbacks] readonly attribute long customElementsCallbacksReadonlyLongAttribute; + [DeprecateAs=LongAttribute] attribute long deprecatedLongAttribute; + [EnforceRange] attribute long enforceRangeLongAttribute; + [ExposeJSAccessors] attribute long exposeJSAccessorsLongAttribute; + [ImplementedAs=implementedAsName] attribute long implementedAsLongAttribute; + [Custom, ImplementedAs=implementedAsNameWithCustom] attribute long customImplementedAsLongAttribute; + [Custom=Getter, ImplementedAs=implementedAsNameWithCustomGetter] attribute long customGetterImplementedAsLongAttribute; + [Custom=Setter, ImplementedAs=implementedAsNameWithCustomGetter] attribute long customSetterImplementedAsLongAttribute; + [MeasureAs=TestFeature] attribute long measureAsLongAttribute; + [NotEnumerable] attribute long notEnumerableLongAttribute; + [PerContextEnabled=FeatureName] attribute long perContextEnabledLongAttribute; + [PerWorldBindings] readonly attribute TestInterfaceEmpty perWorldBindingsReadonlyTestInterfaceEmptyAttribute; + [LogActivity, LogAllWorlds, PerWorldBindings] attribute long activityLoggingAccessPerWorldBindingsLongAttribute; + [LogActivity, PerWorldBindings] attribute long activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttribute; + [LogActivity=GetterOnly, LogAllWorlds, PerWorldBindings] attribute long activityLoggingGetterPerWorldBindingsLongAttribute; + [LogActivity=GetterOnly, PerWorldBindings] attribute long activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttribute; + [PutForwards=href] readonly attribute TestNode location; + [PutForwards=hrefThrows] readonly attribute TestNode locationWithException; + [PutForwards=hrefCallWith] readonly attribute TestNode locationWithCallWith; + [PerWorldBindings, PutForwards=href] readonly attribute TestNode locationWithPerWorldBindings; + [PutForwards=attr1] readonly attribute TestInterfaceGarbageCollected locationGarbageCollected; + [PutForwards=attr1] readonly attribute TestInterfaceWillBeGarbageCollected locationWillBeGarbageCollected; + [RaisesException] attribute long raisesExceptionLongAttribute; + [RaisesException=Getter] attribute long raisesExceptionGetterLongAttribute; + [RaisesException=Setter] attribute long setterRaisesExceptionLongAttribute; + [RaisesException] attribute TestInterfaceEmpty raisesExceptionTestInterfaceEmptyAttribute; + [CachedAttribute=isValueDirty, RaisesException] attribute any cachedAttributeRaisesExceptionGetterAnyAttribute; + [Reflect] attribute TestInterface reflectTestInterfaceAttribute; + [Reflect=reflectedNameAttribute] attribute TestInterface reflectReflectedNameAttributeTestAttribute; + // [Reflect] exceptional types: exceptional getters, exceptional setters, + // or range checking for unsigned + [Reflect] attribute boolean reflectBooleanAttribute; + [Reflect] attribute long reflectLongAttribute; + [Reflect] attribute unsigned short reflectUnsignedShortAttribute; + [Reflect] attribute unsigned long reflectUnsignedLongAttribute; + // [Reflect] exceptional names + [Reflect] attribute DOMString id; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString class; + [Reflect=id] attribute DOMString reflectedId; + [Reflect=name] attribute DOMString reflectedName; + [Reflect=class] attribute DOMString reflectedClass; + // Limited value attributes and enumerated attributes + [Reflect, ReflectOnly="unique"] attribute DOMString limitedToOnlyOneAttribute; + [Reflect, ReflectOnly="Per"|"Paal"|"Espen"] attribute DOMString limitedToOnlyAttribute; + [Reflect=other, ReflectOnly="Value1"|"Value2" ] attribute DOMString limitedToOnlyOtherAttribute; + [Reflect, ReflectOnly="rsa"|"dsa", ReflectMissing="rsa"] attribute DOMString limitedWithMissingDefaultAttribute; + [Reflect, ReflectOnly="ltr"|"rtl"|"auto", ReflectMissing="auto", ReflectInvalid="ltr"] attribute DOMString limitedWithInvalidMissingDefaultAttribute; + [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] readonly attribute DOMString corsSettingAttribute; + [Reflect, ReflectOnly="empty"|"missing"|"invalid"|"a-normal", ReflectEmpty="empty", ReflectMissing="missing", ReflectInvalid="invalid"] readonly attribute DOMString limitedWithEmptyMissingInvalidAttribute; + + [Replaceable] readonly attribute long replaceableReadonlyLongAttribute; + [Replaceable, PutForwards=href] readonly attribute TestNode locationReplaceable; + [RuntimeEnabled=FeatureName] attribute long runtimeEnabledLongAttribute; + [PerContextEnabled=FeatureName, RuntimeEnabled=FeatureName] attribute long perContextEnabledRuntimeEnabledLongAttribute; + [Conditional=CONDITION, RuntimeEnabled=FeatureName] attribute long conditionalRuntimeEnabledLongAttribute; + [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString setterCallWithActiveWindowAndFirstWindowStringAttribute; + [SetterCallWith=ExecutionContext] attribute DOMString setterCallWithExecutionContextStringAttribute; + [TreatNullAs=NullString] attribute DOMString treatNullAsNullStringStringAttribute; + [TreatReturnedNullStringAs=Null] attribute DOMString treatReturnedNullStringAsNullStringAttribute; + [TreatReturnedNullStringAs=Undefined] attribute DOMString treatReturnedNullStringAsUndefinedStringAttribute; + [TreatReturnedNullStringAs=Null] attribute ByteString treatReturnedNullStringAsNullByteStringAttribute; + [TreatReturnedNullStringAs=Undefined] attribute ByteString treatReturnedNullStringAsUndefinedByteStringAttribute; + [TreatReturnedNullStringAs=Null] attribute ScalarValueString treatReturnedNullStringAsNullScalarValueStringAttribute; + [TreatReturnedNullStringAs=Undefined] attribute ScalarValueString treatReturnedNullStringAsUndefinedScalarValueStringAttribute; + [TypeChecking=Interface|Nullable] attribute float typeCheckingInterfaceNullableStringFloatAttribute; // nop for non-interface types + [TypeChecking=Interface] attribute TestInterface typeCheckingInterfaceTestInterfaceAttribute; + [TypeChecking=Nullable] attribute TestInterface? typeCheckingNullableTestInterfaceOrNullAttribute; + [TypeChecking=Interface|Nullable] attribute TestInterface? typeCheckingInterfaceNullableTestInterfaceOrNullAttribute; + [Reflect, URL] attribute DOMString urlStringAttribute; + [Reflect=reflectUrlAttribute, URL] attribute DOMString urlStringAttribute; + [Unforgeable] attribute long unforgeableLongAttribute; + [LogActivity=SetterOnly, LogPreviousValue] attribute long activityLoggingSetterOnlyLogPreviousValueAttribute; + [LogActivity, LogPreviousValue] attribute TestInterfaceEmpty activityLoggingLogPreviousValueInterfaceAttribute; + + + // Methods + // + // Naming convention: + // ReturnType returnTypeMethodTypeName1ArgTypeName2Arg(Type1 typeName1Arg, Type2 typeName2Arg); + // E.g., + // void voidMethodStringArgLongArrayArg(DOMString stringArg, long[] longArrayArg); + void voidMethod(); + static void staticVoidMethod(); + + // Types + // Basic types + Date dateMethod(); + DOMString stringMethod(); + ByteString byteStringMethod(); + ScalarValueString scalarValueStringMethod(); + DOMTimeStamp readonlyDOMTimeStampMethod(); + boolean booleanMethod(); + byte byteMethod(); + double doubleMethod(); + float floatMethod(); + long longMethod(); + long long longLongMethod(); + octet octetMethod(); + short shortMethod(); + unsigned long unsignedLongMethod(); + unsigned long long unsignedLongLongMethod(); + unsigned short unsignedShortMethod(); + + void voidMethodDateArg(Date dateArg); + void voidMethodStringArg(DOMString stringArg); + void voidMethodByteStringArg(ByteString stringArg); + void voidMethodScalarValueStringArg(ScalarValueString scalarValueStringArg); + void voidMethodDOMTimeStampArg(DOMTimeStamp domTimeStampArg); + void voidMethodBooleanArg(boolean booleanArg); + void voidMethodByteArg(byte byteArg); + void voidMethodDoubleArg(double doubleArg); + void voidMethodFloatArg(float floatArg); + void voidMethodLongArg(long longArg); + void voidMethodLongLongArg(long long longLongArg); + void voidMethodOctetArg(octet octetArg); + void voidMethodShortArg(short shortArg); + void voidMethodUnsignedLongArg(unsigned long unsignedLongArg); + void voidMethodUnsignedLongLongArg(unsigned long long unsignedLongLongArg); + void voidMethodUnsignedShortArg(unsigned short unsignedShortArg); + // Interface types + TestInterfaceEmpty testInterfaceEmptyMethod(); + void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + void voidMethodLongArgTestInterfaceEmptyArg(long longArg, TestInterfaceEmpty testInterfaceEmptyArg); + // Callback function type + VoidCallbackFunction voidCallbackFunctionMethod(); + AnyCallbackFunctionOptionalAnyArg anyCallbackFunctionOptionalAnyArgMethod(); + void voidMethodVoidCallbackFunctionArg(VoidCallbackFunction voidCallbackFunctionArg); + void voidMethodAnyCallbackFunctionOptionalAnyArg(AnyCallbackFunctionOptionalAnyArg anyCallbackFunctionOptionalAnyArgArg); + // Custom type conversions + CompareHow compareHowMethod(); + any anyMethod(); + void voidMethodCompareHowArg(CompareHow compareHowArg); + void voidMethodEventTargetArg(EventTarget eventTargetArg); + void voidMethodMediaQueryListListenerArg(MediaQueryListListener mediaQueryListListenerArg); + void voidMethodAnyArg(any anyArg); + // DOM node types + void voidMethodAttrArg(Attr attrArg); + void voidMethodDocumentArg(Document documentArg); + void voidMethodDocumentTypeArg(DocumentType documentTypeArg); + void voidMethodElementArg(Element elementArg); + void voidMethodNodeArg(Node nodeArg); + // Typed arrays + ArrayBuffer arrayBufferMethod(); + ArrayBufferView arrayBufferViewMethod(); + Float32Array float32ArrayMethod(); + Int32Array int32ArrayMethod(); + Uint8Array uint8ArrayMethod(); + void voidMethodArrayBufferArg(ArrayBuffer arrayBufferArg); + void voidMethodArrayBufferOrNullArg(ArrayBuffer? arrayBufferArg); + void voidMethodArrayBufferViewArg(ArrayBufferView arrayBufferViewArg); + void voidMethodFloat32ArrayArg(Float32Array float32ArrayArg); + void voidMethodInt32ArrayArg(Int32Array int32ArrayArg); + void voidMethodUint8ArrayArg(Uint8Array uint8ArrayArg); + // Arrays + long[] longArrayMethod(); + DOMString[] stringArrayMethod(); + TestInterfaceEmpty[] testInterfaceEmptyArrayMethod(); + void voidMethodArrayLongArg(long[] arrayLongArg); + void voidMethodArrayStringArg(DOMString[] arrayStringArg); + void voidMethodArrayTestInterfaceEmptyArg(TestInterfaceEmpty[] arrayTestInterfaceEmptyArg); + // Sequences + sequence<long> longSequenceMethod(); + sequence<DOMString> stringSequenceMethod(); + sequence<TestInterfaceEmpty> testInterfaceEmptySequenceMethod(); + void voidMethodSequenceLongArg(sequence<long> longSequenceArg); + void voidMethodSequenceStringArg(sequence<DOMString> stringSequenceArg); + void voidMethodSequenceTestInterfaceEmptyArg(sequence<TestInterfaceEmpty> testInterfaceEmptySequenceArg); + // Nullable types + // Currently only used on interface type arguments + void voidMethodTestInterfaceEmptyOrNullArg(TestInterfaceEmpty? nullableTestInterfaceEmptyArg); + // Callback interface types + void voidMethodTestCallbackInterfaceArg(TestCallbackInterface testCallbackInterfaceArg); + void voidMethodOptionalTestCallbackInterfaceArg(optional TestCallbackInterface optionalTestCallbackInterfaceArg); + void voidMethodTestCallbackInterfaceOrNullArg(TestCallbackInterface? testCallbackInterfaceArg); + // Enumerations + TestEnum testEnumMethod(); + void voidMethodTestEnumArg(TestEnum testEnumTypeArg); + // Exceptional types + Dictionary dictionaryMethod(); + NodeFilter nodeFilterMethod(); + Promise promiseMethod(); + SerializedScriptValue serializedScriptValueMethod(); + XPathNSResolver xPathNSResolverMethod(); + void voidMethodDictionaryArg(Dictionary dictionaryArg); + void voidMethodEventListenerArg(EventListener eventListenerArg); + void voidMethodNodeFilterArg(NodeFilter nodeFilterArg); + void voidMethodPromiseArg(Promise promiseArg); + void voidMethodSerializedScriptValueArg(SerializedScriptValue serializedScriptValueArg); + void voidMethodXPathNSResolverArg(XPathNSResolver xPathNSResolverArg); + void voidMethodDictionarySequenceArg(sequence<Dictionary> dictionarySequenceArg); + + // Arguments + void voidMethodStringArgLongArg(DOMString stringArg, long longArg); + // Optional arguments + void voidMethodOptionalStringArg(optional DOMString optionalStringArg); + void voidMethodOptionalTestInterfaceEmptyArg(optional TestInterfaceEmpty optionalTestInterfaceEmptyArg); + void voidMethodOptionalLongArg(optional long optionalLongArg); + DOMString stringMethodOptionalLongArg(optional long optionalLongArg); + TestInterfaceEmpty testInterfaceEmptyMethodOptionalLongArg(optional long optionalLongArg); + long longMethodOptionalLongArg(optional long optionalLongArg); + void voidMethodLongArgOptionalLongArg(long longArg, optional long optionalLongArg); + void voidMethodLongArgOptionalLongArgOptionalLongArg(long longArg, optional long optionalLongArg1, optional long optionalLongArg2); + void voidMethodLongArgOptionalTestInterfaceEmptyArg(long longArg, optional TestInterfaceEmpty optionalTestInterfaceEmpty); + void voidMethodTestInterfaceEmptyArgOptionalLongArg(TestInterfaceEmpty optionalTestInterfaceEmpty, optional long longArg); + // Optional arguments: exceptional case + 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 + void voidMethodVariadicStringArg(DOMString... variadicStringArgs); + void voidMethodStringArgVariadicStringArg(DOMString stringArg, DOMString... variadicStringArgs); + void voidMethodVariadicTestInterfaceEmptyArg(TestInterfaceEmpty... variadicTestInterfaceEmptyArgs); + void voidMethodTestInterfaceEmptyArgVariadicTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg, TestInterfaceEmpty... variadicTestInterfaceEmptyArgs); + void voidMethodVariadicTestInterfaceGarbageCollectedArg(TestInterfaceGarbageCollected... variadicTestInterfaceGarbageCollectedArg); + void voidMethodVariadicTestInterfaceWillBeGarbageCollectedArg(TestInterfaceWillBeGarbageCollected... variadicTestInterfaceWillBeGarbageCollectedArg); + + // Overloaded methods + void overloadedMethodA(long longArg); + void overloadedMethodA(long longArg1, long longArg2); + void overloadedMethodB(long longArg); + void overloadedMethodB(DOMString stringArg, optional long longArg); + void overloadedMethodC(long longArg); + void overloadedMethodC(TestInterfaceEmpty testInterfaceEmptyArg); + void overloadedMethodD(long longArg); + void overloadedMethodD(long[] longArrayArg); + void overloadedMethodE(long longArg); + void overloadedMethodE(TestInterfaceEmpty? testInterfaceEmptyOrNullArg); + void overloadedMethodF(optional DOMString stringArg); + void overloadedMethodF(double doubleArg); + void overloadedMethodG(long longArg); + void overloadedMethodG(optional TestInterfaceEmpty? testInterfaceEmptyOrNullArg = null); + void overloadedMethodH(TestInterface testInterfaceArg); + void overloadedMethodH(TestInterfaceEmpty testInterfaceEmptyArg); + void overloadedMethodI(DOMString stringArg); + void overloadedMethodI(double doubleArg); + + + [PerWorldBindings] void overloadedPerWorldBindingsMethod(); + [PerWorldBindings] void overloadedPerWorldBindingsMethod(long longArg); + + static void overloadedStaticMethod(long longArg); + static void overloadedStaticMethod(long longArg1, long longArg2); + + // Extended attributes for arguments + // [Clamp] + void voidMethodClampUnsignedShortArg([Clamp] unsigned short clampUnsignedShortArg); + void voidMethodClampUnsignedLongArg([Clamp] unsigned long clampUnsignedLongArg); + // [Default] + void voidMethodDefaultUndefinedTestInterfaceEmptyArg([Default=Undefined] optional TestInterfaceEmpty defaultUndefinedTestInterfaceEmptyArg); + void voidMethodDefaultUndefinedLongArg([Default=Undefined] optional long defaultUndefinedLongArg); + void voidMethodDefaultUndefinedStringArg([Default=Undefined] optional DOMString defaultUndefinedStringArg); + // [EnforceRange] + void voidMethodEnforceRangeLongArg([EnforceRange] long enforceRangeLongArg); + // [TreatNullAs], [TreatUndefinedAs] + void voidMethodTreatNullAsNullStringStringArg([TreatNullAs=NullString] DOMString treatNullAsNullStringStringArg); + void voidMethodTreatNullAsNullStringTreatUndefinedAsNullStringStringArg([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString treatNullAsNullStringStringArg); + + // Extended attributes for methods + [LogActivity, LogAllWorlds] void activityLoggingAccessForAllWorldsMethod(); + [CallWith=ExecutionContext] void callWithExecutionContextVoidMethod(); + [CallWith=ScriptState] void callWithScriptStateVoidMethod(); + [CallWith=ScriptState] long callWithScriptStateLongMethod(); + [CallWith=ScriptState&ExecutionContext] void callWithScriptStateExecutionContextVoidMethod(); + [CallWith=ScriptState&ScriptArguments] void callWithScriptStateScriptArgumentsVoidMethod(); + [CallWith=ScriptState&ScriptArguments] void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(optional boolean optionalBooleanArg); + [CallWith=ActiveWindow] void callWithActiveWindow(); + [CallWith=ActiveWindow&FirstWindow] void callWithActiveWindowScriptWindow(); + [CheckSecurity=Node] void checkSecurityForNodeVoidMethod(); + [Conditional=CONDITION] void conditionalConditionVoidMethod(); + [Conditional=CONDITION_1&CONDITION_2] void conditionalCondition1AndCondition2VoidMethod(); + [Conditional=CONDITION] static void conditionalConditionStaticVoidMethod(); + [Custom] void customVoidMethod(); + [Conditional=CONDITION, Custom] void conditionalConditionCustomVoidMethod(); + [CustomElementCallbacks] void customElementCallbacksVoidMethod(); + [DeprecateAs=voidMethod] void deprecatedVoidMethod(); + [DoNotCheckSignature] void doNotCheckSignatureVoidMethod(); + [ImplementedAs=implementedAsMethodName] void implementedAsVoidMethod(); + [MeasureAs=TestFeature] void measureAsVoidMethod(); + [DeprecateAs=TestFeatureA] void DeprecateAsOverloadedMethod(); + [DeprecateAs=TestFeatureB] void DeprecateAsOverloadedMethod(long arg); + [DeprecateAs=TestFeature] void DeprecateAsSameValueOverloadedMethod(); + [DeprecateAs=TestFeature] void DeprecateAsSameValueOverloadedMethod(long arg); + [MeasureAs=TestFeatureA] void measureAsOverloadedMethod(); + [MeasureAs=TestFeatureB] void measureAsOverloadedMethod(long arg); + [MeasureAs=TestFeature] void measureAsSameValueOverloadedMethod(); + [MeasureAs=TestFeature] void measureAsSameValueOverloadedMethod(long arg); + [DeprecateAs=TestFeatureA, MeasureAs=TestFeature] void deprecateAsMeasureAsSameValueOverloadedMethod(); + [DeprecateAs=TestFeatureB, MeasureAs=TestFeature] void deprecateAsMeasureAsSameValueOverloadedMethod(long arg); + [DeprecateAs=TestFeature, MeasureAs=TestFeatureA] void deprecateAsSameValueMeasureAsOverloadedMethod(); + [DeprecateAs=TestFeature, MeasureAs=TestFeatureB] void deprecateAsSameValueMeasureAsOverloadedMethod(long arg); + [DeprecateAs=TestFeatureA, MeasureAs=TestFeatureB] void deprecateAsSameValueMeasureAsSameValueOverloadedMethod(); + [DeprecateAs=TestFeatureA, MeasureAs=TestFeatureB] void deprecateAsSameValueMeasureAsSameValueOverloadedMethod(long arg); + [NotEnumerable] void notEnumerableVoidMethod(); + [PerContextEnabled=FeatureName] void perContextEnabledVoidMethod(); + [PerWorldBindings] void perWorldBindingsVoidMethod(); + [PerWorldBindings] void perWorldBindingsVoidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + [LogActivity, LogAllWorlds, PerWorldBindings] void activityLoggingForAllWorldsPerWorldBindingsVoidMethod(); + [LogActivity, PerWorldBindings] void activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethod(); + [RaisesException] void raisesExceptionVoidMethod(); + [RaisesException] DOMString raisesExceptionStringMethod(); + [RaisesException] void raisesExceptionVoidMethodOptionalLongArg(optional long optionalLongArg); + [RaisesException] void raisesExceptionVoidMethodTestCallbackInterfaceArg(TestCallbackInterface testCallbackInterfaceArg); + [RaisesException] void raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg(optional TestCallbackInterface optionalTestCallbackInterfaceArg); + [RaisesException] TestInterfaceEmpty raisesExceptionTestInterfaceEmptyVoidMethod(); + [CallWith=ExecutionContext, RaisesException] void callWithExecutionContextRaisesExceptionVoidMethodLongArg(long longArg); + [ReadOnly] void readOnlyVoidMethod(); + [NotEnumerable, ReadOnly] void notEnumerableReadOnlyVoidMethod(); + [RuntimeEnabled=FeatureName] void runtimeEnabledVoidMethod(); + [PerWorldBindings, RuntimeEnabled=FeatureName] void perWorldBindingsRuntimeEnabledVoidMethod(); + [RuntimeEnabled=FeatureName] void runtimeEnabledOverloadedVoidMethod(DOMString stringArg); + [RuntimeEnabled=FeatureName] void runtimeEnabledOverloadedVoidMethod(long longArg); + [RuntimeEnabled=FeatureName1] void partiallyRuntimeEnabledOverloadedVoidMethod(DOMString stringArg); + [RuntimeEnabled=FeatureName2] void partiallyRuntimeEnabledOverloadedVoidMethod(TestInterface testInterface); + void partiallyRuntimeEnabledOverloadedVoidMethod(long longArg); + [TreatReturnedNullStringAs=Null] DOMString treatReturnedNullStringAsNullStringMethod(); + [TreatReturnedNullStringAs=Undefined] DOMString treatReturnedNullStringAsUndefinedStringMethod(); + [TreatReturnedNullStringAs=Null] ByteString treatReturnedNullStringAsNullByteStringMethod(); + [TreatReturnedNullStringAs=Undefined] ByteString treatReturnedNullStringAsUndefinedByteStringMethod(); + [TreatReturnedNullStringAs=Null] ScalarValueString treatReturnedNullStringAsNullScalarValueStringMethod(); + [TreatReturnedNullStringAs=Undefined] ScalarValueString treatReturnedNullStringAsUndefinedScalarValueStringMethod(); + [TypeChecking=Interface] void typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg); + [TypeChecking=Nullable] void typeCheckingNullableVoidMethodTestInterfaceEmptyOrNullArg(TestInterfaceEmpty? testInterfaceEmptyOrNullArg); + [TypeChecking=Interface|Nullable] void typeCheckingInterfaceNullableVoidMethodTestInterfaceEmptyOrNullArg(TestInterfaceEmpty? testInterfaceEmptyOrNullArg); + [TypeChecking=Unrestricted] void typeCheckingUnrestrictedVoidMethodFloatArgDoubleArg(float floatArg, double doubleArg); + [Unforgeable] void unforgeableVoidMethod(); + void voidMethodTestInterfaceGarbageCollectedSequenceArg(sequence<TestInterfaceGarbageCollected> testInterfaceGarbageCollectedSequenceArg); + void voidMethodTestInterfaceGarbageCollectedArrayArg(TestInterfaceGarbageCollected[] testInterfaceGarbageCollectedArrayArg); + void voidMethodTestInterfaceWillBeGarbageCollectedSequenceArg(sequence<TestInterfaceWillBeGarbageCollected> testInterfaceWillBeGarbageCollectedSequenceArg); + void voidMethodTestInterfaceWillBeGarbageCollectedArrayArg(TestInterfaceWillBeGarbageCollected[] testInterfaceWillBeGarbageCollectedArrayArg); + + // Extended attributes on referenced interfaces + // (not self; self-reference tests at interface themselves) + attribute TestInterface testInterfaceAttribute; // [ImplementedAs] + attribute TestInterfaceGarbageCollected testInterfaceGarbageCollectedAttribute; // [GarbageCollected] + attribute TestInterfaceGarbageCollected? testInterfaceGarbageCollectedOrNullAttribute; // [GarbageCollected] + attribute TestInterfaceWillBeGarbageCollected testInterfaceWillBeGarbageCollectedAttribute; // [WillBeGarbageCollected] + attribute TestInterfaceWillBeGarbageCollected? testInterfaceWillBeGarbageCollectedOrNullAttribute; // [WillBeGarbageCollected] +};
diff --git a/modules/mediasource/WebKitSourceBuffer.idl b/bindings/tests/idls/TestPartialInterface.idl similarity index 61% copy from modules/mediasource/WebKitSourceBuffer.idl copy to bindings/tests/idls/TestPartialInterface.idl index a22916a..c8b0ddc 100644 --- a/modules/mediasource/WebKitSourceBuffer.idl +++ b/bindings/tests/idls/TestPartialInterface.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,22 +28,29 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - WillBeGarbageCollected, - NoInterfaceObject, - RuntimeEnabled=WebKitMediaSource -] interface WebKitSourceBuffer { - - // Returns the time ranges buffered. - [RaisesException=Getter] readonly attribute TimeRanges buffered; - - // Applies an offset to media segment timestamps. - [RaisesException=Setter] attribute double timestampOffset; - - // Append segment data. - [RaisesException] void append(Uint8Array data); - - // Abort the current segment append sequence. - [RaisesException] void abort(); +enum PartialEnumType { + "foo", + "bar" }; +typedef DOMString PartialString; + +callback PartialCallbackType = void (PartialString value); +[ + Conditional=PARTIAL_CONDITION, + RuntimeEnabled=PartialFeatureName, +] partial interface TestInterface { + const unsigned short PARTIAL_UNSIGNED_SHORT = 0; + + attribute long partialLongAttribute; + static attribute long partialStaticLongAttribute; + [CallWith=ExecutionContext] attribute long partialCallWithExecutionContextLongAttribute; + + void partialVoidMethod(); + static void partialStaticVoidMethod(); + void partialVoidMethodLongArg(long longArg); + [CallWith=ExecutionContext, RaisesException] void partialCallWithExecutionContextRaisesExceptionVoidMethod(); + + attribute PartialEnumType partialPartialEnumTypeAttribute; + void partialVoidMethodPartialCallbackTypeArg(PartialCallbackType partialCallbackTypeArg); +};
diff --git a/core/html/shadow/HTMLShadowElement.idl b/bindings/tests/idls/TestPartialInterface2.idl similarity index 74% copy from core/html/shadow/HTMLShadowElement.idl copy to bindings/tests/idls/TestPartialInterface2.idl index 44bc357..43abced 100644 --- a/core/html/shadow/HTMLShadowElement.idl +++ b/bindings/tests/idls/TestPartialInterface2.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,7 +28,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface HTMLShadowElement : HTMLElement { - attribute boolean resetStyleInheritance; - [RuntimeEnabled=ShadowDOM] NodeList getDistributedNodes(); +[ + ImplementedAs=TestPartialInterfaceImplementation, // Conflicts with default partial interface class name + PerContextEnabled=PartialContextName, // Conflicts with [RuntimeEnabled] +] partial interface TestInterface { + const unsigned short PARTIAL2_UNSIGNED_SHORT = 0; + + attribute long partial2LongAttribute; + static attribute long partial2StaticLongAttribute; + + void partial2VoidMethod(); + static void partial2StaticVoidMethod(); };
diff --git a/bindings/tests/idls/TestSpecialOperations.idl b/bindings/tests/idls/TestSpecialOperations.idl new file mode 100644 index 0000000..2e26771 --- /dev/null +++ b/bindings/tests/idls/TestSpecialOperations.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + OverrideBuiltins, +] interface TestSpecialOperations { + // [ImplementedAs], [TypeChecking=Interface|Nullable], union return, nullability + // [OverrideBuiltins] affects named property operations + [ImplementedAs=getItem] getter (Node or NodeList) namedItem(DOMString name); + [TypeChecking=Interface|Nullable] setter Node (DOMString name, Node? value); +};
diff --git a/bindings/tests/idls/TestSpecialOperationsNotEnumerable.idl b/bindings/tests/idls/TestSpecialOperationsNotEnumerable.idl new file mode 100644 index 0000000..0aed31b --- /dev/null +++ b/bindings/tests/idls/TestSpecialOperationsNotEnumerable.idl
@@ -0,0 +1,8 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +interface TestSpecialOperationsNotEnumerable { + [NotEnumerable] getter DOMString (unsigned long index); + [NotEnumerable] getter DOMString (DOMString name); +};
diff --git a/bindings/tests/idls/TestTypedefs.idl b/bindings/tests/idls/TestTypedefs.idl new file mode 100644 index 0000000..373a875 --- /dev/null +++ b/bindings/tests/idls/TestTypedefs.idl
@@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This IDL file is for testing the front end, not code generator, +// as typedefs are resolved during IR construction (after parsing, +// before code generation), and thus the code generator never sees them. + +typedef float Float; +typedef unsigned long long ULongLong; +typedef TestInterfaceEmpty TestInterfaceEmptyType; +typedef long[] ArrayOfLongs; +typedef DOMString String; +typedef DOMString[] ArrayOfStrings; +typedef TestCallbackInterface TestCallbackInterfaceType; +typedef TestInterfaceConstructor T; +typedef (TestInterface or TestInterfaceEmpty) TestInterfaceOrTestInterfaceEmpty; + +[ + Constructor(String stringArg), +] interface TestTypedefs { + attribute ULongLong uLongLongAttribute; + attribute T tAttribute; + + void voidMethodArrayOfLongsArg(optional ArrayOfLongs arrayOfLongsArg); + + void voidMethodFloatArgStringArg(Float floatArg, String stringArg); + void voidMethodTestCallbackInterfaceTypeArg(TestCallbackInterfaceType testCallbackInterfaceTypeArg); + + ULongLong uLongLongMethodTestInterfaceEmptyTypeSequenceArg(sequence<TestInterfaceEmptyType> testInterfaceEmptyTypeSequenceArg); + TestInterfaceOrTestInterfaceEmpty testInterfaceOrTestInterfaceEmptyMethod(); + + ArrayOfStrings arrayOfStringsMethodArrayOfStringsArg(ArrayOfStrings arrayOfStringsArg); + String[] stringArrayMethodStringArrayArg(String[] stringArrayArg); +};
diff --git a/core/README b/core/README index 87619fd..bf749b3 100644 --- a/core/README +++ b/core/README
@@ -5,5 +5,5 @@ using the script: $DART_ROOT/sdk/lib/html/scripts/idlsync.py The current version corresponds to: -URL: http://src.chromium.org/blink/branches/dart/1847 -Current revision: 169590 +URL: http://src.chromium.org/blink/branches/dart/dartium +Current revision: 181268
diff --git a/core/animation/Animation.idl b/core/animation/Animation.idl index ee19ab0..02b98bf 100644 --- a/core/animation/Animation.idl +++ b/core/animation/Animation.idl
@@ -28,10 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://dev.w3.org/fxtf/web-animations/#idl-def-Animation + [ + // FIXME: should be optional union type http://crbug.com/240176 + Constructor(Element? target, sequence<Dictionary> keyframes), + Constructor(Element? target, sequence<Dictionary> keyframes, double timingInput), + Constructor(Element? target, sequence<Dictionary> keyframes, Dictionary timingInput), + RaisesException=Constructor, RuntimeEnabled=WebAnimationsAPI, - Constructor(Element target, sequence<Dictionary> keyframes, Dictionary timingInput), - Constructor(Element target, sequence<Dictionary> keyframes, double timingInput), - Constructor(Element target, sequence<Dictionary> keyframes), -] interface Animation : TimedItem { +] interface Animation : AnimationNode { };
diff --git a/core/animation/Timeline.idl b/core/animation/AnimationEffect.idl similarity index 68% rename from core/animation/Timeline.idl rename to core/animation/AnimationEffect.idl index 47138f7..f5dc6ce 100644 --- a/core/animation/Timeline.idl +++ b/core/animation/AnimationEffect.idl
@@ -4,7 +4,7 @@ [ RuntimeEnabled=WebAnimationsAPI, - ImplementedAs=DocumentTimeline, -] interface Timeline { - Player play(TimedItem source); + NoInterfaceObject, + WillBeGarbageCollected +] interface AnimationEffect { };
diff --git a/core/animation/TimedItem.idl b/core/animation/AnimationNode.idl similarity index 92% rename from core/animation/TimedItem.idl rename to core/animation/AnimationNode.idl index 34fa04d..c04ede6 100644 --- a/core/animation/TimedItem.idl +++ b/core/animation/AnimationNode.idl
@@ -30,7 +30,8 @@ [ RuntimeEnabled=WebAnimationsAPI, -] interface TimedItem { + WillBeGarbageCollected, +] interface AnimationNode { // Playback state readonly attribute double? localTime; readonly attribute unsigned long? currentIteration; @@ -41,6 +42,6 @@ readonly attribute double activeDuration; readonly attribute double endTime; - readonly attribute Timing specified; - readonly attribute Player? player; + readonly attribute Timing timing; + readonly attribute AnimationPlayer? player; };
diff --git a/modules/notifications/WebKitNotification.idl b/core/animation/AnimationPlayer.idl similarity index 63% rename from modules/notifications/WebKitNotification.idl rename to core/animation/AnimationPlayer.idl index ae2acef..8dc0d41 100644 --- a/modules/notifications/WebKitNotification.idl +++ b/core/animation/AnimationPlayer.idl
@@ -29,20 +29,23 @@ */ [ + RuntimeEnabled=WebAnimationsElementAnimate, + NoInterfaceObject, WillBeGarbageCollected, ActiveDOMObject, - Conditional=LEGACY_NOTIFICATIONS, - NoInterfaceObject, - RuntimeEnabled=Notifications, -] interface WebKitNotification : EventTarget { - void show(); +] interface AnimationPlayer : EventTarget { + [RuntimeEnabled=WebAnimationsAPI] attribute AnimationNode? source; + [RuntimeEnabled=WebAnimationsAPI] attribute double startTime; + [RuntimeEnabled=WebAnimationsAPI] attribute double currentTime; + [RuntimeEnabled=WebAnimationsAPI] readonly attribute double timeLag; + [RuntimeEnabled=WebAnimationsAPI] attribute double playbackRate; + [RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean paused; + [RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean finished; + [RuntimeEnabled=WebAnimationsAPI, RaisesException] void finish(); + [RuntimeEnabled=WebAnimationsAPI] void play(); + [RuntimeEnabled=WebAnimationsAPI] void pause(); + [RuntimeEnabled=WebAnimationsAPI] void reverse(); + void cancel(); - - attribute EventHandler ondisplay; - attribute EventHandler onerror; - attribute EventHandler onclose; - attribute EventHandler onclick; - - attribute DOMString dir; - attribute DOMString replaceId; + [MeasureAs=AnimationPlayerFinishEvent] attribute EventHandler onfinish; };
diff --git a/core/animation/AnimationTimeline.idl b/core/animation/AnimationTimeline.idl new file mode 100644 index 0000000..b2c627a --- /dev/null +++ b/core/animation/AnimationTimeline.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=WebAnimationsAPI, + WillBeGarbageCollected, +] interface AnimationTimeline { + readonly attribute double? currentTime; + AnimationPlayer play(AnimationNode source); +};
diff --git a/core/animation/DocumentAnimation.idl b/core/animation/DocumentAnimation.idl index 2bfb6a7..d2c2861 100644 --- a/core/animation/DocumentAnimation.idl +++ b/core/animation/DocumentAnimation.idl
@@ -5,5 +5,5 @@ [ RuntimeEnabled=WebAnimationsAPI, ] partial interface Document { - readonly attribute Timeline timeline; + readonly attribute AnimationTimeline timeline; };
diff --git a/core/animation/ElementAnimation.idl b/core/animation/ElementAnimation.idl index e5c5137..f524939 100644 --- a/core/animation/ElementAnimation.idl +++ b/core/animation/ElementAnimation.idl
@@ -28,10 +28,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=WebAnimationsAPI, -] partial interface Element { - Animation animate(sequence<Dictionary> keyframes, Dictionary timingInput); - Animation animate(sequence<Dictionary> keyframes, double timingInput); - Animation animate(sequence<Dictionary> keyframes); +// http://www.w3.org/TR/web-animations/#idl-def-Element +// FIXME: move to Animatable +// http://dev.w3.org/fxtf/web-animations/#idl-def-Animatable + +partial interface Element { + // FIXME: needs support for union types http://crbug.com/240176 + // AnimationPlayer animate((AnimationEffect or sequence<Dictionary>)? effect, optional (double or Dictionary) timing); + [Custom, RaisesException] AnimationPlayer animate(object effect, optional object timing); };
diff --git a/core/animation/Player.idl b/core/animation/Player.idl deleted file mode 100644 index 1243c39..0000000 --- a/core/animation/Player.idl +++ /dev/null
@@ -1,46 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - RuntimeEnabled=WebAnimationsAPI, -] interface Player { - attribute TimedItem? source; - attribute double startTime; - attribute double currentTime; - readonly attribute double timeLag; - attribute double playbackRate; - readonly attribute boolean paused; - readonly attribute boolean finished; - void cancel(); - [RaisesException] void finish(); - void play(); - void pause(); - void reverse(); -};
diff --git a/core/animation/Timing.idl b/core/animation/Timing.idl index 9da75c5..49e93e1 100644 --- a/core/animation/Timing.idl +++ b/core/animation/Timing.idl
@@ -4,7 +4,8 @@ [ RuntimeEnabled=WebAnimationsAPI, - ImplementedAs=TimedItemTiming, + ImplementedAs=AnimationNodeTiming, + WillBeGarbageCollected, ] interface Timing { attribute double delay; attribute double endDelay; @@ -20,7 +21,7 @@ // FIXME: If the user calls animation.specified.duration = "" (empty string) then duration // gets set to 0 (This is correct behavior for IDL). Correct result is for duration to // be set to 'auto'. - [StrictTypeChecking, ImplementedAs=setDuration] setter double (DOMString name, double duration); + [TypeChecking=Interface|Nullable, ImplementedAs=setDuration] setter double (DOMString name, double duration); attribute double playbackRate; attribute DOMString direction;
diff --git a/core/clipboard/Clipboard.idl b/core/clipboard/DataTransfer.idl similarity index 95% rename from core/clipboard/Clipboard.idl rename to core/clipboard/DataTransfer.idl index 695f70d..497bfdf 100644 --- a/core/clipboard/Clipboard.idl +++ b/core/clipboard/DataTransfer.idl
@@ -27,7 +27,9 @@ */ [ -] interface Clipboard { + ImplementedAs=Clipboard, + WillBeGarbageCollected +] interface DataTransfer { [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect; [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed; readonly attribute DOMString[] types;
diff --git a/core/clipboard/DataTransferItem.idl b/core/clipboard/DataTransferItem.idl index 8499652..32e6904 100644 --- a/core/clipboard/DataTransferItem.idl +++ b/core/clipboard/DataTransferItem.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface DataTransferItem { readonly attribute DOMString kind;
diff --git a/core/clipboard/DataTransferItemList.idl b/core/clipboard/DataTransferItemList.idl index 0babe03..7bdf22c 100644 --- a/core/clipboard/DataTransferItemList.idl +++ b/core/clipboard/DataTransferItemList.idl
@@ -28,13 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface DataTransferItemList { +// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#datatransferitemlist + +[ + TypeChecking=Interface, + WillBeGarbageCollected, +] interface DataTransferItemList { readonly attribute long length; [ImplementedAs=item] getter DataTransferItem (unsigned long index); + [RaisesException] DataTransferItem add(DOMString data, DOMString type); + DataTransferItem add(File? file); [RaisesException, ImplementedAs=deleteItem] void remove(unsigned long index); void clear(); - DataTransferItem add(File? file); - [RaisesException] DataTransferItem add(DOMString data, DOMString type); }; -
diff --git a/core/css/CSS.idl b/core/css/CSS.idl index 4ba9ba7..36fe6da 100644 --- a/core/css/CSS.idl +++ b/core/css/CSS.idl
@@ -29,7 +29,8 @@ [ NoInterfaceObject, - ImplementedAs=DOMWindowCSS + ImplementedAs=DOMWindowCSS, + WillBeGarbageCollected ] interface CSS { boolean supports(DOMString property, DOMString value); boolean supports(DOMString conditionText);
diff --git a/core/css/CSSCharsetRule.idl b/core/css/CSSCharsetRule.idl index 1821607..1635a71 100644 --- a/core/css/CSSCharsetRule.idl +++ b/core/css/CSSCharsetRule.idl
@@ -19,5 +19,5 @@ */ interface CSSCharsetRule : CSSRule { - attribute DOMString encoding; + [MeasureAs=CSSCharsetRuleEncoding] attribute DOMString encoding; };
diff --git a/core/css/CSSKeyframesRule.idl b/core/css/CSSKeyframesRule.idl index ee408d9..d85f8d1 100644 --- a/core/css/CSSKeyframesRule.idl +++ b/core/css/CSSKeyframesRule.idl
@@ -32,7 +32,7 @@ readonly attribute CSSRuleList cssRules; [ImplementedAs=item, NotEnumerable] getter CSSKeyframeRule (unsigned long index); - [RaisesException] void insertRule([Default=Undefined] optional DOMString rule); + void insertRule([Default=Undefined] optional DOMString rule); void deleteRule([Default=Undefined] optional DOMString key); CSSKeyframeRule findRule([Default=Undefined] optional DOMString key); };
diff --git a/core/css/CSSRule.idl b/core/css/CSSRule.idl index 494e16a..a70bd3e 100644 --- a/core/css/CSSRule.idl +++ b/core/css/CSSRule.idl
@@ -22,6 +22,7 @@ [ Custom=Wrap, DependentLifetime, + WillBeGarbageCollected, ] interface CSSRule { // RuleType
diff --git a/core/css/CSSRuleList.idl b/core/css/CSSRuleList.idl index dd18910..35fb400 100644 --- a/core/css/CSSRuleList.idl +++ b/core/css/CSSRuleList.idl
@@ -25,7 +25,8 @@ // Introduced in DOM Level 2: [ - DependentLifetime + DependentLifetime, + WillBeGarbageCollected, ] interface CSSRuleList { readonly attribute unsigned long length; getter CSSRule item(unsigned long index);
diff --git a/core/css/CSSStyleDeclaration.idl b/core/css/CSSStyleDeclaration.idl index 63bd8ff..1fc7e9c 100644 --- a/core/css/CSSStyleDeclaration.idl +++ b/core/css/CSSStyleDeclaration.idl
@@ -20,7 +20,8 @@ // Introduced in DOM Level 2: [ - DependentLifetime + DependentLifetime, + WillBeGarbageCollected ] interface CSSStyleDeclaration { [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, RaisesException=Setter] attribute DOMString cssText; @@ -29,7 +30,7 @@ [TreatReturnedNullStringAs=Null] DOMString getPropertyPriority([Default=Undefined] optional DOMString propertyName); [RaisesException] void setProperty([Default=Undefined] optional DOMString propertyName, [TreatNullAs=NullString,Default=Undefined] optional DOMString value, - [Default=Undefined] optional DOMString priority); + [TreatNullAs=NullString] optional DOMString priority = null); readonly attribute unsigned long length; getter DOMString item([Default=Undefined] optional unsigned long index);
diff --git a/core/css/CSSValue.idl b/core/css/CSSValue.idl index dfdacd3..145010b 100644 --- a/core/css/CSSValue.idl +++ b/core/css/CSSValue.idl
@@ -21,6 +21,7 @@ [ Custom=Wrap, DependentLifetime, + WillBeGarbageCollected, ] interface CSSValue { // UnitTypes
diff --git a/core/css/DocumentFontFaceSet.idl b/core/css/DocumentFontFaceSet.idl index fc2cbc7..6ed56ab 100644 --- a/core/css/DocumentFontFaceSet.idl +++ b/core/css/DocumentFontFaceSet.idl
@@ -31,5 +31,5 @@ [ RuntimeEnabled=FontLoadEvents, ] partial interface Document { - readonly attribute FontFaceSet fonts; + [MeasureAs=DocumentFonts] readonly attribute FontFaceSet fonts; };
diff --git a/core/css/FontFace.idl b/core/css/FontFace.idl index 922be52..77d12b2 100644 --- a/core/css/FontFace.idl +++ b/core/css/FontFace.idl
@@ -28,6 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://dev.w3.org/csswg/css-font-loading/#dom-fontface + enum FontFaceLoadStatus { "unloaded", "loading", @@ -36,10 +38,14 @@ }; [ - RuntimeEnabled=FontLoadEvents, - Constructor(DOMString family, DOMString source, Dictionary descriptors), + // FIXME: should be union type http://crbug.com/240176 + Constructor(DOMString family, DOMString source, optional Dictionary descriptors), + Constructor(DOMString family, ArrayBuffer source, optional Dictionary descriptors), + Constructor(DOMString family, ArrayBufferView source, optional Dictionary descriptors), ConstructorCallWith=ExecutionContext, - RaisesException=Constructor + RaisesException=Constructor, + RuntimeEnabled=FontLoadEvents, + WillBeGarbageCollected, ] interface FontFace { [RaisesException=Setter, SetterCallWith=ExecutionContext] attribute DOMString family; @@ -51,7 +57,7 @@ [RaisesException=Setter, SetterCallWith=ExecutionContext] attribute DOMString featureSettings; readonly attribute FontFaceLoadStatus status; + [CallWith=ScriptState] readonly attribute Promise loaded; - [CallWith=ExecutionContext] void load(); - [CallWith=ExecutionContext] Promise ready(); + [CallWith=ScriptState] Promise load(); };
diff --git a/core/css/FontFaceSet.idl b/core/css/FontFaceSet.idl index 7f5b6ce..10bc2f7 100644 --- a/core/css/FontFaceSet.idl +++ b/core/css/FontFaceSet.idl
@@ -41,9 +41,9 @@ attribute EventHandler onloadingdone; attribute EventHandler onloadingerror; - [RaisesException] boolean check(DOMString font, [Default=NullString] optional DOMString text); - [RaisesException] Promise load(DOMString font, [Default=NullString] optional DOMString text); - Promise ready(); + [RaisesException] boolean check(DOMString font, optional DOMString text = null); + [CallWith=ScriptState] Promise load(DOMString font, optional DOMString text = null); + [MeasureAs=FontFaceSetReady, CallWith=ScriptState] Promise ready(); [RaisesException] void add(FontFace fontFace); void clear();
diff --git a/core/css/MediaList.idl b/core/css/MediaList.idl index 20ef3ec..8db9886 100644 --- a/core/css/MediaList.idl +++ b/core/css/MediaList.idl
@@ -25,6 +25,7 @@ // Introduced in DOM Level 2: [ + WillBeGarbageCollected ] interface MediaList { [TreatNullAs=NullString, TreatReturnedNullStringAs=Null] attribute DOMString mediaText;
diff --git a/core/css/MediaQueryList.idl b/core/css/MediaQueryList.idl index 7785d8d..c60c692 100644 --- a/core/css/MediaQueryList.idl +++ b/core/css/MediaQueryList.idl
@@ -17,7 +17,8 @@ * Boston, MA 02110-1301, USA. */ [ - NoInterfaceObject + NoInterfaceObject, + WillBeGarbageCollected ] interface MediaQueryList { readonly attribute DOMString media; readonly attribute boolean matches;
diff --git a/core/css/RGBColor.idl b/core/css/RGBColor.idl index 09fa76e..398fe1b 100644 --- a/core/css/RGBColor.idl +++ b/core/css/RGBColor.idl
@@ -19,6 +19,7 @@ */ [ + WillBeGarbageCollected ] interface RGBColor { readonly attribute CSSPrimitiveValue red; readonly attribute CSSPrimitiveValue green;
diff --git a/core/css/Rect.idl b/core/css/Rect.idl index 3eac82f..87336d5 100644 --- a/core/css/Rect.idl +++ b/core/css/Rect.idl
@@ -18,6 +18,7 @@ */ [ + WillBeGarbageCollected ] interface Rect { readonly attribute CSSPrimitiveValue top; readonly attribute CSSPrimitiveValue right;
diff --git a/core/css/StyleMedia.idl b/core/css/StyleMedia.idl index 370eee8..b897eb0 100644 --- a/core/css/StyleMedia.idl +++ b/core/css/StyleMedia.idl
@@ -25,7 +25,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + WillBeGarbageCollected ] interface StyleMedia { readonly attribute DOMString type; boolean matchMedium([Default=Undefined] optional DOMString mediaquery);
diff --git a/core/css/StyleSheet.idl b/core/css/StyleSheet.idl index 1071475..ed83f14 100644 --- a/core/css/StyleSheet.idl +++ b/core/css/StyleSheet.idl
@@ -22,6 +22,7 @@ [ Custom=Wrap, SetWrapperReferenceFrom=ownerNode, + WillBeGarbageCollected ] interface StyleSheet { [TreatReturnedNullStringAs=Null] readonly attribute DOMString type; attribute boolean disabled;
diff --git a/core/css/StyleSheetList.idl b/core/css/StyleSheetList.idl index 104a387..3da2d91 100644 --- a/core/css/StyleSheetList.idl +++ b/core/css/StyleSheetList.idl
@@ -21,6 +21,7 @@ // Introduced in DOM Level 2: [ SetWrapperReferenceFrom=document, + WillBeGarbageCollected ] interface StyleSheetList { readonly attribute unsigned long length; getter StyleSheet item(unsigned long index);
diff --git a/core/css/WebKitCSSFilterValue.idl b/core/css/WebKitCSSFilterValue.idl index dd9aff4..8c346d2 100644 --- a/core/css/WebKitCSSFilterValue.idl +++ b/core/css/WebKitCSSFilterValue.idl
@@ -41,7 +41,6 @@ const unsigned short CSS_FILTER_CONTRAST = 9; const unsigned short CSS_FILTER_BLUR = 10; const unsigned short CSS_FILTER_DROP_SHADOW = 11; - const unsigned short CSS_FILTER_CUSTOM = 12; readonly attribute unsigned short operationType; [ImplementedAs=item] getter CSSValue (unsigned long index);
diff --git a/core/css/WebKitCSSMatrix.idl b/core/css/WebKitCSSMatrix.idl index 0016fcf..08ee797 100644 --- a/core/css/WebKitCSSMatrix.idl +++ b/core/css/WebKitCSSMatrix.idl
@@ -25,9 +25,10 @@ // Introduced in DOM Level ?: [ - Constructor([Default=NullString] optional DOMString cssValue), + Constructor(optional DOMString cssValue = null), ImplementedAs=CSSMatrix, - RaisesException=Constructor + RaisesException=Constructor, + WillBeGarbageCollected ] interface WebKitCSSMatrix { // These attributes are simple aliases for certain elements of the 4x4 matrix
diff --git a/core/dom/Attr.idl b/core/dom/Attr.idl index 2403170..9c1fb6c 100644 --- a/core/dom/Attr.idl +++ b/core/dom/Attr.idl
@@ -24,14 +24,20 @@ [TreatReturnedNullStringAs=Null] readonly attribute DOMString name; - [DeprecateAs=AttributeSpecified] readonly attribute boolean specified; + [MeasureAs=AttributeSpecified] readonly attribute boolean specified; - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, RaisesException=Setter, CustomElementCallbacks] attribute DOMString value; + [ImplementedAs=valueForBindings, TreatReturnedNullStringAs=Null, TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString value; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, DeprecateAs=AttrNodeValue, ImplementedAs=valueForBindings] attribute DOMString nodeValue; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, DeprecateAs=AttrTextContent, ImplementedAs=valueForBindings] attribute DOMString textContent; + + // DOM Level 2 + + [DeprecateAs=AttributeOwnerElement] readonly attribute Element ownerElement; // DOM 4 - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString prefix; - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI; - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString prefix; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString namespaceURI; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString localName; };
diff --git a/core/dom/ChildNode.idl b/core/dom/ChildNode.idl index f4a8ba8..38ccf66 100644 --- a/core/dom/ChildNode.idl +++ b/core/dom/ChildNode.idl
@@ -20,11 +20,13 @@ * Boston, MA 02110-1301, USA. */ +// http://dom.spec.whatwg.org/#interface-childnode + [ - NoInterfaceObject + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' ] interface ChildNode { [PerWorldBindings] readonly attribute Element previousElementSibling; [PerWorldBindings] readonly attribute Element nextElementSibling; [RaisesException, CustomElementCallbacks] void remove(); }; -
diff --git a/core/dom/ClientRect.idl b/core/dom/ClientRect.idl index ffdcfdd..4fae5d7 100644 --- a/core/dom/ClientRect.idl +++ b/core/dom/ClientRect.idl
@@ -25,6 +25,7 @@ */ [ + WillBeGarbageCollected, ] interface ClientRect { readonly attribute float top; readonly attribute float right;
diff --git a/core/dom/ClientRectList.idl b/core/dom/ClientRectList.idl index 7f6b198..bf14542 100644 --- a/core/dom/ClientRectList.idl +++ b/core/dom/ClientRectList.idl
@@ -25,6 +25,7 @@ */ [ + WillBeGarbageCollected, ] interface ClientRectList { readonly attribute unsigned long length; getter ClientRect item(unsigned long index);
diff --git a/core/dom/Comment.idl b/core/dom/Comment.idl index 0297e95..3af73b2 100644 --- a/core/dom/Comment.idl +++ b/core/dom/Comment.idl
@@ -18,7 +18,7 @@ */ [ - Constructor([Default=NullString] optional DOMString data), + Constructor(optional DOMString data = null), ConstructorCallWith=Document, ] interface Comment : CharacterData { };
diff --git a/core/dom/DOMError.idl b/core/dom/DOMError.idl index b2ea60f..aba4e7a 100644 --- a/core/dom/DOMError.idl +++ b/core/dom/DOMError.idl
@@ -26,7 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ [ - NoInterfaceObject + Constructor(DOMString name, optional DOMString message = null), + WillBeGarbageCollected ] interface DOMError { readonly attribute DOMString name; readonly attribute DOMString message;
diff --git a/core/dom/DOMException.idl b/core/dom/DOMException.idl index 68d04bf..4442350 100644 --- a/core/dom/DOMException.idl +++ b/core/dom/DOMException.idl
@@ -27,7 +27,8 @@ */ [ - DoNotCheckConstants + DoNotCheckConstants, + WillBeGarbageCollected, ] exception DOMException { readonly attribute unsigned short code;
diff --git a/core/dom/DOMImplementation.idl b/core/dom/DOMImplementation.idl index 7f31def..472d1b0 100644 --- a/core/dom/DOMImplementation.idl +++ b/core/dom/DOMImplementation.idl
@@ -20,6 +20,7 @@ [ SetWrapperReferenceFrom=document, + WillBeGarbageCollected, ] interface DOMImplementation { // DOM Level 1 @@ -36,13 +37,7 @@ [TreatNullAs=NullString] DOMString qualifiedName, [Default=Undefined] optional DocumentType doctype); - // DOMImplementationCSS interface from DOM Level 2 CSS - - [DeprecateAs=DOMImplementationCreateCSSStyleSheet] - CSSStyleSheet createCSSStyleSheet([Default=Undefined] optional DOMString title, - [Default=Undefined] optional DOMString media); - // HTMLDOMImplementation interface from DOM Level 2 HTML - HTMLDocument createHTMLDocument([Default=NullString] optional DOMString title); + HTMLDocument createHTMLDocument(optional DOMString title = null); };
diff --git a/core/dom/DOMStringList.idl b/core/dom/DOMStringList.idl index 1c75bcb..8a57087 100644 --- a/core/dom/DOMStringList.idl +++ b/core/dom/DOMStringList.idl
@@ -24,9 +24,9 @@ */ [ + WillBeGarbageCollected, ] interface DOMStringList { readonly attribute unsigned long length; [TreatReturnedNullStringAs=Null] getter DOMString item([Default=Undefined] optional unsigned long index); - boolean contains([Default=Undefined] optional DOMString string); + [MeasureAs=DOMStringListContains] boolean contains([Default=Undefined] optional DOMString string); }; -
diff --git a/core/dom/DOMStringMap.idl b/core/dom/DOMStringMap.idl index b3590a9..c8c7d15 100644 --- a/core/dom/DOMStringMap.idl +++ b/core/dom/DOMStringMap.idl
@@ -26,6 +26,7 @@ [ OverrideBuiltins, SetWrapperReferenceFrom=element, + WillBeGarbageCollected, ] interface DOMStringMap { [NotEnumerable] getter DOMString (unsigned long index); [RaisesException] setter DOMString (unsigned long index, DOMString value);
diff --git a/core/dom/DOMTokenList.idl b/core/dom/DOMTokenList.idl index 6072629..98d51cf 100644 --- a/core/dom/DOMTokenList.idl +++ b/core/dom/DOMTokenList.idl
@@ -24,6 +24,7 @@ [ SetWrapperReferenceFrom=element, + WillBeGarbageCollected, ] interface DOMTokenList { readonly attribute unsigned long length; [TreatReturnedNullStringAs=Null] getter DOMString item(unsigned long index);
diff --git a/core/dom/Document.idl b/core/dom/Document.idl index 158f5bb..64f4ddf 100644 --- a/core/dom/Document.idl +++ b/core/dom/Document.idl
@@ -20,6 +20,8 @@ callback CustomElementConstructor = Element (); +typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; + [ SpecialWrapFor=HTMLDocument|XMLDocument ] interface Document : Node { @@ -29,21 +31,23 @@ readonly attribute DOMImplementation implementation; readonly attribute Element documentElement; - [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElement(DOMString tagName); + [CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Element createElement(DOMString tagName); DocumentFragment createDocumentFragment(); - [PerWorldBindings] Text createTextNode(DOMString data); + Text createTextNode(DOMString data); Comment createComment(DOMString data); [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4. [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4. - [PerWorldBindings] HTMLCollection getElementsByTagName(DOMString localName); + [DartNoAutoScope] HTMLCollection getElementsByTagName(DOMString localName); // Introduced in DOM Level 2: - [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Node importNode(Node node, optional boolean deep); - [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName); + [CustomElementCallbacks, LogActivity, RaisesException] Node importNode(Node node, optional boolean deep); + [CustomElementCallbacks, LogActivity, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName); + [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, + [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4. HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); - [PerWorldBindings] Element getElementById(DOMString elementId); + [PerWorldBindings, DartNoAutoScope] Element getElementById(DOMString elementId); // DOM Level 3 Core @@ -59,7 +63,7 @@ // DOM Level 2 Events (DocumentEvents interface) - [RaisesException] Event createEvent(optional DOMString eventType); + [RaisesException] Event createEvent(DOMString eventType); // DOM Level 2 Traversal and Range (DocumentRange interface) @@ -87,6 +91,9 @@ CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element, [Default=Undefined] optional DOMString pseudoElement); + // DOM 4 + readonly attribute DOMString contentType; + // Common extensions [CustomElementCallbacks] boolean execCommand([Default=Undefined] optional DOMString command, @@ -100,7 +107,8 @@ DOMString queryCommandValue([Default=Undefined] optional DOMString command); // Moved down from HTMLDocument - + [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir; + [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode; [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title; readonly attribute DOMString referrer; [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain; @@ -108,27 +116,31 @@ [TreatNullAs=NullString, RaisesException] attribute DOMString cookie; - [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings] attribute HTMLElement body; + [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, DartNoAutoScope] attribute HTMLElement body; readonly attribute HTMLHeadElement head; readonly attribute HTMLCollection images; readonly attribute HTMLCollection applets; + readonly attribute HTMLCollection embeds; + [ImplementedAs=embeds] readonly attribute HTMLCollection plugins; readonly attribute HTMLCollection links; readonly attribute HTMLCollection forms; + readonly attribute HTMLCollection scripts; readonly attribute HTMLCollection anchors; readonly attribute DOMString lastModified; - [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName); + [PerWorldBindings, DartNoAutoScope] NodeList getElementsByName([Default=Undefined] optional DOMString elementName); - [PerWorldBindings, ActivityLogging=ForIsolatedWorlds, PutForwards=href] readonly attribute Location location; + [LogActivity, PutForwards=href] readonly attribute Location location; // IE extensions [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset; - [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset; + [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset; [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState; Element elementFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y); + [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y); @@ -139,9 +151,9 @@ // WebKit extensions [TreatReturnedNullStringAs=Null] readonly attribute DOMString preferredStylesheetSet; - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString selectedStylesheetSet; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString selectedStylesheetSet; - CanvasRenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); + [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); // HTML 5 HTMLCollection getElementsByClassName(DOMString classNames); @@ -150,12 +162,10 @@ readonly attribute DOMString compatMode; - // NodeSelector - Selector API - [RaisesException] Element querySelector(DOMString selectors); - [RaisesException] NodeList querySelectorAll(DOMString selectors); - - void webkitExitPointerLock(); - readonly attribute Element webkitPointerLockElement; + [MeasureAs=DocumentExitPointerLock] void exitPointerLock(); + [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement; + [MeasureAs=PrefixedDocumentExitPointerLock, ImplementedAs=exitPointerLock] void webkitExitPointerLock(); + [MeasureAs=PrefixedDocumentPointerLockElement, ImplementedAs=pointerLockElement] readonly attribute Element webkitPointerLockElement; // Event handler attributes attribute EventHandler onbeforecopy; @@ -164,6 +174,8 @@ attribute EventHandler oncopy; attribute EventHandler oncut; attribute EventHandler onpaste; + attribute EventHandler onpointerlockchange; + attribute EventHandler onpointerlockerror; attribute EventHandler onreadystatechange; attribute EventHandler onsearch; [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation; @@ -177,24 +189,24 @@ attribute EventHandler onwebkitfullscreenerror; attribute EventHandler onwebkitpointerlockchange; attribute EventHandler onwebkitpointerlockerror; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel; + [LogActivity=SetterOnly] attribute EventHandler onwheel; [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window, [Default=Undefined] optional EventTarget target, [Default=Undefined] optional long identifier, - [Default=Undefined] optional long pageX, - [Default=Undefined] optional long pageY, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long webkitRadiusX, - [Default=Undefined] optional long webkitRadiusY, + [Default=Undefined] optional double pageX, + [Default=Undefined] optional double pageY, + [Default=Undefined] optional double screenX, + [Default=Undefined] optional double screenY, + [Default=Undefined] optional double webkitRadiusX, + [Default=Undefined] optional double webkitRadiusY, [Default=Undefined] optional float webkitRotationAngle, [Default=Undefined] optional float webkitForce); [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); - [CallWith=ScriptState, CustomElementCallbacks, RaisesException] CustomElementConstructor registerElement(DOMString name, optional Dictionary options); - [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension); - [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, + [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional Dictionary options); + [CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException, DartCustom] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension); + [CustomElementCallbacks, LogActivity, RaisesException, DartCustom] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, [TreatNullAs=NullString] DOMString typeExtension); // Page visibility API. @@ -212,4 +224,3 @@ Document implements GlobalEventHandlers; Document implements ParentNode; -
diff --git a/core/dom/DocumentFragment.idl b/core/dom/DocumentFragment.idl index 4f1ecf9..005032a 100644 --- a/core/dom/DocumentFragment.idl +++ b/core/dom/DocumentFragment.idl
@@ -21,9 +21,8 @@ Constructor, ConstructorCallWith=Document, ] interface DocumentFragment : Node { - // NodeSelector - Selector API - [RaisesException] Element querySelector(DOMString selectors); - [RaisesException] NodeList querySelectorAll(DOMString selectors); + // NonElementParentNode API. + Element getElementById(DOMString elementId); }; DocumentFragment implements ParentNode;
diff --git a/core/dom/DocumentFullscreen.idl b/core/dom/DocumentFullscreen.idl index 917d481..65c6f80 100644 --- a/core/dom/DocumentFullscreen.idl +++ b/core/dom/DocumentFullscreen.idl
@@ -19,17 +19,15 @@ * Boston, MA 02110-1301, USA. */ -[ - RuntimeEnabled=Fullscreen, -] partial interface Document { +partial interface Document { // Mozilla version - readonly attribute boolean webkitIsFullScreen; - readonly attribute boolean webkitFullScreenKeyboardInputAllowed; - readonly attribute Element webkitCurrentFullScreenElement; - void webkitCancelFullScreen(); + [MeasureAs=PrefixedDocumentIsFullscreen] readonly attribute boolean webkitIsFullScreen; + [MeasureAs=PrefixedDocumentFullScreenKeyboardInputAllowed] readonly attribute boolean webkitFullScreenKeyboardInputAllowed; + [MeasureAs=PrefixedDocumentCurrentFullScreenElement] readonly attribute Element webkitCurrentFullScreenElement; + [MeasureAs=PrefixedDocumentCancelFullScreen] void webkitCancelFullScreen(); // W3C version - readonly attribute boolean webkitFullscreenEnabled; - readonly attribute Element webkitFullscreenElement; - void webkitExitFullscreen(); + [MeasureAs=PrefixedDocumentFullscreenEnabled] readonly attribute boolean webkitFullscreenEnabled; + [MeasureAs=PrefixedDocumentFullscreenElement] readonly attribute Element webkitFullscreenElement; + [MeasureAs=PrefixedDocumentExitFullscreen] void webkitExitFullscreen(); };
diff --git a/core/dom/DocumentType.idl b/core/dom/DocumentType.idl index 330aa72..680352b 100644 --- a/core/dom/DocumentType.idl +++ b/core/dom/DocumentType.idl
@@ -25,9 +25,8 @@ // DOM Level 2 - [TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId; - [TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId; - [TreatReturnedNullStringAs=Null, MeasureAs=DocumentTypeInternalSubset] readonly attribute DOMString internalSubset; // Removed from DOM4. + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; }; DocumentType implements ChildNode;
diff --git a/core/dom/Element.idl b/core/dom/Element.idl index a715874..93843ed 100644 --- a/core/dom/Element.idl +++ b/core/dom/Element.idl
@@ -19,65 +19,66 @@ */ [ - SpecialWrapFor=HTMLElement|SVGElement + SpecialWrapFor=HTMLElement|SVGElement, ] interface Element : Node { // DOM Level 1 Core - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString tagName; - [TreatReturnedNullStringAs=Null] DOMString getAttribute(DOMString name); - [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name, DOMString value); + [TreatReturnedNullStringAs=Null, DartNoAutoScope] DOMString getAttribute(DOMString name); + [RaisesException, CustomElementCallbacks, DartNoAutoScope] void setAttribute(DOMString name, DOMString value); [CustomElementCallbacks] void removeAttribute(DOMString name); [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4. - [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4. - [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4. - [PerWorldBindings] HTMLCollection getElementsByTagName(DOMString name); + [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, TypeChecking=Nullable] optional Attr newAttr); // Removed from DOM4. + [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, TypeChecking=Nullable] optional Attr oldAttr); // Removed from DOM4. + HTMLCollection getElementsByTagName(DOMString name); - [PerWorldBindings] readonly attribute NamedNodeMap attributes; + [PerWorldBindings, ImplementedAs=attributesForBindings] readonly attribute NamedNodeMap attributes; [MeasureAs=HasAttributes] boolean hasAttributes(); // DOM Level 2 Core - DOMString getAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); - [RaisesException, CustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, DOMString value); + [TreatReturnedNullStringAs=Null, DartNoAutoScope] DOMString getAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); + [RaisesException, CustomElementCallbacks, DartNoAutoScope] void setAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, DOMString value); [CustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); - [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, + [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString, Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName); // Removed from DOM4. + [RaisesException, CustomElementCallbacks, DeprecateAs=ElementSetAttributeNodeNS] Attr setAttributeNodeNS([Default=Undefined, TypeChecking=Nullable] optional Attr newAttr); // Removed from DOM4. boolean hasAttribute(DOMString name); boolean hasAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName); [PerWorldBindings] readonly attribute CSSStyleDeclaration style; // DOM4 - [Reflect, PerWorldBindings] attribute DOMString id; - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI; - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, RaisesException=Setter] attribute DOMString prefix; - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName; + [Reflect, DartNoAutoScope] attribute DOMString id; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString namespaceURI; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, RaisesException=Setter] attribute DOMString prefix; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString localName; [RaisesException] boolean matches(DOMString selectors); // Common extensions - [PerWorldBindings] readonly attribute long offsetLeft; - [PerWorldBindings] readonly attribute long offsetTop; - [PerWorldBindings] readonly attribute long offsetWidth; - [PerWorldBindings] readonly attribute long offsetHeight; + readonly attribute long offsetLeft; + readonly attribute long offsetTop; + readonly attribute long offsetWidth; + readonly attribute long offsetHeight; [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute Element offsetParent; - [PerWorldBindings] readonly attribute long clientLeft; - [PerWorldBindings] readonly attribute long clientTop; - [PerWorldBindings] readonly attribute long clientWidth; - [PerWorldBindings] readonly attribute long clientHeight; + readonly attribute long clientLeft; + readonly attribute long clientTop; + readonly attribute long clientWidth; + readonly attribute long clientHeight; // FIXME: should be: - // [PerWorldBindings] attribute (Dictionary or long) scrollLeft; - // [PerWorldBindings] attribute (Dictionary or long) scrollTop; + // attribute (Dictionary or double) scrollLeft; + // attribute (Dictionary or double) scrollTop; // http://crbug.com/240176 - [PerWorldBindings, Custom=Setter] attribute long scrollLeft; - [PerWorldBindings, Custom=Setter] attribute long scrollTop; - [PerWorldBindings] readonly attribute long scrollWidth; - [PerWorldBindings] readonly attribute long scrollHeight; + [Custom=Setter] attribute long scrollLeft; + [Custom=Setter] attribute long scrollTop; + readonly attribute long scrollWidth; + readonly attribute long scrollHeight; void focus(); void blur(); @@ -85,39 +86,31 @@ // WebKit extensions - void scrollIntoViewIfNeeded(optional boolean centerIfNeeded); - void scrollByLines([Default=Undefined] optional long lines); - void scrollByPages([Default=Undefined] optional long pages); + [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(optional boolean centerIfNeeded); + [MeasureAs=ElementScrollByLines] void scrollByLines([Default=Undefined] optional long lines); + [MeasureAs=ElementScrollByPages] void scrollByPages([Default=Undefined] optional long pages); // HTML 5 HTMLCollection getElementsByClassName(DOMString classNames); - [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, RaisesException=Setter] attribute DOMString innerHTML; + [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, LogActivity=SetterOnly, RaisesException=Setter] attribute DOMString innerHTML; [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString outerHTML; [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement(DOMString where, Element element); [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMString where, DOMString text); - [CustomElementCallbacks, RaisesException] void insertAdjacentHTML(DOMString where, DOMString html); + [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void insertAdjacentHTML(DOMString where, DOMString html); - [Reflect=class, PerWorldBindings] attribute DOMString className; + [Reflect=class] attribute DOMString className; [PerWorldBindings] readonly attribute DOMTokenList classList; [PerWorldBindings] readonly attribute DOMStringMap dataset; - // NodeSelector - Selector API - [RaisesException] Element querySelector(DOMString selectors); - [RaisesException] NodeList querySelectorAll(DOMString selectors); - // WebKit extension [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSelector] boolean webkitMatchesSelector(DOMString selectors); // Shadow DOM API - [RuntimeEnabled=ShadowDOM, RaisesException] ShadowRoot createShadowRoot(); - [RuntimeEnabled=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot; - [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints(); - - // To-be-deprecated prefixed Shadow DOM API - [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot(); - [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot; + [RaisesException, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadowRoot(); + [PerWorldBindings] readonly attribute ShadowRoot shadowRoot; + NodeList getDestinationInsertionPoints(); // CSSOM View Module API ClientRectList getClientRects(); @@ -125,12 +118,13 @@ // Mozilla version const unsigned short ALLOW_KEYBOARD_INPUT = 1; - [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags); + [LogActivity, LogAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags); // W3C version - [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen(); + [LogActivity, LogAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen(); - void webkitRequestPointerLock(); + [MeasureAs=PrefixedElementRequestPointerLock] void webkitRequestPointerLock(); + [MeasureAs=ElementRequestPointerLock] void requestPointerLock(); // Event handler attributes attribute EventHandler onbeforecopy; @@ -147,7 +141,7 @@ [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; attribute EventHandler onwebkitfullscreenchange; attribute EventHandler onwebkitfullscreenerror; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel; + [LogActivity=SetterOnly] attribute EventHandler onwheel; }; Element implements ParentNode;
diff --git a/core/dom/GlobalEventHandlers.idl b/core/dom/GlobalEventHandlers.idl index 5a65c5b..c835461 100644 --- a/core/dom/GlobalEventHandlers.idl +++ b/core/dom/GlobalEventHandlers.idl
@@ -27,50 +27,55 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/#globaleventhandlers + [ - NoInterfaceObject + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' ] interface GlobalEventHandlers { attribute EventHandler onabort; + [RuntimeEnabled=RequestAutocomplete] attribute EventHandler onautocomplete; + [RuntimeEnabled=RequestAutocomplete] attribute EventHandler onautocompleteerror; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onclick; + [LogActivity=SetterOnly] attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondblclick; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondrag; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragend; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragenter; - //[PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragexit; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragleave; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragover; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondragstart; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler ondrop; + [LogActivity=SetterOnly] attribute EventHandler ondblclick; + [LogActivity=SetterOnly] attribute EventHandler ondrag; + [LogActivity=SetterOnly] attribute EventHandler ondragend; + [LogActivity=SetterOnly] attribute EventHandler ondragenter; + //[LogActivity=SetterOnly] attribute EventHandler ondragexit; + [LogActivity=SetterOnly] attribute EventHandler ondragleave; + [LogActivity=SetterOnly] attribute EventHandler ondragover; + [LogActivity=SetterOnly] attribute EventHandler ondragstart; + [LogActivity=SetterOnly] attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute EventHandler onerror; attribute EventHandler onfocus; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler oninput; + [LogActivity=SetterOnly] attribute EventHandler oninput; attribute EventHandler oninvalid; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onkeydown; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onkeypress; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onkeyup; + [LogActivity=SetterOnly] attribute EventHandler onkeydown; + [LogActivity=SetterOnly] attribute EventHandler onkeypress; + [LogActivity=SetterOnly] attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmousedown; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmouseenter; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmouseleave; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmousemove; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmouseout; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmouseover; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmouseup; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; + [LogActivity=SetterOnly] attribute EventHandler onmousedown; + [LogActivity=SetterOnly] attribute EventHandler onmouseenter; + [LogActivity=SetterOnly] attribute EventHandler onmouseleave; + [LogActivity=SetterOnly] attribute EventHandler onmousemove; + [LogActivity=SetterOnly] attribute EventHandler onmouseout; + [LogActivity=SetterOnly] attribute EventHandler onmouseover; + [LogActivity=SetterOnly] attribute EventHandler onmouseup; + [LogActivity=SetterOnly] attribute EventHandler onmousewheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; @@ -88,7 +93,7 @@ attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; - //attribute EventHandler ontoggle; + attribute EventHandler ontoggle; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; };
diff --git a/core/dom/MessageChannel.idl b/core/dom/MessageChannel.idl index fbd8bab..3a1123c 100644 --- a/core/dom/MessageChannel.idl +++ b/core/dom/MessageChannel.idl
@@ -26,7 +26,8 @@ [ CustomConstructor, - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, + WillBeGarbageCollected ] interface MessageChannel { readonly attribute MessagePort port1; readonly attribute MessagePort port2;
diff --git a/core/dom/MessagePort.idl b/core/dom/MessagePort.idl index 14845be..f834df6 100644 --- a/core/dom/MessagePort.idl +++ b/core/dom/MessagePort.idl
@@ -26,7 +26,8 @@ */ [ - ActiveDOMObject + ActiveDOMObject, + WillBeGarbageCollected ] interface MessagePort : EventTarget { [Custom, RaisesException] void postMessage(any message, optional MessagePort[] messagePorts);
diff --git a/core/dom/MutationObserver.idl b/core/dom/MutationObserver.idl index 05acb2a..2c6d142 100644 --- a/core/dom/MutationObserver.idl +++ b/core/dom/MutationObserver.idl
@@ -30,7 +30,8 @@ [ CustomConstructor(MutationCallback callback), - Custom=VisitDOMWrapper + Custom=VisitDOMWrapper, + WillBeGarbageCollected, ] interface MutationObserver { [RaisesException] void observe(Node target, Dictionary options); sequence<MutationRecord> takeRecords();
diff --git a/core/dom/MutationRecord.idl b/core/dom/MutationRecord.idl index c3ef616..daecf1d 100644 --- a/core/dom/MutationRecord.idl +++ b/core/dom/MutationRecord.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, ] interface MutationRecord { readonly attribute DOMString type; readonly attribute Node target;
diff --git a/core/dom/NamedNodeMap.idl b/core/dom/NamedNodeMap.idl index 783611a..7de6a6f 100644 --- a/core/dom/NamedNodeMap.idl +++ b/core/dom/NamedNodeMap.idl
@@ -20,30 +20,30 @@ [ SetWrapperReferenceFrom=element, + WillBeGarbageCollected, ] interface NamedNodeMap { - Node getNamedItem([Default=Undefined] optional DOMString name); + [MeasureAs=NamedNodeMapGetNamedItem] Node getNamedItem([Default=Undefined] optional DOMString name); [NotEnumerable, ImplementedAs=getNamedItem] getter Node ([Default=Undefined] optional DOMString name); - [RaisesException, CustomElementCallbacks] Node setNamedItem([Default=Undefined] optional Node node); + [RaisesException, CustomElementCallbacks, MeasureAs=NamedNodeMapSetNamedItem] Node setNamedItem([Default=Undefined] optional Node node); - [RaisesException, CustomElementCallbacks] Node removeNamedItem([Default=Undefined] optional DOMString name); + [RaisesException, CustomElementCallbacks, MeasureAs=NamedNodeMapRemoveNamedItem] Node removeNamedItem([Default=Undefined] optional DOMString name); - getter Node item([Default=Undefined] optional unsigned long index); + [MeasureAs=NamedNodeMapItem] getter Node item([Default=Undefined] optional unsigned long index); readonly attribute unsigned long length; // Introduced in DOM Level 2: - // FIXME: the implementation does take an exceptioncode parameter. - /*[RaisesException]*/ Node getNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, - [Default=Undefined] optional DOMString localName); + [MeasureAs=NamedNodeMapGetNamedItemNS] Node getNamedItemNS([TreatNullAs=NullString, Default=Undefined] optional DOMString namespaceURI, + [Default=Undefined] optional DOMString localName); - [RaisesException, CustomElementCallbacks] Node setNamedItemNS([Default=Undefined] optional Node node); + [RaisesException, CustomElementCallbacks, MeasureAs=NamedNodeMapSetNamedItemNS] Node setNamedItemNS([Default=Undefined] optional Node node); - [RaisesException, CustomElementCallbacks] Node removeNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, - [Default=Undefined] optional DOMString localName); + [RaisesException, CustomElementCallbacks, MeasureAs=NamedNodeMapRemoveNamedItemNS] Node removeNamedItemNS([TreatNullAs=NullString, Default=Undefined] optional DOMString namespaceURI, + [Default=Undefined] optional DOMString localName); };
diff --git a/core/dom/Node.idl b/core/dom/Node.idl index 690190d..329b27f 100644 --- a/core/dom/Node.idl +++ b/core/dom/Node.idl
@@ -36,37 +36,36 @@ const unsigned short DOCUMENT_FRAGMENT_NODE = 11; const unsigned short NOTATION_NODE = 12; - [PerWorldBindings] readonly attribute DOMString nodeName; + readonly attribute DOMString nodeName; - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, CustomElementCallbacks] attribute DOMString nodeValue; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString nodeValue; - [PerWorldBindings] readonly attribute unsigned short nodeType; + [DartNoAutoScope] readonly attribute unsigned short nodeType; [PerWorldBindings] readonly attribute Node parentNode; - [PerWorldBindings] readonly attribute NodeList childNodes; - [PerWorldBindings] readonly attribute Node firstChild; - [PerWorldBindings] readonly attribute Node lastChild; - [PerWorldBindings] readonly attribute Node previousSibling; - [PerWorldBindings] readonly attribute Node nextSibling; + [PerWorldBindings, DartNoAutoScope] readonly attribute NodeList childNodes; + [PerWorldBindings, DartNoAutoScope] readonly attribute Node firstChild; + [PerWorldBindings, DartNoAutoScope] readonly attribute Node lastChild; + [PerWorldBindings, DartNoAutoScope] readonly attribute Node previousSibling; + [PerWorldBindings, DartNoAutoScope] readonly attribute Node nextSibling; [PerWorldBindings] readonly attribute Document ownerDocument; - [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Node insertBefore(Node newChild, Node refChild); - [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Node replaceChild(Node newChild, Node oldChild); - [Custom, CustomElementCallbacks, PerWorldBindings, RaisesException] Node removeChild(Node oldChild); - [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Node appendChild(Node newChild); + [Custom, CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Node insertBefore(Node newChild, Node refChild); + [Custom, CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Node replaceChild(Node newChild, Node oldChild); + [Custom, CustomElementCallbacks, RaisesException] Node removeChild(Node oldChild); + [Custom, CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Node appendChild(Node newChild); - boolean hasChildNodes(); - [CustomElementCallbacks, PerWorldBindings] - Node cloneNode(optional boolean deep); + [ImplementedAs=hasChildren] boolean hasChildNodes(); + [CustomElementCallbacks, DartCustom] Node cloneNode(optional boolean deep); [CustomElementCallbacks] void normalize(); // Introduced in DOM Level 2: - [TreatReturnedNullStringAs=Null, PerWorldBindings, MeasureAs=NodeNamespaceURI] readonly attribute DOMString namespaceURI; // Moved to Element and Attr in DOM4. - [TreatReturnedNullStringAs=Null, PerWorldBindings, MeasureAs=NodeLocalName] readonly attribute DOMString localName; // Moved to Element and Attr in DOM4. + [TreatReturnedNullStringAs=Null, MeasureAs=NodeNamespaceURI] readonly attribute DOMString namespaceURI; // Moved to Element and Attr in DOM4. + [TreatReturnedNullStringAs=Null, MeasureAs=NodeLocalName] readonly attribute DOMString localName; // Moved to Element and Attr in DOM4. // Introduced in DOM Level 3: - [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString baseURI; + [TreatReturnedNullStringAs=Null] readonly attribute DOMString baseURI; - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, CustomElementCallbacks] attribute DOMString textContent; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, TreatUndefinedAs=NullString, CustomElementCallbacks] attribute DOMString textContent; [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional Node other); // Removed in DOM4. boolean isEqualNode(Node other); @@ -85,7 +84,7 @@ unsigned short compareDocumentPosition(Node other); // Introduced in DOM4 - [ImplementedAs=containsIncludingShadowDOM] boolean contains(Node other); + boolean contains(Node other); // IE extensions [PerWorldBindings] readonly attribute Element parentElement;
diff --git a/core/dom/NodeFilter.idl b/core/dom/NodeFilter.idl index 58ac22e..7d52e40 100644 --- a/core/dom/NodeFilter.idl +++ b/core/dom/NodeFilter.idl
@@ -19,7 +19,8 @@ */ [ - DependentLifetime + DependentLifetime, + WillBeGarbageCollected, ] interface NodeFilter { // Constants returned by acceptNode const short FILTER_ACCEPT = 1; @@ -41,7 +42,6 @@ const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x00000400; const unsigned long SHOW_NOTATION = 0x00000800; - [CallWith=ScriptState] short acceptNode([Default=Undefined] optional Node n); + [RaisesException] short acceptNode([Default=Undefined] optional Node n); }; -
diff --git a/core/dom/NodeIterator.idl b/core/dom/NodeIterator.idl index c47c809..ef46701 100644 --- a/core/dom/NodeIterator.idl +++ b/core/dom/NodeIterator.idl
@@ -18,19 +18,19 @@ * Boston, MA 02110-1301, USA. */ -// Introduced in DOM Level 2: +// Introduced in DOM Level 2 [ - SetWrapperReferenceTo(NodeFilter filter) + SetWrapperReferenceTo(NodeFilter filter), + WillBeGarbageCollected, ] interface NodeIterator { readonly attribute Node root; readonly attribute unsigned long whatToShow; readonly attribute NodeFilter filter; - readonly attribute boolean expandEntityReferences; + [DeprecateAs=NodeIteratorExpandEntityReferences] readonly attribute boolean expandEntityReferences; readonly attribute Node referenceNode; readonly attribute boolean pointerBeforeReferenceNode; - [CallWith=ScriptState, RaisesException] Node nextNode(); - [CallWith=ScriptState, RaisesException] Node previousNode(); - void detach(); + [RaisesException] Node nextNode(); + [RaisesException] Node previousNode(); + [DeprecateAs=NodeIteratorDetach] void detach(); }; -
diff --git a/core/dom/NodeList.idl b/core/dom/NodeList.idl index b6f81a1..85a7be8 100644 --- a/core/dom/NodeList.idl +++ b/core/dom/NodeList.idl
@@ -21,7 +21,8 @@ [ DependentLifetime, SetWrapperReferenceFrom=virtualOwnerNode, + WillBeGarbageCollected, ] interface NodeList { - getter Node item(unsigned long index); - readonly attribute unsigned long length; + [DartNoAutoScope] getter Node item(unsigned long index); + [DartNoAutoScope] readonly attribute unsigned long length; };
diff --git a/core/dom/ParentNode.idl b/core/dom/ParentNode.idl index 8de54f8..dea4bfd 100644 --- a/core/dom/ParentNode.idl +++ b/core/dom/ParentNode.idl
@@ -1,9 +1,43 @@ +/* + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + [ - NoInterfaceObject, + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' ] interface ParentNode { [PerWorldBindings] readonly attribute HTMLCollection children; [PerWorldBindings] readonly attribute Element firstElementChild; [PerWorldBindings] readonly attribute Element lastElementChild; - [PerWorldBindings] readonly attribute unsigned long childElementCount; -}; + readonly attribute unsigned long childElementCount; + // NodeSelector - Selector API + [RaisesException] Element querySelector(DOMString selectors); + [RaisesException] NodeList querySelectorAll(DOMString selectors); +};
diff --git a/core/dom/Promise.idl b/core/dom/Promise.idl deleted file mode 100644 index 45989d4..0000000 --- a/core/dom/Promise.idl +++ /dev/null
@@ -1,46 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -callback PromiseInit = void (any resolve, any reject); -callback AnyCallback = any (optional any value); -[ - CustomConstructor(PromiseInit init), - GlobalContext=Window&WorkerGlobalScope, -] interface Promise { - [Custom] Promise then(optional AnyCallback fulfillCallback, optional AnyCallback rejectCallback); - [Custom] Promise catch(optional AnyCallback rejectCallback); - - [Custom] static Promise resolve(any value); - [Custom] static Promise reject(any value); - - [Custom] static Promise cast(any value); - [Custom] static Promise race(any iterable); - [Custom] static Promise all(any iterable); -};
diff --git a/core/dom/Range.idl b/core/dom/Range.idl index d3dd1eb..e73f6d3 100644 --- a/core/dom/Range.idl +++ b/core/dom/Range.idl
@@ -22,14 +22,15 @@ [ Constructor, ConstructorCallWith=Document, + WillBeGarbageCollected, ] interface Range { - [RaisesException=Getter] readonly attribute Node startContainer; - [RaisesException=Getter] readonly attribute long startOffset; - [RaisesException=Getter] readonly attribute Node endContainer; - [RaisesException=Getter] readonly attribute long endOffset; - [RaisesException=Getter] readonly attribute boolean collapsed; - [RaisesException=Getter] readonly attribute Node commonAncestorContainer; + readonly attribute Node startContainer; + readonly attribute long startOffset; + readonly attribute Node endContainer; + readonly attribute long endOffset; + readonly attribute boolean collapsed; + readonly attribute Node commonAncestorContainer; [RaisesException] void setStart(Node refNode, long offset); [RaisesException] void setEnd(Node refNode, long offset); @@ -37,7 +38,7 @@ [RaisesException] void setStartAfter(Node refNode); [RaisesException] void setEndBefore(Node refNode); [RaisesException] void setEndAfter(Node refNode); - [RaisesException] void collapse([Default=Undefined] optional boolean toStart); + void collapse([Default=Undefined] optional boolean toStart); [RaisesException] void selectNode(Node refNode); [RaisesException] void selectNodeContents(Node refNode); @@ -54,10 +55,10 @@ [RaisesException, CustomElementCallbacks] DocumentFragment cloneContents(); [RaisesException, CustomElementCallbacks] void insertNode(Node newNode); [RaisesException, CustomElementCallbacks] void surroundContents(Node newParent); - [RaisesException] Range cloneRange(); - [RaisesException] DOMString toString(); + Range cloneRange(); + DOMString toString(); - [RaisesException] void detach(); + [DeprecateAs=RangeDetach] void detach(); [RaisesException] boolean isPointInRange(Node refNode, long offset); [RaisesException] short comparePoint(Node refNode, long offset); @@ -81,7 +82,7 @@ const unsigned short NODE_BEFORE_AND_AFTER = 2; const unsigned short NODE_INSIDE = 3; - [RaisesException] short compareNode([Default=Undefined] optional Node refNode); + [RaisesException, MeasureAs=RangeCompareNode] short compareNode([Default=Undefined] optional Node refNode); - [RaisesException] void expand([Default=Undefined] optional DOMString unit); + [RaisesException, MeasureAs=RangeExpand] void expand([Default=Undefined] optional DOMString unit); };
diff --git a/core/dom/Text.idl b/core/dom/Text.idl index 57e6dc0..2e3f842 100644 --- a/core/dom/Text.idl +++ b/core/dom/Text.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ [ - Constructor([Default=NullString] optional DOMString data), + Constructor(optional DOMString data = null), ConstructorCallWith=Document, Custom=Wrap, ] interface Text : CharacterData { @@ -30,5 +30,5 @@ [MeasureAs=TextReplaceWholeText] Text replaceWholeText(DOMString content); // Removed from DOM4. // Shadow DOM API - [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints(); + NodeList getDestinationInsertionPoints(); };
diff --git a/core/dom/Touch.idl b/core/dom/Touch.idl index c748ec8..574d684 100644 --- a/core/dom/Touch.idl +++ b/core/dom/Touch.idl
@@ -23,17 +23,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface Touch { - readonly attribute long clientX; - readonly attribute long clientY; - readonly attribute long screenX; - readonly attribute long screenY; - readonly attribute long pageX; - readonly attribute long pageY; +[ + WillBeGarbageCollected, +] interface Touch { + readonly attribute double clientX; + readonly attribute double clientY; + readonly attribute double screenX; + readonly attribute double screenY; + readonly attribute double pageX; + readonly attribute double pageY; readonly attribute EventTarget target; readonly attribute unsigned long identifier; - readonly attribute long webkitRadiusX; - readonly attribute long webkitRadiusY; - readonly attribute float webkitRotationAngle; - readonly attribute float webkitForce; + [MeasureAs=PrefixedTouchRadiusX] readonly attribute double webkitRadiusX; + [MeasureAs=PrefixedTouchRadiusY] readonly attribute double webkitRadiusY; + [MeasureAs=PrefixedTouchRotationAngle] readonly attribute float webkitRotationAngle; + [MeasureAs=PrefixedTouchForce] readonly attribute float webkitForce; };
diff --git a/core/dom/TouchList.idl b/core/dom/TouchList.idl index 351a59c..516946d 100644 --- a/core/dom/TouchList.idl +++ b/core/dom/TouchList.idl
@@ -23,7 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface TouchList { +[ + WillBeGarbageCollected, +] interface TouchList { readonly attribute unsigned long length; getter Touch item(unsigned long index);
diff --git a/core/dom/TreeWalker.idl b/core/dom/TreeWalker.idl index eecb1ed..2fb6eb5 100644 --- a/core/dom/TreeWalker.idl +++ b/core/dom/TreeWalker.idl
@@ -18,22 +18,22 @@ * Boston, MA 02110-1301, USA. */ -// Introduced in DOM Level 2: +// Introduced in DOM Level 2 [ - SetWrapperReferenceTo(NodeFilter filter) + SetWrapperReferenceTo(NodeFilter filter), + WillBeGarbageCollected, ] interface TreeWalker { readonly attribute Node root; readonly attribute unsigned long whatToShow; readonly attribute NodeFilter filter; - readonly attribute boolean expandEntityReferences; + [DeprecateAs=TreeWalkerExpandEntityReferences] readonly attribute boolean expandEntityReferences; [RaisesException=Setter] attribute Node currentNode; - [CallWith=ScriptState] Node parentNode(); - [CallWith=ScriptState] Node firstChild(); - [CallWith=ScriptState] Node lastChild(); - [CallWith=ScriptState] Node previousSibling(); - [CallWith=ScriptState] Node nextSibling(); - [CallWith=ScriptState] Node previousNode(); - [CallWith=ScriptState] Node nextNode(); + [RaisesException] Node parentNode(); + [RaisesException] Node firstChild(); + [RaisesException] Node lastChild(); + [RaisesException] Node previousSibling(); + [RaisesException] Node nextSibling(); + [RaisesException] Node previousNode(); + [RaisesException] Node nextNode(); }; -
diff --git a/core/dom/URL.idl b/core/dom/URL.idl index 67dbb1e..37b8051 100644 --- a/core/dom/URL.idl +++ b/core/dom/URL.idl
@@ -24,15 +24,21 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://url.spec.whatwg.org/#url + [ - GlobalContext=Window&WorkerGlobalScope, - RaisesException=Constructor, Constructor(DOMString url), - Constructor(DOMString url, URL base), Constructor(DOMString url, DOMString base), - ImplementedAs=DOMURL + Constructor(DOMString url, URL base), + Exposed=Window&Worker, + ImplementedAs=DOMURL, + RaisesException=Constructor, + WillBeGarbageCollected, ] interface URL { - [CallWith=ExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob); + // FIXME: should be in separate URLBlob.idl partial interface definition + // http://dev.w3.org/2006/webapi/FileAPI/#URL-object + // FIXME: should not be nullable + [RaisesException, CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob); [CallWith=ExecutionContext] static void revokeObjectURL(DOMString url); };
diff --git a/core/dom/URLUtils.idl b/core/dom/URLUtils.idl index 9cb7b48..26ed382 100644 --- a/core/dom/URLUtils.idl +++ b/core/dom/URLUtils.idl
@@ -23,15 +23,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://url.spec.whatwg.org/#urlutils + [ - NoInterfaceObject, - ImplementedAs=DOMURLUtils + NoInterfaceObject, // Always used on target of 'implements' ] interface URLUtils { - attribute DOMString href; - + // FIXME: should be stringifier: http://crbug.com/306606 + // stringifier attribute DOMString href; + [PerWorldBindings, LogActivity=SetterOnly, LogPreviousValue] attribute DOMString href; [NotEnumerable, ImplementedAs=href] DOMString toString(); - readonly attribute DOMString origin; + attribute DOMString protocol; attribute DOMString username; attribute DOMString password; @@ -40,10 +42,7 @@ attribute DOMString port; attribute DOMString pathname; attribute DOMString search; - // Not yet implemented. - // attribute URLQuery? query; - + // attribute URLSearchParams searchParams; attribute DOMString hash; }; -
diff --git a/core/dom/URLUtilsReadOnly.idl b/core/dom/URLUtilsReadOnly.idl index 0d36b46..ccd26f7 100644 --- a/core/dom/URLUtilsReadOnly.idl +++ b/core/dom/URLUtilsReadOnly.idl
@@ -23,13 +23,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - NoInterfaceObject, - ImplementedAs=DOMURLUtilsReadOnly -] interface URLUtilsReadOnly { - readonly attribute DOMString href; +// http://url.spec.whatwg.org/#urlutilsreadonly +[ + NoInterfaceObject, // Always used on target of 'implements' +] interface URLUtilsReadOnly { + // FIXME: should be stringifier: http://crbug.com/306606 + // stringifier readonly attribute DOMString href; + readonly attribute DOMString href; [NotEnumerable, ImplementedAs=href] DOMString toString(); + // Not yet implemented. + // readonly attribute DOMString origin; readonly attribute DOMString protocol; readonly attribute DOMString host;
diff --git a/core/dom/shadow/ShadowRoot.idl b/core/dom/shadow/ShadowRoot.idl index 241c2f6..c7d26bb 100644 --- a/core/dom/shadow/ShadowRoot.idl +++ b/core/dom/shadow/ShadowRoot.idl
@@ -24,15 +24,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - NoInterfaceObject -] interface ShadowRoot : DocumentFragment { +interface ShadowRoot : DocumentFragment { readonly attribute Element activeElement; - [DeprecateAs=ShadowRootApplyAuthorStyles] attribute boolean applyAuthorStyles; - attribute boolean resetStyleInheritance; - [RuntimeEnabled=ShadowDOM, ImplementedAs=olderShadowRootForBindings] readonly attribute ShadowRoot olderShadowRoot; - [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, RaisesException=Setter] attribute DOMString innerHTML; + [ImplementedAs=olderShadowRootForBindings] readonly attribute ShadowRoot olderShadowRoot; + + [TreatNullAs=NullString, CustomElementCallbacks, LogActivity=SetterOnly, RaisesException=Setter] attribute DOMString innerHTML; [RaisesException] Node cloneNode([Default=Undefined] optional boolean deep); Selection getSelection(); @@ -45,6 +42,6 @@ Element elementFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y); - [RuntimeEnabled=ShadowDOM] readonly attribute StyleSheetList styleSheets; - [RuntimeEnabled=ShadowDOM] readonly attribute Element host; + readonly attribute StyleSheetList styleSheets; + readonly attribute Element host; };
diff --git a/core/events/AnimationPlayerEvent.idl b/core/events/AnimationPlayerEvent.idl new file mode 100644 index 0000000..a719ec7 --- /dev/null +++ b/core/events/AnimationPlayerEvent.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + EventConstructor, + RuntimeEnabled=WebAnimationsAPI, +] interface AnimationPlayerEvent : Event { + [InitializedByEventConstructor] readonly attribute double currentTime; + [InitializedByEventConstructor] readonly attribute double timelineTime; +}; +
diff --git a/core/events/ApplicationCacheErrorEvent.idl b/core/events/ApplicationCacheErrorEvent.idl new file mode 100644 index 0000000..c69c3f7 --- /dev/null +++ b/core/events/ApplicationCacheErrorEvent.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + EventConstructor, +] interface ApplicationCacheErrorEvent : Event { + [InitializedByEventConstructor] readonly attribute DOMString reason; + [InitializedByEventConstructor] readonly attribute DOMString url; + [InitializedByEventConstructor] readonly attribute unsigned short status; + [InitializedByEventConstructor] readonly attribute DOMString message; +};
diff --git a/core/events/Event.idl b/core/events/Event.idl index 3f8e80b..58a832a 100644 --- a/core/events/Event.idl +++ b/core/events/Event.idl
@@ -20,6 +20,7 @@ // Introduced in DOM Level 2: [ + WillBeGarbageCollected, Custom=Wrap, EventConstructor, ] interface Event { @@ -67,11 +68,9 @@ void stopImmediatePropagation(); // IE Extensions - readonly attribute EventTarget srcElement; - [ImplementedAs=legacyReturnValue, DeprecateAs=EventReturnValue] attribute boolean returnValue; - attribute boolean cancelBubble; - - [RuntimeEnabled=ShadowDOM] readonly attribute NodeList path; - - [Custom=Getter] readonly attribute Clipboard clipboardData; + [MeasureAs=EventSrcElement] readonly attribute EventTarget srcElement; + [CallWith=ExecutionContext, ImplementedAs=legacyReturnValue, MeasureAs=EventReturnValue] attribute boolean returnValue; + [MeasureAs=EventCancelBubble] attribute boolean cancelBubble; + [MeasureAs=EventPath] readonly attribute NodeList path; + [Custom=Getter, MeasureAs=EventClipboardData] readonly attribute DataTransfer clipboardData; };
diff --git a/core/events/EventTarget.idl b/core/events/EventTarget.idl index 0cd1b17..69a4bc1 100644 --- a/core/events/EventTarget.idl +++ b/core/events/EventTarget.idl
@@ -20,12 +20,15 @@ [ Custom=ToV8, + WillBeGarbageCollected, ] interface EventTarget { - void addEventListener(DOMString type, - EventListener listener, + // FIXME: first 2 args should be required, but throwing TypeError breaks + // legacy content. http://crbug.com/353484 + void addEventListener([TreatNullAs=NullString] optional DOMString type, + optional EventListener listener, optional boolean useCapture); - void removeEventListener(DOMString type, - EventListener listener, + void removeEventListener([TreatNullAs=NullString] optional DOMString type, + optional EventListener listener, optional boolean useCapture); [RaisesException] boolean dispatchEvent(Event event); };
diff --git a/core/events/MessageEvent.idl b/core/events/MessageEvent.idl index b830e16..b9e155b 100644 --- a/core/events/MessageEvent.idl +++ b/core/events/MessageEvent.idl
@@ -27,7 +27,7 @@ [ EventConstructor, - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, RaisesException=Constructor, Custom=Wrap, ] interface MessageEvent : Event { @@ -44,13 +44,4 @@ [Default=Undefined] optional DOMString lastEventIdArg, [Default=Undefined] optional Window sourceArg, [Default=Undefined] optional MessagePort[] messagePorts); - - [Custom, MeasureAs=PrefixedInitMessageEvent] void webkitInitMessageEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional any dataArg, - [Default=Undefined] optional DOMString originArg, - [Default=Undefined] optional DOMString lastEventIdArg, - [Default=Undefined] optional Window sourceArg, - [Default=Undefined] optional MessagePort[] transferables); };
diff --git a/core/events/MouseEvent.idl b/core/events/MouseEvent.idl index 7dd8284..f5b03c8 100644 --- a/core/events/MouseEvent.idl +++ b/core/events/MouseEvent.idl
@@ -30,8 +30,10 @@ [InitializedByEventConstructor] readonly attribute boolean metaKey; [InitializedByEventConstructor] readonly attribute unsigned short button; [InitializedByEventConstructor] readonly attribute EventTarget? relatedTarget; - readonly attribute long webkitMovementX; - readonly attribute long webkitMovementY; + [MeasureAs=MouseEventMovementX] readonly attribute long movementX; + [MeasureAs=MouseEventMovementY] readonly attribute long movementY; + [MeasureAs=PrefixedMouseEventMovementX, ImplementedAs=movementX] readonly attribute long webkitMovementX; + [MeasureAs=PrefixedMouseEventMovementY, ImplementedAs=movementY] readonly attribute long webkitMovementY; void initMouseEvent([Default=Undefined] optional DOMString type, [Default=Undefined] optional boolean canBubble, @@ -57,6 +59,6 @@ readonly attribute Node fromElement; readonly attribute Node toElement; - readonly attribute Clipboard dataTransfer; + readonly attribute DataTransfer dataTransfer; };
diff --git a/core/events/NavigatorEvents.idl b/core/events/NavigatorEvents.idl index 2b83961..ed3d206 100644 --- a/core/events/NavigatorEvents.idl +++ b/core/events/NavigatorEvents.idl
@@ -29,5 +29,5 @@ */ partial interface Navigator { - [RuntimeEnabled=PointerEventsMaxTouchPoints] readonly attribute long maxTouchPoints; + readonly attribute long maxTouchPoints; };
diff --git a/core/events/TouchEvent.idl b/core/events/TouchEvent.idl index f4b396e..36f0ac5 100644 --- a/core/events/TouchEvent.idl +++ b/core/events/TouchEvent.idl
@@ -36,10 +36,10 @@ [Default=Undefined] optional TouchList changedTouches, [Default=Undefined] optional DOMString type, [Default=Undefined] optional Window view, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long clientX, - [Default=Undefined] optional long clientY, + [Default=Undefined] optional long unused1, + [Default=Undefined] optional long unused2, + [Default=Undefined] optional long unused3, + [Default=Undefined] optional long unused4, [Default=Undefined] optional boolean ctrlKey, [Default=Undefined] optional boolean altKey, [Default=Undefined] optional boolean shiftKey,
diff --git a/core/events/WheelEvent.idl b/core/events/WheelEvent.idl index 1cba713..6c7acff 100644 --- a/core/events/WheelEvent.idl +++ b/core/events/WheelEvent.idl
@@ -39,8 +39,10 @@ readonly attribute long wheelDelta; // WebKit Extension + [MeasureAs=PrefixedWheelEventDirectionInvertedFromDevice] readonly attribute boolean webkitDirectionInvertedFromDevice; + [MeasureAs=PrefixedWheelEventInit] void initWebKitWheelEvent([Default=Undefined] optional long wheelDeltaX, [Default=Undefined] optional long wheelDeltaY, [Default=Undefined] optional Window view,
diff --git a/core/fileapi/Blob.idl b/core/fileapi/Blob.idl index 28fd1aa..df6662d 100644 --- a/core/fileapi/Blob.idl +++ b/core/fileapi/Blob.idl
@@ -29,14 +29,16 @@ */ [ + WillBeGarbageCollected, CustomConstructor, CustomConstructor(sequence<any> blobParts, optional BlobPropertyBag options), - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, SpecialWrapFor=File, ] interface Blob { readonly attribute unsigned long long size; readonly attribute DOMString type; - Blob slice(optional long long start, optional long long end, [TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString contentType); + [RaisesException] Blob slice(optional long long start, optional long long end, [TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString contentType); + [RaisesException, CallWith=ExecutionContext, RuntimeEnabled=FileAPIBlobClose] void close(); };
diff --git a/core/fileapi/File.idl b/core/fileapi/File.idl index 4640ad3..db6c425 100644 --- a/core/fileapi/File.idl +++ b/core/fileapi/File.idl
@@ -25,10 +25,10 @@ [ CustomConstructor(sequence<any> blobParts, DOMString fileName, optional BlobPropertyBag options), - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, ] interface File : Blob { readonly attribute DOMString name; [Custom=Getter, MeasureAs=FileGetLastModifiedDate] readonly attribute Date lastModifiedDate; [Custom=Getter, RuntimeEnabled=FileConstructor] readonly attribute long long lastModified; - readonly attribute DOMString webkitRelativePath; + [MeasureAs=PrefixedFileRelativePath] readonly attribute DOMString webkitRelativePath; };
diff --git a/core/fileapi/FileList.idl b/core/fileapi/FileList.idl index a2a2472..d822313 100644 --- a/core/fileapi/FileList.idl +++ b/core/fileapi/FileList.idl
@@ -24,6 +24,7 @@ */ [ + WillBeGarbageCollected ] interface FileList { readonly attribute unsigned long length; getter File item(unsigned long index);
diff --git a/core/fileapi/FileReader.idl b/core/fileapi/FileReader.idl index 6faafff..07bb5a8 100644 --- a/core/fileapi/FileReader.idl +++ b/core/fileapi/FileReader.idl
@@ -30,10 +30,11 @@ */ [ + WillBeGarbageCollected, ActiveDOMObject, Constructor, ConstructorCallWith=ExecutionContext, - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker ] interface FileReader : EventTarget { // ready states const unsigned short EMPTY = 0;
diff --git a/core/fileapi/FileReaderSync.idl b/core/fileapi/FileReaderSync.idl index 125e002..8a15084 100644 --- a/core/fileapi/FileReaderSync.idl +++ b/core/fileapi/FileReaderSync.idl
@@ -29,7 +29,8 @@ */ [ - GlobalContext=WorkerGlobalScope, + WillBeGarbageCollected, + Exposed=Worker, Constructor ] interface FileReaderSync { [CallWith=ExecutionContext, RaisesException] ArrayBuffer readAsArrayBuffer(Blob blob);
diff --git a/core/fileapi/Stream.idl b/core/fileapi/Stream.idl index 1406b7b..11f03fd 100644 --- a/core/fileapi/Stream.idl +++ b/core/fileapi/Stream.idl
@@ -38,7 +38,8 @@ [ RuntimeEnabled=Stream, - ActiveDOMObject + ActiveDOMObject, + WillBeGarbageCollected ] interface Stream { readonly attribute DOMString type; };
diff --git a/core/frame/BarProp.idl b/core/frame/BarProp.idl index cc9ce71..a7be530 100644 --- a/core/frame/BarProp.idl +++ b/core/frame/BarProp.idl
@@ -26,7 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface BarProp { +[ + WillBeGarbageCollected, +] interface BarProp { readonly attribute boolean visible; };
diff --git a/core/frame/ConsoleBase.idl b/core/frame/ConsoleBase.idl index b63a7f5..26f9cde 100644 --- a/core/frame/ConsoleBase.idl +++ b/core/frame/ConsoleBase.idl
@@ -29,6 +29,7 @@ [ NoInterfaceObject, + WillBeGarbageCollected, ] interface ConsoleBase { [CallWith=ScriptArguments&ScriptState] void debug(); [CallWith=ScriptArguments&ScriptState] void error(); @@ -39,19 +40,19 @@ [CallWith=ScriptArguments&ScriptState] void dirxml(); [CallWith=ScriptArguments&ScriptState] void table(); [CallWith=ScriptArguments&ScriptState] void trace(); - [CallWith=ScriptArguments&ScriptState, ImplementedAs=assertCondition] void assert([Default=Undefined] optional boolean condition); + [CallWith=ScriptArguments&ScriptState, ImplementedAs=assertCondition, DartName=assertCondition] void assert([Default=Undefined] optional boolean condition); [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 profileEnd([Default=NullString] optional DOMString title); + [CallWith=ScriptState] void profile(optional DOMString title = null); + [CallWith=ScriptState] void profileEnd(optional DOMString title = null); - void time([Default=NullString] optional DOMString title); - [CallWith=ScriptState] void timeEnd([Default=NullString] optional DOMString title); - void timeStamp([Default=NullString] optional DOMString title); + void time(optional DOMString title = null); + [CallWith=ScriptState] void timeEnd(optional DOMString title = null); + void timeStamp(optional DOMString title = null); - [CallWith=ScriptState] void timeline([Default=NullString] optional DOMString title); - [CallWith=ScriptState] void timelineEnd([Default=NullString] optional DOMString title); + [CallWith=ScriptState] void timeline(optional DOMString title = null); + [CallWith=ScriptState] void timelineEnd(optional DOMString title = null); [CallWith=ScriptArguments&ScriptState] void group(); [CallWith=ScriptArguments&ScriptState] void groupCollapsed();
diff --git a/core/frame/History.idl b/core/frame/History.idl index 6bd6439..4060604 100644 --- a/core/frame/History.idl +++ b/core/frame/History.idl
@@ -23,7 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface History { +[ + WillBeGarbageCollected, +] interface History { readonly attribute unsigned long length; [Custom=Getter] readonly attribute SerializedScriptValue state;
diff --git a/core/frame/ImageBitmap.idl b/core/frame/ImageBitmap.idl index 903a2d7..b211d6e 100644 --- a/core/frame/ImageBitmap.idl +++ b/core/frame/ImageBitmap.idl
@@ -3,6 +3,7 @@ // found in the LICENSE file. [ + WillBeGarbageCollected, ] interface ImageBitmap { readonly attribute long width; readonly attribute long height;
diff --git a/core/frame/Location.idl b/core/frame/Location.idl index 5ce2990..25a0110 100644 --- a/core/frame/Location.idl +++ b/core/frame/Location.idl
@@ -28,26 +28,27 @@ [ CheckSecurity=Frame, + WillBeGarbageCollected, ] interface Location { // |assign|, |replace|, and *writing* |href| do not require a security // check, as they *change* the page, and thus these do not change any // property of an *existing* document at a different origin. // However, *reading* |href|, or accessing any component, is a security // problem, since that allows tracking navigation. - [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity=Setter, Unforgeable] attribute DOMString href; + [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity=Setter, Unforgeable, DartCustom=Setter] attribute DOMString href; - [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] void assign(DOMString url); - [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] void replace(DOMString url); - [CallWith=ActiveWindow, Unforgeable, ReadOnly] void reload(); + [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, LogActivity, DartCustom] void assign(DOMString url); + [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, LogActivity, DartCustom] void replace(DOMString url); + [CallWith=ActiveWindow, Unforgeable, ReadOnly, DartCustom] void reload(); // URI decomposition attributes - [SetterCallWith=ActiveWindow&FirstWindow, RaisesException=Setter] attribute DOMString protocol; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString host; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hostname; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString port; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString pathname; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString search; - [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hash; + [SetterCallWith=ActiveWindow&FirstWindow, RaisesException=Setter, DartCustom=Setter] attribute DOMString protocol; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString host; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString hostname; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString port; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString pathname; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString search; + [SetterCallWith=ActiveWindow&FirstWindow, DartCustom=Setter] attribute DOMString hash; readonly attribute DOMString origin;
diff --git a/core/frame/Navigator.idl b/core/frame/Navigator.idl index 546e3e0..07fb6a2 100644 --- a/core/frame/Navigator.idl +++ b/core/frame/Navigator.idl
@@ -17,12 +17,16 @@ Boston, MA 02110-1301, USA. */ -interface Navigator { - readonly attribute DOMString language; +// http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#navigator + +[ + WillBeGarbageCollected, +] interface Navigator { + // FIXME: move these 3 to NavigatorPlugins readonly attribute PluginArray plugins; readonly attribute MimeTypeArray mimeTypes; - readonly attribute boolean cookieEnabled; boolean javaEnabled(); + readonly attribute boolean cookieEnabled; // FIXME: move to NavigatorStorageUtils void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates. @@ -32,5 +36,7 @@ [MeasureAs=NavigatorVendorSub] readonly attribute DOMString vendorSub; }; +Navigator implements NavigatorCPU; Navigator implements NavigatorID; +Navigator implements NavigatorLanguage; Navigator implements NavigatorOnLine;
diff --git a/core/frame/NavigatorCPU.idl b/core/frame/NavigatorCPU.idl new file mode 100644 index 0000000..8ec502c --- /dev/null +++ b/core/frame/NavigatorCPU.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, +] interface NavigatorCPU { + readonly attribute unsigned long hardwareConcurrency; +};
diff --git a/core/frame/NavigatorID.idl b/core/frame/NavigatorID.idl index c581ad9..0cbd745 100644 --- a/core/frame/NavigatorID.idl +++ b/core/frame/NavigatorID.idl
@@ -28,13 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/#navigatorid + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface NavigatorID { + readonly attribute DOMString appCodeName; // constant "Mozilla" readonly attribute DOMString appName; readonly attribute DOMString appVersion; readonly attribute DOMString platform; + readonly attribute DOMString product; // constant "Gecko" readonly attribute DOMString userAgent; - readonly attribute DOMString appCodeName; - readonly attribute DOMString product; + + readonly attribute boolean dartEnabled; };
diff --git a/core/frame/NavigatorLanguage.idl b/core/frame/NavigatorLanguage.idl new file mode 100644 index 0000000..fe689f6 --- /dev/null +++ b/core/frame/NavigatorLanguage.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, +] interface NavigatorLanguage { + readonly attribute DOMString? language; + [CachedAttribute=hasLanguagesChanged] readonly attribute DOMString[] languages; +};
diff --git a/core/frame/NavigatorOnLine.idl b/core/frame/NavigatorOnLine.idl index db4b08c..9268e63 100644 --- a/core/frame/NavigatorOnLine.idl +++ b/core/frame/NavigatorOnLine.idl
@@ -28,8 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/#navigatoronline + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface NavigatorOnLine { readonly attribute boolean onLine; };
diff --git a/core/frame/PRESUBMIT.py b/core/frame/PRESUBMIT.py new file mode 100644 index 0000000..eba4c2f --- /dev/null +++ b/core/frame/PRESUBMIT.py
@@ -0,0 +1,57 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Blink frame presubmit script + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into gcl. +""" + + +def _RunUseCounterChecks(input_api, output_api): + for f in input_api.AffectedFiles(): + if f.LocalPath().endswith('UseCounter.cpp'): + useCounterCpp = f + break + else: + return [] + + largestFoundBucket = 0 + maximumBucket = 0 + # Looking for a line like "case CSSPropertyGrid: return 453;" + bucketFinder = input_api.re.compile(r'.*CSSProperty.*return\s*([0-9]+).*') + # Looking for a line like "static int maximumCSSSampleId() { return 452; }" + maximumFinder = input_api.re.compile( + r'static int maximumCSSSampleId\(\) { return ([0-9]+)') + for line in useCounterCpp.NewContents(): + bucketMatch = bucketFinder.match(line) + if bucketMatch: + bucket = int(bucketMatch.group(1)) + largestFoundBucket = max(largestFoundBucket, bucket) + else: + maximumMatch = maximumFinder.match(line) + if maximumMatch: + maximumBucket = int(maximumMatch.group(1)) + + if largestFoundBucket != maximumBucket: + if input_api.is_committing: + message_type = output_api.PresubmitError + else: + message_type = output_api.PresubmitPromptWarning + + return [message_type( + 'Largest found CSSProperty bucket Id (%d) does not match ' + 'maximumCSSSampleId (%d)' % + (largestFoundBucket, maximumBucket), + items=[useCounterCpp.LocalPath()])] + + return [] + + +def CheckChangeOnUpload(input_api, output_api): + return _RunUseCounterChecks(input_api, output_api) + + +def CheckChangeOnCommit(input_api, output_api): + return _RunUseCounterChecks(input_api, output_api)
diff --git a/core/frame/Screen.idl b/core/frame/Screen.idl index 8eeca83..a0b6385 100644 --- a/core/frame/Screen.idl +++ b/core/frame/Screen.idl
@@ -27,7 +27,9 @@ */ -interface Screen : EventTarget { +[ + WillBeGarbageCollected, +] interface Screen { readonly attribute unsigned long height; readonly attribute unsigned long width; readonly attribute unsigned long colorDepth;
diff --git a/core/frame/WebKitPoint.idl b/core/frame/WebKitPoint.idl index 88b4be2..bddd675 100644 --- a/core/frame/WebKitPoint.idl +++ b/core/frame/WebKitPoint.idl
@@ -27,6 +27,7 @@ CustomConstructor, CustomConstructor(float x, float y), ImplementedAs=DOMPoint, + WillBeGarbageCollected, ] interface WebKitPoint { attribute float x; attribute float y;
diff --git a/core/frame/Window.idl b/core/frame/Window.idl index c418b52..3e75b0b 100644 --- a/core/frame/Window.idl +++ b/core/frame/Window.idl
@@ -30,20 +30,22 @@ [ CheckSecurity=Frame, Custom=ToV8, - ImplementedAs=DOMWindow, + ImplementedAs=LocalDOMWindow, + PrimaryGlobal, + WillBeGarbageCollected, ] interface Window : EventTarget { // DOM Level 0 - [Replaceable] readonly attribute Screen screen; - [Replaceable] readonly attribute History history; - [Replaceable] readonly attribute BarProp locationbar; - [Replaceable] readonly attribute BarProp menubar; - [Replaceable] readonly attribute BarProp personalbar; - [Replaceable] readonly attribute BarProp scrollbars; - [Replaceable] readonly attribute BarProp statusbar; - [Replaceable] readonly attribute BarProp toolbar; - [Replaceable, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds] readonly attribute Navigator navigator; + readonly attribute Screen screen; + readonly attribute History history; + [Replaceable, MeasureAs=BarPropLocationbar] readonly attribute BarProp locationbar; + [Replaceable, MeasureAs=BarPropMenubar] readonly attribute BarProp menubar; + [Replaceable, MeasureAs=BarPropPersonalbar] readonly attribute BarProp personalbar; + [Replaceable, MeasureAs=BarPropScrollbars] readonly attribute BarProp scrollbars; + [Replaceable, MeasureAs=BarPropStatusbar] readonly attribute BarProp statusbar; + [Replaceable, MeasureAs=BarPropToolbar] readonly attribute BarProp toolbar; + [LogActivity=GetterOnly] readonly attribute Navigator navigator; [Replaceable] readonly attribute Navigator clientInformation; - [DoNotCheckSecurity, Unforgeable, Replaceable, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, PutForwards=href] readonly attribute Location location; + [DoNotCheckSecurity, Unforgeable, Replaceable, LogActivity, PutForwards=href] readonly attribute Location location; [Custom, MeasureAs=WindowEvent, NotEnumerable] attribute Event event; Selection getSelection(); @@ -61,14 +63,15 @@ DOMString name, optional DOMString options); - [Custom] any showModalDialog(DOMString url, + [RuntimeEnabled=ShowModalDialog, Custom] any showModalDialog(DOMString url, optional any dialogArgs, optional DOMString featureArgs); - void alert([Default=NullString] optional DOMString message); - boolean confirm([Default=NullString] optional DOMString message); - [TreatReturnedNullStringAs=Null] DOMString prompt([Default=NullString] optional DOMString message, - [Default=NullString] optional DOMString defaultValue); + void alert(); + void alert(DOMString message); + boolean confirm(optional DOMString message = null); + [TreatReturnedNullStringAs=Null] DOMString prompt(optional DOMString message = null, + optional DOMString defaultValue = null); boolean find([Default=Undefined] optional DOMString string, [Default=Undefined] optional boolean caseSensitive, @@ -78,7 +81,7 @@ [Default=Undefined] optional boolean searchInFrames, [Default=Undefined] optional boolean showDialog); - [Replaceable] readonly attribute boolean offscreenBuffering; + [Replaceable, MeasureAs=WindowOffscreenBuffering] readonly attribute boolean offscreenBuffering; [Replaceable] readonly attribute long outerHeight; [Replaceable] readonly attribute long outerWidth; @@ -93,17 +96,14 @@ readonly attribute long pageXOffset; readonly attribute long pageYOffset; - // FIXME: should be: - // void scrollBy(long x, long y); - // [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollBy(long x, long y, optional Dictionary scrollOptions); - // void scrollTo(long x, long y); - // [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollTo(long x, long y, optional Dictionary scrollOptions); - // void scroll(long x, long y); - // [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scroll(long x, long y, optional Dictionary scrollOptions); - // http://crbug.com/339000 - [RaisesException] void scrollBy(long x, long y, optional Dictionary scrollOptions); - [RaisesException] void scrollTo(long x, long y, optional Dictionary scrollOptions); - [RaisesException] void scroll(long x, long y, optional Dictionary scrollOptions); + // Overloading can be replaced by optional if RuntimeEnabled is removed, by + // changing the third argument to *optional* Dictionary scrollOptions + void scrollBy(long x, long y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollBy(long x, long y, Dictionary scrollOptions); + void scrollTo(long x, long y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollTo(long x, long y, Dictionary scrollOptions); + void scroll(long x, long y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scroll(long x, long y, Dictionary scrollOptions); void moveBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats. void moveTo([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats. void resizeBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats. @@ -116,9 +116,9 @@ attribute DOMString name; attribute DOMString status; - attribute DOMString defaultStatus; + [MeasureAs=WindowDefaultStatus] attribute DOMString defaultStatus; // This attribute is an alias of defaultStatus and is necessary for legacy uses. - [ImplementedAs=defaultStatus] attribute DOMString defaultstatus; + [ImplementedAs=defaultStatus, MeasureAs=WindowDefaultstatus] attribute DOMString defaultstatus; // Self referential attributes [Replaceable, DoNotCheckSecurity] readonly attribute Window self; @@ -139,29 +139,29 @@ readonly attribute StyleMedia styleMedia; // DOM Level 2 Style Interface - [PerWorldBindings] CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element, - [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement); + CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element, + [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString pseudoElement); // WebKit extensions - CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element, - [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement); + [MeasureAs=GetMatchedCSSRules] CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element, + [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString pseudoElement); [Replaceable] readonly attribute double devicePixelRatio; - WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node, - [Default=Undefined] optional WebKitPoint p); - WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node, - [Default=Undefined] optional WebKitPoint p); + [MeasureAs=PrefixedConvertPointFromPageToNode] WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node, + [Default=Undefined] optional WebKitPoint p); + [MeasureAs=PrefixedConvertPointFromNodeToPage] WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node, + [Default=Undefined] optional WebKitPoint p); - [RuntimeEnabled=ApplicationCache, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds] readonly attribute ApplicationCache applicationCache; + [RuntimeEnabled=ApplicationCache, LogActivity=GetterOnly] readonly attribute ApplicationCache applicationCache; - [RuntimeEnabled=SessionStorage, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds, RaisesException=Getter] readonly attribute Storage sessionStorage; - [RuntimeEnabled=LocalStorage, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds, RaisesException=Getter] readonly attribute Storage localStorage; + [RuntimeEnabled=SessionStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage sessionStorage; + [RuntimeEnabled=LocalStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage localStorage; // This is the interface orientation in degrees. Some examples are: // 0 is straight up; -90 is when the device is rotated 90 clockwise; // 90 is when rotated counter clockwise. - [RuntimeEnabled=OrientationEvent] readonly attribute long orientation; + [RuntimeEnabled=OrientationEvent, MeasureAs=WindowOrientation] readonly attribute long orientation; [Replaceable] readonly attribute Console console; @@ -172,9 +172,9 @@ [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(RequestAnimationFrameCallback callback); void cancelAnimationFrame(long id); - [MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback); - [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id); - [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix. + [DeprecateAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback); + [DeprecateAs=PrefixedCancelAnimationFrame, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id); + [DeprecateAs=PrefixedCancelRequestAnimationFrame, ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); [Replaceable] readonly attribute CSS CSS; @@ -182,8 +182,6 @@ [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationend; [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationiteration; [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationstart; - [RuntimeEnabled=DeviceMotion] attribute EventHandler ondevicemotion; - [RuntimeEnabled=DeviceOrientation] attribute EventHandler ondeviceorientation; [RuntimeEnabled=OrientationEvent] attribute EventHandler onorientationchange; attribute EventHandler onsearch; [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; @@ -195,44 +193,16 @@ attribute EventHandler onwebkitanimationiteration; attribute EventHandler onwebkitanimationstart; attribute EventHandler onwebkittransitionend; - [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel; + [LogActivity=SetterOnly] attribute EventHandler onwheel; - [DeprecateAs=CaptureEvents] void captureEvents(); - [DeprecateAs=ReleaseEvents] void releaseEvents(); + [MeasureAs=WindowCaptureEvents] void captureEvents(); + [MeasureAs=WindowReleaseEvents] void releaseEvents(); // Additional constructors. - attribute TransitionEventConstructor WebKitTransitionEvent; + [MeasureAs=PrefixedTransitionEventConstructor] attribute TransitionEventConstructor WebKitTransitionEvent; [RuntimeEnabled=CSSAnimationUnprefixed] attribute WebKitAnimationEventConstructor AnimationEvent; - attribute URLConstructor webkitURL; // FIXME: deprecate this. - attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this. - attribute IDBCursorConstructor webkitIDBCursor; - attribute IDBDatabaseConstructor webkitIDBDatabase; - attribute IDBFactoryConstructor webkitIDBFactory; - attribute IDBIndexConstructor webkitIDBIndex; - attribute IDBKeyRangeConstructor webkitIDBKeyRange; - attribute IDBObjectStoreConstructor webkitIDBObjectStore; - attribute IDBRequestConstructor webkitIDBRequest; - attribute IDBTransactionConstructor webkitIDBTransaction; - - // Constructors whose name does not match the interface name. - // FIXME: Remove these once [ImplementedAs] is used and once constructor names match interface names. - [RuntimeEnabled=MediaStream] attribute MediaStreamConstructor webkitMediaStream; - [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute AudioContextConstructor webkitAudioContext; - [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute OfflineAudioContextConstructor webkitOfflineAudioContext; - [RuntimeEnabled=PeerConnection] attribute RTCPeerConnectionConstructor webkitRTCPeerConnection; - [RuntimeEnabled=ScriptedSpeech] attribute SpeechGrammarConstructor webkitSpeechGrammar; - [RuntimeEnabled=ScriptedSpeech] attribute SpeechGrammarListConstructor webkitSpeechGrammarList; - [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionConstructor webkitSpeechRecognition; - [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionErrorConstructor webkitSpeechRecognitionError; - [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent; - [Conditional=WEB_AUDIO] attribute PannerNodeConstructor webkitAudioPannerNode; - - // Prefixed ShadowRoot constructor should be phased out eventually, but for the moment it must be always exposed. - // Unprefixed ShadowRoot constructor should be visible when the feature flag is enabled. - // FIXME: When it's ready to remove WebKitShadowRoot, get rid of both constructors from Window.idl and remove - // [NoInterfaceObject] from ShadowRoot interface definition. - [RuntimeEnabled=ShadowDOM] attribute ShadowRootConstructor ShadowRoot; - [MeasureAs=PrefixedShadowRootConstructor] attribute ShadowRootConstructor WebKitShadowRoot; + [MeasureAs=PrefixedWindowURL] attribute URLConstructor webkitURL; // FIXME: deprecate this. + [MeasureAs=PrefixedMutationObserverConstructor] attribute MutationObserverConstructor WebKitMutationObserver; // window.toString() requires special handling in V8 [DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString(); @@ -242,7 +212,6 @@ }; Window implements GlobalEventHandlers; -Window implements ImageBitmapFactories; Window implements WindowBase64; Window implements WindowEventHandlers; Window implements WindowTimers;
diff --git a/core/frame/WindowBase64.idl b/core/frame/WindowBase64.idl index 134018d..c5ed3a6 100644 --- a/core/frame/WindowBase64.idl +++ b/core/frame/WindowBase64.idl
@@ -25,10 +25,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#windowbase64 + [ - ImplementedAs=DOMWindowBase64, - NoInterfaceObject, + NoInterfaceObject, // Always used on target of 'implements' ] interface WindowBase64 { - [RaisesException] DOMString atob(DOMString string); [RaisesException] DOMString btoa(DOMString string); + [RaisesException] DOMString atob(DOMString string); };
diff --git a/core/frame/WindowEventHandlers.idl b/core/frame/WindowEventHandlers.idl index c268557..95de525 100644 --- a/core/frame/WindowEventHandlers.idl +++ b/core/frame/WindowEventHandlers.idl
@@ -27,14 +27,18 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#windoweventhandlers + [ - NoInterfaceObject, - ImplementedAs=DOMWindowEventHandlers + ImplementedAs=DOMWindowEventHandlers, + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' ] interface WindowEventHandlers { //attribute EventHandler onafterprint; //attribute EventHandler onbeforeprint; attribute EventHandler onbeforeunload; attribute EventHandler onhashchange; + attribute EventHandler onlanguagechange; attribute EventHandler onmessage; attribute EventHandler onoffline; attribute EventHandler ononline;
diff --git a/core/frame/WindowTimers.idl b/core/frame/WindowTimers.idl index 744567d..47f394f 100644 --- a/core/frame/WindowTimers.idl +++ b/core/frame/WindowTimers.idl
@@ -25,13 +25,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#windowtimers + [ - NoInterfaceObject, - ImplementedAs=DOMWindowTimers + ImplementedAs=DOMWindowTimers, + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' ] interface WindowTimers { + // FIXME: currently using [Custom] and |any| because overload algorithm + // can't handle Function/DOMString overload properly + // http://crbug.com/293561 + // FIXME: would be clearer as a union type, like: + // typedef (Function or DOMString) Handler + // Needs spec update and better union support: http://crbug.com/240176 [Custom] long setTimeout(any handler, [Default=Undefined] optional long timeout); void clearTimeout([Default=Undefined] optional long handle); [Custom] long setInterval(any handler, [Default=Undefined] optional long timeout); void clearInterval([Default=Undefined] optional long handle); }; -
diff --git a/core/html/FormData.idl b/core/html/FormData.idl index 73dcbfb..5b51e24 100644 --- a/core/html/FormData.idl +++ b/core/html/FormData.idl
@@ -28,14 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Constructor([Default=Undefined] optional HTMLFormElement form), - ImplementedAs=DOMFormData -] interface FormData { - // void append(DOMString name, DOMString value); - // void append(DOMString name, Blob value, optional DOMString filename); - [Custom] void append([Default=Undefined] optional DOMString name, - [Default=Undefined] optional DOMString value, - [Default=Undefined] optional DOMString filename); -}; +// https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#formdata +[ + Constructor(optional HTMLFormElement form), + Exposed=Window&Worker, + ImplementedAs=DOMFormData, + WillBeGarbageCollected, +] interface FormData { + [DartCustom] void append(DOMString name, Blob value, optional DOMString filename); + [DartCustom] void append(DOMString name, DOMString value); +};
diff --git a/core/html/HTMLAllCollection.idl b/core/html/HTMLAllCollection.idl index 5ca9c6b..d56b8b6 100644 --- a/core/html/HTMLAllCollection.idl +++ b/core/html/HTMLAllCollection.idl
@@ -29,6 +29,7 @@ Custom=LegacyCallAsFunction, DependentLifetime, SetWrapperReferenceFrom=ownerNode, + WillBeGarbageCollected, ] interface HTMLAllCollection { readonly attribute unsigned long length; [ImplementedAs=item] getter Element (unsigned long index);
diff --git a/core/html/HTMLAnchorElement.idl b/core/html/HTMLAnchorElement.idl index 57519bd..63775c2 100644 --- a/core/html/HTMLAnchorElement.idl +++ b/core/html/HTMLAnchorElement.idl
@@ -31,7 +31,9 @@ [Reflect] attribute DOMString target; [Reflect] attribute DOMString type; - readonly attribute DOMString text; + [ImplementedAs=textContent] attribute DOMString text; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; }; HTMLAnchorElement implements URLUtils;
diff --git a/core/html/HTMLAudioElement.idl b/core/html/HTMLAudioElement.idl index ffb4769..f1e3629 100644 --- a/core/html/HTMLAudioElement.idl +++ b/core/html/HTMLAudioElement.idl
@@ -25,6 +25,7 @@ [ RuntimeEnabled=Media, - NamedConstructor=Audio([Default=NullString] optional DOMString src) + NamedConstructor=Audio(optional DOMString src = null), + ConstructorCallWith=Document ] interface HTMLAudioElement : HTMLMediaElement { };
diff --git a/core/html/HTMLButtonElement.idl b/core/html/HTMLButtonElement.idl index aa40232..d92dcd1 100644 --- a/core/html/HTMLButtonElement.idl +++ b/core/html/HTMLButtonElement.idl
@@ -22,7 +22,7 @@ [Reflect] attribute boolean autofocus; [Reflect] attribute boolean disabled; [ImplementedAs=formOwner] readonly attribute HTMLFormElement form; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString formAction; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString formAction; attribute DOMString formEnctype; attribute DOMString formMethod; [Reflect] attribute boolean formNoValidate;
diff --git a/core/html/HTMLCanvasElement.idl b/core/html/HTMLCanvasElement.idl index 0bee59f..5c851ab 100644 --- a/core/html/HTMLCanvasElement.idl +++ b/core/html/HTMLCanvasElement.idl
@@ -29,9 +29,12 @@ attribute long width; attribute long height; - [Custom, RaisesException] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString type); + // FIXMEDART: Upstream: Added the optional quality param that V8 accepts. + [Custom, RaisesException] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString type, optional float quality); + // FIXMEDART: + // - Upstream: Added the optional quality param that V8 accepts. + // - Return RenderingContext. // The custom binding is needed to handle context creation attributes. - [Custom, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] any getContext([Default=Undefined] optional DOMString contextId); + [Custom, LogActivity] any getContext([Default=Undefined] optional DOMString contextId, optional Dictionary attrs); }; -
diff --git a/core/html/HTMLCollection.idl b/core/html/HTMLCollection.idl index 337cfea..cab83cd 100644 --- a/core/html/HTMLCollection.idl +++ b/core/html/HTMLCollection.idl
@@ -23,6 +23,7 @@ Custom=Wrap, DependentLifetime, SetWrapperReferenceFrom=ownerNode, + WillBeGarbageCollected, ] interface HTMLCollection { readonly attribute unsigned long length; getter Element item([Default=Undefined] optional unsigned long index);
diff --git a/core/html/shadow/HTMLContentElement.idl b/core/html/HTMLContentElement.idl similarity index 96% rename from core/html/shadow/HTMLContentElement.idl rename to core/html/HTMLContentElement.idl index ab59342..15d63d6 100644 --- a/core/html/shadow/HTMLContentElement.idl +++ b/core/html/HTMLContentElement.idl
@@ -27,6 +27,5 @@ [ ] interface HTMLContentElement : HTMLElement { [Reflect, TreatNullAs=NullString] attribute DOMString select; - attribute boolean resetStyleInheritance; NodeList getDistributedNodes(); };
diff --git a/core/html/HTMLDialogElement.idl b/core/html/HTMLDialogElement.idl index 6c2d0c8..c26e394 100644 --- a/core/html/HTMLDialogElement.idl +++ b/core/html/HTMLDialogElement.idl
@@ -28,7 +28,7 @@ ] interface HTMLDialogElement : HTMLElement { [Reflect] attribute boolean open; attribute DOMString returnValue; - [RaisesException] void close([Default=NullString] optional DOMString returnValue); + [RaisesException] void close(optional DOMString returnValue = null); void show(); [RaisesException] void showModal(); };
diff --git a/core/html/HTMLDocument.idl b/core/html/HTMLDocument.idl index 2b2eb03..04ba97f 100644 --- a/core/html/HTMLDocument.idl +++ b/core/html/HTMLDocument.idl
@@ -18,31 +18,28 @@ * Boston, MA 02110-1301, USA. */ -interface HTMLDocument : Document { +[ + // FIXME: Oilpan: remove this once Node specifies WillBeGarbageCollected. + WillBeGarbageCollected +] interface HTMLDocument : Document { [Custom, CustomElementCallbacks] void open(); - void close(); + [RaisesException] void close(); // We support multiple DOMString arguments to match FF / IE, e.g.: // document.write("a", "b", "c") --> document.write("abc") // document.write() --> document.write("") - [CallWith=ActiveWindow, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, CustomElementCallbacks] void write(DOMString... text); - [CallWith=ActiveWindow, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, CustomElementCallbacks] void writeln(DOMString... text); - - readonly attribute HTMLCollection embeds; - [ImplementedAs=embeds] readonly attribute HTMLCollection plugins; - readonly attribute HTMLCollection scripts; + [CallWith=ActiveWindow,LogActivity, CustomElementCallbacks, RaisesException] void write(DOMString... text); + [CallWith=ActiveWindow, LogActivity, CustomElementCallbacks, RaisesException] void writeln(DOMString... text); // Extensions [Replaceable, ImplementedAs=allForBinding] readonly attribute HTMLAllCollection all; - [DeprecateAs=DocumentClear] void clear(); + [MeasureAs=DocumentClear] void clear(); - [DeprecateAs=CaptureEvents] void captureEvents(); - [DeprecateAs=ReleaseEvents] void releaseEvents(); + [MeasureAs=DocumentCaptureEvents] void captureEvents(); + [MeasureAs=DocumentReleaseEvents] void releaseEvents(); - [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir; - [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode; readonly attribute DOMString compatMode; // Deprecated attributes
diff --git a/core/html/HTMLElement.idl b/core/html/HTMLElement.idl index cfcab73..65e7cb2 100644 --- a/core/html/HTMLElement.idl +++ b/core/html/HTMLElement.idl
@@ -24,7 +24,7 @@ [Reflect] attribute DOMString title; [Reflect] attribute DOMString lang; attribute boolean translate; - [Reflect] attribute DOMString dir; + attribute DOMString dir; [CustomElementCallbacks] attribute long tabIndex; [CustomElementCallbacks] attribute boolean draggable;
diff --git a/core/html/HTMLEmbedElement.idl b/core/html/HTMLEmbedElement.idl index ef32573..399417d 100644 --- a/core/html/HTMLEmbedElement.idl +++ b/core/html/HTMLEmbedElement.idl
@@ -24,7 +24,7 @@ [Reflect] attribute DOMString align; [Reflect] attribute DOMString height; [Reflect] attribute DOMString name; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly, LogPreviousValue] attribute DOMString src; [Reflect] attribute DOMString type; [Reflect] attribute DOMString width; [Custom, NotEnumerable] getter boolean (unsigned long index); @@ -33,4 +33,6 @@ [Custom] setter Node (DOMString name, Node value); [CheckSecurity=Node, RaisesException] Document getSVGDocument(); + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLFormElement.idl b/core/html/HTMLFormElement.idl index 912f73e..68283fc 100644 --- a/core/html/HTMLFormElement.idl +++ b/core/html/HTMLFormElement.idl
@@ -22,7 +22,7 @@ OverrideBuiltins, ] interface HTMLFormElement : HTMLElement { [Reflect=accept_charset] attribute DOMString acceptCharset; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString action; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString action; [Reflect, ReflectOnly="on"|"off", ReflectMissing="on", ReflectInvalid="on"] attribute DOMString autocomplete; [CustomElementCallbacks] attribute DOMString enctype; [CustomElementCallbacks] attribute DOMString encoding; @@ -36,11 +36,9 @@ [ImplementedAs=item] getter Element (unsigned long index); [NotEnumerable] getter (RadioNodeList or Element) (DOMString name); - [ImplementedAs=submitFromJavaScript, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] void submit(); + [ImplementedAs=submitFromJavaScript, LogActivity] void submit(); [CustomElementCallbacks] void reset(); boolean checkValidity(); [RuntimeEnabled=RequestAutocomplete] void requestAutocomplete(); - [RuntimeEnabled=RequestAutocomplete] attribute EventHandler onautocomplete; - [RuntimeEnabled=RequestAutocomplete] attribute EventHandler onautocompleteerror; };
diff --git a/core/html/HTMLFrameElement.idl b/core/html/HTMLFrameElement.idl index 82cb3b2..ed43c3c 100644 --- a/core/html/HTMLFrameElement.idl +++ b/core/html/HTMLFrameElement.idl
@@ -27,7 +27,7 @@ [Reflect] attribute DOMString name; [Reflect] attribute boolean noResize; [Reflect] attribute DOMString scrolling; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; // Introduced in DOM Level 2: [CheckSecurity=Node] readonly attribute Document contentDocument; @@ -37,8 +37,6 @@ [CheckSecurity=Node, RaisesException] Document getSVGDocument(); - [TreatNullAs=NullString, Custom=Setter, MeasureAs=HTMLFrameElementLocation] attribute DOMString location; - - readonly attribute long width; - readonly attribute long height; + [MeasureAs=HTMLFrameElementWidth] readonly attribute long width; + [MeasureAs=HTMLFrameElementHeight] readonly attribute long height; };
diff --git a/core/html/HTMLHeadElement.idl b/core/html/HTMLHeadElement.idl index 738deb7..fb54cb5 100644 --- a/core/html/HTMLHeadElement.idl +++ b/core/html/HTMLHeadElement.idl
@@ -18,5 +18,5 @@ */ interface HTMLHeadElement : HTMLElement { - [Reflect, TreatNullAs=NullString, MeasureAs=HTMLHeadElementProfile] attribute DOMString profile; + [Reflect, TreatNullAs=NullString, DeprecateAs=HTMLHeadElementProfile] attribute DOMString profile; };
diff --git a/core/html/HTMLHtmlElement.idl b/core/html/HTMLHtmlElement.idl index 3e329da..3099de6 100644 --- a/core/html/HTMLHtmlElement.idl +++ b/core/html/HTMLHtmlElement.idl
@@ -19,5 +19,4 @@ interface HTMLHtmlElement : HTMLElement { [Reflect] attribute DOMString version; - [Reflect, TreatNullAs=NullString, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, MeasureAs=HTMLHtmlElementManifest] attribute DOMString manifest; };
diff --git a/core/html/HTMLIFrameElement.idl b/core/html/HTMLIFrameElement.idl index 7b864ca..90c3a7a 100644 --- a/core/html/HTMLIFrameElement.idl +++ b/core/html/HTMLIFrameElement.idl
@@ -28,7 +28,7 @@ [Reflect] attribute DOMString name; [Reflect, TreatNullAs=NullString] attribute DOMString sandbox; [Reflect] attribute DOMString scrolling; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly, LogPreviousValue] attribute DOMString src; [Reflect] attribute DOMString srcdoc; [Reflect] attribute DOMString width; @@ -39,4 +39,6 @@ readonly attribute Window contentWindow; [CheckSecurity=Node, RaisesException] Document getSVGDocument(); + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLImageElement.idl b/core/html/HTMLImageElement.idl index 809b785..1914a5f 100644 --- a/core/html/HTMLImageElement.idl +++ b/core/html/HTMLImageElement.idl
@@ -21,7 +21,8 @@ // FIXME: NamedConstructor does not support optional without Default. Fortunately using Undefined makes // us use 0 which happens to be the default width and height anyway. [ - NamedConstructor=Image([Default=Undefined] optional long width, [Default=Undefined] optional long height) + NamedConstructor=Image([Default=Undefined] optional long width, [Default=Undefined] optional long height), + ConstructorCallWith=Document ] interface HTMLImageElement : HTMLElement { [Reflect] attribute DOMString align; [Reflect] attribute DOMString alt; @@ -31,18 +32,22 @@ attribute long height; [Reflect] attribute long hspace; [Reflect] attribute boolean isMap; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString longDesc; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString lowsrc; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString longDesc; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString lowsrc; [Reflect] attribute DOMString name; readonly attribute long naturalHeight; readonly attribute long naturalWidth; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; - [Reflect, RuntimeEnabled=Srcset] attribute DOMString srcset; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; + [Reflect] attribute DOMString srcset; + [Reflect, RuntimeEnabled=PictureSizes] attribute DOMString sizes; + [RuntimeEnabled=PictureSizes] readonly attribute DOMString currentSrc; [Reflect] attribute DOMString useMap; [Reflect] attribute long vspace; attribute long width; // Extensions - readonly attribute long x; - readonly attribute long y; + [MeasureAs=HTMLImageElementX] readonly attribute long x; + [MeasureAs=HTMLImageElementY] readonly attribute long y; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLInputElement.idl b/core/html/HTMLInputElement.idl index 37a919d..8f44cfb 100644 --- a/core/html/HTMLInputElement.idl +++ b/core/html/HTMLInputElement.idl
@@ -19,6 +19,8 @@ * Boston, MA 02110-1301, USA. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#htmlinputelement + interface HTMLInputElement : HTMLElement { [Reflect] attribute DOMString accept; [Reflect] attribute DOMString align; @@ -33,7 +35,7 @@ // The 'files' attribute is intentionally not readonly. // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22682 attribute FileList files; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString formAction; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString formAction; [CustomElementCallbacks] attribute DOMString formEnctype; [CustomElementCallbacks] attribute DOMString formMethod; [Reflect] attribute boolean formNoValidate; @@ -52,15 +54,15 @@ [Reflect] attribute boolean readOnly; [Reflect] attribute boolean required; [RaisesException=Setter, CustomElementCallbacks] attribute unsigned long size; // Changed string -> long -> unsigned long - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; [Reflect] attribute DOMString step; [CustomElementCallbacks] attribute DOMString type; // readonly dropped as part of DOM level 2 [CustomElementCallbacks] attribute DOMString defaultValue; [Reflect] attribute DOMString useMap; // See the discussion in https://bugs.webkit.org/show_bug.cgi?id=100085 [TreatNullAs=NullString, RaisesException=Setter, CustomElementCallbacks] attribute DOMString value; - [RaisesException=Setter, CustomElementCallbacks] attribute Date valueAsDate; - [RaisesException=Setter, CustomElementCallbacks] attribute double valueAsNumber; + [RaisesException=Setter, CustomElementCallbacks] attribute Date? valueAsDate; + [RaisesException=Setter, CustomElementCallbacks] attribute unrestricted double valueAsNumber; [RaisesException, CustomElementCallbacks] void stepUp(optional long n); [RaisesException, CustomElementCallbacks] void stepDown(optional long n); @@ -83,7 +85,7 @@ [RaisesException] void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - [Default=NullString] optional DOMString selectionMode); + optional DOMString selectionMode = null); [RaisesException, ImplementedAs=setSelectionRangeForBinding] void setSelectionRange([Default=Undefined] optional long start, @@ -91,11 +93,8 @@ optional DOMString direction); // Non-standard attributes - [Reflect] attribute boolean webkitdirectory; - [Reflect] attribute boolean incremental; - [Conditional=INPUT_SPEECH, Reflect, RuntimeEnabled=SpeechInput] attribute boolean webkitSpeech; - [Conditional=INPUT_SPEECH, Reflect, RuntimeEnabled=SpeechInput] attribute boolean webkitGrammar; - [Conditional=INPUT_SPEECH] attribute EventHandler onwebkitspeechchange; + [Reflect, MeasureAs=PrefixedDirectoryAttribute] attribute boolean webkitdirectory; + [Reflect, MeasureAs=IncrementalAttribute] attribute boolean incremental; // See http://www.w3.org/TR/html-media-capture/ [Conditional=MEDIA_CAPTURE, Reflect] attribute boolean capture;
diff --git a/core/html/HTMLLinkElement.idl b/core/html/HTMLLinkElement.idl index 92e5d19..3ba1aff 100644 --- a/core/html/HTMLLinkElement.idl +++ b/core/html/HTMLLinkElement.idl
@@ -22,7 +22,7 @@ interface HTMLLinkElement : HTMLElement { [Reflect] attribute boolean disabled; [Reflect] attribute DOMString charset; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString href; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString href; [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; [Reflect] attribute DOMString hreflang; [Reflect] attribute DOMString media; @@ -36,4 +36,6 @@ readonly attribute StyleSheet sheet; [RuntimeEnabled=HTMLImports] readonly attribute Document import; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLMediaElement.idl b/core/html/HTMLMediaElement.idl index 977066a..3d87a59 100644 --- a/core/html/HTMLMediaElement.idl +++ b/core/html/HTMLMediaElement.idl
@@ -26,14 +26,15 @@ [ ActiveDOMObject, RuntimeEnabled=Media, + TypeChecking=Unrestricted, ] interface HTMLMediaElement : HTMLElement { // error state - readonly attribute MediaError error; + [TypeChecking=Interface|Nullable] readonly attribute MediaError? error; // network state - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; - [URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] readonly attribute DOMString currentSrc; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; + [URL, LogActivity=SetterOnly] readonly attribute DOMString currentSrc; [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; const unsigned short NETWORK_EMPTY = 0; @@ -58,7 +59,7 @@ // playback state [RaisesException=Setter] attribute double currentTime; - readonly attribute double duration; + readonly attribute unrestricted double duration; readonly attribute boolean paused; attribute double defaultPlaybackRate; attribute double playbackRate; @@ -71,8 +72,8 @@ void pause(); // media controller - [Reflect] attribute DOMString mediaGroup; - [StrictTypeChecking] attribute MediaController controller; + [RuntimeEnabled=MediaController, Reflect] attribute DOMString mediaGroup; + [RuntimeEnabled=MediaController, TypeChecking=Interface|Nullable] attribute MediaController? controller; // controls attribute boolean controls; @@ -81,8 +82,10 @@ [Reflect=muted] attribute boolean defaultMuted; // tracks - [RuntimeEnabled=VideoTrack] readonly attribute TextTrackList textTracks; - [RuntimeEnabled=VideoTrack, RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language); + [RuntimeEnabled=AudioVideoTracks] readonly attribute AudioTrackList audioTracks; + [RuntimeEnabled=AudioVideoTracks] readonly attribute VideoTrackList videoTracks; + readonly attribute TextTrackList textTracks; + [RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language); // WebKit extensions @@ -90,16 +93,5 @@ [MeasureAs=PrefixedAudioDecodedByteCount] readonly attribute unsigned long webkitAudioDecodedByteCount; [MeasureAs=PrefixedVideoDecodedByteCount] readonly attribute unsigned long webkitVideoDecodedByteCount; - [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=PrefixedMediaCancelKeyRequest] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, [Default=NullString] optional DOMString sessionId); - - [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyadded; - [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyerror; - [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeymessage; - [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitneedkey; - - [RuntimeEnabled=EncryptedMedia] readonly attribute MediaKeys mediaKeys; - [RuntimeEnabled=EncryptedMedia, RaisesException] void setMediaKeys(MediaKeys mediaKeys); - [RuntimeEnabled=EncryptedMedia] attribute EventHandler onneedkey; + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLMeterElement.idl b/core/html/HTMLMeterElement.idl index fde8591..144f83e 100644 --- a/core/html/HTMLMeterElement.idl +++ b/core/html/HTMLMeterElement.idl
@@ -17,12 +17,16 @@ * Boston, MA 02110-1301, USA. */ -interface HTMLMeterElement : HTMLElement { - [RaisesException=Setter] attribute double value; - [RaisesException=Setter] attribute double min; - [RaisesException=Setter] attribute double max; - [RaisesException=Setter] attribute double low; - [RaisesException=Setter] attribute double high; - [RaisesException=Setter] attribute double optimum; +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#htmlmeterelement + +[ + TypeChecking=Unrestricted, +] interface HTMLMeterElement : HTMLElement { + attribute double value; + attribute double min; + attribute double max; + attribute double low; + attribute double high; + attribute double optimum; readonly attribute NodeList labels; };
diff --git a/core/html/HTMLModElement.idl b/core/html/HTMLModElement.idl index c066b68..3c9bf9f 100644 --- a/core/html/HTMLModElement.idl +++ b/core/html/HTMLModElement.idl
@@ -18,6 +18,6 @@ */ interface HTMLModElement : HTMLElement { - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString cite; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString cite; [Reflect] attribute DOMString dateTime; };
diff --git a/core/html/HTMLObjectElement.idl b/core/html/HTMLObjectElement.idl index f01b7e8..b6c7cce 100644 --- a/core/html/HTMLObjectElement.idl +++ b/core/html/HTMLObjectElement.idl
@@ -28,7 +28,7 @@ [Reflect, TreatNullAs=NullString] attribute DOMString border; [Reflect, URL] attribute DOMString codeBase; [Reflect] attribute DOMString codeType; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString data; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString data; [Reflect] attribute boolean declare; [Reflect] attribute DOMString height; [Reflect] attribute long hspace; @@ -52,4 +52,6 @@ [Custom] setter Node (DOMString name, Node value); [CheckSecurity=Node, RaisesException] Document getSVGDocument(); + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLOptionElement.idl b/core/html/HTMLOptionElement.idl index 41c6592..d57d72a 100644 --- a/core/html/HTMLOptionElement.idl +++ b/core/html/HTMLOptionElement.idl
@@ -19,7 +19,11 @@ */ [ - 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), + ConstructorCallWith=Document, RaisesException=Constructor ] interface HTMLOptionElement : HTMLElement { [Reflect] attribute boolean disabled;
diff --git a/core/html/HTMLOptionsCollection.idl b/core/html/HTMLOptionsCollection.idl index 11d7673..8493d14 100644 --- a/core/html/HTMLOptionsCollection.idl +++ b/core/html/HTMLOptionsCollection.idl
@@ -26,12 +26,12 @@ attribute long selectedIndex; [Custom=Setter, RaisesException=Setter] attribute unsigned long length; [ImplementedAs=item] getter Node (unsigned long index); - [RaisesException, StrictTypeChecking] setter HTMLOptionElement (unsigned long index, HTMLOptionElement? value); + [RaisesException, TypeChecking=Interface|Nullable] setter HTMLOptionElement (unsigned long index, HTMLOptionElement? value); // FIXME: The spec and firefox return an Element (the first matching Element). [ImplementedAs=namedGetter] getter (NodeList or Element) namedItem(DOMString name); - [Custom, RaisesException] void add([Default=Undefined] optional HTMLOptionElement option, optional unsigned long index); + [Custom, RaisesException, DartSuppress] void add([Default=Undefined] optional HTMLOptionElement option, optional unsigned long index); void remove(unsigned long index); - void remove(HTMLOptionElement option); // non-standard + [MeasureAs=HTMLOptionsCollectionRemoveElement, DartSuppress] void remove(HTMLOptionElement option); // non-standard };
diff --git a/core/html/HTMLPictureElement.idl b/core/html/HTMLPictureElement.idl new file mode 100644 index 0000000..649316c --- /dev/null +++ b/core/html/HTMLPictureElement.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://picture.responsiveimages.org +[ + RuntimeEnabled=Picture +] interface HTMLPictureElement : HTMLElement { +}; +
diff --git a/core/html/HTMLPreElement.idl b/core/html/HTMLPreElement.idl index 3d035940..6224bc9 100644 --- a/core/html/HTMLPreElement.idl +++ b/core/html/HTMLPreElement.idl
@@ -19,11 +19,8 @@ */ interface HTMLPreElement : HTMLElement { - // FIXME: DOM spec says that width should be of type DOMString - // see http://bugs.webkit.org/show_bug.cgi?id=8992 [Reflect] attribute long width; // Extensions - [Reflect] attribute boolean wrap; + [Reflect, MeasureAs=HTMLPreElementWrap] attribute boolean wrap; }; -
diff --git a/core/html/HTMLProgressElement.idl b/core/html/HTMLProgressElement.idl index b2f5a9c..a3da90a 100644 --- a/core/html/HTMLProgressElement.idl +++ b/core/html/HTMLProgressElement.idl
@@ -17,10 +17,13 @@ * Boston, MA 02110-1301, USA. */ -interface HTMLProgressElement : HTMLElement { - [RaisesException=Setter] attribute double value; - [RaisesException=Setter] attribute double max; - readonly attribute double position; - readonly attribute NodeList labels; -}; +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#htmlprogresselement +[ + TypeChecking=Unrestricted, +] interface HTMLProgressElement : HTMLElement { + attribute double value; + attribute double max; + readonly attribute double position; + readonly attribute NodeList labels; +};
diff --git a/core/html/HTMLQuoteElement.idl b/core/html/HTMLQuoteElement.idl index 93a2aff..db0ab9d 100644 --- a/core/html/HTMLQuoteElement.idl +++ b/core/html/HTMLQuoteElement.idl
@@ -18,5 +18,5 @@ */ interface HTMLQuoteElement : HTMLElement { - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString cite; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString cite; };
diff --git a/core/html/HTMLScriptElement.idl b/core/html/HTMLScriptElement.idl index b8c367a..71b5422 100644 --- a/core/html/HTMLScriptElement.idl +++ b/core/html/HTMLScriptElement.idl
@@ -24,8 +24,10 @@ [Reflect] attribute DOMString charset; attribute boolean async; [Reflect] attribute boolean defer; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; [Reflect] attribute DOMString type; [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; [Reflect, RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute DOMString nonce; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLSelectElement.idl b/core/html/HTMLSelectElement.idl index 3104a3f..470d9c2 100644 --- a/core/html/HTMLSelectElement.idl +++ b/core/html/HTMLSelectElement.idl
@@ -19,6 +19,8 @@ * Boston, MA 02110-1301, USA. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#htmlselectelement + interface HTMLSelectElement : HTMLElement { [Reflect] attribute boolean autofocus; [Reflect] attribute boolean disabled; @@ -34,16 +36,17 @@ [RaisesException=Setter] attribute unsigned long length; getter Element item(unsigned long index); - [RaisesException, StrictTypeChecking] setter HTMLOptionElement (unsigned long index, HTMLOptionElement? value); Element namedItem([Default=Undefined] optional DOMString name); - [RaisesException] void add([Default=Undefined] optional HTMLElement element, - [Default=Undefined] optional HTMLElement before); - void remove(long index); - void remove(HTMLOptionElement option); // non-standard - [RaisesException] void remove(); + // FIXME: should be union type http://crbug.com/240176 + [RaisesException, TypeChecking=Interface, DartSuppress] void add(HTMLElement element, optional HTMLElement? before = null); + [ImplementedAs=addBeforeOptionAtIndex, RaisesException, TypeChecking=Interface] void add(HTMLElement element, long before); + [RaisesException, DartSuppress] void remove(); // ChildNode overload + [DartSuppress] void remove(long index); + [RaisesException, TypeChecking=Interface|Nullable] setter HTMLOptionElement (unsigned long index, HTMLOptionElement? value); + readonly attribute HTMLCollection selectedOptions; - attribute long selectedIndex; - attribute DOMString value; + attribute long selectedIndex; + attribute DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity;
diff --git a/core/html/shadow/HTMLShadowElement.idl b/core/html/HTMLShadowElement.idl similarity index 93% rename from core/html/shadow/HTMLShadowElement.idl rename to core/html/HTMLShadowElement.idl index 44bc357..86532b1 100644 --- a/core/html/shadow/HTMLShadowElement.idl +++ b/core/html/HTMLShadowElement.idl
@@ -29,6 +29,5 @@ */ interface HTMLShadowElement : HTMLElement { - attribute boolean resetStyleInheritance; - [RuntimeEnabled=ShadowDOM] NodeList getDistributedNodes(); + NodeList getDistributedNodes(); };
diff --git a/core/html/HTMLSourceElement.idl b/core/html/HTMLSourceElement.idl index 9d86da4..45f76b9 100644 --- a/core/html/HTMLSourceElement.idl +++ b/core/html/HTMLSourceElement.idl
@@ -26,7 +26,12 @@ [ RuntimeEnabled=Media ] interface HTMLSourceElement : HTMLElement { - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; attribute DOMString type; - [DeprecateAs=HTMLSourceElementMedia] attribute DOMString media; + + [Reflect, RuntimeEnabled=Picture] attribute DOMString srcset; + [Reflect, RuntimeEnabled=Picture] attribute DOMString sizes; + [Reflect, RuntimeEnabled=Picture] attribute DOMString media; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLStyleElement.idl b/core/html/HTMLStyleElement.idl index 42a38de..ecc6b2b 100644 --- a/core/html/HTMLStyleElement.idl +++ b/core/html/HTMLStyleElement.idl
@@ -20,7 +20,6 @@ interface HTMLStyleElement : HTMLElement { attribute boolean disabled; - [RuntimeEnabled=StyleScoped] attribute boolean scoped; [Reflect] attribute DOMString media; [Reflect] attribute DOMString type;
diff --git a/core/html/HTMLTableElement.idl b/core/html/HTMLTableElement.idl index 4cd6d6f..3072583 100644 --- a/core/html/HTMLTableElement.idl +++ b/core/html/HTMLTableElement.idl
@@ -45,6 +45,6 @@ HTMLElement createCaption(); void deleteCaption(); - [RaisesException] HTMLElement insertRow([Default=Undefined] optional long index); + [RaisesException] HTMLElement insertRow(optional long index); [RaisesException] void deleteRow([Default=Undefined] optional long index); };
diff --git a/core/html/HTMLTableRowElement.idl b/core/html/HTMLTableRowElement.idl index aa7b9ca..e38f999 100644 --- a/core/html/HTMLTableRowElement.idl +++ b/core/html/HTMLTableRowElement.idl
@@ -27,6 +27,6 @@ [Reflect=char] attribute DOMString ch; [Reflect=charoff] attribute DOMString chOff; [Reflect] attribute DOMString vAlign; - [RaisesException] HTMLElement insertCell([Default=Undefined] optional long index); + [RaisesException] HTMLElement insertCell(optional long index); [RaisesException] void deleteCell([Default=Undefined] optional long index); };
diff --git a/core/html/HTMLTableSectionElement.idl b/core/html/HTMLTableSectionElement.idl index 836b712..a8f0b89 100644 --- a/core/html/HTMLTableSectionElement.idl +++ b/core/html/HTMLTableSectionElement.idl
@@ -24,6 +24,6 @@ [Reflect=charoff] attribute DOMString chOff; [Reflect] attribute DOMString vAlign; readonly attribute HTMLCollection rows; - [RaisesException] HTMLElement insertRow([Default=Undefined] optional long index); + [RaisesException] HTMLElement insertRow(optional long index); [RaisesException] void deleteRow([Default=Undefined] optional long index); };
diff --git a/core/html/HTMLTextAreaElement.idl b/core/html/HTMLTextAreaElement.idl index e5d7926..937c8c9 100644 --- a/core/html/HTMLTextAreaElement.idl +++ b/core/html/HTMLTextAreaElement.idl
@@ -56,7 +56,7 @@ [RaisesException] void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - [Default=NullString] optional DOMString selectionMode); + optional DOMString selectionMode = null); void setSelectionRange([Default=Undefined] optional long start, [Default=Undefined] optional long end,
diff --git a/core/html/HTMLTrackElement.idl b/core/html/HTMLTrackElement.idl index da7e22e..7ad3e60 100644 --- a/core/html/HTMLTrackElement.idl +++ b/core/html/HTMLTrackElement.idl
@@ -23,11 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=VideoTrack -] interface HTMLTrackElement : HTMLElement { +interface HTMLTrackElement : HTMLElement { attribute DOMString kind; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString src; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString src; [Reflect] attribute DOMString srclang; [Reflect] attribute DOMString label; [Reflect] attribute boolean default; @@ -40,4 +38,6 @@ readonly attribute unsigned short readyState; readonly attribute TextTrack track; + + [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLVideoElement.idl b/core/html/HTMLVideoElement.idl index b68a7db..30825e5 100644 --- a/core/html/HTMLVideoElement.idl +++ b/core/html/HTMLVideoElement.idl
@@ -30,17 +30,17 @@ [Reflect] attribute unsigned long height; readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; - [Reflect, URL, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute DOMString poster; + [Reflect, URL, LogActivity=SetterOnly] attribute DOMString poster; - [DeprecateAs=PrefixedVideoSupportsFullscreen] readonly attribute boolean webkitSupportsFullscreen; - [DeprecateAs=PrefixedVideoDisplayingFullscreen] readonly attribute boolean webkitDisplayingFullscreen; + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoSupportsFullscreen] readonly attribute boolean webkitSupportsFullscreen; + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoDisplayingFullscreen] readonly attribute boolean webkitDisplayingFullscreen; - [DeprecateAs=PrefixedVideoEnterFullscreen, RaisesException, PerWorldBindings, ActivityLogging=ForAllWorlds] void webkitEnterFullscreen(); - [DeprecateAs=PrefixedVideoExitFullscreen] void webkitExitFullscreen(); + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoEnterFullscreen, RaisesException, LogActivity, LogAllWorlds] void webkitEnterFullscreen(); + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoExitFullscreen] void webkitExitFullscreen(); // Note the different capitalization of the "S" in FullScreen. - [DeprecateAs=PrefixedVideoEnterFullScreen, ImplementedAs=webkitEnterFullscreen, RaisesException, PerWorldBindings, ActivityLogging=ForAllWorlds] void webkitEnterFullScreen(); - [DeprecateAs=PrefixedVideoExitFullScreen, ImplementedAs=webkitExitFullscreen] void webkitExitFullScreen(); + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoEnterFullScreen, ImplementedAs=webkitEnterFullscreen, RaisesException, LogActivity, LogAllWorlds] void webkitEnterFullScreen(); + [RuntimeEnabled=PrefixedVideoFullscreen, DeprecateAs=PrefixedVideoExitFullScreen, ImplementedAs=webkitExitFullscreen] void webkitExitFullScreen(); // The number of frames that have been decoded and made available for // playback.
diff --git a/core/html/ImageData.idl b/core/html/ImageData.idl index 0684799..9aee728 100644 --- a/core/html/ImageData.idl +++ b/core/html/ImageData.idl
@@ -26,10 +26,18 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#imagedata + [ + Constructor(unsigned long width, unsigned long height), + Constructor(Uint8ClampedArray data, unsigned long width, [Default=Undefined] optional unsigned long height), Custom=Wrap, + Exposed=Window&Worker, + RaisesException=Constructor, + WillBeGarbageCollected, ] interface ImageData { readonly attribute long width; readonly attribute long height; -}; + [DartCustom=New] readonly attribute ArrayBufferView data; +};
diff --git a/core/html/MediaController.idl b/core/html/MediaController.idl index ad46115..8e70a8b 100644 --- a/core/html/MediaController.idl +++ b/core/html/MediaController.idl
@@ -23,15 +23,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#mediacontroller + [ Constructor, ConstructorCallWith=ExecutionContext, - RuntimeEnabled=Media, + RuntimeEnabled=MediaController, + TypeChecking=Unrestricted, ] interface MediaController : EventTarget { readonly attribute TimeRanges buffered; readonly attribute TimeRanges seekable; - readonly attribute double duration; + readonly attribute unrestricted double duration; [RaisesException=Setter] attribute double currentTime; readonly attribute boolean paused;
diff --git a/core/html/MediaError.idl b/core/html/MediaError.idl index 58b94d8..aaffbc2 100644 --- a/core/html/MediaError.idl +++ b/core/html/MediaError.idl
@@ -24,7 +24,8 @@ */ [ - RuntimeEnabled=Media + RuntimeEnabled=Media, + WillBeGarbageCollected, ] interface MediaError { const unsigned short MEDIA_ERR_ABORTED = 1; const unsigned short MEDIA_ERR_NETWORK = 2;
diff --git a/core/html/TextMetrics.idl b/core/html/TextMetrics.idl index fc37998..14f1148 100644 --- a/core/html/TextMetrics.idl +++ b/core/html/TextMetrics.idl
@@ -24,6 +24,20 @@ */ [ ] interface TextMetrics { + // x-direction readonly attribute float width; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float actualBoundingBoxLeft; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float actualBoundingBoxRight; + + // y-direction + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float fontBoundingBoxAscent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float fontBoundingBoxDescent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float actualBoundingBoxAscent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float actualBoundingBoxDescent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float emHeightAscent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float emHeightDescent; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float hangingBaseline; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float alphabeticBaseline; + [RuntimeEnabled=ExperimentalCanvasFeatures] readonly attribute float ideographicBaseline; };
diff --git a/core/html/ValidityState.idl b/core/html/ValidityState.idl index 582baf9..d4f7253 100644 --- a/core/html/ValidityState.idl +++ b/core/html/ValidityState.idl
@@ -21,6 +21,7 @@ */ [ + WillBeGarbageCollected ] interface ValidityState { readonly attribute boolean valueMissing; readonly attribute boolean typeMismatch;
diff --git a/core/html/canvas/ANGLEInstancedArrays.idl b/core/html/canvas/ANGLEInstancedArrays.idl index 3a7593e..4e63430 100644 --- a/core/html/canvas/ANGLEInstancedArrays.idl +++ b/core/html/canvas/ANGLEInstancedArrays.idl
@@ -31,7 +31,7 @@ [ DoNotCheckConstants, NoInterfaceObject, - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface ANGLEInstancedArrays { const unsigned long VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
diff --git a/core/html/canvas/Canvas2DContextAttributes.idl b/core/html/canvas/Canvas2DContextAttributes.idl index 72e0191..f6017b3 100644 --- a/core/html/canvas/Canvas2DContextAttributes.idl +++ b/core/html/canvas/Canvas2DContextAttributes.idl
@@ -28,4 +28,5 @@ NoInterfaceObject ] interface Canvas2DContextAttributes { attribute boolean alpha; + [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString storage; };
diff --git a/core/html/canvas/CanvasGradient.idl b/core/html/canvas/CanvasGradient.idl index 35a4e2a..3da025a 100644 --- a/core/html/canvas/CanvasGradient.idl +++ b/core/html/canvas/CanvasGradient.idl
@@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ [ + TypeChecking=Unrestricted, ] interface CanvasGradient { [RaisesException] void addColorStop(float offset, DOMString color);
diff --git a/core/html/canvas/CanvasPathMethods.idl b/core/html/canvas/CanvasPathMethods.idl new file mode 100644 index 0000000..2c37810 --- /dev/null +++ b/core/html/canvas/CanvasPathMethods.idl
@@ -0,0 +1,20 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvaspathmethods + +[ + NoInterfaceObject, // Always used on target of 'implements' +] interface CanvasPathMethods { + // shared path API methods + void closePath(); + void moveTo(unrestricted float x, unrestricted float y); + void lineTo(unrestricted float x, unrestricted float y); + void quadraticCurveTo(unrestricted float cpx, unrestricted float cpy, unrestricted float x, unrestricted float y); + void bezierCurveTo(unrestricted float cp1x, unrestricted float cp1y, unrestricted float cp2x, unrestricted float cp2y, unrestricted float x, unrestricted float y); + [RaisesException] void arcTo(unrestricted float x1, unrestricted float y1, unrestricted float x2, unrestricted float y2, unrestricted float radius); + void rect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + [RaisesException] void arc(unrestricted float x, unrestricted float y, unrestricted float radius, unrestricted float startAngle, unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise); + [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise); +};
diff --git a/core/html/canvas/CanvasRenderingContext2D.idl b/core/html/canvas/CanvasRenderingContext2D.idl index d99a6a0..22f2c23 100644 --- a/core/html/canvas/CanvasRenderingContext2D.idl +++ b/core/html/canvas/CanvasRenderingContext2D.idl
@@ -23,150 +23,160 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -enum CanvasWindingRule { "nonzero", "evenodd" }; +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvasrenderingcontext2d -interface CanvasRenderingContext2D : CanvasRenderingContext { +// FIXME: float => double throughout +// FIXME: Use union type in drawImage and createPattern once supported: +// http://crbug.com/372891 +typedef (HTMLImageElement or + HTMLVideoElement or + HTMLCanvasElement // or + // CanvasRenderingContext2D or + // ImageBitmap + ) CanvasImageSource; - void save(); - void restore(); +enum CanvasFillRule { "nonzero", "evenodd" }; - [RuntimeEnabled=ExperimentalCanvasFeatures, Immutable] attribute SVGMatrix currentTransform; - void scale(float sx, float sy); - void rotate(float angle); - void translate(float tx, float ty); - void transform(float m11, float m12, float m21, float m22, float dx, float dy); - void setTransform(float m11, float m12, float m21, float m22, float dx, float dy); +[ + TypeChecking=Interface|Nullable|Unrestricted, + WillBeGarbageCollected, +] interface CanvasRenderingContext2D { + // back-reference to the canvas + readonly attribute HTMLCanvasElement canvas; + + // state + void save(); // push state on state stack + void restore(); // pop state stack and restore state + + // transformations (default transform is the identity matrix) + [RuntimeEnabled=ExperimentalCanvasFeatures] attribute SVGMatrix currentTransform; + void scale(unrestricted float x, unrestricted float y); + void rotate(unrestricted float angle); + void translate(unrestricted float x, unrestricted float y); + void transform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted float f); + void setTransform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted float f); void resetTransform(); - attribute float globalAlpha; - [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; + // compositing + attribute unrestricted float globalAlpha; // (default 1.0) + [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; // (default source-over) - [RaisesException] CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); - [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1); - - attribute float lineWidth; - [TreatNullAs=NullString] attribute DOMString lineCap; - [TreatNullAs=NullString] attribute DOMString lineJoin; - attribute float miterLimit; - - attribute float shadowOffsetX; - attribute float shadowOffsetY; - attribute float shadowBlur; - [TreatNullAs=NullString] attribute DOMString shadowColor; - - void setLineDash(sequence<float> dash); - sequence<float> getLineDash(); - attribute float lineDashOffset; - - void clearRect(float x, float y, float width, float height); - void fillRect(float x, float y, float width, float height); - - void beginPath(); - - attribute Path currentPath; - - // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface. - void closePath(); - void moveTo(float x, float y); - void lineTo(float x, float y); - void quadraticCurveTo(float cpx, float cpy, float x, float y); - void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y); - [RaisesException] void arcTo(float x1, float y1, float x2, float y2, float radius); - void rect(float x, float y, float width, float height); - [RaisesException] void arc(float x, float y, float radius, float startAngle, float endAngle, [Default=Undefined] optional boolean anticlockwise); - [RaisesException] void ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, [Default=Undefined] optional boolean anticlockwise); - - void fill(optional CanvasWindingRule winding); - void stroke(); - void clip(optional CanvasWindingRule winding); - boolean isPointInPath(float x, float y, optional CanvasWindingRule winding); - boolean isPointInStroke(float x, float y); - - // text - attribute DOMString font; - attribute DOMString textAlign; - attribute DOMString textBaseline; - - TextMetrics measureText(DOMString text); - - // other - - void setAlpha(float alpha); - void setCompositeOperation(DOMString compositeOperation); - - void setLineWidth(float width); - void setLineCap(DOMString cap); - void setLineJoin(DOMString join); - void setMiterLimit(float limit); - - void clearShadow(); - - void fillText(DOMString text, float x, float y, optional float maxWidth); - void strokeText(DOMString text, float x, float y, optional float maxWidth); - - void setStrokeColor([StrictTypeChecking] DOMString color, optional float alpha); - void setStrokeColor(float grayLevel, optional float alpha); - void setStrokeColor(float r, float g, float b, float a); - void setStrokeColor(float c, float m, float y, float k, float a); - - void setFillColor([StrictTypeChecking] DOMString color, optional float alpha); - void setFillColor(float grayLevel, optional float alpha); - void setFillColor(float r, float g, float b, float a); - void setFillColor(float c, float m, float y, float k, float a); - - void strokeRect(float x, float y, float width, float height); - - [RaisesException] void drawImage(HTMLImageElement? image, float x, float y); - [RaisesException] void drawImage(HTMLImageElement? image, float x, float y, float width, float height); - [RaisesException] void drawImage(HTMLImageElement? image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); - [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y); - [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y, float width, float height); - [RaisesException] void drawImage(HTMLCanvasElement? canvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); - [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y); - [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y, float width, float height); - [RaisesException] void drawImage(HTMLVideoElement? video, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); - [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y); - [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y, float width, float height); - [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); - - void drawImageFromRect(HTMLImageElement image, - optional float sx, optional float sy, optional float sw, optional float sh, - optional float dx, optional float dy, optional float dw, optional float dh, - optional DOMString compositeOperation); - - void setShadow(float width, float height, float blur, [StrictTypeChecking] optional DOMString color, optional float alpha); - void setShadow(float width, float height, float blur, float grayLevel, optional float alpha); - void setShadow(float width, float height, float blur, float r, float g, float b, float a); - void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a); - - [RaisesException] void putImageData(ImageData? imagedata, float dx, float dy); - [RaisesException] void putImageData(ImageData? imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); - - [RaisesException, DeprecateAs=PrefixedPutImageDataHD] void webkitPutImageDataHD(ImageData? imagedata, float dx, float dy); - [RaisesException, DeprecateAs=PrefixedPutImageDataHD] void webkitPutImageDataHD(ImageData? imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); - - [RaisesException] CanvasPattern createPattern(HTMLCanvasElement? canvas, [TreatNullAs=NullString] DOMString repetitionType); - [RaisesException] CanvasPattern createPattern(HTMLImageElement? image, [TreatNullAs=NullString] DOMString repetitionType); - [RaisesException] ImageData createImageData(ImageData? imagedata); - [RaisesException] ImageData createImageData(float sw, float sh); - - [Custom] attribute object strokeStyle; - [Custom] attribute object fillStyle; - - // pixel manipulation - [RaisesException] ImageData getImageData(float sx, float sy, float sw, float sh); - - [RaisesException, DeprecateAs=PrefixedGetImageDataHD] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh); - - // Focus rings - [RuntimeEnabled=ExperimentalCanvasFeatures] void drawSystemFocusRing(Element element); - [RuntimeEnabled=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element); - - readonly attribute float webkitBackingStorePixelRatio; - - [ImplementedAs=imageSmoothingEnabled, MeasureAs=PrefixedImageSmoothingEnabled] attribute boolean webkitImageSmoothingEnabled; + // image smoothing + [ImplementedAs=imageSmoothingEnabled, MeasureAs=PrefixedImageSmoothingEnabled, DartSuppress] attribute boolean webkitImageSmoothingEnabled; [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothingEnabled; + // colors and styles (see also the CanvasDrawingStyles interface) + // FIXME: Use union types when supported: http://crbug.com/372891 + [Custom] attribute object strokeStyle; // (default black) + [Custom] attribute object fillStyle; // (default black) + CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); + [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1); + [RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, [TreatNullAs=NullString] DOMString repetitionType); + [RaisesException] CanvasPattern createPattern(HTMLImageElement image, [TreatNullAs=NullString] DOMString repetitionType); + [RaisesException] CanvasPattern createPattern(HTMLVideoElement image, [TreatNullAs=NullString] DOMString repetitionType); + + // shadows + attribute unrestricted float shadowOffsetX; + attribute unrestricted float shadowOffsetY; + attribute unrestricted float shadowBlur; + [TreatNullAs=NullString] attribute DOMString shadowColor; + + // rects + void clearRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + void fillRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + void strokeRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + + // path API (see also CanvasPathMethods) + void beginPath(); + void fill(optional CanvasFillRule winding); + [RuntimeEnabled=Path2D] void fill(Path2D path, optional CanvasFillRule winding); + void stroke(); + [RuntimeEnabled=Path2D] void stroke(Path2D path); + // Focus rings + void drawFocusIfNeeded(Element element); + [RuntimeEnabled=Path2D] void drawFocusIfNeeded(Path2D path, Element element); + + [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional Path2D path); + void clip(optional CanvasFillRule winding); + [RuntimeEnabled=Path2D] void clip(Path2D path, optional CanvasFillRule winding); + boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasFillRule winding); + [RuntimeEnabled=Path2D] boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding); + boolean isPointInStroke(unrestricted float x, unrestricted float y); + [RuntimeEnabled=Path2D] boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); + + // text (see also the CanvasDrawingStyles interface) + void fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth); + void strokeText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth); + TextMetrics measureText(DOMString text); + + // drawing images + [RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y); + [RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + [RaisesException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y); + [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float x, unrestricted float y); + [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); + [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + + // pixel manipulation + [DartName=createImageDataFromImageData] ImageData createImageData(ImageData imagedata); + [RaisesException] ImageData createImageData(float sw, float sh); + [RaisesException] ImageData getImageData(float sx, float sy, float sw, float sh); + void putImageData(ImageData imagedata, float dx, float dy); + void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); + + // Context state + // Should be merged with WebGL counterpart in CanvasRenderingContext, once no-longer experimental + [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); + Canvas2DContextAttributes getContextAttributes(); + + // FIXME: factor out to CanvasDrawingStyles + // line caps/joins + attribute unrestricted float lineWidth; // (default 1) + [TreatNullAs=NullString] attribute DOMString lineCap; // "butt", "round", "square" (default "butt") + [TreatNullAs=NullString] attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") + attribute unrestricted float miterLimit; // (default 10) + + // dashed lines + void setLineDash(sequence<unrestricted float> dash); + sequence<unrestricted float> getLineDash(); + attribute unrestricted float lineDashOffset; + + // text + attribute DOMString font; // (default 10px sans-serif) + attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start") + attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") + + // Non-standard APIs. Candidates for deprecation + // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D + [MeasureAs=CanvasRenderingContext2DSetAlpha] void setAlpha(unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetCompositeOperation] void setCompositeOperation(DOMString compositeOperation); + [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(unrestricted float width); + [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap); + [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString join); + [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(unrestricted float limit); + [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); + [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(DOMString color, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unrestricted float grayLevel, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); + [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(DOMString color, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); + [MeasureAs=CanvasRenderingContext2DDrawImageFromRect] void drawImageFromRect( + HTMLImageElement? image, optional unrestricted float sx, optional unrestricted float sy, optional unrestricted float sw, optional unrestricted float sh, + optional unrestricted float dx, optional unrestricted float dy, optional unrestricted float dw, optional unrestricted float dh, optional DOMString compositeOperation); + [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, optional DOMString color, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float grayLevel, optional unrestricted float alpha); + [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); }; +CanvasRenderingContext2D implements CanvasPathMethods;
diff --git a/core/html/canvas/DataView.idl b/core/html/canvas/DataView.idl index 972a6ff..4fc8961 100644 --- a/core/html/canvas/DataView.idl +++ b/core/html/canvas/DataView.idl
@@ -26,8 +26,8 @@ [ Custom=Wrap, CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength), - GlobalContext=Window&WorkerGlobalScope, - StrictTypeChecking, + Exposed=Window&Worker, + TypeChecking=Interface|Nullable, ] interface DataView : ArrayBufferView { // All these methods raise an exception if they would read or write beyond the end of the view.
diff --git a/core/html/canvas/EXTBlendMinMax.idl b/core/html/canvas/EXTBlendMinMax.idl new file mode 100644 index 0000000..55baea7 --- /dev/null +++ b/core/html/canvas/EXTBlendMinMax.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + DoNotCheckConstants, + NoInterfaceObject, + TypeChecking=Interface|Nullable, +] interface EXTBlendMinMax { + const unsigned long MIN_EXT = 0x8007; + const unsigned long MAX_EXT = 0x8008; +};
diff --git a/core/html/canvas/EXTShaderTextureLOD.idl b/core/html/canvas/EXTShaderTextureLOD.idl new file mode 100644 index 0000000..a2e18b6 --- /dev/null +++ b/core/html/canvas/EXTShaderTextureLOD.idl
@@ -0,0 +1,8 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject +] interface EXTShaderTextureLOD { +};
diff --git a/core/html/canvas/OESVertexArrayObject.idl b/core/html/canvas/OESVertexArrayObject.idl index e7cc9f7..5a21f23 100644 --- a/core/html/canvas/OESVertexArrayObject.idl +++ b/core/html/canvas/OESVertexArrayObject.idl
@@ -26,7 +26,7 @@ [ DoNotCheckConstants, NoInterfaceObject, - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface OESVertexArrayObject { const unsigned long VERTEX_ARRAY_BINDING_OES = 0x85B5;
diff --git a/core/html/canvas/Path.idl b/core/html/canvas/Path.idl deleted file mode 100644 index 66435a5..0000000 --- a/core/html/canvas/Path.idl +++ /dev/null
@@ -1,68 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -[ - RuntimeEnabled=ExperimentalCanvasFeatures, - Constructor, - Constructor(Path path), - Constructor(DOMString text), - ImplementedAs=DOMPath -] interface Path { - - // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface. - void closePath(); - void moveTo([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void lineTo([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void quadraticCurveTo([Default=Undefined] optional float cpx, - [Default=Undefined] optional float cpy, - [Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void bezierCurveTo([Default=Undefined] optional float cp1x, - [Default=Undefined] optional float cp1y, - [Default=Undefined] optional float cp2x, - [Default=Undefined] optional float cp2y, - [Default=Undefined] optional float x, - [Default=Undefined] optional float y); - [RaisesException] void arcTo([Default=Undefined] optional float x1, - [Default=Undefined] optional float y1, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2, - [Default=Undefined] optional float radius); - void rect([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float width, - [Default=Undefined] optional float height); - [RaisesException] void arc([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float radius, - [Default=Undefined] optional float startAngle, - [Default=Undefined] optional float endAngle, - [Default=Undefined] optional boolean anticlockwise); -};
diff --git a/core/html/canvas/Path2D.idl b/core/html/canvas/Path2D.idl new file mode 100644 index 0000000..2621485 --- /dev/null +++ b/core/html/canvas/Path2D.idl
@@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path2d + +[ + Constructor, + Constructor(Path2D path), + Constructor(DOMString text), + RuntimeEnabled=Path2D, +] interface Path2D { + + [RuntimeEnabled=ExperimentalCanvasFeatures, TypeChecking=Interface|Nullable] void addPath(Path2D path, optional SVGMatrix? transform); +}; + +Path2D implements CanvasPathMethods;
diff --git a/core/html/canvas/WebGLCompressedTextureETC1.idl b/core/html/canvas/WebGLCompressedTextureETC1.idl new file mode 100644 index 0000000..e37d990 --- /dev/null +++ b/core/html/canvas/WebGLCompressedTextureETC1.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, + DoNotCheckConstants +] interface WebGLCompressedTextureETC1 { + /* Compressed Texture Formats */ + const unsigned long COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; +};
diff --git a/core/html/canvas/WebGLDebugShaders.idl b/core/html/canvas/WebGLDebugShaders.idl index 4948d0e..74851c7 100644 --- a/core/html/canvas/WebGLDebugShaders.idl +++ b/core/html/canvas/WebGLDebugShaders.idl
@@ -25,7 +25,7 @@ [ NoInterfaceObject, - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface WebGLDebugShaders { [TreatReturnedNullStringAs=Null] DOMString getTranslatedShaderSource(WebGLShader? shader); };
diff --git a/core/html/canvas/WebGLLoseContext.idl b/core/html/canvas/WebGLLoseContext.idl index 2b45e1a..117fcf2 100644 --- a/core/html/canvas/WebGLLoseContext.idl +++ b/core/html/canvas/WebGLLoseContext.idl
@@ -25,7 +25,7 @@ [ NoInterfaceObject, - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface WebGLLoseContext { void loseContext(); void restoreContext();
diff --git a/core/html/canvas/WebGLRenderingContext.idl b/core/html/canvas/WebGLRenderingContext.idl index ef8746e..ce2d483 100644 --- a/core/html/canvas/WebGLRenderingContext.idl +++ b/core/html/canvas/WebGLRenderingContext.idl
@@ -23,652 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -typedef unsigned long GLenum; -typedef boolean GLboolean; -typedef unsigned long GLbitfield; -typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */ -typedef short GLshort; -typedef long GLint; -typedef long GLsizei; -typedef long long GLintptr; -typedef long long GLsizeiptr; -typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */ -typedef unsigned short GLushort; -typedef unsigned long GLuint; -typedef /*unrestricted*/ float GLfloat; -typedef /*unrestricted*/ float GLclampf; +// http://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext [ DoNotCheckConstants, - StrictTypeChecking, -] interface WebGLRenderingContext : CanvasRenderingContext { - - /* ClearBufferMask */ - const GLenum DEPTH_BUFFER_BIT = 0x00000100; - const GLenum STENCIL_BUFFER_BIT = 0x00000400; - const GLenum COLOR_BUFFER_BIT = 0x00004000; - - /* BeginMode */ - const GLenum POINTS = 0x0000; - const GLenum LINES = 0x0001; - const GLenum LINE_LOOP = 0x0002; - const GLenum LINE_STRIP = 0x0003; - const GLenum TRIANGLES = 0x0004; - const GLenum TRIANGLE_STRIP = 0x0005; - const GLenum TRIANGLE_FAN = 0x0006; - - /* AlphaFunction (not supported in ES20) */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* BlendingFactorDest */ - const GLenum ZERO = 0; - const GLenum ONE = 1; - const GLenum SRC_COLOR = 0x0300; - const GLenum ONE_MINUS_SRC_COLOR = 0x0301; - const GLenum SRC_ALPHA = 0x0302; - const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; - const GLenum DST_ALPHA = 0x0304; - const GLenum ONE_MINUS_DST_ALPHA = 0x0305; - - /* BlendingFactorSrc */ - /* ZERO */ - /* ONE */ - const GLenum DST_COLOR = 0x0306; - const GLenum ONE_MINUS_DST_COLOR = 0x0307; - const GLenum SRC_ALPHA_SATURATE = 0x0308; - /* SRC_ALPHA */ - /* ONE_MINUS_SRC_ALPHA */ - /* DST_ALPHA */ - /* ONE_MINUS_DST_ALPHA */ - - /* BlendEquationSeparate */ - const GLenum FUNC_ADD = 0x8006; - const GLenum BLEND_EQUATION = 0x8009; - const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ - const GLenum BLEND_EQUATION_ALPHA = 0x883D; - - /* BlendSubtract */ - const GLenum FUNC_SUBTRACT = 0x800A; - const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; - - /* Separate Blend Functions */ - const GLenum BLEND_DST_RGB = 0x80C8; - const GLenum BLEND_SRC_RGB = 0x80C9; - const GLenum BLEND_DST_ALPHA = 0x80CA; - const GLenum BLEND_SRC_ALPHA = 0x80CB; - const GLenum CONSTANT_COLOR = 0x8001; - const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; - const GLenum CONSTANT_ALPHA = 0x8003; - const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; - const GLenum BLEND_COLOR = 0x8005; - - /* Buffer Objects */ - const GLenum ARRAY_BUFFER = 0x8892; - const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; - const GLenum ARRAY_BUFFER_BINDING = 0x8894; - const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - - const GLenum STREAM_DRAW = 0x88E0; - const GLenum STATIC_DRAW = 0x88E4; - const GLenum DYNAMIC_DRAW = 0x88E8; - - const GLenum BUFFER_SIZE = 0x8764; - const GLenum BUFFER_USAGE = 0x8765; - - const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; - - /* CullFaceMode */ - const GLenum FRONT = 0x0404; - const GLenum BACK = 0x0405; - const GLenum FRONT_AND_BACK = 0x0408; - - /* DepthFunction */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* EnableCap */ - const GLenum TEXTURE_2D = 0x0DE1; - const GLenum CULL_FACE = 0x0B44; - const GLenum BLEND = 0x0BE2; - const GLenum DITHER = 0x0BD0; - const GLenum STENCIL_TEST = 0x0B90; - const GLenum DEPTH_TEST = 0x0B71; - const GLenum SCISSOR_TEST = 0x0C11; - const GLenum POLYGON_OFFSET_FILL = 0x8037; - const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - const GLenum SAMPLE_COVERAGE = 0x80A0; - - /* ErrorCode */ - const GLenum NO_ERROR = 0; - const GLenum INVALID_ENUM = 0x0500; - const GLenum INVALID_VALUE = 0x0501; - const GLenum INVALID_OPERATION = 0x0502; - const GLenum OUT_OF_MEMORY = 0x0505; - - /* FrontFaceDirection */ - const GLenum CW = 0x0900; - const GLenum CCW = 0x0901; - - /* GetPName */ - const GLenum LINE_WIDTH = 0x0B21; - const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; - const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; - const GLenum CULL_FACE_MODE = 0x0B45; - const GLenum FRONT_FACE = 0x0B46; - const GLenum DEPTH_RANGE = 0x0B70; - const GLenum DEPTH_WRITEMASK = 0x0B72; - const GLenum DEPTH_CLEAR_VALUE = 0x0B73; - const GLenum DEPTH_FUNC = 0x0B74; - const GLenum STENCIL_CLEAR_VALUE = 0x0B91; - const GLenum STENCIL_FUNC = 0x0B92; - const GLenum STENCIL_FAIL = 0x0B94; - const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; - const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; - const GLenum STENCIL_REF = 0x0B97; - const GLenum STENCIL_VALUE_MASK = 0x0B93; - const GLenum STENCIL_WRITEMASK = 0x0B98; - const GLenum STENCIL_BACK_FUNC = 0x8800; - const GLenum STENCIL_BACK_FAIL = 0x8801; - const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - const GLenum STENCIL_BACK_REF = 0x8CA3; - const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; - const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; - const GLenum VIEWPORT = 0x0BA2; - const GLenum SCISSOR_BOX = 0x0C10; - /* SCISSOR_TEST */ - const GLenum COLOR_CLEAR_VALUE = 0x0C22; - const GLenum COLOR_WRITEMASK = 0x0C23; - const GLenum UNPACK_ALIGNMENT = 0x0CF5; - const GLenum PACK_ALIGNMENT = 0x0D05; - const GLenum MAX_TEXTURE_SIZE = 0x0D33; - const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; - const GLenum SUBPIXEL_BITS = 0x0D50; - const GLenum RED_BITS = 0x0D52; - const GLenum GREEN_BITS = 0x0D53; - const GLenum BLUE_BITS = 0x0D54; - const GLenum ALPHA_BITS = 0x0D55; - const GLenum DEPTH_BITS = 0x0D56; - const GLenum STENCIL_BITS = 0x0D57; - const GLenum POLYGON_OFFSET_UNITS = 0x2A00; - /* POLYGON_OFFSET_FILL */ - const GLenum POLYGON_OFFSET_FACTOR = 0x8038; - const GLenum TEXTURE_BINDING_2D = 0x8069; - const GLenum SAMPLE_BUFFERS = 0x80A8; - const GLenum SAMPLES = 0x80A9; - const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; - const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; - - /* GetTextureParameter */ - /* TEXTURE_MAG_FILTER */ - /* TEXTURE_MIN_FILTER */ - /* TEXTURE_WRAP_S */ - /* TEXTURE_WRAP_T */ - - const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; - - /* HintMode */ - const GLenum DONT_CARE = 0x1100; - const GLenum FASTEST = 0x1101; - const GLenum NICEST = 0x1102; - - /* HintTarget */ - const GLenum GENERATE_MIPMAP_HINT = 0x8192; - - /* DataType */ - const GLenum BYTE = 0x1400; - const GLenum UNSIGNED_BYTE = 0x1401; - const GLenum SHORT = 0x1402; - const GLenum UNSIGNED_SHORT = 0x1403; - const GLenum INT = 0x1404; - const GLenum UNSIGNED_INT = 0x1405; - const GLenum FLOAT = 0x1406; - - /* PixelFormat */ - const GLenum DEPTH_COMPONENT = 0x1902; - const GLenum ALPHA = 0x1906; - const GLenum RGB = 0x1907; - const GLenum RGBA = 0x1908; - const GLenum LUMINANCE = 0x1909; - const GLenum LUMINANCE_ALPHA = 0x190A; - - /* PixelType */ - /* UNSIGNED_BYTE */ - const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; - const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; - const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; - - /* Shaders */ - const GLenum FRAGMENT_SHADER = 0x8B30; - const GLenum VERTEX_SHADER = 0x8B31; - const GLenum MAX_VERTEX_ATTRIBS = 0x8869; - const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - const GLenum MAX_VARYING_VECTORS = 0x8DFC; - const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; - const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - const GLenum SHADER_TYPE = 0x8B4F; - const GLenum DELETE_STATUS = 0x8B80; - const GLenum LINK_STATUS = 0x8B82; - const GLenum VALIDATE_STATUS = 0x8B83; - const GLenum ATTACHED_SHADERS = 0x8B85; - const GLenum ACTIVE_UNIFORMS = 0x8B86; - const GLenum ACTIVE_ATTRIBUTES = 0x8B89; - const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; - const GLenum CURRENT_PROGRAM = 0x8B8D; - - /* StencilFunction */ - const GLenum NEVER = 0x0200; - const GLenum LESS = 0x0201; - const GLenum EQUAL = 0x0202; - const GLenum LEQUAL = 0x0203; - const GLenum GREATER = 0x0204; - const GLenum NOTEQUAL = 0x0205; - const GLenum GEQUAL = 0x0206; - const GLenum ALWAYS = 0x0207; - - /* StencilOp */ - /* ZERO */ - const GLenum KEEP = 0x1E00; - const GLenum REPLACE = 0x1E01; - const GLenum INCR = 0x1E02; - const GLenum DECR = 0x1E03; - const GLenum INVERT = 0x150A; - const GLenum INCR_WRAP = 0x8507; - const GLenum DECR_WRAP = 0x8508; - - /* StringName */ - const GLenum VENDOR = 0x1F00; - const GLenum RENDERER = 0x1F01; - const GLenum VERSION = 0x1F02; - - /* TextureMagFilter */ - const GLenum NEAREST = 0x2600; - const GLenum LINEAR = 0x2601; - - /* TextureMinFilter */ - /* NEAREST */ - /* LINEAR */ - const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; - const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; - const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; - const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; - - /* TextureParameterName */ - const GLenum TEXTURE_MAG_FILTER = 0x2800; - const GLenum TEXTURE_MIN_FILTER = 0x2801; - const GLenum TEXTURE_WRAP_S = 0x2802; - const GLenum TEXTURE_WRAP_T = 0x2803; - - /* TextureTarget */ - /* TEXTURE_2D */ - const GLenum TEXTURE = 0x1702; - - const GLenum TEXTURE_CUBE_MAP = 0x8513; - const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - - /* TextureUnit */ - const GLenum TEXTURE0 = 0x84C0; - const GLenum TEXTURE1 = 0x84C1; - const GLenum TEXTURE2 = 0x84C2; - const GLenum TEXTURE3 = 0x84C3; - const GLenum TEXTURE4 = 0x84C4; - const GLenum TEXTURE5 = 0x84C5; - const GLenum TEXTURE6 = 0x84C6; - const GLenum TEXTURE7 = 0x84C7; - const GLenum TEXTURE8 = 0x84C8; - const GLenum TEXTURE9 = 0x84C9; - const GLenum TEXTURE10 = 0x84CA; - const GLenum TEXTURE11 = 0x84CB; - const GLenum TEXTURE12 = 0x84CC; - const GLenum TEXTURE13 = 0x84CD; - const GLenum TEXTURE14 = 0x84CE; - const GLenum TEXTURE15 = 0x84CF; - const GLenum TEXTURE16 = 0x84D0; - const GLenum TEXTURE17 = 0x84D1; - const GLenum TEXTURE18 = 0x84D2; - const GLenum TEXTURE19 = 0x84D3; - const GLenum TEXTURE20 = 0x84D4; - const GLenum TEXTURE21 = 0x84D5; - const GLenum TEXTURE22 = 0x84D6; - const GLenum TEXTURE23 = 0x84D7; - const GLenum TEXTURE24 = 0x84D8; - const GLenum TEXTURE25 = 0x84D9; - const GLenum TEXTURE26 = 0x84DA; - const GLenum TEXTURE27 = 0x84DB; - const GLenum TEXTURE28 = 0x84DC; - const GLenum TEXTURE29 = 0x84DD; - const GLenum TEXTURE30 = 0x84DE; - const GLenum TEXTURE31 = 0x84DF; - const GLenum ACTIVE_TEXTURE = 0x84E0; - - /* TextureWrapMode */ - const GLenum REPEAT = 0x2901; - const GLenum CLAMP_TO_EDGE = 0x812F; - const GLenum MIRRORED_REPEAT = 0x8370; - - /* Uniform Types */ - const GLenum FLOAT_VEC2 = 0x8B50; - const GLenum FLOAT_VEC3 = 0x8B51; - const GLenum FLOAT_VEC4 = 0x8B52; - const GLenum INT_VEC2 = 0x8B53; - const GLenum INT_VEC3 = 0x8B54; - const GLenum INT_VEC4 = 0x8B55; - const GLenum BOOL = 0x8B56; - const GLenum BOOL_VEC2 = 0x8B57; - const GLenum BOOL_VEC3 = 0x8B58; - const GLenum BOOL_VEC4 = 0x8B59; - const GLenum FLOAT_MAT2 = 0x8B5A; - const GLenum FLOAT_MAT3 = 0x8B5B; - const GLenum FLOAT_MAT4 = 0x8B5C; - const GLenum SAMPLER_2D = 0x8B5E; - const GLenum SAMPLER_CUBE = 0x8B60; - - /* Vertex Arrays */ - const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; - - /* Shader Source */ - const GLenum COMPILE_STATUS = 0x8B81; - - /* Shader Precision-Specified Types */ - const GLenum LOW_FLOAT = 0x8DF0; - const GLenum MEDIUM_FLOAT = 0x8DF1; - const GLenum HIGH_FLOAT = 0x8DF2; - const GLenum LOW_INT = 0x8DF3; - const GLenum MEDIUM_INT = 0x8DF4; - const GLenum HIGH_INT = 0x8DF5; - - /* Framebuffer Object. */ - const GLenum FRAMEBUFFER = 0x8D40; - const GLenum RENDERBUFFER = 0x8D41; - - const GLenum RGBA4 = 0x8056; - const GLenum RGB5_A1 = 0x8057; - const GLenum RGB565 = 0x8D62; - const GLenum DEPTH_COMPONENT16 = 0x81A5; - const GLenum STENCIL_INDEX = 0x1901; - const GLenum STENCIL_INDEX8 = 0x8D48; - const GLenum DEPTH_STENCIL = 0x84F9; - - const GLenum RENDERBUFFER_WIDTH = 0x8D42; - const GLenum RENDERBUFFER_HEIGHT = 0x8D43; - const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; - const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; - const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; - const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; - const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; - const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; - - const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - - const GLenum COLOR_ATTACHMENT0 = 0x8CE0; - const GLenum DEPTH_ATTACHMENT = 0x8D00; - const GLenum STENCIL_ATTACHMENT = 0x8D20; - const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; - - const GLenum NONE = 0; - - const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; - const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; - const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - - const GLenum FRAMEBUFFER_BINDING = 0x8CA6; - const GLenum RENDERBUFFER_BINDING = 0x8CA7; - const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; - - const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; - - /* WebGL-specific enums */ - const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; - const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; - const GLenum CONTEXT_LOST_WEBGL = 0x9242; - const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; - const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; - - readonly attribute GLsizei drawingBufferWidth; - readonly attribute GLsizei drawingBufferHeight; - - void activeTexture(GLenum texture); - void attachShader(WebGLProgram? program, WebGLShader? shader); - void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name); - void bindBuffer(GLenum target, WebGLBuffer? buffer); - void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); - void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); - void bindTexture(GLenum target, WebGLTexture? texture); - void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void blendEquation(GLenum mode); - void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); - void blendFunc(GLenum sfactor, GLenum dfactor); - void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - void bufferData(GLenum target, ArrayBuffer? data, GLenum usage); - void bufferData(GLenum target, ArrayBufferView? data, GLenum usage); - void bufferData(GLenum target, GLsizeiptr size, GLenum usage); - void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data); - void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView? data); - - GLenum checkFramebufferStatus(GLenum target); - void clear(GLbitfield mask); - void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void clearDepth(GLclampf depth); - void clearStencil(GLint s); - void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void compileShader(WebGLShader? shader); - - void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, ArrayBufferView? data); - void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, GLenum format, ArrayBufferView? data); - - void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - - WebGLBuffer createBuffer(); - WebGLFramebuffer createFramebuffer(); - WebGLProgram createProgram(); - WebGLRenderbuffer createRenderbuffer(); - WebGLShader createShader(GLenum type); - WebGLTexture createTexture(); - - void cullFace(GLenum mode); - - void deleteBuffer(WebGLBuffer? buffer); - void deleteFramebuffer(WebGLFramebuffer? framebuffer); - void deleteProgram(WebGLProgram? program); - void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); - void deleteShader(WebGLShader? shader); - void deleteTexture(WebGLTexture? texture); - - void depthFunc(GLenum func); - void depthMask(GLboolean flag); - void depthRange(GLclampf zNear, GLclampf zFar); - void detachShader(WebGLProgram? program, WebGLShader? shader); - void disable(GLenum cap); - void disableVertexAttribArray(GLuint index); - void drawArrays(GLenum mode, GLint first, GLsizei count); - void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); - - void enable(GLenum cap); - void enableVertexAttribArray(GLuint index); - void finish(); - void flush(); - void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer? renderbuffer); - void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture? texture, GLint level); - void frontFace(GLenum mode); - void generateMipmap(GLenum target); - - WebGLActiveInfo getActiveAttrib(WebGLProgram? program, GLuint index); - WebGLActiveInfo getActiveUniform(WebGLProgram? program, GLuint index); - - [Custom] void getAttachedShaders(WebGLProgram? program); - - GLint getAttribLocation(WebGLProgram? program, DOMString name); - - [Custom] any getBufferParameter(GLenum target, GLenum pname); - - WebGLContextAttributes getContextAttributes(); - - GLenum getError(); - - // object getExtension(DOMString name); - [Custom] any getExtension(DOMString name); - - [Custom] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname); - [Custom] any getParameter(GLenum pname); - [Custom] any getProgramParameter(WebGLProgram? program, GLenum pname); - [TreatReturnedNullStringAs=Null] DOMString getProgramInfoLog(WebGLProgram? program); - [Custom] any getRenderbufferParameter(GLenum target, GLenum pname); - [Custom] any getShaderParameter(WebGLShader? shader, GLenum pname); - - [TreatReturnedNullStringAs=Null] DOMString getShaderInfoLog(WebGLShader? shader); - - WebGLShaderPrecisionFormat getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); - - [TreatReturnedNullStringAs=Null] DOMString getShaderSource(WebGLShader? shader); - - [Custom] sequence<DOMString> getSupportedExtensions(); - - [Custom] any getTexParameter(GLenum target, GLenum pname); - - [Custom] any getUniform(WebGLProgram? program, WebGLUniformLocation location); - - WebGLUniformLocation getUniformLocation(WebGLProgram? program, DOMString name); - - [Custom] any getVertexAttrib(GLuint index, GLenum pname); - - GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); - - void hint(GLenum target, GLenum mode); - GLboolean isBuffer(WebGLBuffer? buffer); - GLboolean isContextLost(); - GLboolean isEnabled(GLenum cap); - GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); - GLboolean isProgram(WebGLProgram? program); - GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); - GLboolean isShader(WebGLShader? shader); - GLboolean isTexture(WebGLTexture? texture); - void lineWidth(GLfloat width); - void linkProgram(WebGLProgram? program); - void pixelStorei(GLenum pname, GLint param); - void polygonOffset(GLfloat factor, GLfloat units); - - void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels); - - void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - void sampleCoverage(GLclampf value, GLboolean invert); - void scissor(GLint x, GLint y, GLsizei width, GLsizei height); - void shaderSource(WebGLShader? shader, DOMString string); - void stencilFunc(GLenum func, GLint ref, GLuint mask); - void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); - void stencilMask(GLuint mask); - void stencilMaskSeparate(GLenum face, GLuint mask); - void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); - void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - - void texParameterf(GLenum target, GLenum pname, GLfloat param); - void texParameteri(GLenum target, GLenum pname, GLint param); - - // Supported forms: - [RaisesException] void texImage2D( - GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, ArrayBufferView? pixels); - [RaisesException] void texImage2D( - GLenum target, GLint level, GLenum internalformat, - GLenum format, GLenum type, ImageData? pixels); - [RaisesException] void texImage2D( - GLenum target, GLint level, GLenum internalformat, - GLenum format, GLenum type, HTMLImageElement? image); - [RaisesException] void texImage2D( - GLenum target, GLint level, GLenum internalformat, - GLenum format, GLenum type, HTMLCanvasElement? canvas); - [RaisesException] void texImage2D( - GLenum target, GLint level, GLenum internalformat, - GLenum format, GLenum type, HTMLVideoElement? video); - - [RaisesException] void texSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, ArrayBufferView? pixels); - [RaisesException] void texSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, ImageData? pixels); - [RaisesException] void texSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, HTMLImageElement? image); - [RaisesException] void texSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, HTMLCanvasElement? canvas); - [RaisesException] void texSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, HTMLVideoElement? video); - - void uniform1f(WebGLUniformLocation? location, GLfloat x); - [Custom] void uniform1fv(WebGLUniformLocation? location, Float32Array v); - void uniform1i(WebGLUniformLocation? location, GLint x); - [Custom] void uniform1iv(WebGLUniformLocation? location, Int32Array v); - void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); - [Custom] void uniform2fv(WebGLUniformLocation? location, Float32Array v); - void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); - [Custom] void uniform2iv(WebGLUniformLocation? location, Int32Array v); - void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); - [Custom] void uniform3fv(WebGLUniformLocation? location, Float32Array v); - void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); - [Custom] void uniform3iv(WebGLUniformLocation? location, Int32Array v); - void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - [Custom] void uniform4fv(WebGLUniformLocation? location, Float32Array v); - void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); - [Custom] void uniform4iv(WebGLUniformLocation? location, Int32Array v); - - [Custom] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); - [Custom] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); - [Custom] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); - - void useProgram(WebGLProgram? program); - void validateProgram(WebGLProgram? program); - - void vertexAttrib1f(GLuint indx, GLfloat x); - [Custom] void vertexAttrib1fv(GLuint indx, Float32Array values); - void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); - [Custom] void vertexAttrib2fv(GLuint indx, Float32Array values); - void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - [Custom] void vertexAttrib3fv(GLuint indx, Float32Array values); - void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - [Custom] void vertexAttrib4fv(GLuint indx, Float32Array values); - void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, - GLsizei stride, GLintptr offset); - - void viewport(GLint x, GLint y, GLsizei width, GLsizei height); -}; + TypeChecking=Interface|Nullable, + WillBeGarbageCollected, +] interface WebGLRenderingContext { }; +WebGLRenderingContext implements WebGLRenderingContextBase;
diff --git a/core/html/canvas/WebGLRenderingContextBase.idl b/core/html/canvas/WebGLRenderingContextBase.idl new file mode 100644 index 0000000..e6b013e --- /dev/null +++ b/core/html/canvas/WebGLRenderingContextBase.idl
@@ -0,0 +1,689 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// http://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContextBase + +typedef unsigned long GLenum; +typedef boolean GLboolean; +typedef unsigned long GLbitfield; +typedef byte GLbyte; // 'byte' should be a signed 8 bit type. +typedef short GLshort; +typedef long GLint; +typedef long GLsizei; +typedef long long GLintptr; +typedef long long GLsizeiptr; +typedef octet GLubyte; // 'octet' should be an unsigned 8 bit type. +typedef unsigned short GLushort; +typedef unsigned long GLuint; +typedef unrestricted float GLfloat; +typedef unrestricted float GLclampf; + +[ + // FIXME: [DoNotCheckConstants] and [TypeChecking=Interface|Nullable] should be applied + // to members and not need to be put on implementing interface + // DoNotCheckConstants, // need to put on implementing interface + NoInterfaceObject, // Always used on target of 'implements' + // TypeChecking=Interface|Nullable|Unrestricted, // need to put on implementing interface +] interface WebGLRenderingContextBase { + + readonly attribute HTMLCanvasElement canvas; + + /* ClearBufferMask */ + const GLenum DEPTH_BUFFER_BIT = 0x00000100; + const GLenum STENCIL_BUFFER_BIT = 0x00000400; + const GLenum COLOR_BUFFER_BIT = 0x00004000; + + /* BeginMode */ + const GLenum POINTS = 0x0000; + const GLenum LINES = 0x0001; + const GLenum LINE_LOOP = 0x0002; + const GLenum LINE_STRIP = 0x0003; + const GLenum TRIANGLES = 0x0004; + const GLenum TRIANGLE_STRIP = 0x0005; + const GLenum TRIANGLE_FAN = 0x0006; + + /* AlphaFunction (not supported in ES20) */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* BlendingFactorDest */ + const GLenum ZERO = 0; + const GLenum ONE = 1; + const GLenum SRC_COLOR = 0x0300; + const GLenum ONE_MINUS_SRC_COLOR = 0x0301; + const GLenum SRC_ALPHA = 0x0302; + const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; + const GLenum DST_ALPHA = 0x0304; + const GLenum ONE_MINUS_DST_ALPHA = 0x0305; + + /* BlendingFactorSrc */ + /* ZERO */ + /* ONE */ + const GLenum DST_COLOR = 0x0306; + const GLenum ONE_MINUS_DST_COLOR = 0x0307; + const GLenum SRC_ALPHA_SATURATE = 0x0308; + /* SRC_ALPHA */ + /* ONE_MINUS_SRC_ALPHA */ + /* DST_ALPHA */ + /* ONE_MINUS_DST_ALPHA */ + + /* BlendEquationSeparate */ + const GLenum FUNC_ADD = 0x8006; + const GLenum BLEND_EQUATION = 0x8009; + const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + const GLenum BLEND_EQUATION_ALPHA = 0x883D; + + /* BlendSubtract */ + const GLenum FUNC_SUBTRACT = 0x800A; + const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; + + /* Separate Blend Functions */ + const GLenum BLEND_DST_RGB = 0x80C8; + const GLenum BLEND_SRC_RGB = 0x80C9; + const GLenum BLEND_DST_ALPHA = 0x80CA; + const GLenum BLEND_SRC_ALPHA = 0x80CB; + const GLenum CONSTANT_COLOR = 0x8001; + const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; + const GLenum CONSTANT_ALPHA = 0x8003; + const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; + const GLenum BLEND_COLOR = 0x8005; + + /* Buffer Objects */ + const GLenum ARRAY_BUFFER = 0x8892; + const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; + const GLenum ARRAY_BUFFER_BINDING = 0x8894; + const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + + const GLenum STREAM_DRAW = 0x88E0; + const GLenum STATIC_DRAW = 0x88E4; + const GLenum DYNAMIC_DRAW = 0x88E8; + + const GLenum BUFFER_SIZE = 0x8764; + const GLenum BUFFER_USAGE = 0x8765; + + const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; + + /* CullFaceMode */ + const GLenum FRONT = 0x0404; + const GLenum BACK = 0x0405; + const GLenum FRONT_AND_BACK = 0x0408; + + /* DepthFunction */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* EnableCap */ + const GLenum TEXTURE_2D = 0x0DE1; + const GLenum CULL_FACE = 0x0B44; + const GLenum BLEND = 0x0BE2; + const GLenum DITHER = 0x0BD0; + const GLenum STENCIL_TEST = 0x0B90; + const GLenum DEPTH_TEST = 0x0B71; + const GLenum SCISSOR_TEST = 0x0C11; + const GLenum POLYGON_OFFSET_FILL = 0x8037; + const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + const GLenum SAMPLE_COVERAGE = 0x80A0; + + /* ErrorCode */ + const GLenum NO_ERROR = 0; + const GLenum INVALID_ENUM = 0x0500; + const GLenum INVALID_VALUE = 0x0501; + const GLenum INVALID_OPERATION = 0x0502; + const GLenum OUT_OF_MEMORY = 0x0505; + + /* FrontFaceDirection */ + const GLenum CW = 0x0900; + const GLenum CCW = 0x0901; + + /* GetPName */ + const GLenum LINE_WIDTH = 0x0B21; + const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; + const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; + const GLenum CULL_FACE_MODE = 0x0B45; + const GLenum FRONT_FACE = 0x0B46; + const GLenum DEPTH_RANGE = 0x0B70; + const GLenum DEPTH_WRITEMASK = 0x0B72; + const GLenum DEPTH_CLEAR_VALUE = 0x0B73; + const GLenum DEPTH_FUNC = 0x0B74; + const GLenum STENCIL_CLEAR_VALUE = 0x0B91; + const GLenum STENCIL_FUNC = 0x0B92; + const GLenum STENCIL_FAIL = 0x0B94; + const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; + const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; + const GLenum STENCIL_REF = 0x0B97; + const GLenum STENCIL_VALUE_MASK = 0x0B93; + const GLenum STENCIL_WRITEMASK = 0x0B98; + const GLenum STENCIL_BACK_FUNC = 0x8800; + const GLenum STENCIL_BACK_FAIL = 0x8801; + const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + const GLenum STENCIL_BACK_REF = 0x8CA3; + const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; + const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; + const GLenum VIEWPORT = 0x0BA2; + const GLenum SCISSOR_BOX = 0x0C10; + /* SCISSOR_TEST */ + const GLenum COLOR_CLEAR_VALUE = 0x0C22; + const GLenum COLOR_WRITEMASK = 0x0C23; + const GLenum UNPACK_ALIGNMENT = 0x0CF5; + const GLenum PACK_ALIGNMENT = 0x0D05; + const GLenum MAX_TEXTURE_SIZE = 0x0D33; + const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; + const GLenum SUBPIXEL_BITS = 0x0D50; + const GLenum RED_BITS = 0x0D52; + const GLenum GREEN_BITS = 0x0D53; + const GLenum BLUE_BITS = 0x0D54; + const GLenum ALPHA_BITS = 0x0D55; + const GLenum DEPTH_BITS = 0x0D56; + const GLenum STENCIL_BITS = 0x0D57; + const GLenum POLYGON_OFFSET_UNITS = 0x2A00; + /* POLYGON_OFFSET_FILL */ + const GLenum POLYGON_OFFSET_FACTOR = 0x8038; + const GLenum TEXTURE_BINDING_2D = 0x8069; + const GLenum SAMPLE_BUFFERS = 0x80A8; + const GLenum SAMPLES = 0x80A9; + const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; + const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; + + /* GetTextureParameter */ + /* TEXTURE_MAG_FILTER */ + /* TEXTURE_MIN_FILTER */ + /* TEXTURE_WRAP_S */ + /* TEXTURE_WRAP_T */ + + const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /* HintMode */ + const GLenum DONT_CARE = 0x1100; + const GLenum FASTEST = 0x1101; + const GLenum NICEST = 0x1102; + + /* HintTarget */ + const GLenum GENERATE_MIPMAP_HINT = 0x8192; + + /* DataType */ + const GLenum BYTE = 0x1400; + const GLenum UNSIGNED_BYTE = 0x1401; + const GLenum SHORT = 0x1402; + const GLenum UNSIGNED_SHORT = 0x1403; + const GLenum INT = 0x1404; + const GLenum UNSIGNED_INT = 0x1405; + const GLenum FLOAT = 0x1406; + + /* PixelFormat */ + const GLenum DEPTH_COMPONENT = 0x1902; + const GLenum ALPHA = 0x1906; + const GLenum RGB = 0x1907; + const GLenum RGBA = 0x1908; + const GLenum LUMINANCE = 0x1909; + const GLenum LUMINANCE_ALPHA = 0x190A; + + /* PixelType */ + /* UNSIGNED_BYTE */ + const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; + const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; + const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; + + /* Shaders */ + const GLenum FRAGMENT_SHADER = 0x8B30; + const GLenum VERTEX_SHADER = 0x8B31; + const GLenum MAX_VERTEX_ATTRIBS = 0x8869; + const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + const GLenum MAX_VARYING_VECTORS = 0x8DFC; + const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; + const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + const GLenum SHADER_TYPE = 0x8B4F; + const GLenum DELETE_STATUS = 0x8B80; + const GLenum LINK_STATUS = 0x8B82; + const GLenum VALIDATE_STATUS = 0x8B83; + const GLenum ATTACHED_SHADERS = 0x8B85; + const GLenum ACTIVE_UNIFORMS = 0x8B86; + const GLenum ACTIVE_ATTRIBUTES = 0x8B89; + const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; + const GLenum CURRENT_PROGRAM = 0x8B8D; + + /* StencilFunction */ + const GLenum NEVER = 0x0200; + const GLenum LESS = 0x0201; + const GLenum EQUAL = 0x0202; + const GLenum LEQUAL = 0x0203; + const GLenum GREATER = 0x0204; + const GLenum NOTEQUAL = 0x0205; + const GLenum GEQUAL = 0x0206; + const GLenum ALWAYS = 0x0207; + + /* StencilOp */ + /* ZERO */ + const GLenum KEEP = 0x1E00; + const GLenum REPLACE = 0x1E01; + const GLenum INCR = 0x1E02; + const GLenum DECR = 0x1E03; + const GLenum INVERT = 0x150A; + const GLenum INCR_WRAP = 0x8507; + const GLenum DECR_WRAP = 0x8508; + + /* StringName */ + const GLenum VENDOR = 0x1F00; + const GLenum RENDERER = 0x1F01; + const GLenum VERSION = 0x1F02; + + /* TextureMagFilter */ + const GLenum NEAREST = 0x2600; + const GLenum LINEAR = 0x2601; + + /* TextureMinFilter */ + /* NEAREST */ + /* LINEAR */ + const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; + const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; + const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; + const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; + + /* TextureParameterName */ + const GLenum TEXTURE_MAG_FILTER = 0x2800; + const GLenum TEXTURE_MIN_FILTER = 0x2801; + const GLenum TEXTURE_WRAP_S = 0x2802; + const GLenum TEXTURE_WRAP_T = 0x2803; + + /* TextureTarget */ + /* TEXTURE_2D */ + const GLenum TEXTURE = 0x1702; + + const GLenum TEXTURE_CUBE_MAP = 0x8513; + const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /* TextureUnit */ + const GLenum TEXTURE0 = 0x84C0; + const GLenum TEXTURE1 = 0x84C1; + const GLenum TEXTURE2 = 0x84C2; + const GLenum TEXTURE3 = 0x84C3; + const GLenum TEXTURE4 = 0x84C4; + const GLenum TEXTURE5 = 0x84C5; + const GLenum TEXTURE6 = 0x84C6; + const GLenum TEXTURE7 = 0x84C7; + const GLenum TEXTURE8 = 0x84C8; + const GLenum TEXTURE9 = 0x84C9; + const GLenum TEXTURE10 = 0x84CA; + const GLenum TEXTURE11 = 0x84CB; + const GLenum TEXTURE12 = 0x84CC; + const GLenum TEXTURE13 = 0x84CD; + const GLenum TEXTURE14 = 0x84CE; + const GLenum TEXTURE15 = 0x84CF; + const GLenum TEXTURE16 = 0x84D0; + const GLenum TEXTURE17 = 0x84D1; + const GLenum TEXTURE18 = 0x84D2; + const GLenum TEXTURE19 = 0x84D3; + const GLenum TEXTURE20 = 0x84D4; + const GLenum TEXTURE21 = 0x84D5; + const GLenum TEXTURE22 = 0x84D6; + const GLenum TEXTURE23 = 0x84D7; + const GLenum TEXTURE24 = 0x84D8; + const GLenum TEXTURE25 = 0x84D9; + const GLenum TEXTURE26 = 0x84DA; + const GLenum TEXTURE27 = 0x84DB; + const GLenum TEXTURE28 = 0x84DC; + const GLenum TEXTURE29 = 0x84DD; + const GLenum TEXTURE30 = 0x84DE; + const GLenum TEXTURE31 = 0x84DF; + const GLenum ACTIVE_TEXTURE = 0x84E0; + + /* TextureWrapMode */ + const GLenum REPEAT = 0x2901; + const GLenum CLAMP_TO_EDGE = 0x812F; + const GLenum MIRRORED_REPEAT = 0x8370; + + /* Uniform Types */ + const GLenum FLOAT_VEC2 = 0x8B50; + const GLenum FLOAT_VEC3 = 0x8B51; + const GLenum FLOAT_VEC4 = 0x8B52; + const GLenum INT_VEC2 = 0x8B53; + const GLenum INT_VEC3 = 0x8B54; + const GLenum INT_VEC4 = 0x8B55; + const GLenum BOOL = 0x8B56; + const GLenum BOOL_VEC2 = 0x8B57; + const GLenum BOOL_VEC3 = 0x8B58; + const GLenum BOOL_VEC4 = 0x8B59; + const GLenum FLOAT_MAT2 = 0x8B5A; + const GLenum FLOAT_MAT3 = 0x8B5B; + const GLenum FLOAT_MAT4 = 0x8B5C; + const GLenum SAMPLER_2D = 0x8B5E; + const GLenum SAMPLER_CUBE = 0x8B60; + + /* Vertex Arrays */ + const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /* Read Format */ + const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /* Shader Source */ + const GLenum COMPILE_STATUS = 0x8B81; + + /* Shader Precision-Specified Types */ + const GLenum LOW_FLOAT = 0x8DF0; + const GLenum MEDIUM_FLOAT = 0x8DF1; + const GLenum HIGH_FLOAT = 0x8DF2; + const GLenum LOW_INT = 0x8DF3; + const GLenum MEDIUM_INT = 0x8DF4; + const GLenum HIGH_INT = 0x8DF5; + + /* Framebuffer Object. */ + const GLenum FRAMEBUFFER = 0x8D40; + const GLenum RENDERBUFFER = 0x8D41; + + const GLenum RGBA4 = 0x8056; + const GLenum RGB5_A1 = 0x8057; + const GLenum RGB565 = 0x8D62; + const GLenum DEPTH_COMPONENT16 = 0x81A5; + const GLenum STENCIL_INDEX = 0x1901; + const GLenum STENCIL_INDEX8 = 0x8D48; + const GLenum DEPTH_STENCIL = 0x84F9; + + const GLenum RENDERBUFFER_WIDTH = 0x8D42; + const GLenum RENDERBUFFER_HEIGHT = 0x8D43; + const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; + const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; + const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; + const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; + const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; + const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; + + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + + const GLenum COLOR_ATTACHMENT0 = 0x8CE0; + const GLenum DEPTH_ATTACHMENT = 0x8D00; + const GLenum STENCIL_ATTACHMENT = 0x8D20; + const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; + + const GLenum NONE = 0; + + const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; + const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + + const GLenum FRAMEBUFFER_BINDING = 0x8CA6; + const GLenum RENDERBUFFER_BINDING = 0x8CA7; + const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; + + const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + /* WebGL-specific enums */ + const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; + const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; + const GLenum CONTEXT_LOST_WEBGL = 0x9242; + const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; + const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; + + [DartNoAutoScope] readonly attribute GLsizei drawingBufferWidth; + [DartNoAutoScope] readonly attribute GLsizei drawingBufferHeight; + + [DartNoAutoScope] void activeTexture(GLenum texture); + [DartNoAutoScope] void attachShader(WebGLProgram? program, WebGLShader? shader); + [DartNoAutoScope] void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name); + [DartNoAutoScope] void bindBuffer(GLenum target, WebGLBuffer? buffer); + [DartNoAutoScope] void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); + [DartNoAutoScope] void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); + [DartNoAutoScope] void bindTexture(GLenum target, WebGLTexture? texture); + [DartNoAutoScope] void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + [DartNoAutoScope] void blendEquation(GLenum mode); + [DartNoAutoScope] void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + [DartNoAutoScope] void blendFunc(GLenum sfactor, GLenum dfactor); + [DartNoAutoScope] void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + // FIXME: should be union type + // https://www.khronos.org/bugzilla/show_bug.cgi?id=1172 + void bufferData(GLenum target, GLsizeiptr size, GLenum usage); + void bufferData(GLenum target, ArrayBufferView data, GLenum usage); + void bufferData(GLenum target, ArrayBuffer? data, GLenum usage); + void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data); + void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data); + + [DartNoAutoScope] GLenum checkFramebufferStatus(GLenum target); + [DartNoAutoScope] void clear(GLbitfield mask); + [DartNoAutoScope] void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + [DartNoAutoScope] void clearDepth(GLclampf depth); + [DartNoAutoScope] void clearStencil(GLint s); + [DartNoAutoScope] void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + [DartNoAutoScope] void compileShader(WebGLShader? shader); + + [DartNoAutoScope] void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, ArrayBufferView? data); + [DartNoAutoScope] void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, ArrayBufferView? data); + + [DartNoAutoScope] void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + [DartNoAutoScope] void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + WebGLBuffer createBuffer(); + WebGLFramebuffer createFramebuffer(); + WebGLProgram createProgram(); + WebGLRenderbuffer createRenderbuffer(); + WebGLShader createShader(GLenum type); + WebGLTexture createTexture(); + + [DartNoAutoScope] void cullFace(GLenum mode); + + [DartNoAutoScope] void deleteBuffer(WebGLBuffer? buffer); + [DartNoAutoScope] void deleteFramebuffer(WebGLFramebuffer? framebuffer); + [DartNoAutoScope] void deleteProgram(WebGLProgram? program); + [DartNoAutoScope] void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); + [DartNoAutoScope] void deleteShader(WebGLShader? shader); + [DartNoAutoScope] void deleteTexture(WebGLTexture? texture); + + [DartNoAutoScope] void depthFunc(GLenum func); + [DartNoAutoScope] void depthMask(GLboolean flag); + [DartNoAutoScope] void depthRange(GLclampf zNear, GLclampf zFar); + [DartNoAutoScope] void detachShader(WebGLProgram? program, WebGLShader? shader); + [DartNoAutoScope] void disable(GLenum cap); + [DartNoAutoScope] void disableVertexAttribArray(GLuint index); + [DartNoAutoScope] void drawArrays(GLenum mode, GLint first, GLsizei count); + [DartNoAutoScope] void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); + + [DartNoAutoScope] void enable(GLenum cap); + [DartNoAutoScope] void enableVertexAttribArray(GLuint index); + [DartNoAutoScope] void finish(); + [DartNoAutoScope] void flush(); + [DartNoAutoScope] void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer? renderbuffer); + [DartNoAutoScope] void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture? texture, GLint level); + [DartNoAutoScope] void frontFace(GLenum mode); + [DartNoAutoScope] void generateMipmap(GLenum target); + + [DartNoAutoScope] WebGLActiveInfo getActiveAttrib(WebGLProgram? program, GLuint index); + [DartNoAutoScope] WebGLActiveInfo getActiveUniform(WebGLProgram? program, GLuint index); + + [Custom, DartNoAutoScope] void getAttachedShaders(WebGLProgram? program); + + [DartNoAutoScope] GLint getAttribLocation(WebGLProgram? program, DOMString name); + + [Custom] any getBufferParameter(GLenum target, GLenum pname); + + WebGLContextAttributes getContextAttributes(); + + GLenum getError(); + + // object getExtension(DOMString name); + [Custom] any getExtension(DOMString name); + + [Custom] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname); + [Custom] any getParameter(GLenum pname); + [Custom] any getProgramParameter(WebGLProgram? program, GLenum pname); + [TreatReturnedNullStringAs=Null] DOMString getProgramInfoLog(WebGLProgram? program); + [Custom] any getRenderbufferParameter(GLenum target, GLenum pname); + [Custom] any getShaderParameter(WebGLShader? shader, GLenum pname); + + [TreatReturnedNullStringAs=Null] DOMString getShaderInfoLog(WebGLShader? shader); + + WebGLShaderPrecisionFormat getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); + + [TreatReturnedNullStringAs=Null] DOMString getShaderSource(WebGLShader? shader); + + [Custom] sequence<DOMString> getSupportedExtensions(); + + [Custom] any getTexParameter(GLenum target, GLenum pname); + + [Custom] any getUniform(WebGLProgram? program, WebGLUniformLocation location); + + WebGLUniformLocation getUniformLocation(WebGLProgram? program, DOMString name); + + [Custom] any getVertexAttrib(GLuint index, GLenum pname); + + GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); + + [DartNoAutoScope] void hint(GLenum target, GLenum mode); + [DartNoAutoScope] GLboolean isBuffer(WebGLBuffer? buffer); + [DartNoAutoScope] GLboolean isContextLost(); + [DartNoAutoScope] GLboolean isEnabled(GLenum cap); + [DartNoAutoScope] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); + [DartNoAutoScope] GLboolean isProgram(WebGLProgram? program); + [DartNoAutoScope] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); + [DartNoAutoScope] GLboolean isShader(WebGLShader? shader); + [DartNoAutoScope] GLboolean isTexture(WebGLTexture? texture); + [DartNoAutoScope] void lineWidth(GLfloat width); + [DartNoAutoScope] void linkProgram(WebGLProgram? program); + [DartNoAutoScope] void pixelStorei(GLenum pname, GLint param); + [DartNoAutoScope] void polygonOffset(GLfloat factor, GLfloat units); + + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels); + + void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void sampleCoverage(GLclampf value, GLboolean invert); + [DartNoAutoScope] void scissor(GLint x, GLint y, GLsizei width, GLsizei height); + void shaderSource(WebGLShader? shader, DOMString string); + [DartNoAutoScope] void stencilFunc(GLenum func, GLint ref, GLuint mask); + [DartNoAutoScope] void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + [DartNoAutoScope] void stencilMask(GLuint mask); + [DartNoAutoScope] void stencilMaskSeparate(GLenum face, GLuint mask); + [DartNoAutoScope] void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); + [DartNoAutoScope] void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + void texParameterf(GLenum target, GLenum pname, GLfloat param); + void texParameteri(GLenum target, GLenum pname, GLint param); + + // Supported forms: + // FIXME: should be union type + // https://www.khronos.org/bugzilla/show_bug.cgi?id=1172 + [RaisesException] void texImage2D( + GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, ArrayBufferView? pixels); + [RaisesException] void texImage2D( + GLenum target, GLint level, GLenum internalformat, + GLenum format, GLenum type, ImageData? pixels); + [RaisesException] void texImage2D( + GLenum target, GLint level, GLenum internalformat, + GLenum format, GLenum type, HTMLImageElement image); + [RaisesException] void texImage2D( + GLenum target, GLint level, GLenum internalformat, + GLenum format, GLenum type, HTMLCanvasElement canvas); + [RaisesException] void texImage2D( + GLenum target, GLint level, GLenum internalformat, + GLenum format, GLenum type, HTMLVideoElement video); + + [RaisesException] void texSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, ArrayBufferView? pixels); + [RaisesException] void texSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData? pixels); + [RaisesException] void texSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLImageElement image); + [RaisesException] void texSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLCanvasElement canvas); + [RaisesException] void texSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLVideoElement video); + + [DartNoAutoScope] void uniform1f(WebGLUniformLocation? location, GLfloat x); + [Custom, DartNoAutoScope] void uniform1fv(WebGLUniformLocation? location, Float32Array v); + [DartNoAutoScope] void uniform1i(WebGLUniformLocation? location, GLint x); + [Custom, DartNoAutoScope] void uniform1iv(WebGLUniformLocation? location, Int32Array v); + [DartNoAutoScope] void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); + [Custom, DartNoAutoScope] void uniform2fv(WebGLUniformLocation? location, Float32Array v); + [DartNoAutoScope] void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); + [Custom, DartNoAutoScope] void uniform2iv(WebGLUniformLocation? location, Int32Array v); + [DartNoAutoScope] void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); + [Custom, DartNoAutoScope] void uniform3fv(WebGLUniformLocation? location, Float32Array v); + [DartNoAutoScope] void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); + [Custom, DartNoAutoScope] void uniform3iv(WebGLUniformLocation? location, Int32Array v); + [DartNoAutoScope] void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + [Custom, DartNoAutoScope] void uniform4fv(WebGLUniformLocation? location, Float32Array v); + [DartNoAutoScope] void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); + [Custom, DartNoAutoScope] void uniform4iv(WebGLUniformLocation? location, Int32Array v); + + [Custom, DartNoAutoScope] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); + [Custom, DartNoAutoScope] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); + [Custom, DartNoAutoScope] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array); + + [DartNoAutoScope] void useProgram(WebGLProgram? program); + [DartNoAutoScope] void validateProgram(WebGLProgram? program); + + [DartNoAutoScope] void vertexAttrib1f(GLuint indx, GLfloat x); + [Custom, DartNoAutoScope] void vertexAttrib1fv(GLuint indx, Float32Array values); + [DartNoAutoScope] void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + [Custom, DartNoAutoScope] void vertexAttrib2fv(GLuint indx, Float32Array values); + [DartNoAutoScope] void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + [Custom, DartNoAutoScope] void vertexAttrib3fv(GLuint indx, Float32Array values); + [DartNoAutoScope] void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + [Custom, DartNoAutoScope] void vertexAttrib4fv(GLuint indx, Float32Array values); + [DartNoAutoScope] void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, + GLsizei stride, GLintptr offset); + + [DartNoAutoScope] void viewport(GLint x, GLint y, GLsizei width, GLsizei height); +};
diff --git a/core/html/track/AudioTrack.idl b/core/html/track/AudioTrack.idl new file mode 100644 index 0000000..d5e0449 --- /dev/null +++ b/core/html/track/AudioTrack.idl
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=AudioVideoTracks, + SetWrapperReferenceFrom=owner, + WillBeGarbageCollected, +] interface AudioTrack { + readonly attribute DOMString id; + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + attribute boolean enabled; +};
diff --git a/core/html/track/AudioTrackList.idl b/core/html/track/AudioTrackList.idl new file mode 100644 index 0000000..6bcd473 --- /dev/null +++ b/core/html/track/AudioTrackList.idl
@@ -0,0 +1,16 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=AudioVideoTracks, + SetWrapperReferenceFrom=owner, +] interface AudioTrackList : EventTarget { + readonly attribute unsigned long length; + getter AudioTrack (unsigned long index); + AudioTrack? getTrackById(DOMString id); + + attribute EventHandler onchange; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +};
diff --git a/core/html/track/TextTrack.idl b/core/html/track/TextTrack.idl index a64462d..9a75f4b 100644 --- a/core/html/track/TextTrack.idl +++ b/core/html/track/TextTrack.idl
@@ -27,7 +27,8 @@ enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" }; [ - RuntimeEnabled=VideoTrack + SetWrapperReferenceFrom=owner, + WillBeGarbageCollected, ] interface TextTrack : EventTarget { readonly attribute TextTrackKind kind; readonly attribute DOMString label;
diff --git a/core/html/track/TextTrackCue.idl b/core/html/track/TextTrackCue.idl index efc18e3..d243c43 100644 --- a/core/html/track/TextTrackCue.idl +++ b/core/html/track/TextTrackCue.idl
@@ -23,18 +23,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#texttrackcue + [ Custom=ToV8, - CustomConstructor(double startTime, double endTime, DOMString text), - RuntimeEnabled=VideoTrack, + SetWrapperReferenceFrom=owner, + TypeChecking=Unrestricted, + WillBeGarbageCollected, ] interface TextTrackCue : EventTarget { - readonly attribute TextTrack track; + readonly attribute TextTrack track; // FIXME: should be nullable - attribute DOMString id; - [RaisesException=Setter] attribute double startTime; - [RaisesException=Setter] attribute double endTime; - attribute boolean pauseOnExit; + attribute DOMString id; + attribute double startTime; + attribute double endTime; + attribute boolean pauseOnExit; - attribute EventHandler onenter; - attribute EventHandler onexit; + attribute EventHandler onenter; + attribute EventHandler onexit; };
diff --git a/core/html/track/TextTrackCueList.idl b/core/html/track/TextTrackCueList.idl index a71d687..6ea59a6 100644 --- a/core/html/track/TextTrackCueList.idl +++ b/core/html/track/TextTrackCueList.idl
@@ -24,7 +24,7 @@ */ [ - RuntimeEnabled=VideoTrack + WillBeGarbageCollected, ] interface TextTrackCueList { readonly attribute unsigned long length; getter TextTrackCue item(unsigned long index);
diff --git a/core/html/track/TextTrackList.idl b/core/html/track/TextTrackList.idl index f9d982d..8fbc775 100644 --- a/core/html/track/TextTrackList.idl +++ b/core/html/track/TextTrackList.idl
@@ -25,14 +25,12 @@ [ SetWrapperReferenceFrom=owner, - RuntimeEnabled=VideoTrack, ] interface TextTrackList : EventTarget { readonly attribute unsigned long length; getter TextTrack item(unsigned long index); - TextTrack getTrackById(DOMString id); + TextTrack? getTrackById(DOMString id); attribute EventHandler onaddtrack; attribute EventHandler onchange; attribute EventHandler onremovetrack; }; -
diff --git a/core/html/track/TrackEvent.idl b/core/html/track/TrackEvent.idl index eed9238..38ad03d 100644 --- a/core/html/track/TrackEvent.idl +++ b/core/html/track/TrackEvent.idl
@@ -24,9 +24,7 @@ */ [ - RuntimeEnabled=VideoTrack, EventConstructor, ] interface TrackEvent : Event { [InitializedByEventConstructor, Custom=Getter] readonly attribute object track; -}; - +}; \ No newline at end of file
diff --git a/core/html/track/VideoTrack.idl b/core/html/track/VideoTrack.idl new file mode 100644 index 0000000..cc4efee --- /dev/null +++ b/core/html/track/VideoTrack.idl
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=AudioVideoTracks, + SetWrapperReferenceFrom=owner, + WillBeGarbageCollected, +] interface VideoTrack { + readonly attribute DOMString id; + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + attribute boolean selected; +};
diff --git a/core/html/track/VideoTrackList.idl b/core/html/track/VideoTrackList.idl new file mode 100644 index 0000000..f766335 --- /dev/null +++ b/core/html/track/VideoTrackList.idl
@@ -0,0 +1,17 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=AudioVideoTracks, + SetWrapperReferenceFrom=owner, +] interface VideoTrackList : EventTarget { + readonly attribute unsigned long length; + getter VideoTrack (unsigned long index); + VideoTrack? getTrackById(DOMString id); + readonly attribute long selectedIndex; + + attribute EventHandler onchange; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +};
diff --git a/core/html/track/vtt/VTTCue.idl b/core/html/track/vtt/VTTCue.idl index 8b95817..3ca0307 100644 --- a/core/html/track/vtt/VTTCue.idl +++ b/core/html/track/vtt/VTTCue.idl
@@ -27,18 +27,21 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum DirectionSetting { "" /* horizontal */, "rl", "lr" }; +enum AlignSetting { "start", "middle", "end", "left", "right" }; + [ Constructor(double startTime, double endTime, DOMString text), ConstructorCallWith=Document, - RuntimeEnabled=VideoTrack, + SetWrapperReferenceFrom=owner, ] interface VTTCue : TextTrackCue { [RuntimeEnabled=WebVTTRegions] attribute DOMString regionId; - [RaisesException=Setter] attribute DOMString vertical; + attribute DirectionSetting vertical; attribute boolean snapToLines; [RaisesException=Setter] attribute long line; [RaisesException=Setter] attribute long position; [RaisesException=Setter] attribute long size; - [RaisesException=Setter] attribute DOMString align; + attribute AlignSetting align; attribute DOMString text; DocumentFragment getCueAsHTML(); };
diff --git a/core/html/track/vtt/VTTRegion.idl b/core/html/track/vtt/VTTRegion.idl index 398f740..1a28e70 100644 --- a/core/html/track/vtt/VTTRegion.idl +++ b/core/html/track/vtt/VTTRegion.idl
@@ -25,7 +25,9 @@ [ Constructor, - RuntimeEnabled=WebVTTRegions + RuntimeEnabled=WebVTTRegions, + TypeChecking=Unrestricted, + WillBeGarbageCollected, ] interface VTTRegion { readonly attribute TextTrack track; @@ -38,4 +40,3 @@ [RaisesException=Setter] attribute double viewportAnchorY; [RaisesException=Setter] attribute DOMString scroll; }; -
diff --git a/core/html/track/vtt/VTTRegionList.idl b/core/html/track/vtt/VTTRegionList.idl index 4a06653..cdd3d4d 100644 --- a/core/html/track/vtt/VTTRegionList.idl +++ b/core/html/track/vtt/VTTRegionList.idl
@@ -24,7 +24,8 @@ */ [ - RuntimeEnabled=WebVTTRegions + RuntimeEnabled=WebVTTRegions, + WillBeGarbageCollected, ] interface VTTRegionList { readonly attribute unsigned long length; getter VTTRegion item(unsigned long index);
diff --git a/core/inspector/CodeGeneratorInspector.py b/core/inspector/CodeGeneratorInspector.py index 342b5a2..ce6dae1 100755 --- a/core/inspector/CodeGeneratorInspector.py +++ b/core/inspector/CodeGeneratorInspector.py
@@ -156,7 +156,7 @@ ABBREVIATION = frozenset(["XHR", "DOM", "CSS"]) -VALIDATOR_IFDEF_NAME = "!ASSERT_DISABLED" +VALIDATOR_IFDEF_NAME = "ASSERT_ENABLED" class DomainNameFixes: @@ -1193,6 +1193,18 @@ writer.newline(" typedef TypeBuilder::StructItemTraits ItemTraits;\n") + for prop_data in resolve_data.main_properties: + prop_name = prop_data.p["name"] + param_type_binding = prop_data.param_type_binding + raw_type = param_type_binding.reduce_to_raw_type() + if isinstance(param_type_binding.get_type_model(), TypeModel.ValueType): + writer.append_multiline("\n void %s" % prop_name) + writer.append("(%s value)\n" % param_type_binding.get_type_model().get_command_return_pass_model().get_output_parameter_type()) + writer.newline(" {\n") + writer.newline(" JSONObjectBase::get%s(\"%s\", value);\n" + % (param_type_binding.reduce_to_raw_type().get_setter_name(), prop_data.p["name"])) + writer.newline(" }\n") + for prop_data in resolve_data.optional_properties: prop_name = prop_data.p["name"] param_type_binding = prop_data.param_type_binding @@ -1206,7 +1218,6 @@ format_setter_value_expression(param_type_binding, "value"))) writer.newline(" }\n") - if setter_name in INSPECTOR_OBJECT_SETTER_NAMES: writer.newline(" using JSONObjectBase::%s;\n\n" % setter_name) @@ -1849,6 +1860,9 @@ @staticmethod def process_event(json_event, domain_name, frontend_method_declaration_lines): + if (("handlers" in json_event) and (not ("renderer" in json_event["handlers"]))): + return + event_name = json_event["name"] ad_hoc_type_output = [] @@ -1879,13 +1893,16 @@ @staticmethod def process_command(json_command, domain_name, agent_field_name, agent_interface_name): + if (("handlers" in json_command) and (not ("renderer" in json_command["handlers"]))): + return + json_command_name = json_command["name"] cmd_enum_name = "k%s_%sCmd" % (domain_name, json_command["name"]) Generator.method_name_enum_list.append(" %s," % cmd_enum_name) Generator.method_handler_list.append(" &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name)) - Generator.backend_method_declaration_list.append(" void %s_%s(long callId, JSONObject* requestMessageObject);" % (domain_name, json_command_name)) + Generator.backend_method_declaration_list.append(" void %s_%s(long callId, JSONObject* requestMessageObject, JSONArray* protocolErrors);" % (domain_name, json_command_name)) backend_agent_interface_list = [] if "redirect" in json_command else Generator.backend_agent_interface_list @@ -1897,30 +1914,22 @@ method_in_code = "" method_out_code = "" - agent_call_param_list = [] + result_object_declaration = "" + agent_call_param_list = ["&error"] + agent_call_params_declaration_list = [" ErrorString error;"] + send_response_call_params_list = ["error"] request_message_param = "" normal_response_cook_text = "" - error_response_cook_text = "" error_type_binding = None if "error" in json_command: json_error = json_command["error"] error_type_binding = Generator.resolve_type_and_generate_ad_hoc(json_error, json_command_name + "Error", json_command_name, domain_name, ad_hoc_type_writer, agent_interface_name + "::") error_type_model = error_type_binding.get_type_model().get_optional() error_annotated_type = error_type_model.get_command_return_pass_model().get_output_parameter_type() - agent_call_param_list.append(", %serrorData" % error_type_model.get_command_return_pass_model().get_output_argument_prefix()) + agent_call_param_list.append("%serrorData" % error_type_model.get_command_return_pass_model().get_output_argument_prefix()) backend_agent_interface_list.append(", %s errorData" % error_annotated_type) method_in_code += " %s errorData;\n" % error_type_model.get_command_return_pass_model().get_return_var_type() - - setter_argument = error_type_model.get_command_return_pass_model().get_output_to_raw_expression() % "errorData" - if error_type_binding.get_setter_value_expression_pattern(): - setter_argument = error_type_binding.get_setter_value_expression_pattern() % setter_argument - error_assigment_value = error_type_binding.reduce_to_raw_type().get_constructor_pattern() % setter_argument - - cook = " resultErrorData = %s;\n" % error_assigment_value - - error_condition_pattern = error_type_model.get_command_return_pass_model().get_set_return_condition() - cook = (" if (%s)\n " % (error_condition_pattern % "errorData")) + cook - error_response_cook_text = " if (error.length()) {\n" + cook + " }\n" + send_response_call_params_list.append("errorData") if "parameters" in json_command: json_params = json_command["parameters"] @@ -1945,15 +1954,15 @@ if optional: code = (" bool %s_valueFound = false;\n" - " %s in_%s = get%s(paramsContainerPtr, \"%s\", &%s_valueFound, protocolErrorsPtr);\n" % + " %s in_%s = get%s(paramsContainerPtr, \"%s\", &%s_valueFound, protocolErrors);\n" % (json_param_name, non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name, json_param_name)) - param = ", %s_valueFound ? &in_%s : 0" % (json_param_name, json_param_name) + param = "%s_valueFound ? &in_%s : 0" % (json_param_name, json_param_name) # FIXME: pass optional refptr-values as PassRefPtr formal_param_type_pattern = "const %s*" else: - code = (" %s in_%s = get%s(paramsContainerPtr, \"%s\", 0, protocolErrorsPtr);\n" % + code = (" %s in_%s = get%s(paramsContainerPtr, \"%s\", 0, protocolErrors);\n" % (non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name)) - param = ", in_%s" % json_param_name + param = "in_%s" % json_param_name # FIXME: pass not-optional refptr-values as NonNullPassRefPtr if param_raw_type.is_heavy_value(): formal_param_type_pattern = "const %s&" @@ -1998,19 +2007,19 @@ parameter=annotated_type + " errorData", argument=assigment_value)) - - ad_hoc_type_output.append(callback_output) method_out_code += " RefPtr<" + agent_interface_name + "::" + callback_name + "> callback = adoptRef(new " + agent_interface_name + "::" + callback_name + "(this, callId));\n" - agent_call_param_list.append(", callback") - normal_response_cook_text += " if (!error.length()) \n" - normal_response_cook_text += " return;\n" - normal_response_cook_text += " callback->disable();\n" + agent_call_param_list.append("callback") + normal_response_cook_text += " if (!error.length()) \n" + normal_response_cook_text += " return;\n" + normal_response_cook_text += " callback->disable();\n" backend_agent_interface_list.append(", PassRefPtr<%s> callback" % callback_name) else: if "returns" in json_command: method_out_code += "\n" + agent_call_params_declaration_list.append(" RefPtr<JSONObject> result = JSONObject::create();") + send_response_call_params_list.append("result") response_cook_list = [] for json_return in json_command["returns"]: @@ -2029,18 +2038,18 @@ type_model = type_model.get_optional() code = " %s out_%s;\n" % (type_model.get_command_return_pass_model().get_return_var_type(), json_return_name) - param = ", %sout_%s" % (type_model.get_command_return_pass_model().get_output_argument_prefix(), json_return_name) + param = "%sout_%s" % (type_model.get_command_return_pass_model().get_output_argument_prefix(), json_return_name) var_name = "out_%s" % json_return_name setter_argument = type_model.get_command_return_pass_model().get_output_to_raw_expression() % var_name if return_type_binding.get_setter_value_expression_pattern(): setter_argument = return_type_binding.get_setter_value_expression_pattern() % setter_argument - cook = " result->set%s(\"%s\", %s);\n" % (setter_type, json_return_name, + cook = " result->set%s(\"%s\", %s);\n" % (setter_type, json_return_name, setter_argument) set_condition_pattern = type_model.get_command_return_pass_model().get_set_return_condition() if set_condition_pattern: - cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook + cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook annotated_type = type_model.get_command_return_pass_model().get_output_parameter_type() param_name = var_name @@ -2056,7 +2065,7 @@ normal_response_cook_text += "".join(response_cook_list) if len(normal_response_cook_text) != 0: - normal_response_cook_text = " if (!error.length()) {\n" + normal_response_cook_text + " }" + normal_response_cook_text = " if (!error.length()) {\n" + normal_response_cook_text + " }" # Redirect to another agent's implementation. agent_field = "m_" + agent_field_name @@ -2067,12 +2076,12 @@ Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None, domainName=domain_name, methodName=json_command_name, agentField=agent_field, - methodInCode=method_in_code, - methodOutCode=method_out_code, - agentCallParams="".join(agent_call_param_list), + methodCode="".join([method_in_code, method_out_code]), + agentCallParamsDeclaration="\n".join(agent_call_params_declaration_list), + agentCallParams=", ".join(agent_call_param_list), requestMessageObject=request_message_param, responseCook=normal_response_cook_text, - errorCook=error_response_cook_text, + sendResponseCallParams=", ".join(send_response_call_params_list), commandNameIndex=cmd_enum_name)) declaration_command_name = "%s.%s\\0" % (domain_name, json_command_name) Generator.backend_method_name_declaration_list.append(" \"%s\"" % declaration_command_name)
diff --git a/core/inspector/CodeGeneratorInspectorStrings.py b/core/inspector/CodeGeneratorInspectorStrings.py index 94416e7..f9b8127 100644 --- a/core/inspector/CodeGeneratorInspectorStrings.py +++ b/core/inspector/CodeGeneratorInspectorStrings.py
@@ -33,8 +33,8 @@ """ class $domainClassName { public: $domainClassName(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { } -${frontendDomainMethodDeclarations} void setInspectorFrontendChannel(InspectorFrontendChannel* inspectorFrontendChannel) { m_inspectorFrontendChannel = inspectorFrontendChannel; } - InspectorFrontendChannel* getInspectorFrontendChannel() { return m_inspectorFrontendChannel; } +${frontendDomainMethodDeclarations} + void flush() { m_inspectorFrontendChannel->flush(); } private: InspectorFrontendChannel* m_inspectorFrontendChannel; }; @@ -44,23 +44,19 @@ """) backend_method = ( -"""void InspectorBackendDispatcherImpl::${domainName}_$methodName(long callId, JSONObject*$requestMessageObject) +"""void InspectorBackendDispatcherImpl::${domainName}_$methodName(long callId, JSONObject*$requestMessageObject, JSONArray* protocolErrors) { - RefPtr<JSONArray> protocolErrors = JSONArray::create(); - if (!$agentField) protocolErrors->pushString("${domainName} handler is not available."); -$methodOutCode -$methodInCode - RefPtr<JSONObject> result = JSONObject::create(); - RefPtr<JSONValue> resultErrorData; - ErrorString error; - if (!protocolErrors->length()) { - $agentField->$methodName(&error$agentCallParams); - -$errorCook${responseCook} +$methodCode + if (protocolErrors->length()) { + reportProtocolError(&callId, InvalidParams, String::format(InvalidParamsFormatString, commandName($commandNameIndex)), protocolErrors); + return; } - sendResponse(callId, result, commandName($commandNameIndex), protocolErrors, error, resultErrorData); +$agentCallParamsDeclaration + $agentField->$methodName($agentCallParams); +$responseCook + sendResponse(callId, $sendResponseCallParams); } """) @@ -69,7 +65,7 @@ RefPtr<JSONObject> jsonMessage = JSONObject::create(); jsonMessage->setString("method", "$domainName.$eventName"); $code if (m_inspectorFrontendChannel) - m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString()); + m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage.release()); } """) @@ -91,7 +87,7 @@ if (error) { errorDataValue = $argument; } - sendIfActive(0, error, errorDataValue.release()); + sendIfActive(nullptr, error, errorDataValue.release()); } """) @@ -101,23 +97,23 @@ #define InspectorFrontend_h #include "InspectorTypeBuilder.h" +#include "core/inspector/InspectorFrontendChannel.h" #include "platform/JSONValues.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" namespace WebCore { -class InspectorFrontendChannel; - typedef String ErrorString; class InspectorFrontend { public: InspectorFrontend(InspectorFrontendChannel*); - + InspectorFrontendChannel* channel() { return m_inspectorFrontendChannel; } $domainClassList private: + InspectorFrontendChannel* m_inspectorFrontendChannel; ${fieldDeclarations}}; } // namespace WebCore @@ -247,7 +243,7 @@ virtual void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<JSONValue> data) const; using InspectorBackendDispatcher::reportProtocolError; - void sendResponse(long callId, PassRefPtr<JSONObject> result, const ErrorString&invocationError, PassRefPtr<JSONValue> errorData); + void sendResponse(long callId, const ErrorString& invocationError, PassRefPtr<JSONValue> errorData, PassRefPtr<JSONObject> result); bool isActive() { return m_inspectorFrontendChannel; } $setters @@ -258,19 +254,28 @@ $fieldDeclarations template<typename R, typename V, typename V0> - static R getPropertyValueImpl(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors, V0 initial_value, bool (*as_method)(JSONValue*, V*), const char* type_name); + static R getPropertyValueImpl(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors, V0 initial_value, bool (*as_method)(JSONValue*, V*), const char* type_name); - static int getInt(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); - static double getDouble(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); - static String getString(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); - static bool getBoolean(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); - static PassRefPtr<JSONObject> getObject(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); - static PassRefPtr<JSONArray> getArray(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors); + static int getInt(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); + static double getDouble(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); + static String getString(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); + static bool getBoolean(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); + static PassRefPtr<JSONObject> getObject(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); + static PassRefPtr<JSONArray> getArray(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors); - void sendResponse(long callId, PassRefPtr<JSONObject> result, const char* commandName, PassRefPtr<JSONArray> protocolErrors, ErrorString invocationError, PassRefPtr<JSONValue> errorData); - + void sendResponse(long callId, ErrorString invocationError, PassRefPtr<JSONObject> result) + { + sendResponse(callId, invocationError, RefPtr<JSONValue>(), result); + } + void sendResponse(long callId, ErrorString invocationError) + { + sendResponse(callId, invocationError, RefPtr<JSONValue>(), JSONObject::create()); + } + static const char InvalidParamsFormatString[]; }; +const char InspectorBackendDispatcherImpl::InvalidParamsFormatString[] = "Some arguments of method '%s' can't be processed"; + $methods PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel) @@ -282,7 +287,7 @@ void InspectorBackendDispatcherImpl::dispatch(const String& message) { RefPtr<InspectorBackendDispatcher> protect = this; - typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, JSONObject* messageObject); + typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, JSONObject* messageObject, JSONArray* protocolErrors); typedef HashMap<String, CallHandler> DispatchMap; DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); long callId = 0; @@ -336,20 +341,11 @@ return; } - ((*this).*it->value)(callId, messageObject.get()); + RefPtr<JSONArray> protocolErrors = JSONArray::create(); + ((*this).*it->value)(callId, messageObject.get(), protocolErrors.get()); } -void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<JSONObject> result, const char* commandName, PassRefPtr<JSONArray> protocolErrors, ErrorString invocationError, PassRefPtr<JSONValue> errorData) -{ - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", commandName); - reportProtocolError(&callId, InvalidParams, errorMessage, protocolErrors); - return; - } - sendResponse(callId, result, invocationError, errorData); -} - -void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<JSONObject> result, const ErrorString& invocationError, PassRefPtr<JSONValue> errorData) +void InspectorBackendDispatcherImpl::sendResponse(long callId, const ErrorString& invocationError, PassRefPtr<JSONValue> errorData, PassRefPtr<JSONObject> result) { if (invocationError.length()) { reportProtocolError(&callId, ServerError, invocationError, errorData); @@ -357,10 +353,10 @@ } RefPtr<JSONObject> responseMessage = JSONObject::create(); - responseMessage->setObject("result", result); responseMessage->setNumber("id", callId); + responseMessage->setObject("result", result); if (m_inspectorFrontendChannel) - m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString()); + m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage.release()); } void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode code, const String& errorMessage) const @@ -395,11 +391,11 @@ else message->setValue("id", JSONValue::null()); if (m_inspectorFrontendChannel) - m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString()); + m_inspectorFrontendChannel->sendMessageToFrontend(message.release()); } template<typename R, typename V, typename V0> -R InspectorBackendDispatcherImpl::getPropertyValueImpl(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors, V0 initial_value, bool (*as_method)(JSONValue*, V*), const char* type_name) +R InspectorBackendDispatcherImpl::getPropertyValueImpl(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors, V0 initial_value, bool (*as_method)(JSONValue*, V*), const char* type_name) { ASSERT(protocolErrors); @@ -411,7 +407,7 @@ if (!object) { if (!valueFound) { // Required parameter in missing params container. - protocolErrors->pushString(String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), type_name)); + protocolErrors->pushString(String::format("'params' object must contain required parameter '%s' with type '%s'.", name, type_name)); } return value; } @@ -421,12 +417,12 @@ if (valueIterator == end) { if (!valueFound) - protocolErrors->pushString(String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), type_name)); + protocolErrors->pushString(String::format("Parameter '%s' with type '%s' was not found.", name, type_name)); return value; } if (!as_method(valueIterator->value.get(), &value)) - protocolErrors->pushString(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), type_name)); + protocolErrors->pushString(String::format("Parameter '%s' has wrong type. It must be '%s'.", name, type_name)); else if (valueFound) *valueFound = true; @@ -442,32 +438,32 @@ static bool asArray(JSONValue* value, RefPtr<JSONArray>* output) { return value->asArray(output); } }; -int InspectorBackendDispatcherImpl::getInt(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +int InspectorBackendDispatcherImpl::getInt(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, "Number"); } -double InspectorBackendDispatcherImpl::getDouble(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +double InspectorBackendDispatcherImpl::getDouble(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<double, double, double>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asDouble, "Number"); } -String InspectorBackendDispatcherImpl::getString(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +String InspectorBackendDispatcherImpl::getString(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<String, String, String>(object, name, valueFound, protocolErrors, "", AsMethodBridges::asString, "String"); } -bool InspectorBackendDispatcherImpl::getBoolean(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +bool InspectorBackendDispatcherImpl::getBoolean(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<bool, bool, bool>(object, name, valueFound, protocolErrors, false, AsMethodBridges::asBoolean, "Boolean"); } -PassRefPtr<JSONObject> InspectorBackendDispatcherImpl::getObject(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +PassRefPtr<JSONObject> InspectorBackendDispatcherImpl::getObject(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<PassRefPtr<JSONObject>, RefPtr<JSONObject>, JSONObject*>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asObject, "Object"); } -PassRefPtr<JSONArray> InspectorBackendDispatcherImpl::getArray(JSONObject* object, const String& name, bool* valueFound, JSONArray* protocolErrors) +PassRefPtr<JSONArray> InspectorBackendDispatcherImpl::getArray(JSONObject* object, const char* name, bool* valueFound, JSONArray* protocolErrors) { return getPropertyValueImpl<PassRefPtr<JSONArray>, RefPtr<JSONArray>, JSONArray*>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asArray, "Array"); } @@ -496,7 +492,7 @@ void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& error) { ASSERT(error.length()); - sendIfActive(0, error, PassRefPtr<JSONValue>()); + sendIfActive(nullptr, error, PassRefPtr<JSONValue>()); } bool InspectorBackendDispatcher::CallbackBase::isActive() @@ -508,7 +504,7 @@ { if (m_alreadySent) return; - m_backendImpl->sendResponse(m_id, partialMessage, invocationError, errorData); + m_backendImpl->sendResponse(m_id, invocationError, errorData, partialMessage); m_alreadySent = true; } @@ -530,7 +526,9 @@ namespace WebCore { InspectorFrontend::InspectorFrontend(InspectorFrontendChannel* inspectorFrontendChannel) - : $constructorInit{ + : m_inspectorFrontendChannel(inspectorFrontendChannel) + , $constructorInit +{ } $methods @@ -661,6 +659,11 @@ return static_cast<Array<T>*>(static_cast<JSONArrayBase*>(array.get())); } + void concat(PassRefPtr<Array<T> > array) + { + return ArrayItemHelper<T>::Traits::concat(this->openAccessors(), array->openAccessors()); + } + #if $validatorIfdefName static void assertCorrectValue(JSONValue* value) { @@ -680,6 +683,12 @@ array->pushValue(value); } + static void concat(JSONArray* array, JSONArray* anotherArray) + { + for (JSONArray::iterator it = anotherArray->begin(); it != anotherArray->end(); ++it) + array->pushValue(*it); + } + #if $validatorIfdefName template<typename T> static void assertCorrectValue(JSONValue* value) { @@ -888,7 +897,6 @@ param_container_access_code = """ RefPtr<JSONObject> paramsContainer = requestMessageObject->getObject("params"); JSONObject* paramsContainerPtr = paramsContainer.get(); - JSONArray* protocolErrorsPtr = protocolErrors.get(); """ class_binding_builder_part_1 = (
diff --git a/core/inspector/CodeGeneratorInstrumentation.py b/core/inspector/CodeGeneratorInstrumentation.py old mode 100644 new mode 100755 index aa84d84..c313717 --- a/core/inspector/CodeGeneratorInstrumentation.py +++ b/core/inspector/CodeGeneratorInstrumentation.py
@@ -353,7 +353,7 @@ agent_class=agent_class, agent_fetch=agent_fetch, maybe_return=maybe_return, - params_agent=", ".join(map(Parameter.to_str_name, self.params_impl)[1:])) + params_agent=", ".join(map(Parameter.to_str_value, self.params_impl)[1:])) class Parameter: @@ -384,6 +384,12 @@ self.type = param_decl self.name = generate_param_name(self.type) + if re.match("PassRefPtr<", param_decl): + self.value = "%s.get()" % self.name + else: + self.value = self.name + + def to_str_full(self): if self.default_value is None: return self.to_str_class_and_name() @@ -398,6 +404,9 @@ def to_str_name(self): return self.name + def to_str_value(self): + return self.value + def generate_param_name(param_type): base_name = re.match("(const |PassRefPtr<)?(\w*)", param_type).group(2)
diff --git a/core/inspector/InjectedScriptHost.idl b/core/inspector/InjectedScriptHost.idl index da13730..5dec0fc 100644 --- a/core/inspector/InjectedScriptHost.idl +++ b/core/inspector/InjectedScriptHost.idl
@@ -48,6 +48,7 @@ [Custom] void undebugFunction(any fn); [Custom] void monitorFunction(any fn); [Custom] void unmonitorFunction(any fn); + [Custom] any suppressWarningsAndCall(any receiver, any fn, any param1, any param2); // Only declarative scope (local, with and catch) is accepted. Returns undefined. [Custom] any setFunctionVariableValue(any functionObject, long scopeIndex, DOMString variableName, any newValue);
diff --git a/core/inspector/InspectorFrontendHost.idl b/core/inspector/InspectorFrontendHost.idl index a9102bc..058608a 100644 --- a/core/inspector/InspectorFrontendHost.idl +++ b/core/inspector/InspectorFrontendHost.idl
@@ -36,7 +36,6 @@ // FIXME: setZoomFactor is here only for old frontends. Remove in M38. void setZoomFactor(float zoom); float zoomFactor(); - void inspectedURLChanged(DOMString newURL); void setInjectedScriptForOrigin(DOMString origin, DOMString script); @@ -50,7 +49,6 @@ [Custom] void recordActionTaken(unsigned long actionCode); [Custom] void recordPanelShown(unsigned long panelCode); - [Custom] void recordSettingChanged(unsigned long settingChanged); DOMString getSelectionBackgroundColor(); DOMString getSelectionForegroundColor();
diff --git a/core/inspector/InspectorInstrumentation.idl b/core/inspector/InspectorInstrumentation.idl index adda1e4..d8d4ec1 100644 --- a/core/inspector/InspectorInstrumentation.idl +++ b/core/inspector/InspectorInstrumentation.idl
@@ -58,6 +58,9 @@ * * paramList: C++ parameter list with optional names. Names will be deduced from types if omitted but you have to * specify explicit names for multiple parameters of the same type. +* +* Parameters with type PassRefPtr<T> are converted to raw pointers, +* so reference will not be passed or released until all agents are notified. */ interface InspectorInstrumentation { @@ -65,7 +68,7 @@ #include "core/dom/PseudoElement.h" [Page, Inspector, PageDebugger, PageRuntime] - void didClearWindowObjectInMainWorld([Keep] Frame*); + void didClearDocumentOfWindowObject([Keep] LocalFrame*); [DOMDebugger, Inline=FastReturn] void willInsertDOMNode([Keep] Node* parent); @@ -91,6 +94,9 @@ [DOM, DOMDebugger, Inline=FastReturn] void didInvalidateStyleAttr([Keep] Node*); + [CSS] + void documentDetached([Keep] Document*); + [CSS, Inline=FastReturn] void willMutateRules(CSSStyleSheet*); @@ -106,8 +112,8 @@ [CSS, Inline=FastReturn] void activeStyleSheetsUpdated([Keep] Document*); - [Console] - void frameWindowDiscarded(Frame*, DOMWindow* domWindow); + [Console, PageRuntime] + void frameWindowDiscarded(LocalFrame*, LocalDOMWindow* domWindow); [CSS, Inline=FastReturn] void mediaQueryResultChanged(Document*); @@ -130,9 +136,6 @@ [DOMDebugger, Inline=FastReturn] void didFireWebGLErrorOrWarning(Element*, const String& message); - [Timeline, Inline=FastReturn] - void didScheduleResourceRequest([Keep] Document*, const String& url); - [DOMDebugger, Debugger, Timeline, Inline=FastReturn] void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot); @@ -140,7 +143,7 @@ void didRemoveTimer([Keep] ExecutionContext*, int timerId); [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, const String& scriptName, int scriptLine); + InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, int scriptId, const String& scriptName, int scriptLine); [Timeline, Inline=FastReturn] void didCallFunction(const InspectorInstrumentationCookie&); @@ -152,28 +155,25 @@ void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&); [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willDispatchEvent([Keep] Document*, const Event&, DOMWindow*, Node*, const EventPath&); + InspectorInstrumentationCookie willDispatchEvent([Keep] Document*, const Event&, LocalDOMWindow*, Node*, const EventPath&); [Timeline, Inline=FastReturn] void didDispatchEvent(const InspectorInstrumentationCookie&); [Debugger, Inline=FastReturn] - void didAddEventListener([Keep] EventTarget*, const AtomicString& eventType, EventListener* listener, bool useCapture); + void didEnqueueEvent([Keep] EventTarget*, Event*); [Debugger, Inline=FastReturn] - void didRemoveEventListener([Keep] EventTarget*, const AtomicString& eventType, EventListener* listener, bool useCapture); - - [Debugger, Inline=FastReturn] - void didRemoveAllEventListeners([Keep] EventTarget*); + void didRemoveEvent([Keep] EventTarget*, Event*); [Debugger, DOMDebugger, Inline=FastReturn] - InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, const AtomicString& eventType, EventListener* listener, bool useCapture); + InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, Event*, EventListener* listener, bool useCapture); [Debugger, Inline=FastReturn] void didHandleEvent(const InspectorInstrumentationCookie&); [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow*); + InspectorInstrumentationCookie willDispatchEventOnWindow(LocalFrame*, const Event&, LocalDOMWindow*); [Timeline, Inline=FastReturn] void didDispatchEventOnWindow(const InspectorInstrumentationCookie&); @@ -190,23 +190,14 @@ [Debugger, Inline=FastReturn] void didDeliverMutationRecords(ExecutionContext*); - [Debugger, Inline=FastReturn] - void didPostPromiseTask([Keep] ExecutionContext*, ExecutionContextTask*, bool isResolved); - - [Debugger, Inline=FastReturn] - InspectorInstrumentationCookie willPerformPromiseTask([Keep] ExecutionContext*, ExecutionContextTask*); - - [Debugger, Inline=FastReturn] - void didPerformPromiseTask(const InspectorInstrumentationCookie&); - [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willEvaluateScript([Keep] Frame*, const String& url, int lineNumber); + InspectorInstrumentationCookie willEvaluateScript([Keep] LocalFrame*, const String& url, int lineNumber); [Timeline, Inline=FastReturn] void didEvaluateScript(const InspectorInstrumentationCookie&); [PageRuntime, Inline=FastReturn] - void didCreateIsolatedContext([Keep] Frame*, ScriptState*, SecurityOrigin*); + void didCreateIsolatedContext([Keep] LocalFrame*, ScriptState*, SecurityOrigin*); [DOMDebugger, Debugger, Timeline, Inline=FastReturn] InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId); @@ -215,20 +206,14 @@ void didFireTimer(const InspectorInstrumentationCookie&); [Timeline, Inline=FastReturn] - void didInvalidateLayout([Keep] Frame*); + void didInvalidateLayout([Keep] LocalFrame*); [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willLayout([Keep] Frame*); + InspectorInstrumentationCookie willLayout([Keep] LocalFrame*); [Timeline, Page, Inline=FastReturn] void didLayout(const InspectorInstrumentationCookie&, RenderObject* root); - [Timeline, Inline=FastReturn] - void willAutosizeText([Keep] RenderObject* root); - - [Timeline, Inline=FastReturn] - void didAutosizeText([Keep] RenderObject* root); - [Page, Inline=FastReturn] void didScroll(Page*); @@ -263,58 +248,49 @@ InspectorInstrumentationCookie willRecalculateStyle([Keep] Document*); [Timeline, Resource, Page, Inline=FastReturn] - void didRecalculateStyle(const InspectorInstrumentationCookie&); - - [Timeline, Inline=FastReturn] - void didRecalculateStyleForElement(Element*); + void didRecalculateStyle(const InspectorInstrumentationCookie&, int elementCount); [Timeline, Resource, Inline=FastReturn] void didScheduleStyleRecalculation([Keep] Document*); [Resource, Inline=FastReturn] - void applyUserAgentOverride(Frame*, String* userAgent); + void applyUserAgentOverride(LocalFrame*, String* userAgent); [Page, Inline=FastReturn] bool applyViewportStyleOverride(Document*, StyleResolver*); [Page, Inline=FastReturn] - void applyEmulatedMedia(Frame*, String* media); + void applyEmulatedMedia(LocalFrame*, String* media); [Timeline, Resource] - void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo&); + void willSendRequest(LocalFrame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo&); [Resource] void markResourceAsCached(Page*, unsigned long identifier); - [Timeline, Inline=FastReturn] - InspectorInstrumentationCookie willReceiveResourceData([Keep] Frame*, unsigned long identifier, int length); - - [Timeline, Inline=FastReturn] - void didReceiveResourceData(const InspectorInstrumentationCookie&); - [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this. - void didReceiveResourceResponse([Keep] Frame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); + void didReceiveResourceResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); [Inline=Forward] - void continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); + void continueAfterXFrameOptionsDenied(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); [Inline=Forward] - void continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); + void continueWithPolicyDownload(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); [Inline=Forward] - void continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); + void continueWithPolicyIgnore(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); - [Resource] - void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); + [Timeline, Resource, Inline=FastReturn] + void didReceiveData([Keep] LocalFrame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); [Timeline, Resource] - void didFinishLoading(Frame* frame, unsigned long identifier, DocumentLoader*, double finishTime, int64_t encodedDataLength); + void didFinishLoading(LocalFrame* frame, unsigned long identifier, DocumentLoader*, double finishTime, int64_t encodedDataLength); [Resource] - void didReceiveCORSRedirectResponse([Keep] Frame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); + void didReceiveCORSRedirectResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this. - void didFailLoading(Frame* frame, unsigned long identifier, const ResourceError&); + void didFailLoading(LocalFrame* frame, unsigned long identifier, const ResourceError&); [Resource] void documentThreadableLoaderStartedLoadingForClient(ExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client); @@ -338,37 +314,37 @@ void didReceiveScriptResponse(ExecutionContext*, unsigned long identifier); [Timeline, Inspector, DOM, Page] - void domContentLoadedEventFired([Keep] Frame*); + void domContentLoadedEventFired([Keep] LocalFrame*); [Timeline, Page] - void loadEventFired([Keep] Frame*); + void loadEventFired([Keep] LocalFrame*); [Page] - void frameAttachedToParent([Keep] Frame*); + void frameAttachedToParent([Keep] LocalFrame*); - [Canvas, Page, CSS] - void frameDetachedFromParent([Keep] Frame*); + [Canvas, Page] + void frameDetachedFromParent([Keep] LocalFrame*); - [Console, Resource, CSS, DOM, Inspector, Canvas, Page, PageDebugger] - void didCommitLoad([Keep] Frame*, DocumentLoader*); + [Console, Resource, DOM, Canvas, Page, PageDebugger] + void didCommitLoad([Keep] LocalFrame*, DocumentLoader*); [DOM, Inline=FastReturn] - void frameDocumentUpdated([Keep] Frame*); + void frameDocumentUpdated([Keep] LocalFrame*); [Page] - void loaderDetachedFromFrame(Frame*, DocumentLoader*); + void loaderDetachedFromFrame(LocalFrame*, DocumentLoader*); [Page] - void frameStartedLoading([Keep] Frame*); + void frameStartedLoading([Keep] LocalFrame*); [Page] - void frameStoppedLoading([Keep] Frame*); + void frameStoppedLoading([Keep] LocalFrame*); [Page, Resource] - void frameScheduledNavigation([Keep] Frame*, double delay); + void frameScheduledNavigation([Keep] LocalFrame*, double delay); [Page, Resource] - void frameClearedScheduledNavigation([Keep] Frame*); + void frameClearedScheduledNavigation([Keep] LocalFrame*); [Page, Inline=FastReturn] InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message); @@ -425,10 +401,10 @@ void didCreateWebSocket([Keep] Document*, unsigned long identifier, const KURL& requestURL, const String& protocol); [Resource, Timeline] - void willSendWebSocketHandshakeRequest([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest& request); + void willSendWebSocketHandshakeRequest([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request); [Resource, Timeline] - void didReceiveWebSocketHandshakeResponse([Keep] Document*, unsigned long identifier, const WebSocketHandshakeResponse& response); + void didReceiveWebSocketHandshakeResponse([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request, const WebSocketHandshakeResponse* response); [Resource, Timeline] void didCloseWebSocket([Keep] Document*, unsigned long identifier); @@ -446,10 +422,14 @@ void networkStateChanged(Page*, bool online); [ApplicationCache, Inline=FastReturn] - void updateApplicationCacheStatus([Keep] Frame*); + void updateApplicationCacheStatus([Keep] LocalFrame*); - [LayerTree] - void layerTreeDidChange(Page*); + [Timeline, Inline=FastReturn] + void willUpdateLayerTree(LocalFrame*); + [Timeline, LayerTree, Inline=FastReturn] + void layerTreeDidChange(LocalFrame*); + [Timeline, Inline=FastReturn] + void didUpdateLayerTree(LocalFrame*); [DOM, Inline=FastReturn] void pseudoElementCreated([Keep] PseudoElement*); @@ -469,17 +449,17 @@ // FIXME: Convert to ScriptArguments to match non-worker context. // Use the same implementation as above as a similar method dispatched on Page. [Console] - void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier = 0); + void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, unsigned long requestIdentifier = 0); // Use the same implementation as above as a similar method dispatched on Page. [Console] void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned columnNumber, ScriptState* state, unsigned long requestIdentifier = 0); [Console, Debugger] - void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0); + void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0); [Console] - void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtr<ScriptArguments> arguments); + void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments); [Timeline, Console] void consoleTime([Keep] ExecutionContext* context, const String& title); @@ -500,7 +480,7 @@ void consoleProfile(ExecutionContext* context, const String& title, ScriptState* state); [Profiler, Inline=FastReturn] - void consoleProfileEnd(ExecutionContext* context, const String& title); + void consoleProfileEnd(ExecutionContext* context, const String& title, ScriptState* state); } interface InspectorOverrides { @@ -514,11 +494,11 @@ interface InspectorCanvasInstrumentation { -#include "bindings/v8/ScriptObject.h" +#include "bindings/common/ScriptValue.h" [Canvas] - ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptObject&); + ScriptValue wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptValue&); [Canvas] - ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&); + ScriptValue wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptValue&); }
diff --git a/core/inspector/JavaScriptCallFrame.idl b/core/inspector/JavaScriptCallFrame.idl index 1afad5a..e4c4baa 100644 --- a/core/inspector/JavaScriptCallFrame.idl +++ b/core/inspector/JavaScriptCallFrame.idl
@@ -24,6 +24,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject, DoNotCheckConstants ] interface JavaScriptCallFrame { @@ -39,7 +40,7 @@ [Custom] any restart(); // Only declarative scope (local, with and catch) is accepted. Returns undefined. - any setVariableValue([Default=Undefined] optional long scopeIndex, [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString variableName, [Default=Undefined] optional any newValue); + [CallWith=ScriptState] any setVariableValue([Default=Undefined] optional long scopeIndex, [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString variableName, [Default=Undefined] optional any newValue); readonly attribute JavaScriptCallFrame caller; readonly attribute long sourceID;
diff --git a/core/loader/appcache/ApplicationCache.idl b/core/loader/appcache/ApplicationCache.idl index 0082d60..7f8e07c 100644 --- a/core/loader/appcache/ApplicationCache.idl +++ b/core/loader/appcache/ApplicationCache.idl
@@ -24,7 +24,8 @@ */ [ - DoNotCheckConstants + DoNotCheckConstants, + WillBeGarbageCollected, ] interface ApplicationCache : EventTarget { // update status const unsigned short UNCACHED = 0;
diff --git a/core/page/EventSource.idl b/core/page/EventSource.idl index 5e3efa8..932fece 100644 --- a/core/page/EventSource.idl +++ b/core/page/EventSource.idl
@@ -30,10 +30,11 @@ */ [ + WillBeGarbageCollected, ActiveDOMObject, Constructor(DOMString url, optional Dictionary eventSourceInit), ConstructorCallWith=ExecutionContext, - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, RaisesException=Constructor, ] interface EventSource : EventTarget {
diff --git a/core/page/PagePopupController.idl b/core/page/PagePopupController.idl index 0a4fbd4..e2c88b2 100644 --- a/core/page/PagePopupController.idl +++ b/core/page/PagePopupController.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject, RuntimeEnabled=PagePopup ] interface PagePopupController {
diff --git a/core/page/Selection.idl b/core/page/Selection.idl index 9c5b2d7..53b0826 100644 --- a/core/page/Selection.idl +++ b/core/page/Selection.idl
@@ -30,6 +30,7 @@ // This is based off of Mozilla's Selection interface // https://developer.mozilla.org/En/DOM/Selection [ + WillBeGarbageCollected, ImplementedAs=DOMSelection ] interface Selection { readonly attribute Node anchorNode; @@ -40,8 +41,8 @@ readonly attribute boolean isCollapsed; readonly attribute long rangeCount; - [RaisesException] void collapse([Default=Undefined] optional Node node, - [Default=Undefined] optional long index); + [RaisesException, TypeChecking=Interface|Nullable] void collapse(Node node, + optional long offset); [RaisesException] void collapseToEnd(); [RaisesException] void collapseToStart(); @@ -60,27 +61,27 @@ [NotEnumerable] DOMString toString(); // WebKit extensions - readonly attribute Node baseNode; - readonly attribute long baseOffset; - readonly attribute Node extentNode; - readonly attribute long extentOffset; + [MeasureAs=SelectionBaseNode] readonly attribute Node baseNode; + [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; + [MeasureAs=SelectionExtentNode] readonly attribute Node extentNode; + [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; // WebKit's "type" accessor returns "None", "Range" and "Caret" // IE's type accessor returns "none", "text" and "control" - readonly attribute DOMString type; + [MeasureAs=SelectionType] readonly attribute DOMString type; - void modify([Default=Undefined] optional DOMString alter, - [Default=Undefined] optional DOMString direction, - [Default=Undefined] optional DOMString granularity); - [RaisesException] void setBaseAndExtent([Default=Undefined] optional Node baseNode, - [Default=Undefined] optional long baseOffset, - [Default=Undefined] optional Node extentNode, - [Default=Undefined] optional long extentOffset); - [RaisesException, ImplementedAs=collapse] void setPosition([Default=Undefined] optional Node node, - [Default=Undefined] optional long offset); + [MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMString alter, + [Default=Undefined] optional DOMString direction, + [Default=Undefined] optional DOMString granularity); + [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent([Default=Undefined] optional Node baseNode, + [Default=Undefined] optional long baseOffset, + [Default=Undefined] optional Node extentNode, + [Default=Undefined] optional long extentOffset); + [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException, TypeChecking=Interface|Nullable] void setPosition(Node node, + optional long offset); // IE extentions // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx - void empty(); + [MeasureAs=SelectionEmpty] void empty(); };
diff --git a/core/speech/SpeechInputEvent.idl b/core/speech/SpeechInputEvent.idl deleted file mode 100644 index 4fe740b..0000000 --- a/core/speech/SpeechInputEvent.idl +++ /dev/null
@@ -1,31 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - Conditional=INPUT_SPEECH -] interface SpeechInputEvent : Event { - readonly attribute SpeechInputResultList results; -}; -
diff --git a/core/speech/SpeechInputResult.idl b/core/speech/SpeechInputResult.idl deleted file mode 100644 index bc2d409..0000000 --- a/core/speech/SpeechInputResult.idl +++ /dev/null
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - NoInterfaceObject, - Conditional=INPUT_SPEECH -] interface SpeechInputResult { - readonly attribute DOMString utterance; - readonly attribute float confidence; -}; -
diff --git a/core/speech/SpeechInputResultList.idl b/core/speech/SpeechInputResultList.idl deleted file mode 100644 index 1983aed..0000000 --- a/core/speech/SpeechInputResultList.idl +++ /dev/null
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - NoInterfaceObject, - Conditional=INPUT_SPEECH -] interface SpeechInputResultList { - readonly attribute unsigned long length; - getter SpeechInputResult item(unsigned long index); -}; -
diff --git a/core/storage/Storage.idl b/core/storage/Storage.idl index 6eea590..288703d 100644 --- a/core/storage/Storage.idl +++ b/core/storage/Storage.idl
@@ -36,8 +36,8 @@ [NotEnumerable, RaisesException=Getter] readonly attribute unsigned long length; [NotEnumerable, RaisesException, TreatReturnedNullStringAs=Null] DOMString key(unsigned long index); - [ActivityLogging=ForIsolatedWorlds, NotEnumerable, PerWorldBindings, RaisesException, TreatReturnedNullStringAs=Null] DOMString getItem(DOMString key); - [ActivityLogging=ForIsolatedWorlds, NotEnumerable, RaisesException, PerWorldBindings] void setItem(DOMString key, DOMString data); - [ActivityLogging=ForIsolatedWorlds, NotEnumerable, PerWorldBindings, RaisesException] void removeItem(DOMString key); - [ActivityLogging=ForIsolatedWorlds, NotEnumerable, PerWorldBindings, RaisesException] void clear(); + [LogActivity, NotEnumerable, RaisesException, TreatReturnedNullStringAs=Null] DOMString getItem(DOMString key); + [LogActivity, NotEnumerable, RaisesException] void setItem(DOMString key, DOMString data); + [LogActivity, NotEnumerable, RaisesException] void removeItem(DOMString key); + [LogActivity, NotEnumerable, RaisesException] void clear(); };
diff --git a/core/svg/SVGAngle.idl b/core/svg/SVGAngle.idl index 423a6db..f4b306a 100644 --- a/core/svg/SVGAngle.idl +++ b/core/svg/SVGAngle.idl
@@ -21,7 +21,9 @@ */ [ - StrictTypeChecking, + ImplementedAs=SVGAngleTearOff, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGAngle { // Angle Unit Types const unsigned short SVG_ANGLETYPE_UNKNOWN = 0; @@ -31,8 +33,8 @@ const unsigned short SVG_ANGLETYPE_GRAD = 4; readonly attribute unsigned short unitType; - attribute float value; - attribute float valueInSpecifiedUnits; + [RaisesException=Setter] attribute float value; + [RaisesException=Setter] attribute float valueInSpecifiedUnits; [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString valueAsString;
diff --git a/core/svg/SVGAnimatedAngle.idl b/core/svg/SVGAnimatedAngle.idl index 9a51845..7fe115c 100644 --- a/core/svg/SVGAnimatedAngle.idl +++ b/core/svg/SVGAnimatedAngle.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedAngle { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedAngle { readonly attribute SVGAngle baseVal; readonly attribute SVGAngle animVal; }; -
diff --git a/core/svg/SVGAnimatedBoolean.idl b/core/svg/SVGAnimatedBoolean.idl index b78954a..f009f6f 100644 --- a/core/svg/SVGAnimatedBoolean.idl +++ b/core/svg/SVGAnimatedBoolean.idl
@@ -24,9 +24,9 @@ */ [ - StrictTypeChecking, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGAnimatedBoolean { [RaisesException=Setter] attribute boolean baseVal; readonly attribute boolean animVal; }; -
diff --git a/core/svg/SVGAnimatedEnumeration.idl b/core/svg/SVGAnimatedEnumeration.idl index 7ed1d19..25621e7 100644 --- a/core/svg/SVGAnimatedEnumeration.idl +++ b/core/svg/SVGAnimatedEnumeration.idl
@@ -24,7 +24,9 @@ */ [ - StrictTypeChecking, + ImplementedAs=SVGAnimatedEnumerationBase, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGAnimatedEnumeration { [RaisesException=Setter] attribute unsigned short baseVal; readonly attribute unsigned short animVal;
diff --git a/core/svg/SVGAnimatedInteger.idl b/core/svg/SVGAnimatedInteger.idl index 14287a3..4585be9 100644 --- a/core/svg/SVGAnimatedInteger.idl +++ b/core/svg/SVGAnimatedInteger.idl
@@ -24,7 +24,8 @@ */ [ - StrictTypeChecking, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGAnimatedInteger { [RaisesException=Setter] attribute long baseVal; readonly attribute long animVal;
diff --git a/core/svg/SVGAnimatedLength.idl b/core/svg/SVGAnimatedLength.idl index d300347..c741a20 100644 --- a/core/svg/SVGAnimatedLength.idl +++ b/core/svg/SVGAnimatedLength.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedLength { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedLength { readonly attribute SVGLength baseVal; readonly attribute SVGLength animVal; }; -
diff --git a/core/svg/SVGAnimatedLengthList.idl b/core/svg/SVGAnimatedLengthList.idl index f193b7c..ec507a3 100644 --- a/core/svg/SVGAnimatedLengthList.idl +++ b/core/svg/SVGAnimatedLengthList.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedLengthList { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedLengthList { readonly attribute SVGLengthList baseVal; readonly attribute SVGLengthList animVal; }; -
diff --git a/core/svg/SVGAnimatedNumber.idl b/core/svg/SVGAnimatedNumber.idl index 7890bef..ca88082 100644 --- a/core/svg/SVGAnimatedNumber.idl +++ b/core/svg/SVGAnimatedNumber.idl
@@ -25,7 +25,8 @@ */ [ - StrictTypeChecking, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGAnimatedNumber { [RaisesException=Setter] attribute float baseVal; readonly attribute float animVal;
diff --git a/core/svg/SVGAnimatedNumberList.idl b/core/svg/SVGAnimatedNumberList.idl index 43845d3..355e490 100644 --- a/core/svg/SVGAnimatedNumberList.idl +++ b/core/svg/SVGAnimatedNumberList.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedNumberList { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedNumberList { readonly attribute SVGNumberList baseVal; readonly attribute SVGNumberList animVal; }; -
diff --git a/core/svg/SVGAnimatedPreserveAspectRatio.idl b/core/svg/SVGAnimatedPreserveAspectRatio.idl index b2e6c7f..dbcb42d 100644 --- a/core/svg/SVGAnimatedPreserveAspectRatio.idl +++ b/core/svg/SVGAnimatedPreserveAspectRatio.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedPreserveAspectRatio { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedPreserveAspectRatio { readonly attribute SVGPreserveAspectRatio baseVal; readonly attribute SVGPreserveAspectRatio animVal; }; -
diff --git a/core/svg/SVGAnimatedRect.idl b/core/svg/SVGAnimatedRect.idl index 6bce556..33a7123 100644 --- a/core/svg/SVGAnimatedRect.idl +++ b/core/svg/SVGAnimatedRect.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedRect { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedRect { readonly attribute SVGRect baseVal; readonly attribute SVGRect animVal; }; -
diff --git a/core/svg/SVGAnimatedString.idl b/core/svg/SVGAnimatedString.idl index d1fbf52..dec2f05 100644 --- a/core/svg/SVGAnimatedString.idl +++ b/core/svg/SVGAnimatedString.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedString { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedString { [RaisesException=Setter] attribute DOMString baseVal; readonly attribute DOMString animVal; }; -
diff --git a/core/svg/SVGAnimatedTransformList.idl b/core/svg/SVGAnimatedTransformList.idl index 718a2a6..7a56c32 100644 --- a/core/svg/SVGAnimatedTransformList.idl +++ b/core/svg/SVGAnimatedTransformList.idl
@@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGAnimatedTransformList { +[ + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGAnimatedTransformList { readonly attribute SVGTransformList baseVal; readonly attribute SVGTransformList animVal; }; -
diff --git a/core/svg/SVGAnimationElement.idl b/core/svg/SVGAnimationElement.idl index 945a2a3..deb09d7 100644 --- a/core/svg/SVGAnimationElement.idl +++ b/core/svg/SVGAnimationElement.idl
@@ -24,17 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/animate.html#InterfaceSVGAnimationElement + interface SVGAnimationElement : SVGElement { readonly attribute SVGElement targetElement; + attribute EventHandler onbegin; + attribute EventHandler onend; + attribute EventHandler onrepeat; + float getStartTime(); float getCurrentTime(); float getSimpleDuration(); void beginElement(); - void beginElementAt([Default=Undefined] optional float offset); + void beginElementAt(float offset); void endElement(); - void endElementAt([Default=Undefined] optional float offset); + void endElementAt(float offset); + }; SVGAnimationElement implements SVGTests;
diff --git a/core/svg/SVGCursorElement.idl b/core/svg/SVGCursorElement.idl index 7e35ec1..627bf19 100644 --- a/core/svg/SVGCursorElement.idl +++ b/core/svg/SVGCursorElement.idl
@@ -23,11 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/interact.html#InterfaceSVGCursorElement +// http://www.w3.org/TR/SVG2/interact.html#InterfaceSVGCursorElement + interface SVGCursorElement : SVGElement { readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; }; SVGCursorElement implements SVGURIReference; -SVGCursorElement implements SVGTests; - +SVGCursorElement implements SVGTests; // in SVG 1.1 but not SVG 2
diff --git a/core/svg/SVGDocument.idl b/core/svg/SVGDocument.idl index 0f1dafc..a57cb2e 100644 --- a/core/svg/SVGDocument.idl +++ b/core/svg/SVGDocument.idl
@@ -19,7 +19,9 @@ * Boston, MA 02110-1301, USA. */ -partial interface Document { +[ + ImplementedAs=SVGDocumentExtensions +] partial interface Document { [MeasureAs=SVGDocumentRootElement] readonly attribute SVGSVGElement rootElement; };
diff --git a/core/svg/SVGElement.idl b/core/svg/SVGElement.idl index feffa7c..d18904f 100644 --- a/core/svg/SVGElement.idl +++ b/core/svg/SVGElement.idl
@@ -24,18 +24,17 @@ Custom=Wrap, ] interface SVGElement : Element { attribute DOMString xmlbase; - readonly attribute SVGSVGElement ownerSVGElement; - readonly attribute SVGElement viewportElement; + [TypeChecking=Interface|Nullable] readonly attribute SVGSVGElement? ownerSVGElement; + [TypeChecking=Interface|Nullable] readonly attribute SVGElement? viewportElement; attribute DOMString xmllang; attribute DOMString xmlspace; - readonly attribute SVGAnimatedString className; + [MeasureAs=SVGClassName] readonly attribute SVGAnimatedString className; + readonly attribute CSSStyleDeclaration style; - // CSSValue was deprecated in 2003: - // http://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html - [DeprecateAs=SVGElementGetPresentationAttribute] CSSValue getPresentationAttribute([Default=Undefined] optional DOMString name); + [CustomElementCallbacks] attribute long tabIndex; }; SVGElement implements GlobalEventHandlers;
diff --git a/core/svg/SVGElementInstance.idl b/core/svg/SVGElementInstance.idl deleted file mode 100644 index 8f6a1d8..0000000 --- a/core/svg/SVGElementInstance.idl +++ /dev/null
@@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -interface SVGElementInstance : EventTarget -{ - readonly attribute SVGElement correspondingElement; - readonly attribute SVGUseElement correspondingUseElement; - readonly attribute SVGElementInstance parentNode; - readonly attribute SVGElementInstanceList childNodes; - readonly attribute SVGElementInstance firstChild; - readonly attribute SVGElementInstance lastChild; - readonly attribute SVGElementInstance previousSibling; - readonly attribute SVGElementInstance nextSibling; - - // EventTarget - [NotEnumerable] attribute EventHandler onabort; - [NotEnumerable] attribute EventHandler onblur; - [NotEnumerable] attribute EventHandler onchange; - [NotEnumerable] attribute EventHandler onclick; - [NotEnumerable] attribute EventHandler oncontextmenu; - [NotEnumerable] attribute EventHandler ondblclick; - [NotEnumerable] attribute EventHandler onerror; - [NotEnumerable] attribute EventHandler onfocus; - [NotEnumerable] attribute EventHandler oninput; - [NotEnumerable] attribute EventHandler onkeydown; - [NotEnumerable] attribute EventHandler onkeypress; - [NotEnumerable] attribute EventHandler onkeyup; - [NotEnumerable] attribute EventHandler onload; - [NotEnumerable] attribute EventHandler onmousedown; - [NotEnumerable] attribute EventHandler onmouseenter; - [NotEnumerable] attribute EventHandler onmouseleave; - [NotEnumerable] attribute EventHandler onmousemove; - [NotEnumerable] attribute EventHandler onmouseout; - [NotEnumerable] attribute EventHandler onmouseover; - [NotEnumerable] attribute EventHandler onmouseup; - [NotEnumerable] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel. - [NotEnumerable] attribute EventHandler onbeforecut; - [NotEnumerable] attribute EventHandler oncut; - [NotEnumerable] attribute EventHandler onbeforecopy; - [NotEnumerable] attribute EventHandler oncopy; - [NotEnumerable] attribute EventHandler onbeforepaste; - [NotEnumerable] attribute EventHandler onpaste; - [NotEnumerable] attribute EventHandler ondragenter; - [NotEnumerable] attribute EventHandler ondragover; - [NotEnumerable] attribute EventHandler ondragleave; - [NotEnumerable] attribute EventHandler ondrop; - [NotEnumerable] attribute EventHandler ondragstart; - [NotEnumerable] attribute EventHandler ondrag; - [NotEnumerable] attribute EventHandler ondragend; - [NotEnumerable] attribute EventHandler onreset; - [NotEnumerable] attribute EventHandler onresize; - [NotEnumerable] attribute EventHandler onscroll; - [NotEnumerable] attribute EventHandler onsearch; - [NotEnumerable] attribute EventHandler onselect; - [NotEnumerable] attribute EventHandler onselectstart; - [NotEnumerable] attribute EventHandler onsubmit; - [NotEnumerable] attribute EventHandler onunload; - [NotEnumerable] attribute EventHandler onwheel; -};
diff --git a/core/svg/SVGElementInstanceList.idl b/core/svg/SVGElementInstanceList.idl deleted file mode 100644 index 91534bb..0000000 --- a/core/svg/SVGElementInstanceList.idl +++ /dev/null
@@ -1,30 +0,0 @@ -/* - * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -interface SVGElementInstanceList { - readonly attribute unsigned long length; - - SVGElementInstance item([Default=Undefined] optional unsigned long index); -};
diff --git a/core/svg/SVGFEBlendElement.idl b/core/svg/SVGFEBlendElement.idl index fc3abe6..05cde55 100644 --- a/core/svg/SVGFEBlendElement.idl +++ b/core/svg/SVGFEBlendElement.idl
@@ -23,19 +23,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - DoNotCheckConstants -] interface SVGFEBlendElement : SVGElement { - // Blend Mode Types - const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; - const unsigned short SVG_FEBLEND_MODE_NORMAL = 1; - const unsigned short SVG_FEBLEND_MODE_MULTIPLY = 2; - const unsigned short SVG_FEBLEND_MODE_SCREEN = 3; - const unsigned short SVG_FEBLEND_MODE_DARKEN = 4; - const unsigned short SVG_FEBLEND_MODE_LIGHTEN = 5; +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEBlendElement - readonly attribute SVGAnimatedString in1; - readonly attribute SVGAnimatedString in2; +[ + DoNotCheckConstants, +] interface SVGFEBlendElement : SVGElement { + + // Blend Mode Types + const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; + const unsigned short SVG_FEBLEND_MODE_NORMAL = 1; + const unsigned short SVG_FEBLEND_MODE_MULTIPLY = 2; + const unsigned short SVG_FEBLEND_MODE_SCREEN = 3; + const unsigned short SVG_FEBLEND_MODE_DARKEN = 4; + const unsigned short SVG_FEBLEND_MODE_LIGHTEN = 5; + + readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedString in2; readonly attribute SVGAnimatedEnumeration mode; };
diff --git a/core/svg/SVGFEColorMatrixElement.idl b/core/svg/SVGFEColorMatrixElement.idl index 4d5504b..fa9c032 100644 --- a/core/svg/SVGFEColorMatrixElement.idl +++ b/core/svg/SVGFEColorMatrixElement.idl
@@ -23,19 +23,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEColorMatrixElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFEColorMatrixElement : SVGElement { // Color Matrix Types - const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; - const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1; - const unsigned short SVG_FECOLORMATRIX_TYPE_SATURATE = 2; - const unsigned short SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3; + const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; + const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1; + const unsigned short SVG_FECOLORMATRIX_TYPE_SATURATE = 2; + const unsigned short SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3; const unsigned short SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4; - readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedEnumeration type; - readonly attribute SVGAnimatedNumberList values; + readonly attribute SVGAnimatedNumberList values; }; SVGFEColorMatrixElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEComponentTransferElement.idl b/core/svg/SVGFEComponentTransferElement.idl index a91f58b..e8cc53e 100644 --- a/core/svg/SVGFEComponentTransferElement.idl +++ b/core/svg/SVGFEComponentTransferElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEComponentTransferElement + interface SVGFEComponentTransferElement : SVGElement { readonly attribute SVGAnimatedString in1; };
diff --git a/core/svg/SVGFECompositeElement.idl b/core/svg/SVGFECompositeElement.idl index 986e4e1..9735ce9 100644 --- a/core/svg/SVGFECompositeElement.idl +++ b/core/svg/SVGFECompositeElement.idl
@@ -23,25 +23,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFECompositeElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFECompositeElement : SVGElement { // Composite Operators - const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; - const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1; - const unsigned short SVG_FECOMPOSITE_OPERATOR_IN = 2; - const unsigned short SVG_FECOMPOSITE_OPERATOR_OUT = 3; - const unsigned short SVG_FECOMPOSITE_OPERATOR_ATOP = 4; - const unsigned short SVG_FECOMPOSITE_OPERATOR_XOR = 5; + const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; + const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1; + const unsigned short SVG_FECOMPOSITE_OPERATOR_IN = 2; + const unsigned short SVG_FECOMPOSITE_OPERATOR_OUT = 3; + const unsigned short SVG_FECOMPOSITE_OPERATOR_ATOP = 4; + const unsigned short SVG_FECOMPOSITE_OPERATOR_XOR = 5; const unsigned short SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6; - readonly attribute SVGAnimatedString in1; - readonly attribute SVGAnimatedString in2; + readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedString in2; [ImplementedAs=svgOperator] readonly attribute SVGAnimatedEnumeration operator; - readonly attribute SVGAnimatedNumber k1; - readonly attribute SVGAnimatedNumber k2; - readonly attribute SVGAnimatedNumber k3; - readonly attribute SVGAnimatedNumber k4; + readonly attribute SVGAnimatedNumber k1; + readonly attribute SVGAnimatedNumber k2; + readonly attribute SVGAnimatedNumber k3; + readonly attribute SVGAnimatedNumber k4; }; SVGFECompositeElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEConvolveMatrixElement.idl b/core/svg/SVGFEConvolveMatrixElement.idl index b759230..ea35c38 100644 --- a/core/svg/SVGFEConvolveMatrixElement.idl +++ b/core/svg/SVGFEConvolveMatrixElement.idl
@@ -23,27 +23,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/filters.html#InterfaceSVGFEConvolveMatrixElement +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEConvolveMatrixElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFEConvolveMatrixElement : SVGElement { // Edge Mode Values - const unsigned short SVG_EDGEMODE_UNKNOWN = 0; + const unsigned short SVG_EDGEMODE_UNKNOWN = 0; const unsigned short SVG_EDGEMODE_DUPLICATE = 1; - const unsigned short SVG_EDGEMODE_WRAP = 2; - const unsigned short SVG_EDGEMODE_NONE = 3; + const unsigned short SVG_EDGEMODE_WRAP = 2; + const unsigned short SVG_EDGEMODE_NONE = 3; - readonly attribute SVGAnimatedString in1; - readonly attribute SVGAnimatedInteger orderX; - readonly attribute SVGAnimatedInteger orderY; - readonly attribute SVGAnimatedNumberList kernelMatrix; - readonly attribute SVGAnimatedNumber divisor; - readonly attribute SVGAnimatedNumber bias; - readonly attribute SVGAnimatedInteger targetX; - readonly attribute SVGAnimatedInteger targetY; + readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedInteger orderX; + readonly attribute SVGAnimatedInteger orderY; + readonly attribute SVGAnimatedNumberList kernelMatrix; + readonly attribute SVGAnimatedNumber divisor; + readonly attribute SVGAnimatedNumber bias; + readonly attribute SVGAnimatedInteger targetX; + readonly attribute SVGAnimatedInteger targetY; readonly attribute SVGAnimatedEnumeration edgeMode; - readonly attribute SVGAnimatedNumber kernelUnitLengthX; - readonly attribute SVGAnimatedNumber kernelUnitLengthY; - readonly attribute SVGAnimatedBoolean preserveAlpha; + readonly attribute SVGAnimatedNumber kernelUnitLengthX; + readonly attribute SVGAnimatedNumber kernelUnitLengthY; + readonly attribute SVGAnimatedBoolean preserveAlpha; // in SVG 1.1, removed in SVG 2 }; SVGFEConvolveMatrixElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEDiffuseLightingElement.idl b/core/svg/SVGFEDiffuseLightingElement.idl index b4ebb2b..f0e42d2 100644 --- a/core/svg/SVGFEDiffuseLightingElement.idl +++ b/core/svg/SVGFEDiffuseLightingElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEDiffuseLightingElement + interface SVGFEDiffuseLightingElement : SVGElement { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber surfaceScale;
diff --git a/core/svg/SVGFEDisplacementMapElement.idl b/core/svg/SVGFEDisplacementMapElement.idl index 74ad074..25d13cc 100644 --- a/core/svg/SVGFEDisplacementMapElement.idl +++ b/core/svg/SVGFEDisplacementMapElement.idl
@@ -23,19 +23,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEDisplacementMapElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFEDisplacementMapElement : SVGElement { // Channel Selectors const unsigned short SVG_CHANNEL_UNKNOWN = 0; - const unsigned short SVG_CHANNEL_R = 1; - const unsigned short SVG_CHANNEL_G = 2; - const unsigned short SVG_CHANNEL_B = 3; - const unsigned short SVG_CHANNEL_A = 4; + const unsigned short SVG_CHANNEL_R = 1; + const unsigned short SVG_CHANNEL_G = 2; + const unsigned short SVG_CHANNEL_B = 3; + const unsigned short SVG_CHANNEL_A = 4; - readonly attribute SVGAnimatedString in1; - readonly attribute SVGAnimatedString in2; - readonly attribute SVGAnimatedNumber scale; + readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedString in2; + readonly attribute SVGAnimatedNumber scale; readonly attribute SVGAnimatedEnumeration xChannelSelector; readonly attribute SVGAnimatedEnumeration yChannelSelector; };
diff --git a/core/svg/SVGFEDropShadowElement.idl b/core/svg/SVGFEDropShadowElement.idl index 8e7f36f..556fdaa 100644 --- a/core/svg/SVGFEDropShadowElement.idl +++ b/core/svg/SVGFEDropShadowElement.idl
@@ -17,6 +17,8 @@ * Boston, MA 02110-1301, USA. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEDropShadowElement + interface SVGFEDropShadowElement : SVGElement { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber dx; @@ -24,8 +26,7 @@ readonly attribute SVGAnimatedNumber stdDeviationX; readonly attribute SVGAnimatedNumber stdDeviationY; - void setStdDeviation([Default=Undefined] optional float stdDeviationX, - [Default=Undefined] optional float stdDeviationY); + void setStdDeviation(float stdDeviationX, float stdDeviationY); }; SVGFEDropShadowElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEFloodElement.idl b/core/svg/SVGFEFloodElement.idl index 5334c50..e586c72 100644 --- a/core/svg/SVGFEFloodElement.idl +++ b/core/svg/SVGFEFloodElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEFloodElement + interface SVGFEFloodElement : SVGElement { };
diff --git a/core/svg/SVGFEGaussianBlurElement.idl b/core/svg/SVGFEGaussianBlurElement.idl index 53a06f3..f3a32d6 100644 --- a/core/svg/SVGFEGaussianBlurElement.idl +++ b/core/svg/SVGFEGaussianBlurElement.idl
@@ -23,13 +23,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/filters.html#InterfaceSVGFEGaussianBlurElement +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEGaussianBlurElement +// Currently SVG 1.1 (SVG 2 members not implemented) + interface SVGFEGaussianBlurElement : SVGElement { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber stdDeviationX; readonly attribute SVGAnimatedNumber stdDeviationY; - void setStdDeviation([Default=Undefined] optional float stdDeviationX, - [Default=Undefined] optional float stdDeviationY); + void setStdDeviation(float stdDeviationX, float stdDeviationY); }; SVGFEGaussianBlurElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEImageElement.idl b/core/svg/SVGFEImageElement.idl index 7bbad83..9f2ca38 100644 --- a/core/svg/SVGFEImageElement.idl +++ b/core/svg/SVGFEImageElement.idl
@@ -23,6 +23,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/filters.html#InterfaceSVGFEImageElement +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEImageElement +// Currently SVG 1.1, SVG 2 members not implemented + interface SVGFEImageElement : SVGElement { readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; };
diff --git a/core/svg/SVGFEMergeElement.idl b/core/svg/SVGFEMergeElement.idl index f4d8558..d9da6e8 100644 --- a/core/svg/SVGFEMergeElement.idl +++ b/core/svg/SVGFEMergeElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEMergeElement + interface SVGFEMergeElement : SVGElement { };
diff --git a/core/svg/SVGFEMorphologyElement.idl b/core/svg/SVGFEMorphologyElement.idl index 550c368..831d126 100644 --- a/core/svg/SVGFEMorphologyElement.idl +++ b/core/svg/SVGFEMorphologyElement.idl
@@ -23,21 +23,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEMorphologyElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFEMorphologyElement : SVGElement { // Morphology Operators - const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; - const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; - const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; + const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; + const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; + const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; - readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedString in1; [ImplementedAs=svgOperator] readonly attribute SVGAnimatedEnumeration operator; - readonly attribute SVGAnimatedNumber radiusX; - readonly attribute SVGAnimatedNumber radiusY; + readonly attribute SVGAnimatedNumber radiusX; + readonly attribute SVGAnimatedNumber radiusY; - void setRadius([Default=Undefined] optional float radiusX, - [Default=Undefined] optional float radiusY); + [MeasureAs=SVGFEMorphologyElementSetRadius] void setRadius([Default=Undefined] optional float radiusX, + [Default=Undefined] optional float radiusY); // non-standard }; SVGFEMorphologyElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/core/svg/SVGFEOffsetElement.idl b/core/svg/SVGFEOffsetElement.idl index 1b6460a..38eb9c4 100644 --- a/core/svg/SVGFEOffsetElement.idl +++ b/core/svg/SVGFEOffsetElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFEOffsetElement + interface SVGFEOffsetElement : SVGElement { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber dx;
diff --git a/core/svg/SVGFESpecularLightingElement.idl b/core/svg/SVGFESpecularLightingElement.idl index 00b609e..66d506e 100644 --- a/core/svg/SVGFESpecularLightingElement.idl +++ b/core/svg/SVGFESpecularLightingElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFESpecularLightingElement + interface SVGFESpecularLightingElement : SVGElement { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedNumber surfaceScale;
diff --git a/core/svg/SVGFETileElement.idl b/core/svg/SVGFETileElement.idl index c384323..4395de5 100644 --- a/core/svg/SVGFETileElement.idl +++ b/core/svg/SVGFETileElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFETileElement + interface SVGFETileElement : SVGElement { readonly attribute SVGAnimatedString in1; };
diff --git a/core/svg/SVGFETurbulenceElement.idl b/core/svg/SVGFETurbulenceElement.idl index b914739..0fceef9 100644 --- a/core/svg/SVGFETurbulenceElement.idl +++ b/core/svg/SVGFETurbulenceElement.idl
@@ -23,23 +23,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFETurbulenceElement + [ - DoNotCheckConstants + DoNotCheckConstants, ] interface SVGFETurbulenceElement : SVGElement { // Turbulence Types - const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; + const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1; - const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2; + const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2; // Stitch Options - const unsigned short SVG_STITCHTYPE_UNKNOWN = 0; - const unsigned short SVG_STITCHTYPE_STITCH = 1; + const unsigned short SVG_STITCHTYPE_UNKNOWN = 0; + const unsigned short SVG_STITCHTYPE_STITCH = 1; const unsigned short SVG_STITCHTYPE_NOSTITCH = 2; - readonly attribute SVGAnimatedNumber baseFrequencyX; - readonly attribute SVGAnimatedNumber baseFrequencyY; - readonly attribute SVGAnimatedInteger numOctaves; - readonly attribute SVGAnimatedNumber seed; + readonly attribute SVGAnimatedNumber baseFrequencyX; + readonly attribute SVGAnimatedNumber baseFrequencyY; + readonly attribute SVGAnimatedInteger numOctaves; + readonly attribute SVGAnimatedNumber seed; readonly attribute SVGAnimatedEnumeration stitchTiles; readonly attribute SVGAnimatedEnumeration type; };
diff --git a/core/svg/SVGFilterElement.idl b/core/svg/SVGFilterElement.idl index 6a6997c..5aa71f5 100644 --- a/core/svg/SVGFilterElement.idl +++ b/core/svg/SVGFilterElement.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGFilterElement : SVGElement { readonly attribute SVGAnimatedEnumeration filterUnits; readonly attribute SVGAnimatedEnumeration primitiveUnits;
diff --git a/core/svg/SVGFilterPrimitiveStandardAttributes.idl b/core/svg/SVGFilterPrimitiveStandardAttributes.idl index 6ddcff6..aba43fc 100644 --- a/core/svg/SVGFilterPrimitiveStandardAttributes.idl +++ b/core/svg/SVGFilterPrimitiveStandardAttributes.idl
@@ -24,8 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/filter-effects/#InterfaceSVGFilterPrimitiveStandardAttributes + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface SVGFilterPrimitiveStandardAttributes { readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; @@ -33,4 +35,3 @@ readonly attribute SVGAnimatedLength height; readonly attribute SVGAnimatedString result; }; -
diff --git a/core/svg/SVGFitToViewBox.idl b/core/svg/SVGFitToViewBox.idl index 56bad0f..f61e5ea 100644 --- a/core/svg/SVGFitToViewBox.idl +++ b/core/svg/SVGFitToViewBox.idl
@@ -24,9 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGFitToViewBox + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface SVGFitToViewBox { - readonly attribute SVGAnimatedRect viewBox; + readonly attribute SVGAnimatedRect viewBox; readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; };
diff --git a/core/svg/SVGGeometryElement.idl b/core/svg/SVGGeometryElement.idl index 8cb7022..cd4887c 100644 --- a/core/svg/SVGGeometryElement.idl +++ b/core/svg/SVGGeometryElement.idl
@@ -29,7 +29,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGGeometryElement : SVGGraphicsElement { boolean isPointInFill(SVGPoint point); boolean isPointInStroke(SVGPoint point);
diff --git a/core/svg/SVGGraphicsElement.idl b/core/svg/SVGGraphicsElement.idl index 7666cdc..4241020 100644 --- a/core/svg/SVGGraphicsElement.idl +++ b/core/svg/SVGGraphicsElement.idl
@@ -28,16 +28,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGGraphicsElement : SVGElement { +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGGraphicsElement + +[ + TypeChecking=Interface|Nullable, +] interface SVGGraphicsElement : SVGElement { readonly attribute SVGAnimatedTransformList transform; [MeasureAs=SVGLocatableNearestViewportElement] readonly attribute SVGElement nearestViewportElement; [MeasureAs=SVGLocatableFarthestViewportElement] readonly attribute SVGElement farthestViewportElement; [ImplementedAs=getBBoxFromJavascript] SVGRect getBBox(); - SVGMatrix getCTM(); - SVGMatrix getScreenCTM(); - [RaisesException] SVGMatrix getTransformToElement([Default=Undefined] optional SVGElement element); + [ImplementedAs=getCTMFromJavascript] SVGMatrix getCTM(); + [ImplementedAs=getScreenCTMFromJavascript] SVGMatrix getScreenCTM(); + [RaisesException] SVGMatrix getTransformToElement(SVGElement element); }; SVGGraphicsElement implements SVGTests;
diff --git a/core/svg/SVGLength.idl b/core/svg/SVGLength.idl index 97d9fea..1774912 100644 --- a/core/svg/SVGLength.idl +++ b/core/svg/SVGLength.idl
@@ -23,7 +23,7 @@ [ ImplementedAs=SVGLengthTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGLength { // Length Unit Types const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
diff --git a/core/svg/SVGLengthList.idl b/core/svg/SVGLengthList.idl index eb9e607..23c8719 100644 --- a/core/svg/SVGLengthList.idl +++ b/core/svg/SVGLengthList.idl
@@ -27,13 +27,15 @@ [ ImplementedAs=SVGLengthListTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGLengthList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] SVGLength initialize(SVGLength item); - [RaisesException] SVGLength getItem(unsigned long index); + [RaisesException] getter SVGLength getItem(unsigned long index); + [RaisesException] setter SVGLength (unsigned long index, SVGLength value); [RaisesException] SVGLength insertItemBefore(SVGLength item, unsigned long index); [RaisesException] SVGLength replaceItem(SVGLength item, unsigned long index); [RaisesException] SVGLength removeItem(unsigned long index);
diff --git a/core/svg/SVGMarkerElement.idl b/core/svg/SVGMarkerElement.idl index 0e22319..4527585 100644 --- a/core/svg/SVGMarkerElement.idl +++ b/core/svg/SVGMarkerElement.idl
@@ -23,28 +23,32 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGMarkerElement : SVGElement { +// http://www.w3.org/TR/SVG2/painting.html#InterfaceSVGMarkerElement + +[ + TypeChecking=Interface|Nullable, +] interface SVGMarkerElement : SVGElement { + // Marker Unit Types - const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; + const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1; - const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; + const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; // Marker Orientation Types - const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; - const unsigned short SVG_MARKER_ORIENT_AUTO = 1; - const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; + const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; + const unsigned short SVG_MARKER_ORIENT_AUTO = 1; + const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; - readonly attribute SVGAnimatedLength refX; - readonly attribute SVGAnimatedLength refY; + readonly attribute SVGAnimatedLength refX; + readonly attribute SVGAnimatedLength refY; readonly attribute SVGAnimatedEnumeration markerUnits; - readonly attribute SVGAnimatedLength markerWidth; - readonly attribute SVGAnimatedLength markerHeight; + readonly attribute SVGAnimatedLength markerWidth; + readonly attribute SVGAnimatedLength markerHeight; readonly attribute SVGAnimatedEnumeration orientType; - readonly attribute SVGAnimatedAngle orientAngle; + readonly attribute SVGAnimatedAngle orientAngle; void setOrientToAuto(); - void setOrientToAngle([Default=Undefined] optional SVGAngle angle); + void setOrientToAngle(SVGAngle angle); }; SVGMarkerElement implements SVGFitToViewBox; -
diff --git a/core/svg/SVGMaskElement.idl b/core/svg/SVGMaskElement.idl index 0678551..06ced40 100644 --- a/core/svg/SVGMaskElement.idl +++ b/core/svg/SVGMaskElement.idl
@@ -23,10 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/css-masking/#InterfaceSVGMaskElement + interface SVGMaskElement : SVGElement { readonly attribute SVGAnimatedEnumeration maskUnits; readonly attribute SVGAnimatedEnumeration maskContentUnits; - readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; readonly attribute SVGAnimatedLength width; @@ -34,4 +35,3 @@ }; SVGMaskElement implements SVGTests; -
diff --git a/core/svg/SVGMatrix.idl b/core/svg/SVGMatrix.idl index eb28daa..90d00e4 100644 --- a/core/svg/SVGMatrix.idl +++ b/core/svg/SVGMatrix.idl
@@ -21,28 +21,29 @@ */ [ - SetWrapperReferenceTo(SVGTransform parent), - StrictTypeChecking, + TypeChecking=Interface|Nullable, + ImplementedAs=SVGMatrixTearOff, + SetWrapperReferenceTo(SVGTransform contextTransform) ] interface SVGMatrix { // FIXME: these attributes should all be floats but since we implement // AffineTransform with doubles setting these as doubles makes more sense. - attribute double a; - attribute double b; - attribute double c; - attribute double d; - attribute double e; - attribute double f; + [RaisesException=Setter] attribute double a; + [RaisesException=Setter] attribute double b; + [RaisesException=Setter] attribute double c; + [RaisesException=Setter] attribute double d; + [RaisesException=Setter] attribute double e; + [RaisesException=Setter] attribute double f; SVGMatrix multiply(SVGMatrix secondMatrix); [RaisesException] SVGMatrix inverse(); - [Immutable] SVGMatrix translate(float x, float y); - [Immutable] SVGMatrix scale(float scaleFactor); - [Immutable] SVGMatrix scaleNonUniform(float scaleFactorX, float scaleFactorY); - [Immutable] SVGMatrix rotate(float angle); + SVGMatrix translate(float x, float y); + SVGMatrix scale(float scaleFactor); + SVGMatrix scaleNonUniform(float scaleFactorX, float scaleFactorY); + SVGMatrix rotate(float angle); [RaisesException] SVGMatrix rotateFromVector(float x, float y); - [Immutable] SVGMatrix flipX(); - [Immutable] SVGMatrix flipY(); - [Immutable] SVGMatrix skewX(float angle); - [Immutable] SVGMatrix skewY(float angle); + SVGMatrix flipX(); + SVGMatrix flipY(); + SVGMatrix skewX(float angle); + SVGMatrix skewY(float angle); };
diff --git a/core/svg/SVGNumber.idl b/core/svg/SVGNumber.idl index e873793..63c4b52 100644 --- a/core/svg/SVGNumber.idl +++ b/core/svg/SVGNumber.idl
@@ -23,8 +23,10 @@ [ ImplementedAs=SVGNumberTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGNumber { - [RaisesException=Setter] attribute float value; + // FIXMEDART: this attribute probably does not need to be DartCustom + // anymore. + [RaisesException=Setter, DartCustom] attribute float value; };
diff --git a/core/svg/SVGNumberList.idl b/core/svg/SVGNumberList.idl index 1bc3a5b..e5cf2fe 100644 --- a/core/svg/SVGNumberList.idl +++ b/core/svg/SVGNumberList.idl
@@ -27,13 +27,15 @@ [ ImplementedAs=SVGNumberListTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGNumberList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] SVGNumber initialize(SVGNumber item); - [RaisesException] SVGNumber getItem(unsigned long index); + [RaisesException] getter SVGNumber getItem(unsigned long index); + [RaisesException] setter SVGNumber (unsigned long index, SVGNumber value); [RaisesException] SVGNumber insertItemBefore(SVGNumber item, unsigned long index); [RaisesException] SVGNumber replaceItem(SVGNumber item, unsigned long index); [RaisesException] SVGNumber removeItem(unsigned long index);
diff --git a/core/svg/SVGPathElement.idl b/core/svg/SVGPathElement.idl index 5acffd0..3cc9d2f 100644 --- a/core/svg/SVGPathElement.idl +++ b/core/svg/SVGPathElement.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathElement : SVGGeometryElement { readonly attribute SVGAnimatedNumber pathLength;
diff --git a/core/svg/SVGPathSeg.idl b/core/svg/SVGPathSeg.idl index 60ed633..4b9ce79 100644 --- a/core/svg/SVGPathSeg.idl +++ b/core/svg/SVGPathSeg.idl
@@ -26,6 +26,7 @@ [ Custom=Wrap, + DependentLifetime, ] interface SVGPathSeg { // Path Segment Types const unsigned short PATHSEG_UNKNOWN = 0; @@ -52,4 +53,3 @@ readonly attribute unsigned short pathSegType; readonly attribute DOMString pathSegTypeAsLetter; }; -
diff --git a/core/svg/SVGPathSegArcAbs.idl b/core/svg/SVGPathSegArcAbs.idl index 2f8e401..9f60267 100644 --- a/core/svg/SVGPathSegArcAbs.idl +++ b/core/svg/SVGPathSegArcAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegArcAbs : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegArcRel.idl b/core/svg/SVGPathSegArcRel.idl index 2c81a87..405a5c6 100644 --- a/core/svg/SVGPathSegArcRel.idl +++ b/core/svg/SVGPathSegArcRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegArcRel : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegClosePath.idl b/core/svg/SVGPathSegClosePath.idl index e05ca79..bb47b28 100644 --- a/core/svg/SVGPathSegClosePath.idl +++ b/core/svg/SVGPathSegClosePath.idl
@@ -26,4 +26,3 @@ interface SVGPathSegClosePath : SVGPathSeg { }; -
diff --git a/core/svg/SVGPathSegCurvetoCubicAbs.idl b/core/svg/SVGPathSegCurvetoCubicAbs.idl index c8703d6..3fb452c 100644 --- a/core/svg/SVGPathSegCurvetoCubicAbs.idl +++ b/core/svg/SVGPathSegCurvetoCubicAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoCubicAbs : SVGPathSeg { attribute float x; attribute float y; @@ -34,4 +34,3 @@ attribute float x2; attribute float y2; }; -
diff --git a/core/svg/SVGPathSegCurvetoCubicRel.idl b/core/svg/SVGPathSegCurvetoCubicRel.idl index 645276d..a047127 100644 --- a/core/svg/SVGPathSegCurvetoCubicRel.idl +++ b/core/svg/SVGPathSegCurvetoCubicRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoCubicRel : SVGPathSeg { attribute float x; attribute float y; @@ -34,4 +34,3 @@ attribute float x2; attribute float y2; }; -
diff --git a/core/svg/SVGPathSegCurvetoCubicSmoothAbs.idl b/core/svg/SVGPathSegCurvetoCubicSmoothAbs.idl index aba3847..c84d239 100644 --- a/core/svg/SVGPathSegCurvetoCubicSmoothAbs.idl +++ b/core/svg/SVGPathSegCurvetoCubicSmoothAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoCubicSmoothAbs : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegCurvetoCubicSmoothRel.idl b/core/svg/SVGPathSegCurvetoCubicSmoothRel.idl index 34294a0..daa38e3 100644 --- a/core/svg/SVGPathSegCurvetoCubicSmoothRel.idl +++ b/core/svg/SVGPathSegCurvetoCubicSmoothRel.idl
@@ -25,11 +25,10 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoCubicSmoothRel : SVGPathSeg { attribute float x; attribute float y; attribute float x2; attribute float y2; }; -
diff --git a/core/svg/SVGPathSegCurvetoQuadraticAbs.idl b/core/svg/SVGPathSegCurvetoQuadraticAbs.idl index 7500b40..3014b01 100644 --- a/core/svg/SVGPathSegCurvetoQuadraticAbs.idl +++ b/core/svg/SVGPathSegCurvetoQuadraticAbs.idl
@@ -25,11 +25,10 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoQuadraticAbs : SVGPathSeg { attribute float x; attribute float y; attribute float x1; attribute float y1; }; -
diff --git a/core/svg/SVGPathSegCurvetoQuadraticRel.idl b/core/svg/SVGPathSegCurvetoQuadraticRel.idl index 7554dfe..a14cbe3 100644 --- a/core/svg/SVGPathSegCurvetoQuadraticRel.idl +++ b/core/svg/SVGPathSegCurvetoQuadraticRel.idl
@@ -25,11 +25,10 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoQuadraticRel : SVGPathSeg { attribute float x; attribute float y; attribute float x1; attribute float y1; }; -
diff --git a/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl b/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl index e84fa8c..aad9a56 100644 --- a/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl +++ b/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoQuadraticSmoothAbs : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl b/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl index b50e2ae..a1e6aba 100644 --- a/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl +++ b/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegCurvetoQuadraticSmoothRel : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegLinetoAbs.idl b/core/svg/SVGPathSegLinetoAbs.idl index c6fb097..e1c1f5c 100644 --- a/core/svg/SVGPathSegLinetoAbs.idl +++ b/core/svg/SVGPathSegLinetoAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoAbs : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegLinetoHorizontalAbs.idl b/core/svg/SVGPathSegLinetoHorizontalAbs.idl index 16d58db..08d774c 100644 --- a/core/svg/SVGPathSegLinetoHorizontalAbs.idl +++ b/core/svg/SVGPathSegLinetoHorizontalAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoHorizontalAbs : SVGPathSeg { attribute float x; };
diff --git a/core/svg/SVGPathSegLinetoHorizontalRel.idl b/core/svg/SVGPathSegLinetoHorizontalRel.idl index d48b6f6..34d378d 100644 --- a/core/svg/SVGPathSegLinetoHorizontalRel.idl +++ b/core/svg/SVGPathSegLinetoHorizontalRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoHorizontalRel : SVGPathSeg { attribute float x; };
diff --git a/core/svg/SVGPathSegLinetoRel.idl b/core/svg/SVGPathSegLinetoRel.idl index fc3b88f..f356c17 100644 --- a/core/svg/SVGPathSegLinetoRel.idl +++ b/core/svg/SVGPathSegLinetoRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoRel : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegLinetoVerticalAbs.idl b/core/svg/SVGPathSegLinetoVerticalAbs.idl index 22a09e3..9c6aaa9 100644 --- a/core/svg/SVGPathSegLinetoVerticalAbs.idl +++ b/core/svg/SVGPathSegLinetoVerticalAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoVerticalAbs : SVGPathSeg { attribute float y; };
diff --git a/core/svg/SVGPathSegLinetoVerticalRel.idl b/core/svg/SVGPathSegLinetoVerticalRel.idl index 0ceaf8e..36f44d4 100644 --- a/core/svg/SVGPathSegLinetoVerticalRel.idl +++ b/core/svg/SVGPathSegLinetoVerticalRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegLinetoVerticalRel : SVGPathSeg { attribute float y; };
diff --git a/core/svg/SVGPathSegList.idl b/core/svg/SVGPathSegList.idl index 5214f9d..5e896e4 100644 --- a/core/svg/SVGPathSegList.idl +++ b/core/svg/SVGPathSegList.idl
@@ -25,13 +25,17 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, + SetWrapperReferenceTo(SVGElement contextElement), + ImplementedAs=SVGPathSegListTearOff ] interface SVGPathSegList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] SVGPathSeg initialize(SVGPathSeg newItem); - [RaisesException] SVGPathSeg getItem(unsigned long index); + [RaisesException] getter SVGPathSeg getItem(unsigned long index); + [RaisesException] setter SVGPathSeg (unsigned long index, SVGPathSeg value); [RaisesException] SVGPathSeg insertItemBefore(SVGPathSeg newItem, unsigned long index); [RaisesException] SVGPathSeg replaceItem(SVGPathSeg newItem, unsigned long index); [RaisesException] SVGPathSeg removeItem(unsigned long index);
diff --git a/core/svg/SVGPathSegMovetoAbs.idl b/core/svg/SVGPathSegMovetoAbs.idl index d92e467..b257339 100644 --- a/core/svg/SVGPathSegMovetoAbs.idl +++ b/core/svg/SVGPathSegMovetoAbs.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegMovetoAbs : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPathSegMovetoRel.idl b/core/svg/SVGPathSegMovetoRel.idl index 30909c2..15891e3 100644 --- a/core/svg/SVGPathSegMovetoRel.idl +++ b/core/svg/SVGPathSegMovetoRel.idl
@@ -25,7 +25,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPathSegMovetoRel : SVGPathSeg { attribute float x; attribute float y;
diff --git a/core/svg/SVGPatternElement.idl b/core/svg/SVGPatternElement.idl index d91bb95..04a1e00 100644 --- a/core/svg/SVGPatternElement.idl +++ b/core/svg/SVGPatternElement.idl
@@ -23,17 +23,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/pservers.html#InterfaceSVGPatternElement +// http://www.w3.org/TR/SVG2/pservers.html#InterfaceSVGPatternElement + interface SVGPatternElement : SVGElement { - readonly attribute SVGAnimatedEnumeration patternUnits; - readonly attribute SVGAnimatedEnumeration patternContentUnits; + readonly attribute SVGAnimatedEnumeration patternUnits; + readonly attribute SVGAnimatedEnumeration patternContentUnits; readonly attribute SVGAnimatedTransformList patternTransform; - readonly attribute SVGAnimatedLength x; - readonly attribute SVGAnimatedLength y; - readonly attribute SVGAnimatedLength width; - readonly attribute SVGAnimatedLength height; + readonly attribute SVGAnimatedLength x; + readonly attribute SVGAnimatedLength y; + readonly attribute SVGAnimatedLength width; + readonly attribute SVGAnimatedLength height; }; SVGPatternElement implements SVGFitToViewBox; -SVGPatternElement implements SVGTests; +SVGPatternElement implements SVGTests; // in SVG 1.1 but not SVG 2 SVGPatternElement implements SVGURIReference; -
diff --git a/core/svg/SVGPoint.idl b/core/svg/SVGPoint.idl index a222243..a192380 100644 --- a/core/svg/SVGPoint.idl +++ b/core/svg/SVGPoint.idl
@@ -23,7 +23,7 @@ [ ImplementedAs=SVGPointTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPoint { [RaisesException=Setter] attribute float x; [RaisesException=Setter] attribute float y;
diff --git a/core/svg/SVGPointList.idl b/core/svg/SVGPointList.idl index 51aba12..444570b 100644 --- a/core/svg/SVGPointList.idl +++ b/core/svg/SVGPointList.idl
@@ -26,13 +26,15 @@ [ ImplementedAs=SVGPointListTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGPointList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] SVGPoint initialize(SVGPoint item); - [RaisesException] SVGPoint getItem(unsigned long index); + [RaisesException] getter SVGPoint getItem(unsigned long index); + [RaisesException] setter SVGPoint (unsigned long index, SVGPoint value); [RaisesException] SVGPoint insertItemBefore(SVGPoint item, unsigned long index); [RaisesException] SVGPoint replaceItem(SVGPoint item, unsigned long index); [RaisesException] SVGPoint removeItem(unsigned long index);
diff --git a/core/svg/SVGPreserveAspectRatio.idl b/core/svg/SVGPreserveAspectRatio.idl index 1591630..67b7124 100644 --- a/core/svg/SVGPreserveAspectRatio.idl +++ b/core/svg/SVGPreserveAspectRatio.idl
@@ -24,7 +24,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ImplementedAs=SVGPreserveAspectRatioTearOff, SetWrapperReferenceTo(SVGElement contextElement) ] interface SVGPreserveAspectRatio {
diff --git a/core/svg/SVGRect.idl b/core/svg/SVGRect.idl index 3f1be98..faff038 100644 --- a/core/svg/SVGRect.idl +++ b/core/svg/SVGRect.idl
@@ -23,7 +23,7 @@ [ ImplementedAs=SVGRectTearOff, SetWrapperReferenceTo(SVGElement contextElement), - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGRect { [RaisesException=Setter] attribute float x; [RaisesException=Setter] attribute float y;
diff --git a/core/svg/SVGRenderingIntent.idl b/core/svg/SVGRenderingIntent.idl index 4092cda..2cdc2f4 100644 --- a/core/svg/SVGRenderingIntent.idl +++ b/core/svg/SVGRenderingIntent.idl
@@ -23,7 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGRenderingIntent { +[ + DependentLifetime, +] interface SVGRenderingIntent { // Rendering Intent Types const unsigned short RENDERING_INTENT_UNKNOWN = 0; const unsigned short RENDERING_INTENT_AUTO = 1;
diff --git a/core/svg/SVGSVGElement.idl b/core/svg/SVGSVGElement.idl index d05aec3..093f153 100644 --- a/core/svg/SVGSVGElement.idl +++ b/core/svg/SVGSVGElement.idl
@@ -20,17 +20,18 @@ * Boston, MA 02110-1301, USA. */ +// http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement + // TODO: no css::ViewCSS available! // TODO: no events::DocumentEvent available! [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGSVGElement : SVGGraphicsElement { + readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; readonly attribute SVGAnimatedLength width; readonly attribute SVGAnimatedLength height; - attribute DOMString contentScriptType; - attribute DOMString contentStyleType; readonly attribute SVGRect viewport; readonly attribute float pixelUnitToMillimeterX; readonly attribute float pixelUnitToMillimeterY;
diff --git a/core/svg/SVGStringList.idl b/core/svg/SVGStringList.idl index 0b5dc41..870ba4c 100644 --- a/core/svg/SVGStringList.idl +++ b/core/svg/SVGStringList.idl
@@ -24,15 +24,17 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, SetWrapperReferenceTo(SVGElement contextElement), ImplementedAs=SVGStringListTearOff ] interface SVGStringList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] DOMString initialize(DOMString item); - [RaisesException] DOMString getItem(unsigned long index); + [RaisesException] getter DOMString getItem(unsigned long index); + [RaisesException] setter DOMString (unsigned long index, DOMString value); [RaisesException] DOMString insertItemBefore(DOMString item, unsigned long index); [RaisesException] DOMString replaceItem(DOMString item, unsigned long index); [RaisesException] DOMString removeItem(unsigned long index);
diff --git a/core/svg/SVGSymbolElement.idl b/core/svg/SVGSymbolElement.idl index 0d2ecae..9a5b351 100644 --- a/core/svg/SVGSymbolElement.idl +++ b/core/svg/SVGSymbolElement.idl
@@ -23,6 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSymbolElement + interface SVGSymbolElement : SVGElement { };
diff --git a/core/svg/SVGTests.idl b/core/svg/SVGTests.idl index 591a86b..9e0f5a1 100644 --- a/core/svg/SVGTests.idl +++ b/core/svg/SVGTests.idl
@@ -24,13 +24,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGTests + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface SVGTests { + readonly attribute SVGStringList requiredFeatures; readonly attribute SVGStringList requiredExtensions; readonly attribute SVGStringList systemLanguage; - boolean hasExtension([Default=Undefined] optional DOMString extension); + boolean hasExtension(DOMString extension); }; -
diff --git a/core/svg/SVGTextContentElement.idl b/core/svg/SVGTextContentElement.idl index f16b1f9..4f0466b 100644 --- a/core/svg/SVGTextContentElement.idl +++ b/core/svg/SVGTextContentElement.idl
@@ -24,7 +24,7 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface SVGTextContentElement : SVGGraphicsElement { // lengthAdjust Types const unsigned short LENGTHADJUST_UNKNOWN = 0;
diff --git a/core/svg/SVGTransform.idl b/core/svg/SVGTransform.idl index 96c0058..d810948 100644 --- a/core/svg/SVGTransform.idl +++ b/core/svg/SVGTransform.idl
@@ -20,7 +20,9 @@ */ [ - StrictTypeChecking, + TypeChecking=Interface|Nullable, + ImplementedAs=SVGTransformTearOff, + SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGTransform { // Transform Types const unsigned short SVG_TRANSFORM_UNKNOWN = 0; @@ -31,15 +33,15 @@ const unsigned short SVG_TRANSFORM_SKEWX = 5; const unsigned short SVG_TRANSFORM_SKEWY = 6; - readonly attribute unsigned short type; - [ImplementedAs=svgMatrix] readonly attribute SVGMatrix matrix; + [ImplementedAs=transformType] readonly attribute unsigned short type; + readonly attribute SVGMatrix matrix; readonly attribute float angle; - void setMatrix(SVGMatrix matrix); - void setTranslate(float tx, float ty); - void setScale(float sx, float sy); - void setRotate(float angle, float cx, float cy); - void setSkewX(float angle); - void setSkewY(float angle); + [RaisesException] void setMatrix(SVGMatrix matrix); + [RaisesException] void setTranslate(float tx, float ty); + [RaisesException] void setScale(float sx, float sy); + [RaisesException] void setRotate(float angle, float cx, float cy); + [RaisesException] void setSkewX(float angle); + [RaisesException] void setSkewY(float angle); };
diff --git a/core/svg/SVGTransformList.idl b/core/svg/SVGTransformList.idl index fe57a7a..9bc5521 100644 --- a/core/svg/SVGTransformList.idl +++ b/core/svg/SVGTransformList.idl
@@ -25,13 +25,17 @@ */ [ - StrictTypeChecking, + ImplementedAs=SVGTransformListTearOff, + SetWrapperReferenceTo(SVGElement contextElement), + TypeChecking=Interface|Nullable, ] interface SVGTransformList { - readonly attribute unsigned long numberOfItems; + readonly attribute unsigned long length; + [ImplementedAs=length] readonly attribute unsigned long numberOfItems; [RaisesException] void clear(); [RaisesException] SVGTransform initialize(SVGTransform item); - [RaisesException] SVGTransform getItem(unsigned long index); + [RaisesException] getter SVGTransform getItem(unsigned long index); + [RaisesException] setter SVGTransform (unsigned long index, SVGTransform value); [RaisesException] SVGTransform insertItemBefore(SVGTransform item, unsigned long index); [RaisesException] SVGTransform replaceItem(SVGTransform item, unsigned long index); [RaisesException] SVGTransform removeItem(unsigned long index); @@ -41,4 +45,3 @@ [RaisesException] SVGTransform consolidate(); }; -
diff --git a/core/svg/SVGURIReference.idl b/core/svg/SVGURIReference.idl index 2e2d49f..8a3f713 100644 --- a/core/svg/SVGURIReference.idl +++ b/core/svg/SVGURIReference.idl
@@ -24,9 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGURIReference + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface SVGURIReference { readonly attribute SVGAnimatedString href; }; -
diff --git a/core/svg/SVGUnitTypes.idl b/core/svg/SVGUnitTypes.idl index 5f5ec2e..95c2a49 100644 --- a/core/svg/SVGUnitTypes.idl +++ b/core/svg/SVGUnitTypes.idl
@@ -23,7 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGUnitTypes { +[ + DependentLifetime, +] interface SVGUnitTypes { // Unit Types const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0; const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1;
diff --git a/core/svg/SVGUseElement.idl b/core/svg/SVGUseElement.idl index 9aee55c..ffbd341 100644 --- a/core/svg/SVGUseElement.idl +++ b/core/svg/SVGUseElement.idl
@@ -23,16 +23,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement +// http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGUseElement + interface SVGUseElement : SVGGraphicsElement { readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; readonly attribute SVGAnimatedLength width; readonly attribute SVGAnimatedLength height; - - [MeasureAs=SVGInstanceRoot] readonly attribute SVGElementInstance instanceRoot; - readonly attribute SVGElementInstance animatedInstanceRoot; }; -SVGUseElement implements SVGTests; SVGUseElement implements SVGURIReference; -
diff --git a/core/svg/SVGViewElement.idl b/core/svg/SVGViewElement.idl index 7f95023..fb860f5 100644 --- a/core/svg/SVGViewElement.idl +++ b/core/svg/SVGViewElement.idl
@@ -23,10 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/linking.html#InterfaceSVGViewElement + interface SVGViewElement : SVGElement { readonly attribute SVGStringList viewTarget; }; SVGViewElement implements SVGFitToViewBox; SVGViewElement implements SVGZoomAndPan; -
diff --git a/core/svg/SVGViewSpec.idl b/core/svg/SVGViewSpec.idl index f5bb3a4..5c16d61 100644 --- a/core/svg/SVGViewSpec.idl +++ b/core/svg/SVGViewSpec.idl
@@ -23,8 +23,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGViewSpec { - readonly attribute SVGTransformList transform; +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGViewSpec + +[ + DependentLifetime, + WillBeGarbageCollected, + SetWrapperReferenceTo(SVGElement contextElement), +] interface SVGViewSpec { + [ImplementedAs=transformFromJavascript] readonly attribute SVGTransformList transform; readonly attribute SVGElement viewTarget; readonly attribute DOMString viewBoxString; readonly attribute DOMString preserveAspectRatioString;
diff --git a/core/svg/SVGZoomAndPan.idl b/core/svg/SVGZoomAndPan.idl index ae3ab58..2eeedfd 100644 --- a/core/svg/SVGZoomAndPan.idl +++ b/core/svg/SVGZoomAndPan.idl
@@ -24,12 +24,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/SVG2/types.html#InterfaceSVGZoomAndPan + [ - NoInterfaceObject + NoInterfaceObject, // Always used on target of 'implements' ] interface SVGZoomAndPan { + + // Zoom and Pan Types const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0; const unsigned short SVG_ZOOMANDPAN_DISABLE = 1; const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2; - [RaisesException=Setter] attribute unsigned short zoomAndPan; + [RaisesException=Setter] attribute unsigned short zoomAndPan; // readonly in SVGViewSpec, hence raises exception on setter there };
diff --git a/core/svg/SVGZoomEvent.idl b/core/svg/SVGZoomEvent.idl index bb7e2ac..719739b 100644 --- a/core/svg/SVGZoomEvent.idl +++ b/core/svg/SVGZoomEvent.idl
@@ -23,11 +23,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGZoomEvent : UIEvent { +[ + DependentLifetime, +] interface SVGZoomEvent : UIEvent { readonly attribute SVGRect zoomRectScreen; readonly attribute float previousScale; readonly attribute SVGPoint previousTranslate; readonly attribute float newScale; readonly attribute SVGPoint newTranslate; }; -
diff --git a/core/testing/GCObservation.idl b/core/testing/GCObservation.idl index aaed5c2..378b055 100644 --- a/core/testing/GCObservation.idl +++ b/core/testing/GCObservation.idl
@@ -29,11 +29,10 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface GCObservation { // Technically, this is true if the object was "near death"; the // object may have been kept alive through a weak handle. Having // been collected is the common case, though. readonly attribute boolean wasCollected; }; -
diff --git a/core/testing/InternalProfilers.idl b/core/testing/InternalProfilers.idl index 5ad4863..c73eb1a 100644 --- a/core/testing/InternalProfilers.idl +++ b/core/testing/InternalProfilers.idl
@@ -29,7 +29,7 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface InternalProfilers { void startHeapProfiling(DOMString prefix); void stopHeapProfiling();
diff --git a/core/testing/InternalSettings.idl b/core/testing/InternalSettings.idl index 69686ce..4120690 100644 --- a/core/testing/InternalSettings.idl +++ b/core/testing/InternalSettings.idl
@@ -24,12 +24,11 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface InternalSettings : InternalSettingsGenerated { // All methods which access Page::settings() can raise an exception // when the page cannot be accessed. (Such as during page tear-down.) [RaisesException] void setMockScrollbarsEnabled(boolean enabled); - [RaisesException] void setTouchEventEmulationEnabled(boolean enabled); [RaisesException] void setStandardFontFamily(DOMString family, DOMString script); [RaisesException] void setSerifFontFamily(DOMString family, DOMString script); [RaisesException] void setSansSerifFontFamily(DOMString family, DOMString script); @@ -42,15 +41,10 @@ [RaisesException] void setAccessibilityFontScaleFactor(float fontScaleFactor); [RaisesException] void setMediaTypeOverride(DOMString mediaTypeOverride); [RaisesException] void setEditingBehavior(DOMString behavior); - [RaisesException] void setPasswordGenerationDecorationEnabled(boolean enabled); [RaisesException] void setImagesEnabled(boolean enabled); [RaisesException] void setDefaultVideoPosterURL(DOMString poster); [RaisesException] void setViewportEnabled(boolean enabled); - // FIXME: This is a temporary flag and should be removed once accelerated - // overflow scroll is ready (crbug.com/254111). - [RaisesException] void setCompositorDrivenAcceleratedScrollingEnabled(boolean enabled); - // FIXME: This is a temporary flag and should be removed once squashing is // ready (crbug.com/261605). [RaisesException] void setLayerSquashingEnabled(boolean enabled); @@ -60,9 +54,8 @@ // be removed or moved onto internals.runtimeFlags: void setAuthorShadowDOMForAnyElementEnabled(boolean enabled); void setCSSExclusionsEnabled(boolean enabled); - void setExperimentalWebSocketEnabled(boolean enabled); void setLangAttributeAwareFormControlUIEnabled(boolean enabled); void setOverlayScrollbarsEnabled(boolean enabled); - void setStyleScopedEnabled(boolean enabled); void setExperimentalContentSecurityPolicyFeaturesEnabled(boolean enabled); + void setPseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled(boolean enabled); };
diff --git a/core/testing/Internals.idl b/core/testing/Internals.idl index 082be3d..daec6fd 100644 --- a/core/testing/Internals.idl +++ b/core/testing/Internals.idl
@@ -26,7 +26,7 @@ [ DoNotCheckConstants, - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface Internals { DOMString address(Node node); @@ -44,7 +44,6 @@ [RaisesException] boolean isSharingStyle(Element element1, Element element2); - [RaisesException] unsigned long numberOfScopedHTMLStyleChildren(Node scope); [RaisesException] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node); [RaisesException] ShadowRoot shadowRoot(Element host); @@ -96,8 +95,6 @@ [RaisesException] ClientRect boundingBox(Element element); - [RaisesException] ClientRectList inspectorHighlightRects(Document document); - [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType); [RaisesException] unsigned long activeMarkerCountForNode(Node node); [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index); @@ -139,7 +136,9 @@ sequence<DOMString> userPreferredLanguages(); void setUserPreferredLanguages(sequence<DOMString> languages); + [RaisesException] unsigned long activeDOMObjectCount(Document document); [RaisesException] unsigned long wheelEventHandlerCount(Document document); + [RaisesException] unsigned long scrollEventHandlerCount(Document document); [RaisesException] unsigned long touchEventHandlerCount(Document document); [RaisesException] LayerRectList touchEventTargetLayerRects(Document document); @@ -176,18 +175,8 @@ [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags); [RaisesException] DOMString elementLayerTreeAsText(Element element, optional unsigned short flags); - [RaisesException] NodeList paintOrderListBeforePromote(Element element); - [RaisesException] NodeList paintOrderListAfterPromote(Element element); - [RaisesException] boolean scrollsWithRespectTo(Element element1, Element element2); [RaisesException] boolean isUnclippedDescendant(Element element); - [RaisesException] boolean needsCompositedScrolling(Element element); - - // The values of these constants must be kept in sync with those in RenderLayer. - const unsigned short DO_NOT_FORCE_COMPOSITED_SCROLLING = 0; - const unsigned short COMPOSITED_SCROLLING_ALWAYS_ON = 1; - const unsigned short COMPOSITED_SCROLLING_ALWAYS_OFF = 2; - [RaisesException] void setNeedsCompositedScrolling(Element element, unsigned short value); [RaisesException] DOMString scrollingStateTreeAsText(Document document); [RaisesException] DOMString mainThreadScrollingReasons(Document document); @@ -205,8 +194,6 @@ unsigned long numberOfLiveDocuments(); DOMString dumpRefCountedInstanceCounts(); sequence<DOMString> consoleMessageArgumentCounts(Document document); - Window openDummyInspectorFrontend(DOMString url); - void closeDummyInspectorFrontend(); unsigned long[] setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes); [RaisesException] void setInspectorResourcesDataSizeLimits(long maximumResourcesContentSize, long maximumSingleResourceContentSize); @@ -227,6 +214,8 @@ void webkitWillExitFullScreenForElement(Document document, Element element); void webkitDidExitFullScreenForElement(Document document, Element element); + void mediaPlayerRequestFullscreen(HTMLMediaElement mediaElement); + void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme); void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme); @@ -245,6 +234,8 @@ // specified without security checks. Unspecified means this document. [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node node); + [RaisesException] void forceFullRepaint(Document document); + // Returns a list of draggable/non-draggable regions in the document. [RaisesException] ClientRectList draggableRegions(Document document); [RaisesException] ClientRectList nonDraggableRegions(Document document); @@ -270,11 +261,26 @@ boolean loseSharedGraphicsContext3D(); [RaisesException] void forceCompositingUpdate(Document document); - [RaisesException] boolean isCompositorFramePending(Document document); void setZoomFactor(float factor); [RaisesException] void setShouldRevealPassword(Element element, boolean reveal); + [CallWith=ScriptState] Promise createPromise(); + [CallWith=ScriptState] Promise createResolvedPromise(any value); + [CallWith=ScriptState] Promise createRejectedPromise(any reason); [CallWith=ExecutionContext] Promise addOneToPromise(Promise promise); + + void setValueForUser(Element element, DOMString value); + + DOMString textSurroundingNode(Node node, long x, long y, unsigned long maxLength); + + void setFocused(boolean focused); + + [RaisesException] boolean ignoreLayoutWithPendingStylesheets(Document document); + + // These functions are for testing NetInfo. You must call setNetworkStateNotifierTestOnly(true) + // before calling setNetworkConnectionInfo. + void setNetworkStateNotifierTestOnly(boolean testOnly); + [RaisesException] void setNetworkConnectionInfo(DOMString type); };
diff --git a/core/testing/LayerRect.idl b/core/testing/LayerRect.idl index 7cc2f5b..effc2e6 100644 --- a/core/testing/LayerRect.idl +++ b/core/testing/LayerRect.idl
@@ -29,9 +29,17 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface LayerRect { - readonly attribute Node layerRootNode; + /* The node that most closely represents the layer in which the rect + occurs. When a layer doesn't correspond directly to a node (eg. + for layer squashing) this will the node representing an ancestor + layer. */ + readonly attribute Node layerAssociatedNode; readonly attribute DOMString layerType; + /* Offset of the associated node from the GraphicsLayer */ + readonly attribute long associatedNodeOffsetX; + readonly attribute long associatedNodeOffsetY; + /* Rectange in the GraphicsLayer co-ordinate space */ readonly attribute ClientRect layerRelativeRect; };
diff --git a/core/testing/LayerRectList.idl b/core/testing/LayerRectList.idl index 03e63c5..ffe74d3 100644 --- a/core/testing/LayerRectList.idl +++ b/core/testing/LayerRectList.idl
@@ -29,9 +29,8 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface LayerRectList { readonly attribute unsigned long length; getter LayerRect item(unsigned long index); }; -
diff --git a/core/testing/MallocStatistics.idl b/core/testing/MallocStatistics.idl index 663fabb..5e969e9 100644 --- a/core/testing/MallocStatistics.idl +++ b/core/testing/MallocStatistics.idl
@@ -24,7 +24,7 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface MallocStatistics { readonly attribute unsigned long reservedVMBytes; readonly attribute unsigned long committedVMBytes;
diff --git a/core/testing/TypeConversions.idl b/core/testing/TypeConversions.idl index b87b984..86dc328 100644 --- a/core/testing/TypeConversions.idl +++ b/core/testing/TypeConversions.idl
@@ -24,7 +24,7 @@ */ [ - NoInterfaceObject, // testing interfaces do not appear on global objects + WillBeGarbageCollected, ] interface TypeConversions { attribute long testLong; [EnforceRange, ImplementedAs=testLong] attribute long testEnforceRangeLong; @@ -45,4 +45,20 @@ [EnforceRange, ImplementedAs=testShort] attribute short testEnforceRangeShort; attribute unsigned short testUnsignedShort; [EnforceRange, ImplementedAs=testUnsignedShort] attribute unsigned short testEnforceRangeUnsignedShort; + + attribute ByteString testByteString; + [ImplementedAs=testByteString, TreatReturnedNullStringAs=Null] attribute ByteString testByteStringTreatReturnedNullStringAsNullAttribute; + [ImplementedAs=testByteString, TreatReturnedNullStringAs=Undefined] attribute ByteString testByteStringTreatReturnedNullStringAsUndefinedAttribute; + [ImplementedAs=testByteString, TreatReturnedNullStringAs=Null] ByteString getTestByteStringTreatReturnedNullStringAsNullMethod(); + [ImplementedAs=testByteString, TreatReturnedNullStringAs=Undefined] ByteString getTestByteStringTreatReturnedNullStringAsUndefinedMethod(); + void setTestByteString(ByteString byteString); + [ImplementedAs=setTestByteString] void setTestByteStringDefaultNull(optional ByteString byteString = null); + + attribute ScalarValueString testScalarValueString; + [ImplementedAs=testScalarValueString, TreatReturnedNullStringAs=Null] attribute ScalarValueString testScalarValueStringTreatReturnedNullStringAsNullAttribute; + [ImplementedAs=testScalarValueString, TreatReturnedNullStringAs=Undefined] attribute ScalarValueString testScalarValueStringTreatReturnedNullStringAsUndefinedAttribute; + [ImplementedAs=testScalarValueString, TreatReturnedNullStringAs=Null] ScalarValueString getTestScalarValueStringTreatReturnedNullStringAsNullMethod(); + [ImplementedAs=testScalarValueString, TreatReturnedNullStringAs=Undefined] ScalarValueString getTestScalarValueStringTreatReturnedNullStringAsUndefinedMethod(); + void setTestScalarValueString(ScalarValueString scalarValueString); + [ImplementedAs=setTestScalarValueString] void setTestScalarValueStringDefaultNull(optional ScalarValueString scalarValueString = null); };
diff --git a/core/timing/MemoryInfo.idl b/core/timing/MemoryInfo.idl index 30ac718..552f175 100644 --- a/core/timing/MemoryInfo.idl +++ b/core/timing/MemoryInfo.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface MemoryInfo {
diff --git a/core/timing/Performance.idl b/core/timing/Performance.idl index 762f6b0..50e62a8 100644 --- a/core/timing/Performance.idl +++ b/core/timing/Performance.idl
@@ -30,29 +30,28 @@ */ // See: http://www.w3.org/TR/navigation-timing/ -interface Performance : EventTarget { +[ + WillBeGarbageCollected +] interface Performance : EventTarget { readonly attribute PerformanceNavigation navigation; readonly attribute PerformanceTiming timing; readonly attribute MemoryInfo memory; [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntries(); [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByType(DOMString entryType); - [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType); - [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntries] sequence<PerformanceEntry> webkitGetEntries(); - [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByType] sequence<PerformanceEntry> webkitGetEntriesByType(DOMString entryType); - [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByName] sequence<PerformanceEntry> webkitGetEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType); + [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, optional DOMString entryType = null); - void webkitClearResourceTimings(); - void webkitSetResourceTimingBufferSize(unsigned long maxSize); + [MeasureAs=PrefixedPerformanceClearResourceTimings] void webkitClearResourceTimings(); + [MeasureAs=PrefixedPerformanceSetResourceTimingBufferSize] void webkitSetResourceTimingBufferSize(unsigned long maxSize); attribute EventHandler onwebkitresourcetimingbufferfull; // See http://www.w3.org/TR/2012/CR-user-timing-20120726/ [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); - [MeasureAs=UnprefixedUserTiming] void clearMeasures([Default=NullString] optional DOMString measureName); + [RaisesException,MeasureAs=UnprefixedUserTiming] void measure(DOMString measureName, optional DOMString startMark = null, optional DOMString endMark = null); + [MeasureAs=UnprefixedUserTiming] void clearMeasures(optional DOMString measureName = null); // See http://www.w3.org/TR/hr-time/ for details. double now();
diff --git a/core/timing/PerformanceEntry.idl b/core/timing/PerformanceEntry.idl index 2f5771f..06d8222 100644 --- a/core/timing/PerformanceEntry.idl +++ b/core/timing/PerformanceEntry.idl
@@ -30,6 +30,7 @@ // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html [ + WillBeGarbageCollected, Custom=Wrap, ] interface PerformanceEntry { readonly attribute DOMString name;
diff --git a/core/timing/PerformanceNavigation.idl b/core/timing/PerformanceNavigation.idl index cde7a72..ea485ab 100644 --- a/core/timing/PerformanceNavigation.idl +++ b/core/timing/PerformanceNavigation.idl
@@ -29,7 +29,9 @@ */ // See: http://www.w3.org/TR/navigation-timing/ -interface PerformanceNavigation { +[ + WillBeGarbageCollected +] interface PerformanceNavigation { const unsigned short TYPE_NAVIGATE = 0; const unsigned short TYPE_RELOAD = 1; const unsigned short TYPE_BACK_FORWARD = 2;
diff --git a/core/timing/PerformanceTiming.idl b/core/timing/PerformanceTiming.idl index 160e5cc..3178e42 100644 --- a/core/timing/PerformanceTiming.idl +++ b/core/timing/PerformanceTiming.idl
@@ -29,7 +29,9 @@ */ // See: http://dev.w3.org/2006/webapi/WebTiming/ -interface PerformanceTiming { +[ + WillBeGarbageCollected +] interface PerformanceTiming { readonly attribute unsigned long long navigationStart; readonly attribute unsigned long long unloadEventStart; readonly attribute unsigned long long unloadEventEnd;
diff --git a/core/workers/AbstractWorker.idl b/core/workers/AbstractWorker.idl index 1b643f7..fc46a14 100644 --- a/core/workers/AbstractWorker.idl +++ b/core/workers/AbstractWorker.idl
@@ -30,8 +30,9 @@ */ [ - NoInterfaceObject + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' + WillBeGarbageCollected, ] interface AbstractWorker { attribute EventHandler onerror; }; -
diff --git a/core/workers/DedicatedWorkerGlobalScope.idl b/core/workers/DedicatedWorkerGlobalScope.idl index 1ef0663..8c4444d 100644 --- a/core/workers/DedicatedWorkerGlobalScope.idl +++ b/core/workers/DedicatedWorkerGlobalScope.idl
@@ -29,7 +29,8 @@ */ [ - GlobalContext=DedicatedWorkerGlobalScope, + Exposed=DedicatedWorker, + Global=Worker&DedicatedWorker ] interface DedicatedWorkerGlobalScope : WorkerGlobalScope { [Custom, RaisesException] void postMessage(any message, optional MessagePort[] messagePorts); attribute EventHandler onmessage;
diff --git a/core/workers/SharedWorker.idl b/core/workers/SharedWorker.idl index b36361e..bd4719c 100644 --- a/core/workers/SharedWorker.idl +++ b/core/workers/SharedWorker.idl
@@ -31,10 +31,11 @@ [ ActiveDOMObject, - Constructor(DOMString scriptURL, [Default=NullString] optional DOMString name), + Constructor(DOMString scriptURL, optional DOMString name = null), ConstructorCallWith=ExecutionContext, RaisesException=Constructor, RuntimeEnabled=SharedWorker, + WillBeGarbageCollected, ] interface SharedWorker : EventTarget { readonly attribute MessagePort port; };
diff --git a/core/workers/SharedWorkerGlobalScope.idl b/core/workers/SharedWorkerGlobalScope.idl index dcb59b8..e2a7f55 100644 --- a/core/workers/SharedWorkerGlobalScope.idl +++ b/core/workers/SharedWorkerGlobalScope.idl
@@ -29,7 +29,8 @@ */ [ - GlobalContext=SharedWorkerGlobalScope + Exposed=SharedWorker, + Global=Worker&SharedWorker ] interface SharedWorkerGlobalScope : WorkerGlobalScope { readonly attribute DOMString name; attribute EventHandler onconnect;
diff --git a/core/workers/Worker.idl b/core/workers/Worker.idl index 5d9f11a..f494473 100644 --- a/core/workers/Worker.idl +++ b/core/workers/Worker.idl
@@ -30,6 +30,7 @@ Constructor(DOMString scriptUrl), ConstructorCallWith=ExecutionContext, RaisesException=Constructor, + WillBeGarbageCollected, ] interface Worker : EventTarget { attribute EventHandler onmessage;
diff --git a/core/workers/WorkerGlobalScope.idl b/core/workers/WorkerGlobalScope.idl index d61d48f..ced2f23 100644 --- a/core/workers/WorkerGlobalScope.idl +++ b/core/workers/WorkerGlobalScope.idl
@@ -26,7 +26,8 @@ [ Custom=ToV8, - GlobalContext=WorkerGlobalScope, + Exposed=Worker, + WillBeGarbageCollected ] interface WorkerGlobalScope : EventTarget { // WorkerGlobalScope @@ -42,9 +43,8 @@ [Replaceable] readonly attribute WorkerNavigator navigator; // Additional constructors - attribute URLConstructor webkitURL; // FIXME: deprecate this. + [MeasureAs=PrefixedWorkerURL] attribute URLConstructor webkitURL; // FIXME: deprecate this. }; -WorkerGlobalScope implements ImageBitmapFactories; WorkerGlobalScope implements WindowBase64; WorkerGlobalScope implements WindowTimers;
diff --git a/core/workers/WorkerLocation.idl b/core/workers/WorkerLocation.idl index 64ed9e0..252f3a7 100644 --- a/core/workers/WorkerLocation.idl +++ b/core/workers/WorkerLocation.idl
@@ -26,9 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/workers/#workerlocation [ - GlobalContext=WorkerGlobalScope + Exposed=Worker, + WillBeGarbageCollected, ] interface WorkerLocation { }; +// https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation WorkerLocation implements URLUtilsReadOnly;
diff --git a/core/workers/WorkerNavigator.idl b/core/workers/WorkerNavigator.idl index 3debfca..1e82b03 100644 --- a/core/workers/WorkerNavigator.idl +++ b/core/workers/WorkerNavigator.idl
@@ -26,10 +26,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workernavigator-object + [ - GlobalContext=WorkerGlobalScope + Exposed=Worker, + WillBeGarbageCollected, ] interface WorkerNavigator { }; +WorkerNavigator implements NavigatorCPU; WorkerNavigator implements NavigatorID; WorkerNavigator implements NavigatorOnLine;
diff --git a/core/xml/DOMParser.idl b/core/xml/DOMParser.idl index ff6af34..aa390c5 100644 --- a/core/xml/DOMParser.idl +++ b/core/xml/DOMParser.idl
@@ -18,6 +18,7 @@ */ [ + WillBeGarbageCollected, Constructor ] interface DOMParser { [RaisesException] Document parseFromString([Default=Undefined] optional DOMString str,
diff --git a/core/xml/DocumentXPathEvaluator.idl b/core/xml/DocumentXPathEvaluator.idl index 3ef7c2d..8380ad0 100644 --- a/core/xml/DocumentXPathEvaluator.idl +++ b/core/xml/DocumentXPathEvaluator.idl
@@ -19,10 +19,10 @@ partial interface Document { // DOM Level 3 XPath (XPathEvaluator interface) - [RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression, + [MeasureAs=DocumentXPathCreateExpression, RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression, [Default=Undefined] optional XPathNSResolver resolver); - XPathNSResolver createNSResolver(Node nodeResolver); - [Custom, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression, + [MeasureAs=DocumentXPathCreateNSResolver] XPathNSResolver createNSResolver(Node nodeResolver); + [Custom, MeasureAs=DocumentXPathEvaluate, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression, [Default=Undefined] optional Node contextNode, [Default=Undefined] optional XPathNSResolver resolver, [Default=Undefined] optional unsigned short type,
diff --git a/core/xml/XMLHttpRequest.idl b/core/xml/XMLHttpRequest.idl index 2fba4d6..6eaa71b 100644 --- a/core/xml/XMLHttpRequest.idl +++ b/core/xml/XMLHttpRequest.idl
@@ -37,9 +37,10 @@ }; [ + WillBeGarbageCollected, ActiveDOMObject, CustomConstructor(optional XMLHttpRequestOptions options), - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker ] interface XMLHttpRequest : XMLHttpRequestEventTarget { // event handler attributes attribute EventHandler onreadystatechange; @@ -56,11 +57,18 @@ [RaisesException=Setter] attribute boolean withCredentials; - [Custom, ActivityLogging=ForAllWorlds, RaisesException] void open(DOMString method, DOMString url, optional boolean async, optional DOMString user, optional DOMString password); + [Custom, LogActivity, LogAllWorlds, RaisesException] void open(DOMString method, DOMString url, optional boolean async, optional DOMString user, optional DOMString password); - [ActivityLogging=ForAllWorlds, RaisesException] void setRequestHeader(DOMString header, DOMString value); + [LogActivity, LogAllWorlds, RaisesException] void setRequestHeader(DOMString header, DOMString value); [Custom, RaisesException] void send(); + // FIXMEDART: send(ArrayBuffer data) should be eventually deprecated. + [DartCustom=New] void send(ArrayBuffer data); + [DartCustom=New] void send(ArrayBufferView data); + [DartCustom=New] void send(Blob data); + [DartCustom=New] void send(Document data); + [DartCustom=New] void send(DOMString data); + [DartCustom=New] void send(FormData data); void abort(); @@ -74,6 +82,7 @@ [RaisesException=Setter] attribute XMLHttpRequestResponseType responseType; [Custom=Getter, RaisesException=Getter] readonly attribute object response; + readonly attribute DOMString responseURL; readonly attribute unsigned short status; readonly attribute DOMString statusText;
diff --git a/core/xml/XMLHttpRequestProgressEvent.idl b/core/xml/XMLHttpRequestProgressEvent.idl index cd0f45b..a28d64b 100644 --- a/core/xml/XMLHttpRequestProgressEvent.idl +++ b/core/xml/XMLHttpRequestProgressEvent.idl
@@ -25,7 +25,7 @@ // We should also inherit from LSProgressEvent when the idl is added. interface XMLHttpRequestProgressEvent : ProgressEvent { - readonly attribute unsigned long long position; - readonly attribute unsigned long long totalSize; + [MeasureAs=XHRProgressEventPosition] readonly attribute unsigned long long position; + [MeasureAs=XHRProgressEventTotalSize] readonly attribute unsigned long long totalSize; };
diff --git a/core/xml/XMLSerializer.idl b/core/xml/XMLSerializer.idl index 88a9171..1a7b627 100644 --- a/core/xml/XMLSerializer.idl +++ b/core/xml/XMLSerializer.idl
@@ -19,6 +19,7 @@ */ [ + WillBeGarbageCollected, Constructor ] interface XMLSerializer { [RaisesException] DOMString serializeToString([Default=Undefined] optional Node node);
diff --git a/core/xml/XPathEvaluator.idl b/core/xml/XPathEvaluator.idl index 30e899b..d11018a 100644 --- a/core/xml/XPathEvaluator.idl +++ b/core/xml/XPathEvaluator.idl
@@ -18,6 +18,7 @@ */ [ + WillBeGarbageCollected, Constructor ] interface XPathEvaluator { [RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression,
diff --git a/core/xml/XPathExpression.idl b/core/xml/XPathExpression.idl index 7b881ea..35ab908 100644 --- a/core/xml/XPathExpression.idl +++ b/core/xml/XPathExpression.idl
@@ -17,7 +17,10 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -interface XPathExpression { + +[ + WillBeGarbageCollected +] interface XPathExpression { [RaisesException] XPathResult evaluate([Default=Undefined] optional Node contextNode, [Default=Undefined] optional unsigned short type, [Default=Undefined] optional XPathResult inResult);
diff --git a/core/xml/XPathNSResolver.idl b/core/xml/XPathNSResolver.idl index 3210792..fd16fcc 100644 --- a/core/xml/XPathNSResolver.idl +++ b/core/xml/XPathNSResolver.idl
@@ -19,6 +19,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface XPathNSResolver { [TreatReturnedNullStringAs=Null] DOMString lookupNamespaceURI([Default=Undefined] optional DOMString prefix);
diff --git a/core/xml/XPathResult.idl b/core/xml/XPathResult.idl index dd5f9cf..f60a5ea 100644 --- a/core/xml/XPathResult.idl +++ b/core/xml/XPathResult.idl
@@ -18,6 +18,7 @@ */ [ + WillBeGarbageCollected ] interface XPathResult { const unsigned short ANY_TYPE = 0; const unsigned short NUMBER_TYPE = 1;
diff --git a/core/xml/XSLTProcessor.idl b/core/xml/XSLTProcessor.idl index 7c99868..dc51a60 100644 --- a/core/xml/XSLTProcessor.idl +++ b/core/xml/XSLTProcessor.idl
@@ -31,6 +31,7 @@ // http://bugs.webkit.org/show_bug.cgi?id=5446 [ + WillBeGarbageCollected, Constructor, RuntimeEnabled=XSLT, MeasureAs=XSLTProcessor
diff --git a/modules/README b/modules/README index 87619fd..bf749b3 100644 --- a/modules/README +++ b/modules/README
@@ -5,5 +5,5 @@ using the script: $DART_ROOT/sdk/lib/html/scripts/idlsync.py The current version corresponds to: -URL: http://src.chromium.org/blink/branches/dart/1847 -Current revision: 169590 +URL: http://src.chromium.org/blink/branches/dart/dartium +Current revision: 181268
diff --git a/modules/battery/BatteryManager.idl b/modules/battery/BatteryManager.idl new file mode 100644 index 0000000..01a6ce1 --- /dev/null +++ b/modules/battery/BatteryManager.idl
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html#batterymanager-interface +[ + RuntimeEnabled=BatteryStatus, + TypeChecking=Unrestricted, +] interface BatteryManager : EventTarget { + readonly attribute boolean charging; + readonly attribute unrestricted double chargingTime; + readonly attribute unrestricted double dischargingTime; + readonly attribute double level; + + attribute EventHandler onchargingchange; + attribute EventHandler onchargingtimechange; + attribute EventHandler ondischargingtimechange; + attribute EventHandler onlevelchange; +};
diff --git a/modules/battery/NavigatorBattery.idl b/modules/battery/NavigatorBattery.idl new file mode 100644 index 0000000..c5bff09 --- /dev/null +++ b/modules/battery/NavigatorBattery.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=BatteryStatus, +] partial interface Navigator { + [CallWith=ScriptState] Promise getBattery(); +}; +
diff --git a/modules/beacon/NavigatorBeacon.idl b/modules/beacon/NavigatorBeacon.idl new file mode 100644 index 0000000..465c211 --- /dev/null +++ b/modules/beacon/NavigatorBeacon.idl
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/Beacon/Overview.html#Navigator + +[ + RuntimeEnabled=Beacon, +] partial interface Navigator { + // FIXME: should be union type http://crbug.com/240176 + [CallWith=ExecutionContext, RaisesException] boolean sendBeacon(DOMString url, ArrayBufferView data); + [CallWith=ExecutionContext, RaisesException] boolean sendBeacon(DOMString url, Blob data); + [CallWith=ExecutionContext, RaisesException] boolean sendBeacon(DOMString url, FormData data); + [CallWith=ExecutionContext, RaisesException] boolean sendBeacon(DOMString url, [Default=Undefined] optional DOMString data); +};
diff --git a/modules/crypto/Algorithm.idl b/modules/crypto/AesKeyAlgorithm.idl similarity index 91% copy from modules/crypto/Algorithm.idl copy to modules/crypto/AesKeyAlgorithm.idl index a1373bd..171650d 100644 --- a/modules/crypto/Algorithm.idl +++ b/modules/crypto/AesKeyAlgorithm.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,8 +29,7 @@ */ [ - WillBeGarbageCollected, NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; +] interface AesKeyAlgorithm : KeyAlgorithm { + readonly attribute unsigned short length; };
diff --git a/modules/crypto/Crypto.idl b/modules/crypto/Crypto.idl index dca27c6..2348d77 100644 --- a/modules/crypto/Crypto.idl +++ b/modules/crypto/Crypto.idl
@@ -27,7 +27,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface Crypto { // Note that getRandomValues() is available even when the "Crypto"
diff --git a/modules/crypto/KeyPair.idl b/modules/crypto/HmacKeyAlgorithm.idl similarity index 89% copy from modules/crypto/KeyPair.idl copy to modules/crypto/HmacKeyAlgorithm.idl index a27de45..89cc843 100644 --- a/modules/crypto/KeyPair.idl +++ b/modules/crypto/HmacKeyAlgorithm.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,9 +29,8 @@ */ [ - WillBeGarbageCollected, NoInterfaceObject -] interface KeyPair { - readonly attribute Key publicKey; - readonly attribute Key privateKey; +] interface HmacKeyAlgorithm : KeyAlgorithm { + readonly attribute KeyAlgorithm hash; + readonly attribute unsigned long length; };
diff --git a/modules/crypto/Key.idl b/modules/crypto/Key.idl index b3901bc..9bc0305 100644 --- a/modules/crypto/Key.idl +++ b/modules/crypto/Key.idl
@@ -29,11 +29,11 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface Key { readonly attribute DOMString type; readonly attribute boolean extractable; - readonly attribute Algorithm algorithm; + readonly attribute KeyAlgorithm algorithm; readonly attribute DOMString[] usages; };
diff --git a/modules/crypto/Algorithm.idl b/modules/crypto/KeyAlgorithm.idl similarity index 88% copy from modules/crypto/Algorithm.idl copy to modules/crypto/KeyAlgorithm.idl index a1373bd..d9e0ea0 100644 --- a/modules/crypto/Algorithm.idl +++ b/modules/crypto/KeyAlgorithm.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,8 +29,9 @@ */ [ - WillBeGarbageCollected, - NoInterfaceObject -] interface Algorithm { + GarbageCollected, + NoInterfaceObject, + SpecialWrapFor=AesKeyAlgorithm|HmacKeyAlgorithm|RsaHashedKeyAlgorithm +] interface KeyAlgorithm { readonly attribute DOMString name; };
diff --git a/modules/crypto/Algorithm.idl b/modules/crypto/RsaHashedKeyAlgorithm.idl similarity index 90% copy from modules/crypto/Algorithm.idl copy to modules/crypto/RsaHashedKeyAlgorithm.idl index a1373bd..28b765d 100644 --- a/modules/crypto/Algorithm.idl +++ b/modules/crypto/RsaHashedKeyAlgorithm.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,8 +29,7 @@ */ [ - WillBeGarbageCollected, NoInterfaceObject -] interface Algorithm { - readonly attribute DOMString name; +] interface RsaHashedKeyAlgorithm : RsaKeyAlgorithm { + readonly attribute KeyAlgorithm hash; };
diff --git a/modules/crypto/KeyPair.idl b/modules/crypto/RsaKeyAlgorithm.idl similarity index 88% copy from modules/crypto/KeyPair.idl copy to modules/crypto/RsaKeyAlgorithm.idl index a27de45..8cf43ed 100644 --- a/modules/crypto/KeyPair.idl +++ b/modules/crypto/RsaKeyAlgorithm.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,9 +29,8 @@ */ [ - WillBeGarbageCollected, NoInterfaceObject -] interface KeyPair { - readonly attribute Key publicKey; - readonly attribute Key privateKey; +] interface RsaKeyAlgorithm : KeyAlgorithm { + readonly attribute unsigned long modulusLength; + readonly attribute Uint8Array publicExponent; };
diff --git a/modules/crypto/SubtleCrypto.idl b/modules/crypto/SubtleCrypto.idl index ff0718b..da23af3 100644 --- a/modules/crypto/SubtleCrypto.idl +++ b/modules/crypto/SubtleCrypto.idl
@@ -28,21 +28,43 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface + +typedef DOMString KeyFormat; +typedef DOMString KeyUsage; // from Key interface + +// FIXME: use below; needs support for union types http://crbug.com/240176 +typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData; + [ - WillBeGarbageCollected, - NoInterfaceObject + GarbageCollected, + NoInterfaceObject, ] interface SubtleCrypto { - [RaisesException] Promise encrypt(Dictionary algorithm, Key key, ArrayBufferView data); - [RaisesException] Promise decrypt(Dictionary algorithm, Key key, ArrayBufferView data); - [RaisesException] Promise sign(Dictionary algorithm, Key key, ArrayBufferView data); - [RaisesException, ImplementedAs=verifySignature] Promise verify(Dictionary algorithm, Key key, ArrayBufferView signature, ArrayBufferView data); - [RaisesException] Promise digest(Dictionary algorithm, ArrayBufferView data); + [CallWith=ScriptState] Promise encrypt(Dictionary algorithm, Key key, ArrayBuffer data); + [CallWith=ScriptState] Promise encrypt(Dictionary algorithm, Key key, ArrayBufferView data); - [RaisesException] Promise generateKey(Dictionary algorithm, boolean extractable, DOMString[] keyUsages); - [RaisesException] Promise importKey(DOMString format, ArrayBufferView keyData, Dictionary? algorithm, boolean extractable, DOMString[] keyUsages); - [RaisesException] Promise exportKey(DOMString format, Key key); + [CallWith=ScriptState] Promise decrypt(Dictionary algorithm, Key key, ArrayBuffer data); + [CallWith=ScriptState] Promise decrypt(Dictionary algorithm, Key key, ArrayBufferView data); - [RaisesException] Promise wrapKey(DOMString format, Key key, Key wrappingKey, Dictionary wrapAlgorithm); - [RaisesException] Promise unwrapKey(DOMString format, ArrayBufferView wrappedKey, Key unwrappingKey, Dictionary unwrapAlgorithm, Dictionary? unwrappedKeyAlgorithm, boolean extractable, DOMString[] keyUsages); + [CallWith=ScriptState] Promise sign(Dictionary algorithm, Key key, ArrayBuffer data); + [CallWith=ScriptState] Promise sign(Dictionary algorithm, Key key, ArrayBufferView data); + + // FIXME: should be: Promise verify(Dictionary algorithm, Key key, CryptoOperationData signature, CryptoOperationData data); + [CallWith=ScriptState, Custom, ImplementedAs=verifySignature] Promise verify(Dictionary algorithm, Key key, object signature, object data); + + [CallWith=ScriptState] Promise digest(Dictionary algorithm, ArrayBuffer data); + [CallWith=ScriptState] Promise digest(Dictionary algorithm, ArrayBufferView data); + + [CallWith=ScriptState] Promise generateKey(Dictionary algorithm, boolean extractable, DOMString[] keyUsages); + + [CallWith=ScriptState] Promise importKey(KeyFormat format, ArrayBuffer keyData, Dictionary algorithm, boolean extractable, KeyUsage[] keyUsages); + [CallWith=ScriptState] Promise importKey(KeyFormat format, ArrayBufferView keyData, Dictionary algorithm, boolean extractable, KeyUsage[] keyUsages); + [CallWith=ScriptState] Promise importKey(KeyFormat format, Dictionary keyData, Dictionary algorithm, boolean extractable, KeyUsage[] keyUsages); + + [CallWith=ScriptState] Promise exportKey(KeyFormat format, Key key); + + [CallWith=ScriptState] Promise wrapKey(KeyFormat format, Key key, Key wrappingKey, Dictionary wrapAlgorithm); + + [CallWith=ScriptState] Promise unwrapKey(KeyFormat format, ArrayBuffer wrappedKey, Key unwrappingKey, Dictionary unwrapAlgorithm, Dictionary unwrappedKeyAlgorithm, boolean extractable, KeyUsage[] keyUsages); + [CallWith=ScriptState] Promise unwrapKey(KeyFormat format, ArrayBufferView wrappedKey, Key unwrappingKey, Dictionary unwrapAlgorithm, Dictionary unwrappedKeyAlgorithm, boolean extractable, KeyUsage[] keyUsages); }; -
diff --git a/modules/crypto/WorkerCrypto.idl b/modules/crypto/WorkerCrypto.idl deleted file mode 100644 index 65da143..0000000 --- a/modules/crypto/WorkerCrypto.idl +++ /dev/null
@@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - WillBeGarbageCollected, - NoInterfaceObject -] interface WorkerCrypto { - [Custom, RaisesException] ArrayBufferView getRandomValues(ArrayBufferView array); -};
diff --git a/modules/crypto/WorkerGlobalScopeCrypto.idl b/modules/crypto/WorkerGlobalScopeCrypto.idl index e85ba50..2def760 100644 --- a/modules/crypto/WorkerGlobalScopeCrypto.idl +++ b/modules/crypto/WorkerGlobalScopeCrypto.idl
@@ -31,5 +31,5 @@ [ RuntimeEnabled=Crypto, ] partial interface WorkerGlobalScope { - readonly attribute WorkerCrypto crypto; + readonly attribute Crypto crypto; };
diff --git a/modules/device_light/DeviceLightEvent.idl b/modules/device_light/DeviceLightEvent.idl new file mode 100644 index 0000000..6d3d3b9 --- /dev/null +++ b/modules/device_light/DeviceLightEvent.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=DeviceLight, + EventConstructor +] interface DeviceLightEvent : Event { + [InitializedByEventConstructor] readonly attribute unrestricted double value; +};
diff --git a/modules/device_light/WindowDeviceLight.idl b/modules/device_light/WindowDeviceLight.idl new file mode 100644 index 0000000..1b8cd79 --- /dev/null +++ b/modules/device_light/WindowDeviceLight.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=DeviceLight, + ImplementedAs=DOMWindowDeviceLight +] partial interface Window { + attribute EventHandler ondevicelight; +};
diff --git a/modules/device_orientation/DeviceMotionEvent.idl b/modules/device_orientation/DeviceMotionEvent.idl index b7df842..5e70a83 100644 --- a/modules/device_orientation/DeviceMotionEvent.idl +++ b/modules/device_orientation/DeviceMotionEvent.idl
@@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=DeviceMotion -] interface DeviceMotionEvent : Event { +interface DeviceMotionEvent : Event { readonly attribute DeviceAcceleration acceleration; readonly attribute DeviceAcceleration accelerationIncludingGravity; readonly attribute DeviceRotationRate rotationRate;
diff --git a/modules/device_orientation/WindowDeviceMotion.idl b/modules/device_orientation/WindowDeviceMotion.idl new file mode 100644 index 0000000..15130d8 --- /dev/null +++ b/modules/device_orientation/WindowDeviceMotion.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + ImplementedAs=DOMWindowDeviceMotion +] partial interface Window { + attribute EventHandler ondevicemotion; +};
diff --git a/modules/device_orientation/WindowDeviceOrientation.idl b/modules/device_orientation/WindowDeviceOrientation.idl new file mode 100644 index 0000000..8a7d18a --- /dev/null +++ b/modules/device_orientation/WindowDeviceOrientation.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + ImplementedAs=DOMWindowDeviceOrientation +] partial interface Window { + attribute EventHandler ondeviceorientation; +};
diff --git a/modules/encoding/TextDecoder.idl b/modules/encoding/TextDecoder.idl index 2a1f987..f71c7b8 100644 --- a/modules/encoding/TextDecoder.idl +++ b/modules/encoding/TextDecoder.idl
@@ -30,11 +30,14 @@ [ RuntimeEnabled=EncodingAPI, - GlobalContext=Window&WorkerGlobalScope, - Constructor([Default=NullString] optional DOMString label, optional Dictionary options), + Exposed=Window&Worker, + Constructor(optional DOMString label = null, optional Dictionary options), RaisesException=Constructor, - WillBeGarbageCollected + GarbageCollected, + MeasureAs=TextDecoderConstructor ] interface TextDecoder { readonly attribute DOMString encoding; - [RaisesException] DOMString decode(optional ArrayBufferView input, optional Dictionary options); + readonly attribute boolean fatal; + readonly attribute boolean ignoreBOM; + [RaisesException, MeasureAs=TextDecoderDecode] DOMString decode(optional ArrayBufferView input, optional Dictionary options); };
diff --git a/modules/encoding/TextEncoder.idl b/modules/encoding/TextEncoder.idl index 0428015..dc86fef 100644 --- a/modules/encoding/TextEncoder.idl +++ b/modules/encoding/TextEncoder.idl
@@ -30,11 +30,12 @@ [ RuntimeEnabled=EncodingAPI, - GlobalContext=Window&WorkerGlobalScope, - Constructor([Default=NullString] optional DOMString utfLabel), + Exposed=Window&Worker, + Constructor(optional DOMString utfLabel = null), RaisesException=Constructor, - WillBeGarbageCollected + GarbageCollected, + MeasureAs=TextEncoderConstructor ] interface TextEncoder { readonly attribute DOMString encoding; - Uint8Array encode([Default=NullString] optional DOMString input, optional Dictionary options); + [MeasureAs=TextEncoderEncode] Uint8Array encode(optional ScalarValueString input = null, optional Dictionary options); };
diff --git a/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl b/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl new file mode 100644 index 0000000..52cd222 --- /dev/null +++ b/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +partial interface HTMLMediaElement { + [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, optional DOMString sessionId = null); + [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 onwebkitkeyerror; + [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeymessage; + [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitneedkey; + + [RuntimeEnabled=EncryptedMedia] readonly attribute MediaKeys mediaKeys; + [RuntimeEnabled=EncryptedMedia, RaisesException, TypeChecking=Interface|Nullable] void setMediaKeys(MediaKeys? mediaKeys); + [RuntimeEnabled=EncryptedMedia] attribute EventHandler onneedkey; +};
diff --git a/modules/encryptedmedia/MediaKeySession.idl b/modules/encryptedmedia/MediaKeySession.idl index 5a2ba37..a5cf333 100644 --- a/modules/encryptedmedia/MediaKeySession.idl +++ b/modules/encryptedmedia/MediaKeySession.idl
@@ -26,7 +26,8 @@ [ ActiveDOMObject, RuntimeEnabled=EncryptedMedia, - WillBeGarbageCollected + GarbageCollected, + TypeChecking=Interface|Nullable ] interface MediaKeySession : EventTarget { // error state readonly attribute MediaKeyError error;
diff --git a/modules/encryptedmedia/MediaKeys.idl b/modules/encryptedmedia/MediaKeys.idl index b1f76e6..a17d8d9 100644 --- a/modules/encryptedmedia/MediaKeys.idl +++ b/modules/encryptedmedia/MediaKeys.idl
@@ -26,10 +26,14 @@ [ RuntimeEnabled=EncryptedMedia, Constructor(DOMString keySystem), + ConstructorCallWith=ExecutionContext, RaisesException=Constructor, - WillBeGarbageCollected + GarbageCollected, + TypeChecking=Interface|Nullable ] interface MediaKeys { + readonly attribute DOMString keySystem; + [CallWith=ExecutionContext, RaisesException] MediaKeySession createSession(DOMString type, Uint8Array initData); - readonly attribute DOMString keySystem; + static boolean isTypeSupported(DOMString keySystem, optional DOMString contentType = null); };
diff --git a/modules/filesystem/DOMFileSystem.idl b/modules/filesystem/DOMFileSystem.idl index 6e8ab7f..80f5032 100644 --- a/modules/filesystem/DOMFileSystem.idl +++ b/modules/filesystem/DOMFileSystem.idl
@@ -31,7 +31,8 @@ [ NoInterfaceObject, - ActiveDOMObject + ActiveDOMObject, + GarbageCollected, ] interface DOMFileSystem { readonly attribute DOMString name; readonly attribute DirectoryEntry root;
diff --git a/modules/filesystem/DOMFileSystemSync.idl b/modules/filesystem/DOMFileSystemSync.idl index 5e67ada..55ce1d7 100644 --- a/modules/filesystem/DOMFileSystemSync.idl +++ b/modules/filesystem/DOMFileSystemSync.idl
@@ -29,7 +29,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + GarbageCollected, ] interface DOMFileSystemSync { readonly attribute DOMString name; readonly attribute DirectoryEntrySync root;
diff --git a/modules/filesystem/DirectoryReader.idl b/modules/filesystem/DirectoryReader.idl index 7660917..f4971fa 100644 --- a/modules/filesystem/DirectoryReader.idl +++ b/modules/filesystem/DirectoryReader.idl
@@ -29,7 +29,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + GarbageCollected, ] interface DirectoryReader { void readEntries(EntriesCallback successCallback, optional ErrorCallback errorCallback); };
diff --git a/modules/filesystem/DirectoryReaderSync.idl b/modules/filesystem/DirectoryReaderSync.idl index cf4937c..2f30b1c 100644 --- a/modules/filesystem/DirectoryReaderSync.idl +++ b/modules/filesystem/DirectoryReaderSync.idl
@@ -29,7 +29,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + GarbageCollected, ] interface DirectoryReaderSync { [RaisesException] EntrySync[] readEntries(); };
diff --git a/modules/filesystem/Entry.idl b/modules/filesystem/Entry.idl index 734272f..5c3fed4 100644 --- a/modules/filesystem/Entry.idl +++ b/modules/filesystem/Entry.idl
@@ -31,6 +31,7 @@ [ Custom=Wrap, NoInterfaceObject, + GarbageCollected, ] interface Entry { readonly attribute boolean isFile; readonly attribute boolean isDirectory;
diff --git a/modules/filesystem/EntrySync.idl b/modules/filesystem/EntrySync.idl index 192c50b..b8f6b72 100644 --- a/modules/filesystem/EntrySync.idl +++ b/modules/filesystem/EntrySync.idl
@@ -31,6 +31,7 @@ [ Custom=Wrap, NoInterfaceObject, + GarbageCollected, ] interface EntrySync { readonly attribute boolean isFile; readonly attribute boolean isDirectory;
diff --git a/modules/filesystem/FileWriter.idl b/modules/filesystem/FileWriter.idl index 2d4b54b..4cac0d0 100644 --- a/modules/filesystem/FileWriter.idl +++ b/modules/filesystem/FileWriter.idl
@@ -31,7 +31,8 @@ [ NoInterfaceObject, - ActiveDOMObject + ActiveDOMObject, + GarbageCollected, ] interface FileWriter : EventTarget { // ready states const unsigned short INIT = 0;
diff --git a/modules/filesystem/FileWriterSync.idl b/modules/filesystem/FileWriterSync.idl index 9b746bd..40fca49 100644 --- a/modules/filesystem/FileWriterSync.idl +++ b/modules/filesystem/FileWriterSync.idl
@@ -29,7 +29,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + GarbageCollected, ] interface FileWriterSync { // synchronous write/modify methods [RaisesException] void write(Blob data);
diff --git a/modules/filesystem/Metadata.idl b/modules/filesystem/Metadata.idl index ee77c0c..5e556fe 100644 --- a/modules/filesystem/Metadata.idl +++ b/modules/filesystem/Metadata.idl
@@ -29,7 +29,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + GarbageCollected, ] interface Metadata { readonly attribute Date modificationTime; readonly attribute unsigned long long size;
diff --git a/modules/gamepad/Gamepad.idl b/modules/gamepad/Gamepad.idl index 937cf2d..9ec0905 100644 --- a/modules/gamepad/Gamepad.idl +++ b/modules/gamepad/Gamepad.idl
@@ -24,13 +24,15 @@ */ [ - WillBeGarbageCollected, - NoInterfaceObject + GarbageCollected, ] interface Gamepad { readonly attribute DOMString id; readonly attribute unsigned long index; + readonly attribute boolean connected; readonly attribute unsigned long long timestamp; - readonly attribute float[] axes; - readonly attribute float[] buttons; + readonly attribute DOMString mapping; + readonly attribute double[] axes; +// FIXMEDART: enable buttons for dart once we handle HeapVector propertly on +// the Dart side of the bindings. + [DartSuppress] readonly attribute GamepadButton[] buttons; }; -
diff --git a/modules/gamepad/GamepadButton.idl b/modules/gamepad/GamepadButton.idl new file mode 100644 index 0000000..19d88ce --- /dev/null +++ b/modules/gamepad/GamepadButton.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, + GarbageCollected, +] interface GamepadButton { + readonly attribute boolean pressed; + readonly attribute double value; +};
diff --git a/modules/gamepad/GamepadEvent.idl b/modules/gamepad/GamepadEvent.idl new file mode 100644 index 0000000..718226e --- /dev/null +++ b/modules/gamepad/GamepadEvent.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + EventConstructor, +] interface GamepadEvent : Event { + [InitializedByEventConstructor] readonly attribute Gamepad gamepad; +};
diff --git a/modules/gamepad/GamepadList.idl b/modules/gamepad/GamepadList.idl index 70ebf4e..03602d4 100644 --- a/modules/gamepad/GamepadList.idl +++ b/modules/gamepad/GamepadList.idl
@@ -24,8 +24,8 @@ */ [ - WillBeGarbageCollected, NoInterfaceObject, + GarbageCollected, ] interface GamepadList { readonly attribute unsigned long length; getter Gamepad item([Default=Undefined] optional unsigned long index);
diff --git a/modules/gamepad/NavigatorGamepad.idl b/modules/gamepad/NavigatorGamepad.idl index a9948c8..81b1f29 100644 --- a/modules/gamepad/NavigatorGamepad.idl +++ b/modules/gamepad/NavigatorGamepad.idl
@@ -20,5 +20,6 @@ [ RuntimeEnabled=Gamepad, ] partial interface Navigator { - GamepadList webkitGetGamepads(); + [DeprecateAs=PrefixedGamepad] WebKitGamepadList webkitGetGamepads(); + GamepadList getGamepads(); };
diff --git a/modules/gamepad/WebKitGamepad.idl b/modules/gamepad/WebKitGamepad.idl new file mode 100644 index 0000000..d8d2cb2 --- /dev/null +++ b/modules/gamepad/WebKitGamepad.idl
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + GarbageCollected, +] interface WebKitGamepad { + readonly attribute DOMString id; + readonly attribute unsigned long index; + readonly attribute boolean connected; + readonly attribute unsigned long long timestamp; + readonly attribute DOMString mapping; + readonly attribute float[] axes; + readonly attribute float[] buttons; +};
diff --git a/modules/gamepad/WebKitGamepadList.idl b/modules/gamepad/WebKitGamepadList.idl new file mode 100644 index 0000000..2b35c56 --- /dev/null +++ b/modules/gamepad/WebKitGamepadList.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, + GarbageCollected, +] interface WebKitGamepadList { + readonly attribute unsigned long length; + getter WebKitGamepad item([Default=Undefined] optional unsigned long index); +};
diff --git a/modules/geolocation/Coordinates.idl b/modules/geolocation/Coordinates.idl index f4bb161..9ff3e28 100644 --- a/modules/geolocation/Coordinates.idl +++ b/modules/geolocation/Coordinates.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface Coordinates { readonly attribute double latitude;
diff --git a/modules/geolocation/Geolocation.idl b/modules/geolocation/Geolocation.idl index 1d98cfb..ca1b5a5 100644 --- a/modules/geolocation/Geolocation.idl +++ b/modules/geolocation/Geolocation.idl
@@ -25,16 +25,16 @@ // http://www.w3.org/TR/geolocation-API/#geolocation_interface [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, ] interface Geolocation { - // FIXME: should be: PositionOptions options (need PositionOptions.idl) - [Custom, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] void getCurrentPosition(PositionCallback successCallback, + // FIXME: should be: PositionOptions options: need PositionOptions.idl and dictionary http:/crbug.com/321462 + [Custom, LogActivity] void getCurrentPosition(PositionCallback successCallback, optional PositionErrorCallback errorCallback, optional object options); - // FIXME: should be: PositionOptions options (need PositionOptions.idl) - [Custom, PerWorldBindings, ActivityLogging=ForIsolatedWorlds] long watchPosition(PositionCallback successCallback, + // FIXME: should be: PositionOptions options: need PositionOptions.idl and dictionary http:/crbug.com/321462 + [Custom, LogActivity] long watchPosition(PositionCallback successCallback, optional PositionErrorCallback errorCallback, optional object options);
diff --git a/modules/geolocation/Geoposition.idl b/modules/geolocation/Geoposition.idl index 6e72f36..7d5c597 100644 --- a/modules/geolocation/Geoposition.idl +++ b/modules/geolocation/Geoposition.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface Geoposition { readonly attribute Coordinates coords;
diff --git a/modules/geolocation/NavigatorGeolocation.idl b/modules/geolocation/NavigatorGeolocation.idl index 318db59..9b96fd7 100644 --- a/modules/geolocation/NavigatorGeolocation.idl +++ b/modules/geolocation/NavigatorGeolocation.idl
@@ -17,8 +17,6 @@ * Boston, MA 02110-1301, USA. */ -[ - RuntimeEnabled=Geolocation, -] partial interface Navigator { +partial interface Navigator { readonly attribute Geolocation geolocation; };
diff --git a/modules/geolocation/PositionError.idl b/modules/geolocation/PositionError.idl index 0495032..b4a7f83 100644 --- a/modules/geolocation/PositionError.idl +++ b/modules/geolocation/PositionError.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface PositionError { readonly attribute unsigned short code;
diff --git a/modules/imagebitmap/ImageBitmapFactories.idl b/modules/imagebitmap/ImageBitmapFactories.idl index 7f244e1..f095d8c 100644 --- a/modules/imagebitmap/ImageBitmapFactories.idl +++ b/modules/imagebitmap/ImageBitmapFactories.idl
@@ -28,14 +28,34 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.whatwg.org/specs/web-apps/current-work/#imagebitmapfactories + +// FIXME: should use typedef instead, but +// requires better union type support: http://crbug.com/240176 +/* +typedef (// HTMLImageElement or + // HTMLVideoElement or + // HTMLCanvasElement or + Blob or + ImageData or + // CanvasRenderingContext2D or + ImageBitmap) ImageBitmapSource; +*/ + [ - NoInterfaceObject, - RuntimeEnabled=ExperimentalCanvasFeatures + LegacyTreatAsPartialInterface, + NoInterfaceObject, // Always used on target of 'implements' + RuntimeEnabled=ExperimentalCanvasFeatures, + TypeChecking=Interface|Nullable, ] interface ImageBitmapFactories { - [RaisesException] Promise createImageBitmap(Blob blob); - [RaisesException] Promise createImageBitmap(Blob blob, long sx, long sy, long sw, long sh); - [RaisesException] Promise createImageBitmap(ImageData data); - [RaisesException] Promise createImageBitmap(ImageData data, long sx, long sy, long sw, long sh); - [RaisesException] Promise createImageBitmap(ImageBitmap bitmap); - [RaisesException] Promise createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(Blob blob); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(Blob blob, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(ImageData data); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(ImageData data, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(ImageBitmap bitmap); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh); }; + +Window implements ImageBitmapFactories; +WorkerGlobalScope implements ImageBitmapFactories; +
diff --git a/modules/imagebitmap/WindowImageBitmapFactories.idl b/modules/imagebitmap/WindowImageBitmapFactories.idl index 419649f..f7b85df 100644 --- a/modules/imagebitmap/WindowImageBitmapFactories.idl +++ b/modules/imagebitmap/WindowImageBitmapFactories.idl
@@ -31,13 +31,14 @@ [ ImplementedAs=ImageBitmapFactories, RuntimeEnabled=ExperimentalCanvasFeatures, + TypeChecking=Interface|Nullable, ] partial interface Window { - [RaisesException] Promise createImageBitmap(HTMLImageElement image); - [RaisesException] Promise createImageBitmap(HTMLImageElement image, long sx, long sy, long sw, long sh); - [RaisesException] Promise createImageBitmap(HTMLVideoElement video); - [RaisesException] Promise createImageBitmap(HTMLVideoElement video, long sx, long sy, long sw, long sh); - [RaisesException] Promise createImageBitmap(CanvasRenderingContext2D context); - [RaisesException] Promise createImageBitmap(CanvasRenderingContext2D context, long sx, long sy, long sw, long sh); - [RaisesException] Promise createImageBitmap(HTMLCanvasElement canvas); - [RaisesException] Promise createImageBitmap(HTMLCanvasElement canvas, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLImageElement image); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLImageElement image, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLVideoElement video); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLVideoElement video, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(CanvasRenderingContext2D context); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(CanvasRenderingContext2D context, long sx, long sy, long sw, long sh); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLCanvasElement canvas); + [CallWith=ScriptState, RaisesException] Promise createImageBitmap(HTMLCanvasElement canvas, long sx, long sy, long sw, long sh); };
diff --git a/modules/indexeddb/IDBCursor.idl b/modules/indexeddb/IDBCursor.idl index aaeb085..727f529 100644 --- a/modules/indexeddb/IDBCursor.idl +++ b/modules/indexeddb/IDBCursor.idl
@@ -23,16 +23,19 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface IDBCursor { +[ + GarbageCollected +] interface IDBCursor { readonly attribute DOMString direction; - [CallWith=ExecutionContext, CachedAttribute=isKeyDirty] readonly attribute any key; - [CallWith=ExecutionContext, CachedAttribute=isPrimaryKeyDirty] readonly attribute any primaryKey; - [CallWith=ExecutionContext] readonly attribute any source; + [CallWith=ScriptState, CachedAttribute=isKeyDirty] readonly attribute any key; + [CallWith=ScriptState, CachedAttribute=isPrimaryKeyDirty] readonly attribute any primaryKey; + [CallWith=ScriptState] readonly attribute any source; [CallWith=ScriptState, RaisesException] IDBRequest update(any value); [RaisesException] void advance([EnforceRange] unsigned long count); - [CallWith=ExecutionContext, ImplementedAs=continueFunction, RaisesException] void continue([Default=Undefined] optional any key); - [CallWith=ExecutionContext, RaisesException, RuntimeEnabled=IndexedDBExperimental] void continuePrimaryKey(any key, any primaryKey); - [CallWith=ExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(); + // FIXMEDART: Define new names for these (see b/4436830). + [CallWith=ScriptState, ImplementedAs=continueFunction, RaisesException] void continue([Default=Undefined] optional any key); + [CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] void continuePrimaryKey(any key, any primaryKey); + [CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(); };
diff --git a/modules/indexeddb/IDBCursorWithValue.idl b/modules/indexeddb/IDBCursorWithValue.idl index cad30a6..719aa1e 100644 --- a/modules/indexeddb/IDBCursorWithValue.idl +++ b/modules/indexeddb/IDBCursorWithValue.idl
@@ -23,6 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface IDBCursorWithValue : IDBCursor { - [CallWith=ExecutionContext,CachedAttribute=isValueDirty] readonly attribute any value; +[ +] interface IDBCursorWithValue : IDBCursor { + [CallWith=ScriptState, CachedAttribute=isValueDirty] readonly attribute any value; };
diff --git a/modules/indexeddb/IDBDatabase.idl b/modules/indexeddb/IDBDatabase.idl index c8e80d3..41e8ff0 100644 --- a/modules/indexeddb/IDBDatabase.idl +++ b/modules/indexeddb/IDBDatabase.idl
@@ -24,23 +24,24 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://dvcs.w3.org/hg/IndexedDB/raw-file/default/Overview.html#idl-def-IDBDatabase + [ - ActiveDOMObject + ActiveDOMObject, + GarbageCollected, ] interface IDBDatabase : EventTarget { readonly attribute DOMString name; - [CallWith=ExecutionContext] readonly attribute any version; + [CallWith=ScriptState] readonly attribute any version; readonly attribute DOMStringList objectStoreNames; - + [RaisesException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options); + [RaisesException] void deleteObjectStore(DOMString name); + // FIXME: should be union type http://crbug.com/240176 + [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, optional DOMString mode = null); + [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = null); + [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMStringList storeNames, optional DOMString mode = null); + void close(); attribute EventHandler onabort; attribute EventHandler onclose; attribute EventHandler onerror; attribute EventHandler onversionchange; - - [RaisesException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options); - [RaisesException] void deleteObjectStore(DOMString name); - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMStringList storeNames, [Default=NullString] optional DOMString mode); - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, [Default=NullString] optional DOMString mode); - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, [Default=NullString] optional DOMString mode); - - void close(); };
diff --git a/modules/indexeddb/IDBFactory.idl b/modules/indexeddb/IDBFactory.idl index 7e0013c..7e91862 100644 --- a/modules/indexeddb/IDBFactory.idl +++ b/modules/indexeddb/IDBFactory.idl
@@ -24,11 +24,12 @@ */ [ + GarbageCollected ] interface IDBFactory { - [CallWith=ExecutionContext, ImplementedAs=getDatabaseNames, RaisesException] IDBRequest webkitGetDatabaseNames(); + [CallWith=ScriptState, ImplementedAs=getDatabaseNames, RaisesException] IDBRequest webkitGetDatabaseNames(); - [CallWith=ExecutionContext, RaisesException] IDBOpenDBRequest open(DOMString name, [EnforceRange] optional unsigned long long version); - [CallWith=ExecutionContext, RaisesException] IDBOpenDBRequest deleteDatabase(DOMString name); + [CallWith=ScriptState, RaisesException] IDBOpenDBRequest open(DOMString name, [EnforceRange] optional unsigned long long version); + [CallWith=ScriptState, RaisesException] IDBOpenDBRequest deleteDatabase(DOMString name); - [CallWith=ExecutionContext, RaisesException] short cmp(any first, any second); + [CallWith=ScriptState, RaisesException] short cmp(any first, any second); };
diff --git a/modules/indexeddb/IDBIndex.idl b/modules/indexeddb/IDBIndex.idl index d2607ab..5087716 100644 --- a/modules/indexeddb/IDBIndex.idl +++ b/modules/indexeddb/IDBIndex.idl
@@ -24,17 +24,18 @@ */ [ + GarbageCollected ] interface IDBIndex { readonly attribute DOMString name; readonly attribute IDBObjectStore objectStore; - [CallWith=ExecutionContext] readonly attribute any keyPath; + [CallWith=ScriptState] readonly attribute any keyPath; readonly attribute boolean unique; readonly attribute boolean multiEntry; - [CallWith=ExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); - [CallWith=ExecutionContext, RaisesException] IDBRequest openKeyCursor([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, optional DOMString direction = null); - [CallWith=ExecutionContext, RaisesException] IDBRequest get(any key); - [CallWith=ExecutionContext, RaisesException] IDBRequest getKey(any key); - [CallWith=ExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key); + [CallWith=ScriptState, RaisesException] IDBRequest get(any key); + [CallWith=ScriptState, RaisesException] IDBRequest getKey(any key); + [CallWith=ScriptState, RaisesException] IDBRequest count([Default=Undefined] optional any key); };
diff --git a/modules/indexeddb/IDBKeyRange.idl b/modules/indexeddb/IDBKeyRange.idl index 031bfca..9b0b06b 100644 --- a/modules/indexeddb/IDBKeyRange.idl +++ b/modules/indexeddb/IDBKeyRange.idl
@@ -24,14 +24,16 @@ */ [ + GarbageCollected ] interface IDBKeyRange { - [ImplementedAs=lowerValue,CallWith=ExecutionContext] readonly attribute any lower; - [ImplementedAs=upperValue,CallWith=ExecutionContext] readonly attribute any upper; + [ImplementedAs=lowerValue, CallWith=ScriptState] readonly attribute any lower; + [ImplementedAs=upperValue, CallWith=ScriptState] readonly attribute any upper; readonly attribute boolean lowerOpen; readonly attribute boolean upperOpen; - [CallWith=ExecutionContext, RaisesException] static IDBKeyRange only(any value); - [CallWith=ExecutionContext, RaisesException] static IDBKeyRange lowerBound(any bound, [Default=Undefined] optional boolean open); - [CallWith=ExecutionContext, RaisesException] static IDBKeyRange upperBound(any bound, [Default=Undefined] optional boolean open); - [CallWith=ExecutionContext, RaisesException] static IDBKeyRange bound(any lower, any upper, [Default=Undefined] optional boolean lowerOpen, [Default=Undefined] optional boolean upperOpen); + // FIXMEDART: Define new names for these (see b/4436830). + [CallWith=ExecutionContext, RaisesException, DartName=only_] static IDBKeyRange only(any value); + [CallWith=ExecutionContext, RaisesException, DartName=lowerBound_] static IDBKeyRange lowerBound(any bound, [Default=Undefined] optional boolean open); + [CallWith=ExecutionContext, RaisesException, DartName=upperBound_] static IDBKeyRange upperBound(any bound, [Default=Undefined] optional boolean open); + [CallWith=ExecutionContext, RaisesException, DartName=bound_] static IDBKeyRange bound(any lower, any upper, [Default=Undefined] optional boolean lowerOpen, [Default=Undefined] optional boolean upperOpen); };
diff --git a/modules/indexeddb/IDBObjectStore.idl b/modules/indexeddb/IDBObjectStore.idl index daa7923..14bd1da 100644 --- a/modules/indexeddb/IDBObjectStore.idl +++ b/modules/indexeddb/IDBObjectStore.idl
@@ -23,25 +23,28 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://dvcs.w3.org/hg/IndexedDB/raw-file/default/Overview.html#idl-def-IDBObjectStore + [ + GarbageCollected, ] interface IDBObjectStore { [TreatReturnedNullStringAs=Null] readonly attribute DOMString name; - [CallWith=ExecutionContext] readonly attribute any keyPath; + [CallWith=ScriptState] readonly attribute any keyPath; readonly attribute DOMStringList indexNames; readonly attribute IDBTransaction transaction; readonly attribute boolean autoIncrement; [CallWith=ScriptState, RaisesException] IDBRequest put(any value, [Default=Undefined] optional any key); [CallWith=ScriptState, RaisesException] IDBRequest add(any value, [Default=Undefined] optional any key); - [CallWith=ExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); - [CallWith=ExecutionContext, RaisesException] IDBRequest clear(); - [CallWith=ExecutionContext, RaisesException] IDBRequest get(any key); - [CallWith=ExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); - [CallWith=ExecutionContext, RaisesException, RuntimeEnabled=IndexedDBExperimental] IDBRequest openKeyCursor([Default=Undefined] optional any range, [Default=NullString] optional DOMString direction); - - [CallWith=ExecutionContext, RaisesException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional Dictionary options); - [CallWith=ExecutionContext, RaisesException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional Dictionary options); + [CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); + [CallWith=ScriptState, RaisesException] IDBRequest get(any key); + [CallWith=ScriptState, RaisesException] IDBRequest clear(); + [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, optional DOMString direction = null); + // 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, sequence<DOMString> keyPath, optional Dictionary options); [RaisesException] IDBIndex index(DOMString name); [RaisesException] void deleteIndex(DOMString name); - [CallWith=ExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key); + [CallWith=ScriptState, RaisesException] IDBRequest count([Default=Undefined] optional any key); };
diff --git a/modules/indexeddb/IDBRequest.idl b/modules/indexeddb/IDBRequest.idl index 139810f..a52b55b 100644 --- a/modules/indexeddb/IDBRequest.idl +++ b/modules/indexeddb/IDBRequest.idl
@@ -28,12 +28,13 @@ */ [ - ActiveDOMObject + ActiveDOMObject, + GarbageCollected, ] interface IDBRequest : EventTarget { [RaisesException=Getter, CachedAttribute=isResultDirty] readonly attribute any result; [RaisesException=Getter] readonly attribute DOMError error; - [CallWith=ExecutionContext] readonly attribute any source; + readonly attribute any source; readonly attribute IDBTransaction transaction; // States
diff --git a/modules/indexeddb/IDBTransaction.idl b/modules/indexeddb/IDBTransaction.idl index 1787cb4..f68c86e 100644 --- a/modules/indexeddb/IDBTransaction.idl +++ b/modules/indexeddb/IDBTransaction.idl
@@ -25,7 +25,8 @@ */ [ - ActiveDOMObject + ActiveDOMObject, + GarbageCollected ] interface IDBTransaction : EventTarget { // Properties
diff --git a/modules/indexeddb/IDBVersionChangeEvent.idl b/modules/indexeddb/IDBVersionChangeEvent.idl index 2d81f43..3ee0c58 100644 --- a/modules/indexeddb/IDBVersionChangeEvent.idl +++ b/modules/indexeddb/IDBVersionChangeEvent.idl
@@ -23,9 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface IDBVersionChangeEvent : Event { - [CallWith=ExecutionContext] readonly attribute any oldVersion; - [CallWith=ExecutionContext] readonly attribute any newVersion; +[ + EventConstructor +] interface IDBVersionChangeEvent : Event { + [InitializedByEventConstructor] readonly attribute unsigned long long oldVersion; + [InitializedByEventConstructor] readonly attribute unsigned long long? newVersion; // FIXME: These are non-standard, see // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22370
diff --git a/modules/indexeddb/WindowIndexedDatabase.idl b/modules/indexeddb/WindowIndexedDatabase.idl index d27f09b..5b80cb8 100644 --- a/modules/indexeddb/WindowIndexedDatabase.idl +++ b/modules/indexeddb/WindowIndexedDatabase.idl
@@ -30,4 +30,13 @@ [ImplementedAs=indexedDB, MeasureAs=PrefixedIndexedDB] readonly attribute IDBFactory webkitIndexedDB; [MeasureAs=UnprefixedIndexedDB] readonly attribute IDBFactory indexedDB; + + [MeasureAs=PrefixedIDBCursorConstructor] attribute IDBCursorConstructor webkitIDBCursor; + [MeasureAs=PrefixedIDBDatabaseConstructor] attribute IDBDatabaseConstructor webkitIDBDatabase; + [MeasureAs=PrefixedIDBFactoryConstructor] attribute IDBFactoryConstructor webkitIDBFactory; + [MeasureAs=PrefixedIDBIndexConstructor] attribute IDBIndexConstructor webkitIDBIndex; + [MeasureAs=PrefixedIDBKeyRangeConstructor] attribute IDBKeyRangeConstructor webkitIDBKeyRange; + [MeasureAs=PrefixedIDBObjectStoreConstructor] attribute IDBObjectStoreConstructor webkitIDBObjectStore; + [MeasureAs=PrefixedIDBRequestConstructor] attribute IDBRequestConstructor webkitIDBRequest; + [MeasureAs=PrefixedIDBTransactionConstructor] attribute IDBTransactionConstructor webkitIDBTransaction; };
diff --git a/modules/mediasource/MediaSource.idl b/modules/mediasource/MediaSource.idl index 28ea22e..a03cde5 100644 --- a/modules/mediasource/MediaSource.idl +++ b/modules/mediasource/MediaSource.idl
@@ -28,6 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#idl-def-MediaSource + enum EndOfStreamError { "network", "decode" @@ -38,6 +40,7 @@ Constructor, ConstructorCallWith=ExecutionContext, RuntimeEnabled=MediaSource, + TypeChecking=Interface|Nullable|Unrestricted, ] interface MediaSource : EventTarget { // All the source buffers created by this object. readonly attribute SourceBufferList sourceBuffers; @@ -45,7 +48,7 @@ // Subset of sourceBuffers that provide data for the selected/enabled tracks. readonly attribute SourceBufferList activeSourceBuffers; - [RaisesException=Setter] attribute double duration; + [RaisesException=Setter] attribute unrestricted double duration; [RaisesException] SourceBuffer addSourceBuffer(DOMString type); [RaisesException] void removeSourceBuffer(SourceBuffer buffer);
diff --git a/modules/mediasource/SourceBuffer.idl b/modules/mediasource/SourceBuffer.idl index 1272771..7827d60 100644 --- a/modules/mediasource/SourceBuffer.idl +++ b/modules/mediasource/SourceBuffer.idl
@@ -28,15 +28,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#idl-def-SourceBuffer + enum AppendMode { "segments", "sequence" }; [ - NoInterfaceObject, ActiveDOMObject, - RuntimeEnabled=MediaSource + NoInterfaceObject, + RuntimeEnabled=MediaSource, + TypeChecking=Interface|Nullable|Unrestricted, ] interface SourceBuffer : EventTarget { // Gets or sets the AppendMode. @@ -55,7 +58,7 @@ [RaisesException=Setter] attribute double appendWindowStart; // Presentation timestamp for the end of append window. - [RaisesException=Setter] attribute double appendWindowEnd; + [RaisesException=Setter] attribute unrestricted double appendWindowEnd; // Append segment data. [RaisesException] void appendBuffer(ArrayBuffer data); @@ -65,6 +68,8 @@ // Abort the current segment append sequence. [RaisesException] void abort(); + // Pending W3C bug: "Change SourceBuffer.remove() end parameter to 'unrestricted double'", + // https://www.w3.org/Bugs/Public/show_bug.cgi?id=25518 [RaisesException] void remove(double start, double end); };
diff --git a/modules/mediasource/URLMediaSource.idl b/modules/mediasource/URLMediaSource.idl index 7312dce..0d336fd 100644 --- a/modules/mediasource/URLMediaSource.idl +++ b/modules/mediasource/URLMediaSource.idl
@@ -28,7 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -partial interface URL { - [CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaSource? source); - [CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(WebKitMediaSource? source); +// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#idl-def-URL + +[ + TypeChecking=Interface|Nullable, +] partial interface URL { + [CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaSource source); };
diff --git a/modules/mediasource/WebKitMediaSource.idl b/modules/mediasource/WebKitMediaSource.idl deleted file mode 100644 index aa5385a..0000000 --- a/modules/mediasource/WebKitMediaSource.idl +++ /dev/null
@@ -1,59 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -enum WebKitEndOfStreamError { - "network", - "decode" -}; - -[ - ActiveDOMObject, - Constructor, - ConstructorCallWith=ExecutionContext, - NoInterfaceObject, - RuntimeEnabled=WebKitMediaSource, -] interface WebKitMediaSource : EventTarget { - // All the source buffers created by this object. - readonly attribute WebKitSourceBufferList sourceBuffers; - - // Subset of sourceBuffers that provide data for the selected/enabled tracks. - readonly attribute WebKitSourceBufferList activeSourceBuffers; - - [RaisesException=Setter] attribute double duration; - - [RaisesException] WebKitSourceBuffer addSourceBuffer(DOMString type); - [RaisesException] void removeSourceBuffer(WebKitSourceBuffer buffer); - - readonly attribute DOMString readyState; - - [RaisesException] void endOfStream(optional WebKitEndOfStreamError error); - - static boolean isTypeSupported (DOMString type); -};
diff --git a/modules/mediasource/WebKitSourceBufferList.idl b/modules/mediasource/WebKitSourceBufferList.idl deleted file mode 100644 index 840ba87..0000000 --- a/modules/mediasource/WebKitSourceBufferList.idl +++ /dev/null
@@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - WillBeGarbageCollected, - NoInterfaceObject, - RuntimeEnabled=WebKitMediaSource -] interface WebKitSourceBufferList : EventTarget { - readonly attribute unsigned long length; - getter WebKitSourceBuffer item(unsigned long index); -}; -
diff --git a/core/events/BeforeLoadEvent.idl b/modules/mediastream/MediaDeviceInfo.idl similarity index 69% rename from core/events/BeforeLoadEvent.idl rename to modules/mediastream/MediaDeviceInfo.idl index b8758d7..1698fc7 100644 --- a/core/events/BeforeLoadEvent.idl +++ b/modules/mediastream/MediaDeviceInfo.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -21,13 +21,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -[ - RuntimeEnabled=BeforeLoad, - EventConstructor, -] interface BeforeLoadEvent : Event { - [InitializedByEventConstructor] readonly attribute DOMString url; +enum MediaDeviceKind { + "audioinput", + "audiooutput", + "videoinput" }; +[ + WillBeGarbageCollected, + NoInterfaceObject +] interface MediaDeviceInfo { + readonly attribute DOMString deviceId; + readonly attribute MediaDeviceKind kind; + readonly attribute DOMString label; + readonly attribute DOMString groupId; +};
diff --git a/core/html/canvas/CanvasRenderingContext.idl b/modules/mediastream/MediaDeviceInfoCallback.idl similarity index 77% rename from core/html/canvas/CanvasRenderingContext.idl rename to modules/mediastream/MediaDeviceInfoCallback.idl index ae89a5f..f6792c9 100644 --- a/core/html/canvas/CanvasRenderingContext.idl +++ b/modules/mediastream/MediaDeviceInfoCallback.idl
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2014 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,10 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Custom=Wrap, - NoInterfaceObject, -] interface CanvasRenderingContext { - readonly attribute HTMLCanvasElement canvas; +callback interface MediaDeviceInfoCallback { + void handleEvent(sequence<MediaDeviceInfo> devices); };
diff --git a/modules/mediastream/MediaStream.idl b/modules/mediastream/MediaStream.idl index 8191d0a..60a9712 100644 --- a/modules/mediastream/MediaStream.idl +++ b/modules/mediastream/MediaStream.idl
@@ -22,7 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-MediaStream + [ + WillBeGarbageCollected, Constructor, Constructor(MediaStream stream), Constructor(MediaStreamTrack[] tracks), @@ -40,6 +43,7 @@ [RaisesException] void addTrack(MediaStreamTrack track); [RaisesException] void removeTrack(MediaStreamTrack track); MediaStreamTrack getTrackById(DOMString trackId); + [CallWith=ExecutionContext] MediaStream clone(); readonly attribute boolean ended;
diff --git a/modules/mediastream/MediaStreamTrack.idl b/modules/mediastream/MediaStreamTrack.idl index 409d17b..7249c0c 100644 --- a/modules/mediastream/MediaStreamTrack.idl +++ b/modules/mediastream/MediaStreamTrack.idl
@@ -23,6 +23,7 @@ */ [ + WillBeGarbageCollected, ActiveDOMObject ] interface MediaStreamTrack : EventTarget { readonly attribute DOMString kind; @@ -33,6 +34,7 @@ [CallWith=ExecutionContext, RaisesException] static void getSources(MediaStreamTrackSourcesCallback callback); [ImplementedAs=stopTrack, RaisesException] void stop(); + [CallWith=ExecutionContext] MediaStreamTrack clone(); attribute EventHandler onmute; attribute EventHandler onunmute;
diff --git a/modules/mediastream/NavigatorMediaStream.idl b/modules/mediastream/NavigatorMediaStream.idl index d6db353..0783d99 100644 --- a/modules/mediastream/NavigatorMediaStream.idl +++ b/modules/mediastream/NavigatorMediaStream.idl
@@ -22,5 +22,7 @@ ] partial interface Navigator { [RaisesException] void webkitGetUserMedia(Dictionary options, NavigatorUserMediaSuccessCallback successCallback, - optional NavigatorUserMediaErrorCallback errorCallback); + NavigatorUserMediaErrorCallback errorCallback); + + [RaisesException] void getMediaDevices(MediaDeviceInfoCallback resultCallback); };
diff --git a/modules/mediastream/NavigatorUserMediaError.idl b/modules/mediastream/NavigatorUserMediaError.idl index dd32480..e068867 100644 --- a/modules/mediastream/NavigatorUserMediaError.idl +++ b/modules/mediastream/NavigatorUserMediaError.idl
@@ -23,6 +23,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface NavigatorUserMediaError { readonly attribute DOMString name;
diff --git a/modules/mediastream/RTCDTMFSender.idl b/modules/mediastream/RTCDTMFSender.idl index 375a6a5..1acdc57 100644 --- a/modules/mediastream/RTCDTMFSender.idl +++ b/modules/mediastream/RTCDTMFSender.idl
@@ -24,6 +24,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject, ActiveDOMObject ] interface RTCDTMFSender : EventTarget {
diff --git a/modules/mediastream/RTCDataChannel.idl b/modules/mediastream/RTCDataChannel.idl index 4a69b5a..7827c20 100644 --- a/modules/mediastream/RTCDataChannel.idl +++ b/modules/mediastream/RTCDataChannel.idl
@@ -22,35 +22,30 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCDataChannel + [ - NoInterfaceObject + WillBeGarbageCollected, + NoInterfaceObject, ] interface RTCDataChannel : EventTarget { readonly attribute DOMString label; - - // DEPRECATED - readonly attribute boolean reliable; - + readonly attribute boolean reliable; // DEPRECATED readonly attribute boolean ordered; readonly attribute unsigned short maxRetransmitTime; readonly attribute unsigned short maxRetransmits; readonly attribute DOMString protocol; readonly attribute boolean negotiated; readonly attribute unsigned short id; - readonly attribute DOMString readyState; readonly attribute unsigned long bufferedAmount; - + attribute EventHandler onopen; + attribute EventHandler onerror; + attribute EventHandler onclose; + void close(); + attribute EventHandler onmessage; [RaisesException=Setter] attribute DOMString binaryType; - + [RaisesException] void send(DOMString data); + [RaisesException] void send(Blob data); [RaisesException] void send(ArrayBuffer data); [RaisesException] void send(ArrayBufferView data); - [RaisesException] void send(Blob data); - [RaisesException] void send(DOMString data); - - void close(); - - attribute EventHandler onopen; - attribute EventHandler onerror; - attribute EventHandler onclose; - attribute EventHandler onmessage; };
diff --git a/modules/mediastream/RTCIceCandidate.idl b/modules/mediastream/RTCIceCandidate.idl index 6404c11..74a1c60 100644 --- a/modules/mediastream/RTCIceCandidate.idl +++ b/modules/mediastream/RTCIceCandidate.idl
@@ -29,11 +29,12 @@ */ [ + WillBeGarbageCollected, Constructor(Dictionary dictionary), RaisesException=Constructor ] interface RTCIceCandidate { - readonly attribute DOMString candidate; - readonly attribute DOMString sdpMid; - readonly attribute unsigned short sdpMLineIndex; + [TreatNullAs=NullString] attribute DOMString candidate; + [TreatNullAs=NullString] attribute DOMString sdpMid; + attribute unsigned short sdpMLineIndex; };
diff --git a/modules/mediastream/RTCPeerConnection.idl b/modules/mediastream/RTCPeerConnection.idl index 0cd9608..4d2459f 100644 --- a/modules/mediastream/RTCPeerConnection.idl +++ b/modules/mediastream/RTCPeerConnection.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, ActiveDOMObject, Constructor(Dictionary rtcIceServers, optional Dictionary mediaConstraints), ConstructorCallWith=ExecutionContext, @@ -50,7 +51,7 @@ [RaisesException] void updateIce(optional Dictionary configuration, optional Dictionary mediaConstraints); // DEPRECATED - [RaisesException] void addIceCandidate(RTCIceCandidate candidate); + [RaisesException, DartSuppress] void addIceCandidate(RTCIceCandidate candidate); [RaisesException] void addIceCandidate(RTCIceCandidate candidate, VoidCallback successCallback, RTCErrorCallback failureCallback); @@ -61,8 +62,8 @@ sequence<MediaStream> getRemoteStreams(); MediaStream getStreamById(DOMString streamId); - [StrictTypeChecking, RaisesException] void addStream(MediaStream? stream, optional Dictionary mediaConstraints); - [StrictTypeChecking, RaisesException] void removeStream(MediaStream? stream); + [TypeChecking=Interface|Nullable, RaisesException] void addStream(MediaStream? stream, optional Dictionary mediaConstraints); + [TypeChecking=Interface|Nullable, RaisesException] void removeStream(MediaStream? stream); void getStats(RTCStatsCallback successCallback, [Default=Undefined] optional MediaStreamTrack selector);
diff --git a/modules/mediastream/RTCSessionDescription.idl b/modules/mediastream/RTCSessionDescription.idl index c906381..6aaf55e 100644 --- a/modules/mediastream/RTCSessionDescription.idl +++ b/modules/mediastream/RTCSessionDescription.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, Constructor(optional Dictionary descriptionInitDict), RaisesException=Constructor ] interface RTCSessionDescription {
diff --git a/modules/mediastream/RTCStatsReport.idl b/modules/mediastream/RTCStatsReport.idl index 15c193b..2fdce08 100644 --- a/modules/mediastream/RTCStatsReport.idl +++ b/modules/mediastream/RTCStatsReport.idl
@@ -23,6 +23,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface RTCStatsReport { readonly attribute Date timestamp;
diff --git a/modules/mediastream/RTCStatsResponse.idl b/modules/mediastream/RTCStatsResponse.idl index edc759a..5e8a53b 100644 --- a/modules/mediastream/RTCStatsResponse.idl +++ b/modules/mediastream/RTCStatsResponse.idl
@@ -23,6 +23,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface RTCStatsResponse { sequence<RTCStatsReport> result();
diff --git a/modules/mediastream/SourceInfo.idl b/modules/mediastream/SourceInfo.idl index 814dd65..8913dd5 100644 --- a/modules/mediastream/SourceInfo.idl +++ b/modules/mediastream/SourceInfo.idl
@@ -24,6 +24,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface SourceInfo { readonly attribute DOMString id;
diff --git a/modules/mediastream/URLMediaStream.idl b/modules/mediastream/URLMediaStream.idl index dda838d..0e9b64b 100644 --- a/modules/mediastream/URLMediaStream.idl +++ b/modules/mediastream/URLMediaStream.idl
@@ -28,6 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/mediacapture-streams/#idl-def-URL + partial interface URL { - [CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaStream? stream); + [CallWith=ExecutionContext, TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaStream stream); };
diff --git a/modules/mediastream/WindowMediaStream.idl b/modules/mediastream/WindowMediaStream.idl new file mode 100644 index 0000000..f5b14fc --- /dev/null +++ b/modules/mediastream/WindowMediaStream.idl
@@ -0,0 +1,11 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + ImplementedAs=DOMWindowMediaStream, +] partial interface Window { + [RuntimeEnabled=MediaStream] attribute MediaStreamConstructor webkitMediaStream; + + [RuntimeEnabled=PeerConnection] attribute RTCPeerConnectionConstructor webkitRTCPeerConnection; +};
diff --git a/modules/navigatorcontentutils/testing/InternalsNavigatorContentUtils.idl b/modules/navigatorcontentutils/testing/InternalsNavigatorContentUtils.idl new file mode 100644 index 0000000..0d43a95 --- /dev/null +++ b/modules/navigatorcontentutils/testing/InternalsNavigatorContentUtils.idl
@@ -0,0 +1,7 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +partial interface Internals { + void setNavigatorContentUtilsClientMock(Document document); +};
diff --git a/modules/netinfo/NavigatorNetworkInformation.idl b/modules/netinfo/NavigatorNetworkInformation.idl new file mode 100644 index 0000000..c3ee9e7 --- /dev/null +++ b/modules/netinfo/NavigatorNetworkInformation.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=NetworkInformation +] partial interface Navigator { + readonly attribute NetworkInformation connection; +};
diff --git a/modules/netinfo/NetworkInformation.idl b/modules/netinfo/NetworkInformation.idl new file mode 100644 index 0000000..7a12c36 --- /dev/null +++ b/modules/netinfo/NetworkInformation.idl
@@ -0,0 +1,23 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +enum ConnectionType { + "cellular", + "bluetooth", + "ethernet", + "wifi", + "other", + "none" +}; + +[ + RuntimeEnabled=NetworkInformation, + Exposed=Window&Worker, + WillBeGarbageCollected, + ActiveDOMObject +] interface NetworkInformation : EventTarget { + readonly attribute ConnectionType type; + attribute EventHandler ontypechange; +}; +
diff --git a/modules/netinfo/WorkerNavigatorNetworkInformation.idl b/modules/netinfo/WorkerNavigatorNetworkInformation.idl new file mode 100644 index 0000000..a2126fa --- /dev/null +++ b/modules/netinfo/WorkerNavigatorNetworkInformation.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=NetworkInformation, + Exposed=Worker +] partial interface WorkerNavigator { + [CallWith=ExecutionContext] readonly attribute NetworkInformation connection; +};
diff --git a/modules/notifications/Notification.idl b/modules/notifications/Notification.idl index b51ee3a..51a26d9 100644 --- a/modules/notifications/Notification.idl +++ b/modules/notifications/Notification.idl
@@ -30,7 +30,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ActiveDOMObject, Constructor(DOMString title, [Default=Undefined] optional Dictionary options), ConstructorCallWith=ExecutionContext,
diff --git a/modules/notifications/NotificationCenter.idl b/modules/notifications/NotificationCenter.idl deleted file mode 100644 index 6fd3270..0000000 --- a/modules/notifications/NotificationCenter.idl +++ /dev/null
@@ -1,43 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - WillBeGarbageCollected, - NoInterfaceObject, - Conditional=LEGACY_NOTIFICATIONS, - ActiveDOMObject -] interface NotificationCenter { - [MeasureAs=LegacyTextNotifications, ActivityLogging=ForAllWorlds, RaisesException] WebKitNotification createNotification(DOMString iconUrl, DOMString title, DOMString body); - - long checkPermission(); - void requestPermission(optional VoidCallback callback); -}; -
diff --git a/modules/notifications/WindowNotifications.idl b/modules/notifications/WindowNotifications.idl deleted file mode 100644 index 0017310..0000000 --- a/modules/notifications/WindowNotifications.idl +++ /dev/null
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - Conditional=LEGACY_NOTIFICATIONS, - ImplementedAs=DOMWindowNotifications, - RuntimeEnabled=Notifications, -] partial interface Window { - [MeasureAs=LegacyNotifications, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds] readonly attribute NotificationCenter webkitNotifications; -};
diff --git a/modules/notifications/WorkerGlobalScopeNotifications.idl b/modules/notifications/WorkerGlobalScopeNotifications.idl deleted file mode 100644 index 932dcfb..0000000 --- a/modules/notifications/WorkerGlobalScopeNotifications.idl +++ /dev/null
@@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -[ - Conditional=LEGACY_NOTIFICATIONS, - RuntimeEnabled=Notifications, -] partial interface WorkerGlobalScope { - readonly attribute NotificationCenter webkitNotifications; -};
diff --git a/modules/performance/WorkerPerformance.idl b/modules/performance/WorkerPerformance.idl index 8c234d8..df38289 100644 --- a/modules/performance/WorkerPerformance.idl +++ b/modules/performance/WorkerPerformance.idl
@@ -29,10 +29,12 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface WorkerPerformance { // See https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime2/Overview.html for details. [CallWith=ExecutionContext] double now(); + + [RuntimeEnabled=MemoryInfoInWorkers] readonly attribute MemoryInfo memory; };
diff --git a/modules/push_messaging/NavigatorPushManager.idl b/modules/push_messaging/NavigatorPushManager.idl new file mode 100644 index 0000000..26db0dd --- /dev/null +++ b/modules/push_messaging/NavigatorPushManager.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=PushMessaging, +] partial interface Navigator { + readonly attribute PushManager push; +};
diff --git a/modules/push_messaging/PushEvent.idl b/modules/push_messaging/PushEvent.idl new file mode 100644 index 0000000..a6a03ff --- /dev/null +++ b/modules/push_messaging/PushEvent.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + EventConstructor, + RuntimeEnabled=PushMessaging, +] interface PushEvent : Event { + [InitializedByEventConstructor] readonly attribute DOMString data; +};
diff --git a/modules/push_messaging/PushManager.idl b/modules/push_messaging/PushManager.idl new file mode 100644 index 0000000..4346304 --- /dev/null +++ b/modules/push_messaging/PushManager.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, + RuntimeEnabled=PushMessaging, + GarbageCollected, +] interface PushManager { + [CallWith=ScriptState, ImplementedAs=registerPushMessaging] Promise register(DOMString senderId); +};
diff --git a/modules/push_messaging/PushRegistration.idl b/modules/push_messaging/PushRegistration.idl new file mode 100644 index 0000000..9ff2d6d --- /dev/null +++ b/modules/push_messaging/PushRegistration.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject, + GarbageCollected, +] interface PushRegistration { + readonly attribute DOMString pushEndpoint; + readonly attribute DOMString pushRegistrationId; +};
diff --git a/modules/push_messaging/ServiceWorkerGlobalScopePush.idl b/modules/push_messaging/ServiceWorkerGlobalScopePush.idl new file mode 100644 index 0000000..3395b3d --- /dev/null +++ b/modules/push_messaging/ServiceWorkerGlobalScopePush.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=PushMessaging, +] partial interface ServiceWorkerGlobalScope { + attribute EventHandler onpush; +};
diff --git a/modules/quota/DeprecatedStorageInfo.idl b/modules/quota/DeprecatedStorageInfo.idl index 389db91..c69dcbc 100644 --- a/modules/quota/DeprecatedStorageInfo.idl +++ b/modules/quota/DeprecatedStorageInfo.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface DeprecatedStorageInfo { const unsigned short TEMPORARY = 0;
diff --git a/modules/quota/DeprecatedStorageQuota.idl b/modules/quota/DeprecatedStorageQuota.idl index 905f189..1562bc4 100644 --- a/modules/quota/DeprecatedStorageQuota.idl +++ b/modules/quota/DeprecatedStorageQuota.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface DeprecatedStorageQuota { [CallWith=ExecutionContext] void queryUsageAndQuota(StorageUsageCallback usageCallback, optional StorageErrorCallback errorCallback);
diff --git a/modules/quota/StorageInfo.idl b/modules/quota/StorageInfo.idl index feec250..112f4a4 100644 --- a/modules/quota/StorageInfo.idl +++ b/modules/quota/StorageInfo.idl
@@ -29,7 +29,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, RuntimeEnabled=QuotaPromise ] interface StorageInfo {
diff --git a/modules/quota/StorageQuota.idl b/modules/quota/StorageQuota.idl index 20c0cbc..1cfb28a 100644 --- a/modules/quota/StorageQuota.idl +++ b/modules/quota/StorageQuota.idl
@@ -34,11 +34,11 @@ }; [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, RuntimeEnabled=QuotaPromise ] interface StorageQuota { readonly attribute StorageType[] supportedTypes; - [CallWith=ExecutionContext] Promise queryInfo(StorageType type); - [CallWith=ExecutionContext] Promise requestPersistentQuota([Clamp] unsigned long long newQuota); + [CallWith=ScriptState] Promise queryInfo(StorageType type); + [CallWith=ScriptState] Promise requestPersistentQuota([Clamp] unsigned long long newQuota); };
diff --git a/modules/screen_orientation/ScreenOrientation.idl b/modules/screen_orientation/ScreenOrientation.idl index 6fc0d5d..c1bf532 100644 --- a/modules/screen_orientation/ScreenOrientation.idl +++ b/modules/screen_orientation/ScreenOrientation.idl
@@ -2,14 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +enum OrientationType { + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; + +enum OrientationLockType { + "any", + "landscape", + "portrait", + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; + [ RuntimeEnabled=ScreenOrientation ] partial interface Screen { - readonly attribute DOMString orientation; + readonly attribute OrientationType orientation; - boolean lockOrientation(sequence<DOMString> orientations); - boolean lockOrientation(DOMString orientation); + [CallWith=ScriptState] Promise lockOrientation(OrientationLockType orientation); void unlockOrientation(); - attribute EventHandler onorientationchange; };
diff --git a/modules/serviceworkers/Client.idl b/modules/serviceworkers/Client.idl new file mode 100644 index 0000000..e30fd2b --- /dev/null +++ b/modules/serviceworkers/Client.idl
@@ -0,0 +1,16 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#client-interface +[ + Exposed=ServiceWorker, + RuntimeEnabled=ServiceWorker +] interface Client { + readonly attribute unsigned long id; + + // FIXME: Currently we think targetOrigin's probably not necessary, but + // re-add it if the ongoing issue [1] concludes the other way. + // [1] https://github.com/slightlyoff/ServiceWorker/issues/190 + [Custom, RaisesException, CallWith=ExecutionContext] void postMessage(SerializedScriptValue message, optional MessagePort[] messagePorts); +};
diff --git a/modules/serviceworkers/FetchEvent.idl b/modules/serviceworkers/FetchEvent.idl new file mode 100644 index 0000000..acb860f --- /dev/null +++ b/modules/serviceworkers/FetchEvent.idl
@@ -0,0 +1,13 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#fetch-event-interface +[ + RuntimeEnabled=ServiceWorker, + Exposed=ServiceWorker +] interface FetchEvent : Event { + readonly attribute Request request; + + [CallWith=ScriptState] void respondWith(any value); +};
diff --git a/modules/serviceworkers/HeaderMap.idl b/modules/serviceworkers/HeaderMap.idl new file mode 100644 index 0000000..38d198b --- /dev/null +++ b/modules/serviceworkers/HeaderMap.idl
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://fetch.spec.whatwg.org/#headers-class +// FIXME: Fetch spec has renamed this to just 'Headers' +// FIXME: This should be defined as MapClass(DOMString, DOMString) +// once binding code supports it (http://crbug.com/347435). +[ + Constructor, + RuntimeEnabled=ServiceWorker, + Exposed=ServiceWorker +] interface HeaderMap { + readonly attribute unsigned long size; + + // FIXME: Define keys, values, entries. + // FIXME: Some of the method definitions (like set) don't strictly + // follow the MapClass's ones (http://heycam.github.io/webidl/#MapClass), + // as this is supposed to be a transient implementation until we have real + // MapClass. + + void clear(); + [ImplementedAs=remove] boolean delete(DOMString key); + DOMString get(DOMString key); + boolean has(DOMString key); + void set(DOMString key, DOMString value); + void forEach(HeaderMapForEachCallback callback, optional any thisArg); +};
diff --git a/modules/serviceworkers/HeaderMapForEachCallback.idl b/modules/serviceworkers/HeaderMapForEachCallback.idl new file mode 100644 index 0000000..d6bbb8d --- /dev/null +++ b/modules/serviceworkers/HeaderMapForEachCallback.idl
@@ -0,0 +1,8 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +callback interface HeaderMapForEachCallback { + [CallWith=ThisValue] boolean handleItem(DOMString value, DOMString key, HeaderMap map); + boolean handleItem(DOMString value, DOMString key, HeaderMap map); +};
diff --git a/modules/serviceworkers/InstallEvent.idl b/modules/serviceworkers/InstallEvent.idl index 9384e90..b014697 100644 --- a/modules/serviceworkers/InstallEvent.idl +++ b/modules/serviceworkers/InstallEvent.idl
@@ -28,10 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-event-interface [ RuntimeEnabled=ServiceWorker, - GlobalContext=ServiceWorkerGlobalScope, + Exposed=ServiceWorker, ] interface InstallEvent : InstallPhaseEvent { void replace(); - [CallWith=ExecutionContext] Promise reloadAll(); + [CallWith=ScriptState] Promise reloadAll(); };
diff --git a/modules/serviceworkers/InstallPhaseEvent.idl b/modules/serviceworkers/InstallPhaseEvent.idl index 21afbcc..9f2637f 100644 --- a/modules/serviceworkers/InstallPhaseEvent.idl +++ b/modules/serviceworkers/InstallPhaseEvent.idl
@@ -28,9 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-phase-event-interface [ RuntimeEnabled=ServiceWorker, - GlobalContext=ServiceWorkerGlobalScope, + Exposed=ServiceWorker, ] interface InstallPhaseEvent : Event { - void waitUntil(any value); + [CallWith=ScriptState] void waitUntil(any value); };
diff --git a/modules/serviceworkers/NavigatorServiceWorker.idl b/modules/serviceworkers/NavigatorServiceWorker.idl index 1f53354..6ed88f0 100644 --- a/modules/serviceworkers/NavigatorServiceWorker.idl +++ b/modules/serviceworkers/NavigatorServiceWorker.idl
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#navigator-service-worker [ RuntimeEnabled=ServiceWorker, ] partial interface Navigator { - readonly attribute ServiceWorkerContainer serviceWorker; + readonly attribute ServiceWorkerContainer serviceWorker; };
diff --git a/modules/serviceworkers/Request.idl b/modules/serviceworkers/Request.idl new file mode 100644 index 0000000..aea4e91 --- /dev/null +++ b/modules/serviceworkers/Request.idl
@@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://fetch.spec.whatwg.org/#request-class +[ + Constructor(optional Dictionary requestInitDict), + RuntimeEnabled=ServiceWorker, + Exposed=ServiceWorker +] interface Request { + attribute ScalarValueString url; + attribute ByteString method; + readonly attribute DOMString origin; + readonly attribute HeaderMap headers; + + // FIXME: Implement the following: + // attribute unsigned long timeout; + // readonly attribute Mode mode; + // attribute boolean synchronous; + // readonly attribute unsigned long redirectCount; + // attribute boolean forcePreflight; + // attribute boolean forceSameOrigin; + // attribute boolean omitCredentials; + // readonly attribute DOMString referrer; + // attribute any body; +};
diff --git a/modules/serviceworkers/Response.idl b/modules/serviceworkers/Response.idl new file mode 100644 index 0000000..fb8ecf3 --- /dev/null +++ b/modules/serviceworkers/Response.idl
@@ -0,0 +1,20 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://fetch.spec.whatwg.org/#response-class +// FIXME: Split this idl/impl into AbstractResponse and Response. +[ + // FIXME: Add ctors for String, Stream, and ArrayBuffer/ArrayBufferView response bodies. + Constructor(Blob body, optional Dictionary responseInitDict), + RuntimeEnabled=ServiceWorker, + Exposed=ServiceWorker +] interface Response { + attribute unsigned short status; + attribute ByteString statusText; + readonly attribute HeaderMap headers; + + // FIXME: Implement the following: + // attribute DOMString url; + // Promise<Blob> toBlob(); +};
diff --git a/modules/serviceworkers/ServiceWorker.idl b/modules/serviceworkers/ServiceWorker.idl index b58eb90..b9a2bdd 100644 --- a/modules/serviceworkers/ServiceWorker.idl +++ b/modules/serviceworkers/ServiceWorker.idl
@@ -27,8 +27,21 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-interface [ - RuntimeEnabled=ServiceWorker, - NoInterfaceObject -] interface ServiceWorker { + ActiveDOMObject, + RuntimeEnabled=ServiceWorker +] interface ServiceWorker : EventTarget { + + // FIXME: Should inherit this from Worker. + [Custom, RaisesException] void postMessage(SerializedScriptValue message, optional MessagePort[] messagePorts); + + readonly attribute ScalarValueString scope; + readonly attribute ScalarValueString url; + // FIXME: Should be ServiceWorkerState enum, not DOMString. + readonly attribute DOMString state; + attribute EventHandler onstatechange; }; + +ServiceWorker implements AbstractWorker;
diff --git a/modules/serviceworkers/ServiceWorkerClients.idl b/modules/serviceworkers/ServiceWorkerClients.idl new file mode 100644 index 0000000..1fc9ad0 --- /dev/null +++ b/modules/serviceworkers/ServiceWorkerClients.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-clients-interface +[ + Exposed=ServiceWorker, + RuntimeEnabled=ServiceWorker +] interface ServiceWorkerClients { + [CallWith=ScriptState] Promise getServiced(); +};
diff --git a/modules/serviceworkers/ServiceWorkerContainer.idl b/modules/serviceworkers/ServiceWorkerContainer.idl index c6ab688..9f8a3f6 100644 --- a/modules/serviceworkers/ServiceWorkerContainer.idl +++ b/modules/serviceworkers/ServiceWorkerContainer.idl
@@ -28,11 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-container-interface [ - RuntimeEnabled=ServiceWorker, - NoInterfaceObject + RuntimeEnabled=ServiceWorker ] interface ServiceWorkerContainer { - [CallWith=ExecutionContext, ImplementedAs=registerServiceWorker] Promise - register(DOMString url, optional Dictionary options); - [CallWith=ExecutionContext, ImplementedAs=unregisterServiceWorker] Promise unregister(optional DOMString scope); + [Unforgeable] readonly attribute ServiceWorker active; + [Unforgeable] readonly attribute ServiceWorker controller; + [Unforgeable] readonly attribute ServiceWorker installing; + [Unforgeable] readonly attribute ServiceWorker waiting; + + [CallWith=ScriptState] readonly attribute Promise ready; + + [CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(ScalarValueString url, optional Dictionary options); + [CallWith=ScriptState, ImplementedAs=unregisterServiceWorker] Promise unregister(ScalarValueString scope); };
diff --git a/modules/serviceworkers/ServiceWorkerGlobalScope.idl b/modules/serviceworkers/ServiceWorkerGlobalScope.idl index 3db5927..07d2dbf 100644 --- a/modules/serviceworkers/ServiceWorkerGlobalScope.idl +++ b/modules/serviceworkers/ServiceWorkerGlobalScope.idl
@@ -27,12 +27,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-global-scope-interface [ - GlobalContext=ServiceWorkerGlobalScope, + Exposed=ServiceWorker, + Global=Worker&ServiceWorker, RuntimeEnabled=ServiceWorker, ] interface ServiceWorkerGlobalScope : WorkerGlobalScope { - attribute EventHandler oninstall; + + readonly attribute ServiceWorkerClients clients; + [CallWith=ExecutionContext, Unforgeable] readonly attribute ScalarValueString scope; + + [CallWith=ScriptState] Promise fetch(ScalarValueString request); + [CallWith=ScriptState] Promise fetch(Request request); + attribute EventHandler onactivate; attribute EventHandler onfetch; + attribute EventHandler oninstall; + attribute EventHandler onmessage; + attribute EventHandler onsync; }; -
diff --git a/modules/speech/SpeechGrammar.idl b/modules/speech/SpeechGrammar.idl index 141f444..7b186bf 100644 --- a/modules/speech/SpeechGrammar.idl +++ b/modules/speech/SpeechGrammar.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, Constructor ] interface SpeechGrammar {
diff --git a/modules/speech/SpeechGrammarList.idl b/modules/speech/SpeechGrammarList.idl index 4974916..a0dde22 100644 --- a/modules/speech/SpeechGrammarList.idl +++ b/modules/speech/SpeechGrammarList.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, Constructor ] interface SpeechGrammarList {
diff --git a/modules/speech/SpeechRecognition.idl b/modules/speech/SpeechRecognition.idl index c1b5783..712bac6 100644 --- a/modules/speech/SpeechRecognition.idl +++ b/modules/speech/SpeechRecognition.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, ActiveDOMObject, Constructor,
diff --git a/modules/speech/SpeechRecognitionAlternative.idl b/modules/speech/SpeechRecognitionAlternative.idl index d00acd7..38acdc0 100644 --- a/modules/speech/SpeechRecognitionAlternative.idl +++ b/modules/speech/SpeechRecognitionAlternative.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface SpeechRecognitionAlternative { readonly attribute DOMString transcript;
diff --git a/modules/speech/SpeechRecognitionResult.idl b/modules/speech/SpeechRecognitionResult.idl index 719fe8d..ab0761b 100644 --- a/modules/speech/SpeechRecognitionResult.idl +++ b/modules/speech/SpeechRecognitionResult.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface SpeechRecognitionResult { readonly attribute unsigned long length;
diff --git a/modules/speech/SpeechRecognitionResultList.idl b/modules/speech/SpeechRecognitionResultList.idl index a4065eb..e93a5cf 100644 --- a/modules/speech/SpeechRecognitionResultList.idl +++ b/modules/speech/SpeechRecognitionResultList.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface SpeechRecognitionResultList { readonly attribute unsigned long length;
diff --git a/modules/speech/SpeechSynthesis.idl b/modules/speech/SpeechSynthesis.idl index 922415e..7822292 100644 --- a/modules/speech/SpeechSynthesis.idl +++ b/modules/speech/SpeechSynthesis.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, RuntimeEnabled=SpeechSynthesis ] interface SpeechSynthesis : EventTarget {
diff --git a/modules/speech/SpeechSynthesisUtterance.idl b/modules/speech/SpeechSynthesisUtterance.idl index b143ea2..490a03a 100644 --- a/modules/speech/SpeechSynthesisUtterance.idl +++ b/modules/speech/SpeechSynthesisUtterance.idl
@@ -24,8 +24,8 @@ */ [ - WillBeGarbageCollected, - Constructor([Default=NullString] optional DOMString text), + GarbageCollected, + Constructor(optional DOMString text = null), ConstructorCallWith=ExecutionContext, RuntimeEnabled=SpeechSynthesis, ] interface SpeechSynthesisUtterance : EventTarget {
diff --git a/modules/speech/SpeechSynthesisVoice.idl b/modules/speech/SpeechSynthesisVoice.idl index 8173be1..05d36a5 100644 --- a/modules/speech/SpeechSynthesisVoice.idl +++ b/modules/speech/SpeechSynthesisVoice.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject, RuntimeEnabled=SpeechSynthesis ] interface SpeechSynthesisVoice {
diff --git a/modules/speech/WindowSpeech.idl b/modules/speech/WindowSpeech.idl new file mode 100644 index 0000000..0d331cc --- /dev/null +++ b/modules/speech/WindowSpeech.idl
@@ -0,0 +1,14 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + ImplementedAs=DOMWindowSpeech, + RuntimeEnabled=ScriptedSpeech, +] partial interface Window { + attribute SpeechGrammarConstructor webkitSpeechGrammar; + attribute SpeechGrammarListConstructor webkitSpeechGrammarList; + attribute SpeechRecognitionConstructor webkitSpeechRecognition; + attribute SpeechRecognitionErrorConstructor webkitSpeechRecognitionError; + attribute SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent; +};
diff --git a/modules/vibration/NavigatorVibration.idl b/modules/vibration/NavigatorVibration.idl index 2c2c140..8ed6624 100644 --- a/modules/vibration/NavigatorVibration.idl +++ b/modules/vibration/NavigatorVibration.idl
@@ -17,9 +17,12 @@ * Boston, MA 02110-1301, USA. */ +// http://dev.w3.org/2009/dap/vibration/#idl-def-Navigator + partial interface Navigator { + // FIXME: should be union type http://crbug.com/240176 // FIXME: The contents of the pattern argument should be clamped. // See https://code.google.com/p/chromium/issues/detail?id=310138 + boolean vibrate([Clamp] unsigned long pattern); boolean vibrate(sequence<unsigned long> pattern); - boolean vibrate([Clamp] unsigned long time); };
diff --git a/modules/webaudio/AnalyserNode.idl b/modules/webaudio/AnalyserNode.idl index f3add66..4de5f29 100644 --- a/modules/webaudio/AnalyserNode.idl +++ b/modules/webaudio/AnalyserNode.idl
@@ -29,11 +29,11 @@ readonly attribute unsigned long frequencyBinCount; // minDecibels / maxDecibels represent the range to scale the FFT analysis data for conversion to unsigned byte values. - [RaisesException=Setter] attribute float minDecibels; - [RaisesException=Setter] attribute float maxDecibels; + [RaisesException=Setter] attribute double minDecibels; + [RaisesException=Setter] attribute double maxDecibels; // A value from 0.0 -> 1.0 where 0.0 represents no time averaging with the last analysis frame. - [RaisesException=Setter] attribute float smoothingTimeConstant; + [RaisesException=Setter] attribute double smoothingTimeConstant; // Copies the current frequency data into the passed array. // If the array has fewer elements than the frequencyBinCount, the excess elements will be dropped. @@ -41,5 +41,6 @@ void getByteFrequencyData(Uint8Array array); // Real-time waveform data + void getFloatTimeDomainData(Float32Array array); void getByteTimeDomainData(Uint8Array array); };
diff --git a/modules/webaudio/AudioBuffer.idl b/modules/webaudio/AudioBuffer.idl index 19f66a5..7ec7c60 100644 --- a/modules/webaudio/AudioBuffer.idl +++ b/modules/webaudio/AudioBuffer.idl
@@ -27,14 +27,13 @@ */ [ + WillBeGarbageCollected, Conditional=WEB_AUDIO ] interface AudioBuffer { readonly attribute long length; // in sample-frames - readonly attribute float duration; // in seconds + readonly attribute double duration; // in seconds readonly attribute float sampleRate; // in sample-frames per second - attribute float gain; // linear gain (default 1.0) - // Channel access readonly attribute unsigned long numberOfChannels; [RaisesException] Float32Array getChannelData(unsigned long channelIndex);
diff --git a/modules/webaudio/AudioBufferSourceNode.idl b/modules/webaudio/AudioBufferSourceNode.idl index 5ac1c01..135f1ce 100644 --- a/modules/webaudio/AudioBufferSourceNode.idl +++ b/modules/webaudio/AudioBufferSourceNode.idl
@@ -25,30 +25,18 @@ // A cached (non-streamed), memory-resident audio source [ Conditional=WEB_AUDIO, - StrictTypeChecking, + TypeChecking=Interface|Nullable, ] interface AudioBufferSourceNode : AudioSourceNode { [RaisesException=Setter] attribute AudioBuffer buffer; - const unsigned short UNSCHEDULED_STATE = 0; - const unsigned short SCHEDULED_STATE = 1; - const unsigned short PLAYING_STATE = 2; - const unsigned short FINISHED_STATE = 3; - - readonly attribute unsigned short playbackState; - - readonly attribute AudioParam gain; readonly attribute AudioParam playbackRate; attribute boolean loop; attribute double loopStart; attribute double loopEnd; - [RaisesException, MeasureAs=WebAudioStart] void start(optional double when, optional double grainOffset, optional double grainDuration); + [RaisesException] void start(optional double when, optional double grainOffset, optional double grainDuration); [RaisesException] void stop(optional double when); - [RaisesException, ImplementedAs=start, MeasureAs=LegacyWebAudio] void noteOn(double when); - [RaisesException, MeasureAs=LegacyWebAudio] void noteGrainOn(double when, double grainOffset, double grainDuration); - [RaisesException, ImplementedAs=stop] void noteOff(double when); - attribute EventHandler onended; };
diff --git a/modules/webaudio/AudioContext.idl b/modules/webaudio/AudioContext.idl index 52da1a5..0f6518e 100644 --- a/modules/webaudio/AudioContext.idl +++ b/modules/webaudio/AudioContext.idl
@@ -24,19 +24,20 @@ */ [ + WillBeGarbageCollected, ActiveDOMObject, Conditional=WEB_AUDIO, Constructor, - Constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate), ConstructorCallWith=Document, NoInterfaceObject, RaisesException=Constructor, ] interface AudioContext : EventTarget { + // All rendered audio ultimately connects to destination, which represents the audio hardware. readonly attribute AudioDestinationNode destination; // All scheduled times are relative to this time in seconds. - readonly attribute float currentTime; + readonly attribute double currentTime; // All AudioNodes in the context run at this sample-rate (sample-frames per second). readonly attribute float sampleRate; @@ -44,14 +45,12 @@ // All panning is relative to this listener. readonly attribute AudioListener listener; - // Number of AudioBufferSourceNodes that are currently playing. - readonly attribute unsigned long activeSourceCount; - [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate); - [RaisesException] AudioBuffer createBuffer(ArrayBuffer? buffer, boolean mixToMono); // Asynchronous audio file data decoding. - [RaisesException] void decodeAudioData(ArrayBuffer audioData, AudioBufferCallback successCallback, optional AudioBufferCallback errorCallback); + // FIXMEDART(ager): Auto-generate this custom method when the info about + // retaining typed arrays is in the IDL. + [RaisesException, DartCustom] void decodeAudioData(ArrayBuffer audioData, AudioBufferCallback successCallback, optional AudioBufferCallback errorCallback); // Sources AudioBufferSourceNode createBufferSource(); @@ -82,10 +81,4 @@ // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate); attribute EventHandler oncomplete; void startRendering(); - - [MeasureAs=LegacyWebAudio, ImplementedAs=createGain] GainNode createGainNode(); - [MeasureAs=LegacyWebAudio, ImplementedAs=createDelay, RaisesException] DelayNode createDelayNode(optional double maxDelayTime); - - [MeasureAs=LegacyWebAudio, ImplementedAs=createScriptProcessor, RaisesException] ScriptProcessorNode createJavaScriptNode(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels); - };
diff --git a/modules/webaudio/AudioListener.idl b/modules/webaudio/AudioListener.idl index 0011fe0..b9668f5 100644 --- a/modules/webaudio/AudioListener.idl +++ b/modules/webaudio/AudioListener.idl
@@ -27,6 +27,7 @@ */ [ + WillBeGarbageCollected, Conditional=WEB_AUDIO ] interface AudioListener { attribute float dopplerFactor; // same as OpenAL (default 1.0)
diff --git a/modules/webaudio/AudioNode.idl b/modules/webaudio/AudioNode.idl index 35d98cc..4ed4d40 100644 --- a/modules/webaudio/AudioNode.idl +++ b/modules/webaudio/AudioNode.idl
@@ -22,23 +22,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum ChannelCountMode { + "max", + "clamped-max", + "explicit" +}; + +enum ChannelInterpretation { + "speakers", + "discrete" +}; + +// http://webaudio.github.io/web-audio-api/#idl-def-AudioNode + [ Conditional=WEB_AUDIO, Custom=Wrap, + WillBeGarbageCollected, ] interface AudioNode : EventTarget { - readonly attribute AudioContext context; + // FIXME: AudioNode argument should not be nullable + [RaisesException] void connect(AudioNode? destination, [Default=Undefined] optional unsigned long output, [Default=Undefined] optional unsigned long input); + [RaisesException] void connect(AudioParam destination, [Default=Undefined] optional unsigned long output); + [RaisesException] void disconnect([Default=Undefined] optional unsigned long output); + readonly attribute AudioContext context; readonly attribute unsigned long numberOfInputs; readonly attribute unsigned long numberOfOutputs; - - [RaisesException=Setter] attribute unsigned long channelCount; - - [RaisesException=Setter] attribute DOMString channelCountMode; - - [RaisesException=Setter] attribute DOMString channelInterpretation; - - [RaisesException] void connect(AudioNode? destination, [Default=Undefined] optional unsigned long output, [Default=Undefined] optional unsigned long input); - - [RaisesException] void connect(AudioParam? destination, [Default=Undefined] optional unsigned long output); - - [RaisesException] void disconnect([Default=Undefined] optional unsigned long output); + [RaisesException=Setter] attribute unsigned long channelCount; + [RaisesException=Setter] attribute ChannelCountMode channelCountMode; + [RaisesException=Setter] attribute ChannelInterpretation channelInterpretation; };
diff --git a/modules/webaudio/AudioParam.idl b/modules/webaudio/AudioParam.idl index fa15d58..95d90e2 100644 --- a/modules/webaudio/AudioParam.idl +++ b/modules/webaudio/AudioParam.idl
@@ -27,6 +27,7 @@ */ [ + WillBeGarbageCollected, Conditional=WEB_AUDIO ] interface AudioParam { attribute float value; @@ -49,11 +50,11 @@ // Sets an array of arbitrary parameter values starting at time for the given duration. // The number of values will be scaled to fit into the desired duration. - void setValueCurveAtTime(Float32Array values, double time, double duration); + // FIXMEDART(ager): Auto-generate this custom method when the info about + // retaining typed arrays is in the IDL. + [DartCustom] void setValueCurveAtTime(Float32Array values, double time, double duration); // Cancels all scheduled parameter changes with times greater than or equal to startTime. void cancelScheduledValues(double startTime); - [MeasureAs=LegacyWebAudio, ImplementedAs=setTargetAtTime] void setTargetValueAtTime(float targetValue, double time, double timeConstant); - };
diff --git a/modules/webaudio/AudioProcessingEvent.idl b/modules/webaudio/AudioProcessingEvent.idl index ed8f90a..2b81282 100644 --- a/modules/webaudio/AudioProcessingEvent.idl +++ b/modules/webaudio/AudioProcessingEvent.idl
@@ -25,6 +25,7 @@ [ Conditional=WEB_AUDIO ] interface AudioProcessingEvent : Event { + readonly attribute double playbackTime; readonly attribute AudioBuffer inputBuffer; readonly attribute AudioBuffer outputBuffer; };
diff --git a/modules/webaudio/BiquadFilterNode.idl b/modules/webaudio/BiquadFilterNode.idl index 2422dfb..9783ab2 100644 --- a/modules/webaudio/BiquadFilterNode.idl +++ b/modules/webaudio/BiquadFilterNode.idl
@@ -22,20 +22,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum BiquadFilterType { + "lowpass", + "highpass", + "bandpass", + "lowshelf", + "highshelf", + "peaking", + "notch", + "allpass" +}; + [ Conditional=WEB_AUDIO ] interface BiquadFilterNode : AudioNode { - // Filter type. - const unsigned short LOWPASS = 0; - const unsigned short HIGHPASS = 1; - const unsigned short BANDPASS = 2; - const unsigned short LOWSHELF = 3; - const unsigned short HIGHSHELF = 4; - const unsigned short PEAKING = 5; - const unsigned short NOTCH = 6; - const unsigned short ALLPASS = 7; - - [Custom=Setter] attribute DOMString type; + attribute BiquadFilterType type; readonly attribute AudioParam frequency; // in Hertz readonly attribute AudioParam detune; // in Cents
diff --git a/modules/webaudio/ConvolverNode.idl b/modules/webaudio/ConvolverNode.idl index f033917..fe0544b 100644 --- a/modules/webaudio/ConvolverNode.idl +++ b/modules/webaudio/ConvolverNode.idl
@@ -26,6 +26,6 @@ [ Conditional=WEB_AUDIO ] interface ConvolverNode : AudioNode { - attribute AudioBuffer buffer; + [RaisesException=Setter] attribute AudioBuffer buffer; attribute boolean normalize; };
diff --git a/modules/webaudio/OfflineAudioContext.idl b/modules/webaudio/OfflineAudioContext.idl index 5f5f8ac..5d5ec0c 100644 --- a/modules/webaudio/OfflineAudioContext.idl +++ b/modules/webaudio/OfflineAudioContext.idl
@@ -23,6 +23,7 @@ */ [ + WillBeGarbageCollected, Conditional=WEB_AUDIO, Constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate), ConstructorCallWith=ExecutionContext,
diff --git a/modules/webaudio/OscillatorNode.idl b/modules/webaudio/OscillatorNode.idl index 7cbe29d..823d20e 100644 --- a/modules/webaudio/OscillatorNode.idl +++ b/modules/webaudio/OscillatorNode.idl
@@ -22,27 +22,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum OscillatorType { + "sine", + "square", + "sawtooth", + "triangle", + "custom" +}; + // OscillatorNode is an audio generator of periodic waveforms. [ Conditional=WEB_AUDIO ] interface OscillatorNode : AudioSourceNode { - // Type constants. - const unsigned short SINE = 0; - const unsigned short SQUARE = 1; - const unsigned short SAWTOOTH = 2; - const unsigned short TRIANGLE = 3; - const unsigned short CUSTOM = 4; - - [Custom=Setter] attribute DOMString type; - - // Playback state constants. - const unsigned short UNSCHEDULED_STATE = 0; - const unsigned short SCHEDULED_STATE = 1; - const unsigned short PLAYING_STATE = 2; - const unsigned short FINISHED_STATE = 3; - - readonly attribute unsigned short playbackState; + attribute OscillatorType type; readonly attribute AudioParam frequency; // in Hertz readonly attribute AudioParam detune; // in Cents
diff --git a/modules/webaudio/PannerNode.idl b/modules/webaudio/PannerNode.idl index 4557408..cbd1fc8 100644 --- a/modules/webaudio/PannerNode.idl +++ b/modules/webaudio/PannerNode.idl
@@ -22,22 +22,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum PanningModelType { + "equalpower", + "HRTF" +}; + +enum DistanceModelType { + "linear", + "inverse", + "exponential" +}; + [ NoInterfaceObject, Conditional=WEB_AUDIO ] interface PannerNode : AudioNode { - // Panning model - const unsigned short EQUALPOWER = 0; - const unsigned short HRTF = 1; - const unsigned short SOUNDFIELD = 2; - - // Distance model - const unsigned short LINEAR_DISTANCE = 0; - const unsigned short INVERSE_DISTANCE = 1; - const unsigned short EXPONENTIAL_DISTANCE = 2; - // Default model for stereo is HRTF - [Custom=Setter] attribute DOMString panningModel; + attribute PanningModelType panningModel; // Uses a 3D cartesian coordinate system void setPosition(float x, float y, float z); @@ -45,7 +46,7 @@ void setVelocity(float x, float y, float z); // Distance model - [Custom=Setter] attribute DOMString distanceModel; + attribute DistanceModelType distanceModel; attribute double refDistance; attribute double maxDistance;
diff --git a/modules/webaudio/PeriodicWave.idl b/modules/webaudio/PeriodicWave.idl index 40a04b1..3dccbc7 100644 --- a/modules/webaudio/PeriodicWave.idl +++ b/modules/webaudio/PeriodicWave.idl
@@ -24,6 +24,7 @@ // PeriodicWave represents a periodic audio waveform given by its Fourier coefficients. [ + WillBeGarbageCollected, Conditional=WEB_AUDIO ] interface PeriodicWave {
diff --git a/modules/webaudio/ScriptProcessorNode.idl b/modules/webaudio/ScriptProcessorNode.idl index bc000b9..55c3d7f 100644 --- a/modules/webaudio/ScriptProcessorNode.idl +++ b/modules/webaudio/ScriptProcessorNode.idl
@@ -27,7 +27,9 @@ Conditional=WEB_AUDIO ] interface ScriptProcessorNode : AudioNode { // Rendering callback - attribute EventHandler onaudioprocess; + [DartSuppress] attribute EventHandler onaudioprocess; readonly attribute long bufferSize; + + [DartCustom=New] void _setEventListener(EventListener eventListener); };
diff --git a/modules/webaudio/WaveShaperNode.idl b/modules/webaudio/WaveShaperNode.idl index e1ee72b..834b39e 100644 --- a/modules/webaudio/WaveShaperNode.idl +++ b/modules/webaudio/WaveShaperNode.idl
@@ -22,9 +22,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum OverSampleType { + "none", + "2x", + "4x" +}; + [ Conditional=WEB_AUDIO ] interface WaveShaperNode : AudioNode { - attribute Float32Array curve; - [RaisesException=Setter] attribute DOMString oversample; + // FIXMEDART(ager): Auto-generate this custom method when the info about + // retaining typed arrays is in the IDL. + [DartCustom=Setter] attribute Float32Array curve; + [RaisesException=Setter] attribute OverSampleType oversample; };
diff --git a/modules/webaudio/WindowWebAudio.idl b/modules/webaudio/WindowWebAudio.idl new file mode 100644 index 0000000..75788e1 --- /dev/null +++ b/modules/webaudio/WindowWebAudio.idl
@@ -0,0 +1,12 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + ImplementedAs=DOMWindowWebAudio, +] partial interface Window { + [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute AudioContextConstructor AudioContext; + [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute OfflineAudioContextConstructor OfflineAudioContext; + [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute AudioContextConstructor webkitAudioContext; + [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute OfflineAudioContextConstructor webkitOfflineAudioContext; +};
diff --git a/modules/webdatabase/Database.idl b/modules/webdatabase/Database.idl index 5dcd692..e809806 100644 --- a/modules/webdatabase/Database.idl +++ b/modules/webdatabase/Database.idl
@@ -27,6 +27,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface Database { readonly attribute DOMString version;
diff --git a/modules/webdatabase/DatabaseSync.idl b/modules/webdatabase/DatabaseSync.idl index eaaf30f..a558400 100644 --- a/modules/webdatabase/DatabaseSync.idl +++ b/modules/webdatabase/DatabaseSync.idl
@@ -29,6 +29,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface DatabaseSync { readonly attribute DOMString version;
diff --git a/modules/webdatabase/SQLError.idl b/modules/webdatabase/SQLError.idl index daaed71..b084c97 100644 --- a/modules/webdatabase/SQLError.idl +++ b/modules/webdatabase/SQLError.idl
@@ -27,6 +27,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject ] interface SQLError { readonly attribute unsigned long code;
diff --git a/modules/webdatabase/SQLResultSet.idl b/modules/webdatabase/SQLResultSet.idl index 9452687..8b61f24 100644 --- a/modules/webdatabase/SQLResultSet.idl +++ b/modules/webdatabase/SQLResultSet.idl
@@ -27,7 +27,8 @@ */ [ - NoInterfaceObject + NoInterfaceObject, + WillBeGarbageCollected, ] interface SQLResultSet { readonly attribute SQLResultSetRowList rows;
diff --git a/modules/webdatabase/SQLResultSetRowList.idl b/modules/webdatabase/SQLResultSetRowList.idl index a5fcad4..b99f377 100644 --- a/modules/webdatabase/SQLResultSetRowList.idl +++ b/modules/webdatabase/SQLResultSetRowList.idl
@@ -28,7 +28,12 @@ [ NoInterfaceObject, + WillBeGarbageCollected, ] interface SQLResultSetRowList { readonly attribute unsigned long length; - [Custom] object item(unsigned long index); + // FIXMEDART: Upstream this? + // - [Custom, DartSuppress] object item(unsigned long index); + // - Changed the return type to Dictionary so that rows are exposed in the Dart + // API as a Maps, with the appropriate conversion in JavaScript. + [Custom] Dictionary item(unsigned long index); };
diff --git a/modules/webdatabase/SQLTransaction.idl b/modules/webdatabase/SQLTransaction.idl index f7508bc..cc8b2bb 100644 --- a/modules/webdatabase/SQLTransaction.idl +++ b/modules/webdatabase/SQLTransaction.idl
@@ -27,6 +27,7 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject, ] interface SQLTransaction { [Custom] void executeSql(DOMString sqlStatement,
diff --git a/modules/webdatabase/SQLTransactionSync.idl b/modules/webdatabase/SQLTransactionSync.idl index 283e38d..7cbb0e6 100644 --- a/modules/webdatabase/SQLTransactionSync.idl +++ b/modules/webdatabase/SQLTransactionSync.idl
@@ -29,7 +29,8 @@ */ [ + WillBeGarbageCollected, NoInterfaceObject, ] interface SQLTransactionSync { - [Custom] SQLResultSet executeSql(DOMString sqlStatement, object[] arguments); + [RaisesException, Custom] SQLResultSet executeSql(DOMString sqlStatement, object[] arguments); };
diff --git a/modules/webdatabase/WindowWebDatabase.idl b/modules/webdatabase/WindowWebDatabase.idl index 1fd19f6..0d18b0e 100644 --- a/modules/webdatabase/WindowWebDatabase.idl +++ b/modules/webdatabase/WindowWebDatabase.idl
@@ -28,5 +28,5 @@ ImplementedAs=DOMWindowWebDatabase, RuntimeEnabled=Database, ] partial interface Window { - [MeasureAs=OpenWebDatabase, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); + [MeasureAs=OpenWebDatabase, LogActivity, RaisesException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); };
diff --git a/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl b/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl index f3a707d..49fe6a2 100644 --- a/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl +++ b/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl
@@ -27,7 +27,7 @@ [ RuntimeEnabled=Database, ] partial interface WorkerGlobalScope { - [RaisesException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); + [RaisesException, MeasureAs=OpenWebDatabaseInWorker] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); - [RaisesException] DatabaseSync openDatabaseSync(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); + [RaisesException, MeasureAs=OpenWebDatabaseSyncInWorker] DatabaseSync openDatabaseSync(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); };
diff --git a/modules/webmidi/MIDIAccess.idl b/modules/webmidi/MIDIAccess.idl index a20b6bc..5ffcfac 100644 --- a/modules/webmidi/MIDIAccess.idl +++ b/modules/webmidi/MIDIAccess.idl
@@ -35,6 +35,8 @@ sequence<MIDIInput> inputs(); sequence<MIDIOutput> outputs(); + readonly attribute boolean sysexEnabled; + attribute EventHandler onconnect; attribute EventHandler ondisconnect; };
diff --git a/modules/webmidi/MIDIAccessPromise.idl b/modules/webmidi/MIDIAccessPromise.idl deleted file mode 100644 index 2a4b37a..0000000 --- a/modules/webmidi/MIDIAccessPromise.idl +++ /dev/null
@@ -1,39 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// FIXME: Once Promise is implemented, remove this interface and use it. -// See also, http://crbug.com/243345 -[ - NoInterfaceObject, - ActiveDOMObject -] interface MIDIAccessPromise { - // Supports only then() method tentatively. But it never returns Promise. - void then(MIDISuccessCallback successCallback, MIDIErrorCallback errorCallback); -};
diff --git a/modules/webmidi/MIDIOutput.idl b/modules/webmidi/MIDIOutput.idl index afb686f..a41bcfb 100644 --- a/modules/webmidi/MIDIOutput.idl +++ b/modules/webmidi/MIDIOutput.idl
@@ -28,6 +28,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://www.w3.org/TR/webmidi/#idl-def-MIDIOutput +// http://cwilso.github.io/web-midi-api/#idl-def-MIDIOutput + [ NoInterfaceObject, SetWrapperReferenceTo(MIDIAccess midiAccess),
diff --git a/modules/webmidi/NavigatorWebMIDI.idl b/modules/webmidi/NavigatorWebMIDI.idl index 9e11a66..6a275d5 100644 --- a/modules/webmidi/NavigatorWebMIDI.idl +++ b/modules/webmidi/NavigatorWebMIDI.idl
@@ -31,5 +31,5 @@ [ RuntimeEnabled=WebMIDI, ] partial interface Navigator { - MIDIAccessPromise requestMIDIAccess(optional Dictionary options); + [CallWith=ScriptState] Promise requestMIDIAccess(optional Dictionary options); };
diff --git a/modules/websockets/WebSocket.idl b/modules/websockets/WebSocket.idl index a7a245c..eeb8cbd 100644 --- a/modules/websockets/WebSocket.idl +++ b/modules/websockets/WebSocket.idl
@@ -29,14 +29,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// http://dev.w3.org/html5/websockets/#websocket +// http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#websocket + +// FIXME: use BinaryType in binaryType +enum BinaryType { "blob", "arraybuffer" }; + [ ActiveDOMObject, + // FIXME: should be optional union type http://crbug.com/240176 Constructor(DOMString url), - Constructor(DOMString url, sequence<DOMString> protocols), Constructor(DOMString url, DOMString protocol), + Constructor(DOMString url, sequence<DOMString> protocols), ConstructorCallWith=ExecutionContext, - GlobalContext=Window&WorkerGlobalScope, + Exposed=Window&Worker, RaisesException=Constructor, + WillBeGarbageCollected, ] interface WebSocket : EventTarget { [MeasureAs=WebSocketURL] readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. readonly attribute DOMString url; @@ -47,24 +55,21 @@ const unsigned short CLOSING = 2; const unsigned short CLOSED = 3; readonly attribute unsigned short readyState; - readonly attribute unsigned long bufferedAmount; // networking - attribute EventHandler onopen; - attribute EventHandler onmessage; - attribute EventHandler onerror; - attribute EventHandler onclose; - - [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString protocol; + attribute EventHandler onopen; + attribute EventHandler onerror; + attribute EventHandler onclose; [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString extensions; + [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString protocol; + [RaisesException] void close([Clamp] optional unsigned short code, optional DOMString reason); - attribute DOMString binaryType; - + // messaging + attribute EventHandler onmessage; + attribute DOMString binaryType; + [RaisesException] void send(DOMString data); + [RaisesException] void send(Blob data); [RaisesException] void send(ArrayBuffer data); [RaisesException] void send(ArrayBufferView data); - [RaisesException] void send(Blob data); - [RaisesException] void send(DOMString data); - - [RaisesException] void close([Clamp] optional unsigned short code, optional DOMString reason); };