diff --git a/pkg/pkg.status b/pkg/pkg.status index 36160f6fbbe..de2031af5ab 100644 --- a/pkg/pkg.status +++ b/pkg/pkg.status @@ -17,6 +17,7 @@ polymer/example/scoped_style/*: Skip scheduled_test/test/scheduled_server_test: Pass, Fail # 13524 scheduled_test/test/scheduled_process_test: Pass, Slow # Issue 9231 +polymer/test/event_path_test: Pass, Fail # Issue 15766 # Skip test not runnable via test.dart third_party/html5lib/test/dom_compat_test: Skip diff --git a/tests/html/audiobuffersourcenode_test.dart b/tests/html/audiobuffersourcenode_test.dart index 10fecc9af18..9d5025f8637 100644 --- a/tests/html/audiobuffersourcenode_test.dart +++ b/tests/html/audiobuffersourcenode_test.dart @@ -18,6 +18,7 @@ main() { if(AudioContext.supported) { var ctx = new AudioContext(); AudioBufferSourceNode node = ctx.createBufferSource(); + expect(node is AudioBufferSourceNode, isTrue); node.start(ctx.currentTime, 0, 2); node.stop(ctx.currentTime + 2); expect(node is AudioBufferSourceNode, isTrue); diff --git a/tests/html/html.status b/tests/html/html.status index b7fa8d66a61..3820d3da358 100644 --- a/tests/html/html.status +++ b/tests/html/html.status @@ -21,6 +21,9 @@ custom/attribute_changed_callback_test/unsupported_on_polyfill: Fail # Polyfill [ $compiler == dart2js && $browser ] custom/created_callback_test: Fail # Support for created constructor. +[ $compiler == none && ($runtime == drt || $runtime == dartium) ] +audiobuffersourcenode_test/functional: Fail # 15913 + [ $compiler == none && ($runtime == drt || $runtime == dartium) && $mode == debug && $system == macos] audiobuffersourcenode_test: Pass, Fail, Crash # http://crbug.com/256601 diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl index 726ae664cc8..415b91482ec 100644 --- a/tools/dom/idl/dart/dart.idl +++ b/tools/dom/idl/dart/dart.idl @@ -191,15 +191,15 @@ interface WebGLRenderingContext { // TODO(vsm): Define new names for these (see b/4436830). [Supplemental] interface IDBCursor { - [DartName=next, CallWith=ScriptExecutionContext, ImplementedAs=continueFunction, RaisesException] void continue([ForceOptional] optional any key); + [DartName=next, CallWith=ExecutionContext, ImplementedAs=continueFunction, RaisesException] void continue([ForceOptional] optional any key); }; [Supplemental] interface IDBIndex { - [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction); + [CallWith=ExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction); - [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction); + [CallWith=ExecutionContext, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction); - [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key); + [CallWith=ExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key); }; [Supplemental] @@ -219,9 +219,9 @@ interface IDBKeyRange { interface IDBObjectStore { [CallWith=ScriptState, RaisesException] IDBRequest put(any value, [ForceOptional] optional any key); [CallWith=ScriptState, RaisesException] IDBRequest add(any value, [ForceOptional] optional any key); - # [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); - [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor(any key, [ForceOptional] optional DOMString direction); - [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count(any key); + # [CallWith=ExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key); + [CallWith=ExecutionContext, RaisesException] IDBRequest openCursor(any key, [ForceOptional] optional DOMString direction); + [CallWith=ExecutionContext, RaisesException] IDBRequest count(any key); }; interface EntrySync { @@ -359,3 +359,4 @@ interface TextDecoder {}; [Supplemental] interface Window : EventTarget {}; +Element implements GlobalEventHandlers; diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py index 93a24741ad3..135d7d54a67 100644 --- a/tools/dom/scripts/generator.py +++ b/tools/dom/scripts/generator.py @@ -19,6 +19,7 @@ _pure_interfaces = monitored.Set('generator._pure_interfaces', [ 'DOMStringMap', 'ChildNode', 'EventListener', + 'GlobalEventHandlers', 'MediaQueryListListener', 'MutationCallback', 'NavigatorID', @@ -31,7 +32,10 @@ _pure_interfaces = monitored.Set('generator._pure_interfaces', [ 'SVGURIReference', 'SVGZoomAndPan', 'TimeoutHandler', + 'URLUtils', + 'URLUtilsReadOnly', 'WindowBase64', + 'WindowEventHandlers', 'WindowTimers', ]) @@ -194,6 +198,9 @@ def GetCallbackInfo(interface): auto-transforming callbacks into futures).""" callback_handlers = [operation for operation in interface.operations if operation.id == 'handleEvent'] + if callback_handlers == []: + callback_handlers = [operation for operation in interface.operations + if operation.id == 'handleItem'] return AnalyzeOperation(interface, callback_handlers) # Given a list of overloaded arguments, render dart arguments. @@ -1172,7 +1179,7 @@ _idl_type_registry = monitored.Dict('generator._idl_type_registry', { 'SVGPoint': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff'), 'SVGPointList': TypeData(clazz='SVGTearOff'), 'SVGPreserveAspectRatio': TypeData(clazz='SVGTearOff'), - 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff'), + 'SVGRect': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff'), 'SVGStringList': TypeData(clazz='SVGTearOff', item_type='DOMString', native_type='SVGStaticListPropertyTearOff'), 'SVGTransform': TypeData(clazz='SVGTearOff'), diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py index 5c70a8caf36..6d7326b6d20 100644 --- a/tools/dom/scripts/systemnative.py +++ b/tools/dom/scripts/systemnative.py @@ -17,6 +17,7 @@ from systemhtml import js_support_checks, GetCallbackInfo, HTML_LIBRARY_NAMES # an ugly workaround. _cpp_callback_map = { ('DataTransferItem', 'webkitGetAsEntry'): 'DataTransferItemFileSystem', + ('Document', 'fonts'): 'DocumentFontFaceSet', ('Document', 'webkitIsFullScreen'): 'DocumentFullscreen', ('Document', 'webkitFullScreenKeyboardInputAllowed'): 'DocumentFullscreen', ('Document', 'webkitCurrentFullScreenElement'): 'DocumentFullscreen', @@ -39,6 +40,7 @@ _cpp_callback_map = { ('DOMWindow', 'clearInterval'): 'DOMWindowTimers', ('DOMWindow', 'createImageBitmap'): 'ImageBitmapFactories', ('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem', + ('HTMLVideoElement', 'getVideoPlaybackQuality'): 'HTMLVideoElementMediaSource', ('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack', ('Navigator', 'geolocation'): 'NavigatorGeolocation', ('Navigator', 'webkitPersistentStorage'): 'NavigatorStorageQuota', @@ -58,6 +60,7 @@ _cpp_callback_map = { ('Navigator', 'onLine'): 'NavigatorOnLine', ('Navigator', 'registerServiceWorker'): 'NavigatorServiceWorker', ('Navigator', 'unregisterServiceWorker'): 'NavigatorServiceWorker', + ('Navigator', 'maxTouchPoints'): 'NavigatorEvents', ('WorkerGlobalScope', 'crypto'): 'WorkerGlobalScopeCrypto', ('WorkerGlobalScope', 'indexedDB'): 'WorkerGlobalScopeIndexedDatabase', ('WorkerGlobalScope', 'webkitNotifications'): 'WorkerGlobalScopeNotifications', @@ -100,6 +103,17 @@ _cpp_no_auto_scope_list = set([ ('Document', 'body', 'Getter'), ]) +# TODO(vsm): This should be recoverable from IDL, but we appear to not +# track the necessary info. +_url_utils = ['hash', 'host', 'hostname', 'origin', + 'password', 'pathname', 'port', 'protocol', + 'search', 'username'] +_cpp_static_call_map = { + 'DOMURL': _url_utils + ['href', 'toString'], + 'HTMLAnchorElement': _url_utils, + 'HTMLAreaElement': _url_utils, +} + def _GetCPPPartialNames(interface): interface_name = interface.ext_attrs.get('ImplementedAs', interface.id) if not _cpp_partial_map: @@ -174,8 +188,11 @@ class DartiumBackend(HtmlDartGenerator): cpp_impl_handlers_emitter = emitter.Emitter() class_name = 'Dart%s' % self._interface.id for operation in self._interface.operations: + function_name = operation.id parameters = [] arguments = [] + if operation.ext_attrs.get('CallWith') == 'ThisValue': + parameters.append('ScriptValue scriptValue') conversion_includes = [] for argument in operation.arguments: argument_type_info = self._TypeInfo(argument.type.id) @@ -184,9 +201,22 @@ class DartiumBackend(HtmlDartGenerator): arguments.append(argument_type_info.to_dart_conversion(argument.id)) conversion_includes.extend(argument_type_info.conversion_includes()) + # FIXME(vsm): Handle ThisValue attribute. + if operation.ext_attrs.get('CallWith') == 'ThisValue': + cpp_header_handlers_emitter.Emit( + '\n' + ' virtual bool $FUNCTION($PARAMETERS) {\n' + ' DART_UNIMPLEMENTED();\n' + ' return false;\n' + ' }\n', + FUNCTION=function_name, + PARAMETERS=', '.join(parameters)) + continue + cpp_header_handlers_emitter.Emit( '\n' - ' virtual bool handleEvent($PARAMETERS);\n', + ' virtual bool $FUNCTION($PARAMETERS);\n', + FUNCTION=function_name, PARAMETERS=', '.join(parameters)) if 'Custom' in operation.ext_attrs: @@ -198,7 +228,7 @@ class DartiumBackend(HtmlDartGenerator): arguments_declaration = 'Dart_Handle* arguments = 0' cpp_impl_handlers_emitter.Emit( '\n' - 'bool $CLASS_NAME::handleEvent($PARAMETERS)\n' + 'bool $CLASS_NAME::$FUNCTION($PARAMETERS)\n' '{\n' ' if (!m_callback.isIsolateAlive())\n' ' return false;\n' @@ -208,6 +238,7 @@ class DartiumBackend(HtmlDartGenerator): ' return m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n' '}\n', CLASS_NAME=class_name, + FUNCTION=function_name, PARAMETERS=', '.join(parameters), ARGUMENTS_DECLARATION=arguments_declaration, ARGUMENT_COUNT=len(arguments)) @@ -460,6 +491,7 @@ class DartiumBackend(HtmlDartGenerator): if ('CustomToV8' in ext_attrs or 'PureInterface' in ext_attrs or 'CPPPureInterface' in ext_attrs or + 'SpecialWrapFor' in ext_attrs or self._interface_type_info.custom_to_dart()): to_dart_emitter.Emit( ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType* value);\n') @@ -555,7 +587,7 @@ class DartiumBackend(HtmlDartGenerator): if 'Reflect' in attr.ext_attrs: webcore_function_name = self._TypeInfo(attr.type.id).webcore_setter_name() else: - webcore_function_name = re.sub(r'^(xml(?=[A-Z])|\w)', + webcore_function_name = re.sub(r'^(xml|css|(?=[A-Z])|\w)', lambda s: s.group(1).upper(), attr.id) webcore_function_name = 'set%s' % webcore_function_name @@ -754,6 +786,8 @@ class DartiumBackend(HtmlDartGenerator): generate_custom_element_scope_if_needed=False): ext_attrs = node.ext_attrs + if self._IsStatic(node.id): + needs_receiver = True cpp_arguments = [] runtime_check = None @@ -782,8 +816,8 @@ class DartiumBackend(HtmlDartGenerator): # it's not needed and should be just removed. arguments = arguments[:-1] - requires_script_execution_context = (ext_attrs.get('CallWith') == 'ScriptExecutionContext' or - ext_attrs.get('ConstructorCallWith') == 'ScriptExecutionContext') + requires_script_execution_context = (ext_attrs.get('CallWith') == 'ExecutionContext' or + ext_attrs.get('ConstructorCallWith') == 'ExecutionContext') requires_document = ext_attrs.get('ConstructorCallWith') == 'Document' @@ -811,7 +845,7 @@ class DartiumBackend(HtmlDartGenerator): cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)] if generate_custom_element_scope_if_needed and (ext_attrs.get('CustomElementCallbacks', 'None') != 'None' or 'Reflect' in ext_attrs): - self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"') + self._cpp_impl_includes.add('"core/dom/custom/CustomElementCallbackDispatcher.h"') needs_custom_element_callbacks = True if return_type_is_nullable: @@ -872,7 +906,7 @@ class DartiumBackend(HtmlDartGenerator): if requires_script_execution_context: body_emitter.Emit( - ' ScriptExecutionContext* context = DartUtilities::scriptExecutionContext();\n' + ' ExecutionContext* context = DartUtilities::scriptExecutionContext();\n' ' if (!context) {\n' ' exception = Dart_NewStringFromCString("Failed to retrieve a context");\n' ' goto fail;\n' @@ -1019,6 +1053,8 @@ class DartiumBackend(HtmlDartGenerator): cpp_arguments.insert(0, 'receiver') else: cpp_arguments.append('receiver') + elif self._IsStatic(node.id): + cpp_arguments.insert(0, 'receiver') function_call = '%s(%s)' % (function_expression, ', '.join(cpp_arguments)) if return_type == 'void': @@ -1128,12 +1164,18 @@ class DartiumBackend(HtmlDartGenerator): attribute_name = attr.ext_attrs['Reflect'] or attr.id.lower() return 'WebCore::%s::%sAttr' % (namespace, attribute_name) + def _IsStatic(self, attribute_name): + cpp_type_name = self._interface_type_info.native_type() + if cpp_type_name in _cpp_static_call_map: + return attribute_name in _cpp_static_call_map[cpp_type_name] + return False + def _GenerateWebCoreFunctionExpression(self, function_name, idl_node, cpp_callback_name=None): if 'ImplementedBy' in idl_node.ext_attrs: return '%s::%s' % (idl_node.ext_attrs['ImplementedBy'], function_name) cpp_type_name = self._interface_type_info.native_type() impl_type_name = _GetCPPTypeName(cpp_type_name, function_name, cpp_callback_name) - if idl_node.is_static: + if idl_node.is_static or self._IsStatic(idl_node.id): return '%s::%s' % (impl_type_name, function_name) if cpp_type_name == impl_type_name: return '%s%s' % (self._interface_type_info.receiver(), function_name) diff --git a/tools/dom/templates/html/dartium/cpp_callback_header.template b/tools/dom/templates/html/dartium/cpp_callback_header.template index 285b523b884..001207fe902 100644 --- a/tools/dom/templates/html/dartium/cpp_callback_header.template +++ b/tools/dom/templates/html/dartium/cpp_callback_header.template @@ -47,7 +47,7 @@ public: $HANDLERS private: - Dart$(INTERFACE)(Dart_Handle object, Dart_Handle& exception, ScriptExecutionContext* context) + Dart$(INTERFACE)(Dart_Handle object, Dart_Handle& exception, ExecutionContext* context) : ActiveDOMCallback(context) , m_callback(object, exception) {