Fixes for Blink roll.
TBR=jacobr@google.com,asiva@google.com Review URL: https://codereview.chromium.org//19820007 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25395 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -11,8 +11,8 @@ main() {
|
||||
// Intentionally do not initialize it!
|
||||
try {
|
||||
document.dispatchEvent(event);
|
||||
} on EventException catch (e) {
|
||||
expect(e.name, DomException.UNSPECIFIED_EVENT_TYPE);
|
||||
} on DomException catch (e) {
|
||||
expect(e.name, DomException.INVALID_STATE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,9 +37,10 @@ main() {
|
||||
var blob = new Blob([workerScript], 'text/javascript');
|
||||
var url = Url.createObjectUrl(blob);
|
||||
var worker = new Worker(url);
|
||||
return worker.onMessage.first.then((e) {
|
||||
var test = expectAsync1((e) {
|
||||
expect(e.data, 'WorkerMessage');
|
||||
});
|
||||
worker.onMessage.first.then(test);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -1265,7 +1265,7 @@
|
||||
},
|
||||
"support_level": "stable"
|
||||
},
|
||||
"DOMWindow": {
|
||||
"Window": {
|
||||
"members": {
|
||||
"CSS": {
|
||||
"comment": "http://www.w3.org/TR/css3-conditional/#the-css-interface"
|
||||
|
||||
@@ -40,8 +40,11 @@ interface ScriptProcessorNode {
|
||||
[Custom] void _setEventListener(EventListener eventListener);
|
||||
};
|
||||
|
||||
/*
|
||||
// TODO(vsm): How should this interact with the new ChildNode and
|
||||
// ParentNode interfaces?
|
||||
// Force ElementTraversal. WebKit defines these directly.
|
||||
interface ElementTraversal {
|
||||
interface ElementTraversal : ChildNode, ParentNode {
|
||||
readonly attribute unsigned long childElementCount;
|
||||
readonly attribute Element firstElementChild;
|
||||
readonly attribute Element lastElementChild;
|
||||
@@ -49,6 +52,7 @@ interface ElementTraversal {
|
||||
readonly attribute Element previousElementSibling;
|
||||
};
|
||||
Element implements ElementTraversal;
|
||||
*/
|
||||
|
||||
[Callback]
|
||||
interface TimeoutHandler {
|
||||
@@ -221,7 +225,7 @@ interface Blob {
|
||||
[Supplemental,
|
||||
Constructor(float x, float y)
|
||||
]
|
||||
interface DOMPoint {
|
||||
interface WebKitPoint {
|
||||
};
|
||||
|
||||
[Supplemental, Callback] // Add missing Callback attribute.
|
||||
@@ -324,3 +328,7 @@ interface Location {
|
||||
[CustomSetter] attribute DOMString search;
|
||||
[CustomSetter] attribute DOMString hash;
|
||||
};
|
||||
|
||||
|
||||
[Supplemental]
|
||||
interface Window : EventTarget {};
|
||||
|
||||
@@ -86,7 +86,7 @@ class DartGenerator(object):
|
||||
self._IsCompoundType(database, type_name)):
|
||||
continue
|
||||
# Ignore constructor warnings.
|
||||
if not (interface.id in ['DOMWindow', 'WorkerContext'] and
|
||||
if not (interface.id in ['Window', 'WorkerContext'] and
|
||||
type_name.endswith('Constructor')):
|
||||
_logger.warn('removing %s in %s which has unidentified type %s' %
|
||||
(node_name, interface.id, type_name))
|
||||
@@ -213,6 +213,7 @@ class DartGenerator(object):
|
||||
ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg')])
|
||||
for interface in database.GetInterfaces():
|
||||
for operation in interface.operations:
|
||||
call_with = operation.ext_attrs.get('CallWith', '').split('|')
|
||||
call_with = (operation.ext_attrs.get('CallWith', '').split('|') +
|
||||
operation.ext_attrs.get('ConstructorCallWith', '').split('|'))
|
||||
if 'ScriptArguments' in call_with:
|
||||
operation.arguments.append(ARG)
|
||||
|
||||
@@ -60,7 +60,7 @@ _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', {
|
||||
"@Creates('Null')",
|
||||
],
|
||||
|
||||
# Normally DOMWindow is nevernull, but starting from a <template> element in
|
||||
# Normally Window is nevernull, but starting from a <template> element in
|
||||
# JavaScript, this will be null:
|
||||
# template.content.ownerDocument.defaultView
|
||||
'Document.window': [
|
||||
@@ -70,16 +70,16 @@ _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', {
|
||||
|
||||
# Methods returning Window can return a local window, or a cross-frame
|
||||
# window (=Object) that needs wrapping.
|
||||
'DOMWindow': [
|
||||
'Window': [
|
||||
"@Creates('Window|=Object')",
|
||||
"@Returns('Window|=Object')",
|
||||
],
|
||||
|
||||
'DOMWindow.openDatabase': [
|
||||
'Window.openDatabase': [
|
||||
"@Creates('SqlDatabase')",
|
||||
],
|
||||
|
||||
'DOMWindow.showModalDialog': [
|
||||
'Window.showModalDialog': [
|
||||
"@Creates('Null')",
|
||||
],
|
||||
|
||||
@@ -389,15 +389,15 @@ _annotations = monitored.Dict('dartmetadata._annotations', {
|
||||
],
|
||||
'DOMFileSystem': _file_system_annotations,
|
||||
'DOMFileSystemSync': _file_system_annotations,
|
||||
'DOMPoint': _webkit_experimental_annotations,
|
||||
'DOMWindow.webkitConvertPointFromNodeToPage': _webkit_experimental_annotations,
|
||||
'DOMWindow.webkitConvertPointFromPageToNode': _webkit_experimental_annotations,
|
||||
'DOMWindow.indexedDB': _indexed_db_annotations,
|
||||
'DOMWindow.openDatabase': _web_sql_annotations,
|
||||
'DOMWindow.performance': _performance_annotations,
|
||||
'DOMWindow.webkitNotifications': _webkit_experimental_annotations,
|
||||
'DOMWindow.webkitRequestFileSystem': _file_system_annotations,
|
||||
'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations,
|
||||
'WebKitPoint': _webkit_experimental_annotations,
|
||||
'Window.webkitConvertPointFromNodeToPage': _webkit_experimental_annotations,
|
||||
'Window.webkitConvertPointFromPageToNode': _webkit_experimental_annotations,
|
||||
'Window.indexedDB': _indexed_db_annotations,
|
||||
'Window.openDatabase': _web_sql_annotations,
|
||||
'Window.performance': _performance_annotations,
|
||||
'Window.webkitNotifications': _webkit_experimental_annotations,
|
||||
'Window.webkitRequestFileSystem': _file_system_annotations,
|
||||
'Window.webkitResolveLocalFileSystemURL': _file_system_annotations,
|
||||
'Element.ontransitionend': _all_but_ie9_annotations,
|
||||
# Placeholder to add experimental flag, implementation for this is
|
||||
# pending in a separate CL.
|
||||
|
||||
@@ -14,6 +14,7 @@ import shutil
|
||||
import idlnode
|
||||
import idlparser
|
||||
import idlrenderer
|
||||
from generator import IsDartCollectionType, IsPureInterface
|
||||
|
||||
_logger = logging.getLogger('database')
|
||||
|
||||
@@ -245,3 +246,34 @@ class Database(object):
|
||||
|
||||
def AddEnum(self, enum):
|
||||
self._enums[enum.id] = enum
|
||||
|
||||
def TransitiveSecondaryParents(self, interface):
|
||||
"""Returns a list of all non-primary parents.
|
||||
|
||||
The list contains the interface objects for interfaces defined in the
|
||||
database, and the name for undefined interfaces.
|
||||
"""
|
||||
def walk(parents):
|
||||
for parent in parents:
|
||||
parent_name = parent.type.id
|
||||
if parent_name == 'EventTarget':
|
||||
# Currently EventTarget is implemented as a mixin, not a proper
|
||||
# super interface---ignore its members.
|
||||
continue
|
||||
if IsDartCollectionType(parent_name):
|
||||
result.append(parent_name)
|
||||
continue
|
||||
if self.HasInterface(parent_name):
|
||||
parent_interface = self.GetInterface(parent_name)
|
||||
result.append(parent_interface)
|
||||
walk(parent_interface.parents)
|
||||
|
||||
result = []
|
||||
if interface.parents:
|
||||
parent = interface.parents[0]
|
||||
if IsPureInterface(parent.type.id):
|
||||
walk(interface.parents)
|
||||
else:
|
||||
walk(interface.parents[1:])
|
||||
return result
|
||||
|
||||
|
||||
@@ -225,6 +225,8 @@ class DatabaseBuilder(object):
|
||||
if name in old_attrs and old_attrs[name] == value:
|
||||
pass # Identical
|
||||
else:
|
||||
if name == 'ImplementedAs' and name in old_attrs:
|
||||
continue
|
||||
old_attrs[name] = value
|
||||
changed = True
|
||||
return changed
|
||||
@@ -397,7 +399,7 @@ class DatabaseBuilder(object):
|
||||
if interface.is_supplemental:
|
||||
target_name = interface.ext_attrs['Supplemental']
|
||||
if target_name:
|
||||
# [Supplemental=DOMWindow] - merge into DOMWindow.
|
||||
# [Supplemental=Window] - merge into Window.
|
||||
target = target_name
|
||||
else:
|
||||
# [Supplemental] - merge into existing inteface with same name.
|
||||
@@ -451,8 +453,8 @@ class DatabaseBuilder(object):
|
||||
% (interface.id, import_options.source))
|
||||
continue
|
||||
|
||||
_logger.info('importing interface %s (source=%s)'
|
||||
% (interface.id, import_options.source))
|
||||
_logger.info('importing interface %s (source=%s file=%s)'
|
||||
% (interface.id, import_options.source, idl_file))
|
||||
interface.attributes = filter(enabled, interface.attributes)
|
||||
interface.operations = filter(enabled, interface.operations)
|
||||
self._imported_interfaces.append((interface, import_options))
|
||||
@@ -558,7 +560,7 @@ class DatabaseBuilder(object):
|
||||
map(normalize, interface.operations)
|
||||
|
||||
def fetch_constructor_data(self, options):
|
||||
window_interface = self._database.GetInterface('DOMWindow')
|
||||
window_interface = self._database.GetInterface('Window')
|
||||
for attr in window_interface.attributes:
|
||||
type = attr.type.id
|
||||
if not type.endswith('Constructor'):
|
||||
@@ -566,7 +568,7 @@ class DatabaseBuilder(object):
|
||||
type = re.sub('(Constructor)+$', '', type)
|
||||
# TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and fetch
|
||||
# this information directly from it. Unfortunately right now database is massaged
|
||||
# a lot so it's difficult to maintain necessary information on DOMWindow itself.
|
||||
# a lot so it's difficult to maintain necessary information on Window itself.
|
||||
interface = self._database.GetInterface(type)
|
||||
if 'V8EnabledPerContext' in attr.ext_attrs:
|
||||
interface.ext_attrs['synthesizedV8EnabledPerContext'] = \
|
||||
|
||||
@@ -115,8 +115,15 @@ def main(parallel=False):
|
||||
|
||||
idl_files = []
|
||||
|
||||
# Check default location in a regular dart enlistment.
|
||||
webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party',
|
||||
'WebCore')
|
||||
|
||||
if not os.path.exists(webcore_dir):
|
||||
# Check default location in a dartium enlistment.
|
||||
webcore_dir = os.path.join(current_dir, '..', '..', '..', '..',
|
||||
'third_party', 'WebKit', 'Source')
|
||||
|
||||
if not os.path.exists(webcore_dir):
|
||||
raise RuntimeError('directory not found: %s' % webcore_dir)
|
||||
|
||||
@@ -125,6 +132,7 @@ def main(parallel=False):
|
||||
'testing', # IDLs to expose testing APIs
|
||||
'networkinfo', # Not yet used in Blink yet
|
||||
'vibration', # Not yet used in Blink yet
|
||||
'inspector',
|
||||
]
|
||||
|
||||
def visitor(arg, dir_name, names):
|
||||
|
||||
@@ -16,11 +16,15 @@ from htmlrenamer import html_interface_renames, typed_array_renames
|
||||
_pure_interfaces = monitored.Set('generator._pure_interfaces', [
|
||||
# TODO(sra): DOMStringMap should be a class implementing Map<String,String>.
|
||||
'DOMStringMap',
|
||||
'ChildNode',
|
||||
#'Crypto',
|
||||
'ElementTimeControl',
|
||||
'ElementTraversal',
|
||||
'EventListener',
|
||||
'MediaQueryListListener',
|
||||
'MutationCallback',
|
||||
'ParentNode',
|
||||
#'SubtleCrypto',
|
||||
'SVGExternalResourcesRequired',
|
||||
'SVGFilterPrimitiveStandardAttributes',
|
||||
'SVGFitToViewBox',
|
||||
@@ -31,6 +35,9 @@ _pure_interfaces = monitored.Set('generator._pure_interfaces', [
|
||||
'SVGURIReference',
|
||||
'SVGZoomAndPan',
|
||||
'TimeoutHandler',
|
||||
'WindowTimers',
|
||||
#'WorkerCrypto',
|
||||
'WorkerPerformance',
|
||||
])
|
||||
|
||||
def IsPureInterface(interface_name):
|
||||
@@ -519,7 +526,7 @@ dart2js_conversions = monitored.Dict('generator.dart2js_conversions', {
|
||||
# Wrap non-local Windows. We need to check EventTarget (the base type)
|
||||
# as well. Note, there are no functions that take a non-local Window
|
||||
# as a parameter / setter.
|
||||
'DOMWindow get':
|
||||
'Window get':
|
||||
Conversion('_convertNativeToDart_Window', 'dynamic', 'WindowBase'),
|
||||
'EventTarget get':
|
||||
Conversion('_convertNativeToDart_EventTarget', 'dynamic',
|
||||
@@ -547,7 +554,7 @@ dart2js_conversions = monitored.Dict('generator.dart2js_conversions', {
|
||||
|
||||
# postMessage
|
||||
'any set MessagePort.postMessage': _serialize_SSV,
|
||||
'SerializedScriptValue set DOMWindow.postMessage': _serialize_SSV,
|
||||
'SerializedScriptValue set Window.postMessage': _serialize_SSV,
|
||||
|
||||
'* get CustomEvent.detail':
|
||||
Conversion('convertNativeToDart_SerializedScriptValue',
|
||||
@@ -750,6 +757,7 @@ class InterfaceIDLTypeInfo(IDLTypeInfo):
|
||||
|
||||
def native_type(self):
|
||||
database = self._type_registry._database
|
||||
|
||||
if database.HasInterface(self.idl_type()):
|
||||
interface = database.GetInterface(self.idl_type())
|
||||
if 'ImplementedAs' in interface.ext_attrs:
|
||||
@@ -811,6 +819,9 @@ class SequenceIDLTypeInfo(IDLTypeInfo):
|
||||
return '%s', 'Vector<%s>' % item_native_type, 'DartUtilities', 'toNativeVector<%s>' % item_native_type
|
||||
return '%s', 'Vector< RefPtr<%s> >' % item_native_type, 'DartUtilities', 'toNativeVector< RefPtr<%s> >' % item_native_type
|
||||
|
||||
def parameter_type(self):
|
||||
return self.native_type()
|
||||
|
||||
def pass_native_by_ref(self): return True
|
||||
|
||||
def to_dart_conversion(self, value, interface_name=None, attributes=None):
|
||||
@@ -1028,7 +1039,7 @@ _idl_type_registry = monitored.Dict('generator._idl_type_registry', {
|
||||
|
||||
'CSSRule': TypeData(clazz='Interface', conversion_includes=['CSSImportRule']),
|
||||
'DOMStringMap': TypeData(clazz='Interface', dart_type='Map<String, String>'),
|
||||
'DOMWindow': TypeData(clazz='Interface', custom_to_dart=True),
|
||||
'Window': TypeData(clazz='Interface', custom_to_dart=True),
|
||||
'Element': TypeData(clazz='Interface', merged_interface='HTMLElement',
|
||||
custom_to_dart=True),
|
||||
'EventListener': TypeData(clazz='Interface', custom_to_native=True),
|
||||
@@ -1140,10 +1151,14 @@ class TypeRegistry(object):
|
||||
def _TypeInfo(self, type_name):
|
||||
match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name)
|
||||
if match:
|
||||
type_data = TypeData('Sequence')
|
||||
if type_name == 'DOMString[]':
|
||||
return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMString'))
|
||||
return DOMStringArrayTypeInfo(type_data, self.TypeInfo('DOMString'))
|
||||
item_info = self.TypeInfo(match.group(1) or match.group(2))
|
||||
return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info)
|
||||
# TODO(vsm): Generalize this code.
|
||||
if 'SourceInfo' in type_name:
|
||||
type_data.native_type = 'Vector<RefPtr<SourceInfo> >'
|
||||
return SequenceIDLTypeInfo(type_name, type_data, item_info)
|
||||
|
||||
if not type_name in _idl_type_registry:
|
||||
if self._database.HasEnum(type_name):
|
||||
|
||||
@@ -8,8 +8,8 @@ dart:html APIs from the IDL database."""
|
||||
|
||||
import emitter
|
||||
from generator import AnalyzeOperation, ConstantOutputOrder, \
|
||||
DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \
|
||||
IsPureInterface, TypeOrNothing, ConvertToFuture, GetCallbackInfo
|
||||
DartDomNameOfAttribute, FindMatchingAttribute, \
|
||||
TypeOrNothing, ConvertToFuture, GetCallbackInfo
|
||||
from copy import deepcopy
|
||||
from htmlrenamer import convert_to_future_members, keep_overloaded_members, \
|
||||
private_html_members, renamed_html_members, renamed_overloads, \
|
||||
@@ -108,14 +108,15 @@ class HtmlDartGenerator(object):
|
||||
# interfaces need to be added. Sometimes the attribute or operation is
|
||||
# defined in the current interface as well as a parent. In that case we
|
||||
# avoid making a duplicate definition and pray that the signatures match.
|
||||
secondary_parents = self._TransitiveSecondaryParents(interface)
|
||||
secondary_parents = self._database.TransitiveSecondaryParents(interface)
|
||||
for parent_interface in sorted(secondary_parents):
|
||||
if isinstance(parent_interface, str):
|
||||
continue
|
||||
for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
|
||||
if not FindMatchingAttribute(interface, attr):
|
||||
self.SecondaryContext(parent_interface)
|
||||
self.AddAttribute(attr)
|
||||
if attr.type.id != 'EventListener':
|
||||
self.SecondaryContext(parent_interface)
|
||||
self.AddAttribute(attr)
|
||||
|
||||
# Group overloaded operations by name.
|
||||
operationsByName =self._OperationsByName(parent_interface)
|
||||
@@ -642,35 +643,5 @@ class HtmlDartGenerator(object):
|
||||
if type_name in _secure_base_types:
|
||||
return _secure_base_types[type_name]
|
||||
|
||||
def _TransitiveSecondaryParents(self, interface):
|
||||
"""Returns a list of all non-primary parents.
|
||||
|
||||
The list contains the interface objects for interfaces defined in the
|
||||
database, and the name for undefined interfaces.
|
||||
"""
|
||||
def walk(parents):
|
||||
for parent in parents:
|
||||
parent_name = parent.type.id
|
||||
if parent_name == 'EventTarget':
|
||||
# Currently EventTarget is implemented as a mixin, not a proper
|
||||
# super interface---ignore its members.
|
||||
continue
|
||||
if IsDartCollectionType(parent_name):
|
||||
result.append(parent_name)
|
||||
continue
|
||||
if self._database.HasInterface(parent_name):
|
||||
parent_interface = self._database.GetInterface(parent_name)
|
||||
result.append(parent_interface)
|
||||
walk(parent_interface.parents)
|
||||
|
||||
result = []
|
||||
if interface.parents:
|
||||
parent = interface.parents[0]
|
||||
if IsPureInterface(parent.type.id):
|
||||
walk(interface.parents)
|
||||
else:
|
||||
walk(interface.parents[1:])
|
||||
return result
|
||||
|
||||
def _DartType(self, type_name):
|
||||
return self._type_registry.DartType(type_name)
|
||||
|
||||
@@ -300,13 +300,22 @@ class HtmlEventGenerator(object):
|
||||
PROVIDER=provider,
|
||||
TYPE=event_type)
|
||||
|
||||
def _GetRawEvents(self, interface):
|
||||
all_interfaces = ([ interface ] +
|
||||
self._database.TransitiveSecondaryParents(interface))
|
||||
events = set([])
|
||||
for super_interface in all_interfaces:
|
||||
events = events.union(
|
||||
set([attr.id for attr in super_interface.attributes
|
||||
if attr.type.id == 'EventListener']))
|
||||
return events
|
||||
|
||||
def _GetEvents(self, interface, custom_events):
|
||||
""" Gets a list of all of the events for the specified interface.
|
||||
"""
|
||||
html_interface_name = interface.doc_js_name
|
||||
|
||||
events = set([attr.id for attr in interface.attributes
|
||||
if attr.type.id == 'EventListener'])
|
||||
events = self._GetRawEvents(interface)
|
||||
|
||||
if html_interface_name in _html_manual_events:
|
||||
events.update(_html_manual_events[html_interface_name])
|
||||
|
||||
@@ -30,7 +30,7 @@ html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames',
|
||||
'DatabaseSync': 'SqlDatabaseSync',
|
||||
'DOMApplicationCache': 'ApplicationCache',
|
||||
'DOMFileSystem': 'FileSystem',
|
||||
'DOMPoint': '_DomPoint',
|
||||
'WebKitPoint': '_DomPoint',
|
||||
'Entity': '_Entity', # Not sure if we want to expose this yet, may conflict with other libs.
|
||||
'EntryCallback': '_EntryCallback',
|
||||
'EntriesCallback': '_EntriesCallback',
|
||||
@@ -55,6 +55,7 @@ html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames',
|
||||
'SVGException': 'SvgException', # Manual of avoid conflict with Exception.
|
||||
'SVGGradientElement': '_GradientElement',
|
||||
'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts.
|
||||
'Stream': 'FileStream',
|
||||
'StringCallback': '_StringCallback',
|
||||
'WebGLVertexArrayObjectOES': 'VertexArrayObject',
|
||||
'XMLHttpRequest': 'HttpRequest',
|
||||
@@ -115,6 +116,9 @@ _removed_html_interfaces = [
|
||||
'SVGVKernElement',
|
||||
'SharedWorker', # Workers
|
||||
'SharedWorkerContext', # Workers
|
||||
'WebKitMediaSource',
|
||||
'WebKitSourceBuffer',
|
||||
'WebKitSourceBufferList',
|
||||
'WorkerContext', # Workers
|
||||
'WorkerLocation', # Workers
|
||||
'WorkerNavigator', # Workers
|
||||
@@ -131,8 +135,8 @@ convert_to_future_members = monitored.Set(
|
||||
'DirectoryEntry.getFile',
|
||||
'DirectoryEntry.removeRecursively',
|
||||
'DirectoryReader.readEntries',
|
||||
'DOMWindow.webkitRequestFileSystem',
|
||||
'DOMWindow.webkitResolveLocalFileSystemURL',
|
||||
'Window.webkitRequestFileSystem',
|
||||
'Window.webkitResolveLocalFileSystemURL',
|
||||
'Entry.copyTo',
|
||||
'Entry.getMetadata',
|
||||
'Entry.getParent',
|
||||
@@ -196,12 +200,15 @@ private_html_members = monitored.Set('htmlrenamer.private_html_members', [
|
||||
'Element.childElementCount',
|
||||
'Element.children',
|
||||
'Element.firstElementChild',
|
||||
'ParentNode.childElementCount',
|
||||
'ParentNode.children',
|
||||
'ParentNode.firstElementChild',
|
||||
'Element.getAttribute',
|
||||
'Element.getAttributeNS',
|
||||
'Element.getElementsByTagName',
|
||||
'Element.hasAttribute',
|
||||
'Element.hasAttributeNS',
|
||||
'Element.lastElementChild',
|
||||
'ParentNode.lastElementChild',
|
||||
'Element.querySelectorAll',
|
||||
'Element.removeAttribute',
|
||||
'Element.removeAttributeNS',
|
||||
@@ -298,8 +305,8 @@ private_html_members = monitored.Set('htmlrenamer.private_html_members', [
|
||||
'UIEvent.pageX',
|
||||
'UIEvent.pageY',
|
||||
'WheelEvent.initWebKitWheelEvent',
|
||||
'DOMWindow.getComputedStyle',
|
||||
'DOMWindow.moveTo',
|
||||
'Window.getComputedStyle',
|
||||
'Window.moveTo',
|
||||
])
|
||||
|
||||
# Members from the standard dom that exist in the dart:html library with
|
||||
@@ -314,16 +321,16 @@ renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', {
|
||||
'Document.createCDATASection': 'createCDataSection',
|
||||
'Document.defaultView': 'window',
|
||||
'Document.querySelector': 'query',
|
||||
'DOMWindow.CSS': 'css',
|
||||
'DOMWindow.clearTimeout': '_clearTimeout',
|
||||
'DOMWindow.clearInterval': '_clearInterval',
|
||||
'DOMWindow.setTimeout': '_setTimeout',
|
||||
'DOMWindow.setInterval': '_setInterval',
|
||||
'DOMWindow.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage',
|
||||
'DOMWindow.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode',
|
||||
'DOMWindow.webkitNotifications': 'notifications',
|
||||
'DOMWindow.webkitRequestFileSystem': '_requestFileSystem',
|
||||
'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
|
||||
'Window.CSS': 'css',
|
||||
'Window.clearTimeout': '_clearTimeout',
|
||||
'Window.clearInterval': '_clearInterval',
|
||||
'Window.setTimeout': '_setTimeout',
|
||||
'Window.setInterval': '_setInterval',
|
||||
'Window.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage',
|
||||
'Window.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode',
|
||||
'Window.webkitNotifications': 'notifications',
|
||||
'Window.webkitRequestFileSystem': '_requestFileSystem',
|
||||
'Window.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
|
||||
'Element.querySelector': 'query',
|
||||
'Element.webkitCreateShadowRoot': 'createShadowRoot',
|
||||
'Element.webkitMatchesSelector' : 'matches',
|
||||
@@ -373,7 +380,10 @@ renamed_overloads = monitored.Dict('htmldartgenreator.renamed_overloads', {
|
||||
'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
|
||||
'RTCDataChannel.send(Blob data)': 'sendBlob',
|
||||
'RTCDataChannel.send(DOMString data)': 'sendString',
|
||||
'SourceBuffer.appendBuffer(ArrayBufferView view)': 'appendBufferView',
|
||||
'URL.createObjectURL(WebKitMediaSource source)':
|
||||
'_createObjectUrlFromWebKitMediaSource',
|
||||
'URL.createObjectURL(MediaSource source)':
|
||||
'createObjectUrlFromSource',
|
||||
'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream',
|
||||
'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob',
|
||||
@@ -460,18 +470,18 @@ removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [
|
||||
'CanvasRenderingContext2D.setShadow',
|
||||
'CanvasRenderingContext2D.setStrokeColor',
|
||||
'CharacterData.remove',
|
||||
'DOMWindow.call:blur',
|
||||
'DOMWindow.call:focus',
|
||||
'DOMWindow.clientInformation',
|
||||
'DOMWindow.get:frames',
|
||||
'DOMWindow.get:length',
|
||||
'DOMWindow.on:beforeUnload',
|
||||
'DOMWindow.pagePopupController',
|
||||
'DOMWindow.prompt',
|
||||
'DOMWindow.webkitCancelAnimationFrame',
|
||||
'DOMWindow.webkitCancelRequestAnimationFrame',
|
||||
'DOMWindow.webkitIndexedDB',
|
||||
'DOMWindow.webkitRequestAnimationFrame',
|
||||
'Window.call:blur',
|
||||
'Window.call:focus',
|
||||
'Window.clientInformation',
|
||||
'Window.get:frames',
|
||||
'Window.get:length',
|
||||
'Window.on:beforeUnload',
|
||||
'Window.pagePopupController',
|
||||
'Window.prompt',
|
||||
'Window.webkitCancelAnimationFrame',
|
||||
'Window.webkitCancelRequestAnimationFrame',
|
||||
'Window.webkitIndexedDB',
|
||||
'Window.webkitRequestAnimationFrame',
|
||||
'Document.alinkColor',
|
||||
'Document.all',
|
||||
'Document.applets',
|
||||
@@ -711,7 +721,7 @@ removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [
|
||||
|
||||
# Manual dart: library name lookup.
|
||||
_library_names = monitored.Dict('htmlrenamer._library_names', {
|
||||
'DOMWindow': 'html',
|
||||
'Window': 'html',
|
||||
'Database': 'web_sql',
|
||||
'Navigator': 'html',
|
||||
'WorkerContext': 'html',
|
||||
|
||||
@@ -70,7 +70,7 @@ class IDLParser(object):
|
||||
OR(Module, Interface, ExceptionDef, TypeDef, ImplStmt,
|
||||
ValueTypeDef, Const, Enum),
|
||||
# WebKit:
|
||||
OR(Module, Interface, Enum, TypeDef))
|
||||
OR(Module, Interface, Enum, TypeDef, ImplStmt, CallbackDeclaration))
|
||||
|
||||
def Enum():
|
||||
def StringLiteral():
|
||||
@@ -90,6 +90,9 @@ class IDLParser(object):
|
||||
[MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id,
|
||||
'{', _Definitions, '}', MAYBE(';')])
|
||||
|
||||
def CallbackDeclaration():
|
||||
return [Callback, Type, '=', Type,'(', ')', ';']
|
||||
|
||||
def Callback():
|
||||
return ['callback']
|
||||
|
||||
|
||||
@@ -15,14 +15,22 @@ from systemhtml import js_support_checks, GetCallbackInfo, HTML_LIBRARY_NAMES
|
||||
|
||||
_cpp_type_map = {
|
||||
('DataTransferItem', 'webkitGetAsEntry'): 'DataTransferItemFileSystem',
|
||||
('DOMWindow', 'indexedDB'): 'DOMWindowIndexedDatabase',
|
||||
('DOMWindow', 'speechSynthesis'): 'DOMWindowSpeechSynthesis',
|
||||
('DOMWindow', 'webkitNotifications'): 'DOMWindowNotifications',
|
||||
('DOMWindow', 'storage'): 'DOMWindowQuota',
|
||||
('DOMWindow', 'webkitStorageInfo'): 'DOMWindowQuota',
|
||||
('DOMWindow', 'openDatabase'): 'DOMWindowWebDatabase',
|
||||
('DOMWindow', 'webkitRequestFileSystem'): 'DOMWindowFileSystem',
|
||||
('DOMWindow', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem',
|
||||
('Document', 'webkitIsFullScreen'): 'DocumentFullscreen',
|
||||
('Document', 'webkitFullScreenKeyboardInputAllowed'): 'DocumentFullscreen',
|
||||
('Document', 'webkitCurrentFullScreenElement'): 'DocumentFullscreen',
|
||||
('Document', 'webkitCancelFullScreen'): 'DocumentFullscreen',
|
||||
('Document', 'webkitFullscreenEnabled'): 'DocumentFullscreen',
|
||||
('Document', 'webkitFullscreenElement'): 'DocumentFullscreen',
|
||||
('Document', 'webkitExitFullscreen'): 'DocumentFullscreen',
|
||||
('Window', 'crypto'): 'DOMWindowCrypto',
|
||||
('Window', 'indexedDB'): 'DOMWindowIndexedDatabase',
|
||||
('Window', 'speechSynthesis'): 'DOMWindowSpeechSynthesis',
|
||||
('Window', 'webkitNotifications'): 'DOMWindowNotifications',
|
||||
('Window', 'storage'): 'DOMWindowQuota',
|
||||
('Window', 'webkitStorageInfo'): 'DOMWindowQuota',
|
||||
('Window', 'openDatabase'): 'DOMWindowWebDatabase',
|
||||
('Window', 'webkitRequestFileSystem'): 'DOMWindowFileSystem',
|
||||
('Window', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem',
|
||||
('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem',
|
||||
('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack',
|
||||
('Navigator', 'geolocation'): 'NavigatorGeolocation',
|
||||
@@ -32,6 +40,8 @@ _cpp_type_map = {
|
||||
('Navigator', 'unregisterProtocolHandler'): 'NavigatorContentUtils',
|
||||
('Navigator', 'webkitGetUserMedia'): 'NavigatorMediaStream',
|
||||
('Navigator', 'webkitGetGamepads'): 'NavigatorGamepad',
|
||||
('Navigator', 'requestMIDIAccess'): 'NavigatorWebMIDI',
|
||||
('Navigator', 'vibrate'): 'NavigatorVibration',
|
||||
}
|
||||
|
||||
_cpp_partial_map = {}
|
||||
@@ -293,6 +303,9 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes),
|
||||
CALLBACKS=self._cpp_definitions_emitter.Fragments(),
|
||||
RESOLVER=self._cpp_resolver_emitter.Fragments(),
|
||||
WEBCORE_CLASS_NAME=self._interface_type_info.native_type(),
|
||||
WEBCORE_CLASS_NAME_ESCAPED=
|
||||
self._interface_type_info.native_type().replace('<', '_').replace('>', '_'),
|
||||
DART_IMPLEMENTATION_CLASS=self._interface_type_info.implementation_name(),
|
||||
DART_IMPLEMENTATION_LIBRARY='dart:%s' % self._renamer.GetLibraryName(self._interface))
|
||||
|
||||
@@ -353,6 +366,8 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
INTERFACE=self._interface.id,
|
||||
WEBCORE_INCLUDES=webcore_includes,
|
||||
WEBCORE_CLASS_NAME=self._interface_type_info.native_type(),
|
||||
WEBCORE_CLASS_NAME_ESCAPED=
|
||||
self._interface_type_info.native_type().replace('<', '_').replace('>', '_'),
|
||||
DECLARATIONS=self._cpp_declarations_emitter.Fragments(),
|
||||
IS_NODE=TypeCheckHelper(is_node_test),
|
||||
IS_ACTIVE=TypeCheckHelper(is_active_test),
|
||||
@@ -607,7 +622,8 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
raises_exceptions = raises_dom_exception or arguments
|
||||
|
||||
# TODO(antonm): unify with ScriptState below.
|
||||
requires_stack_info = ext_attrs.get('CallWith') == 'ScriptArguments|ScriptState'
|
||||
requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptState' or
|
||||
ext_attrs.get('ConstructorCallWith') == 'ScriptArguments|ScriptState')
|
||||
if requires_stack_info:
|
||||
raises_exceptions = True
|
||||
cpp_arguments = ['&state', 'scriptArguments.release()']
|
||||
@@ -616,7 +632,8 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
arguments = arguments[:-1]
|
||||
|
||||
# TODO(antonm): unify with ScriptState below.
|
||||
requires_script_arguments = ext_attrs.get('CallWith') == 'ScriptArguments'
|
||||
requires_script_arguments = (ext_attrs.get('CallWith') == 'ScriptArguments' or
|
||||
ext_attrs.get('ConstructorCallWith') == 'ScriptArguments')
|
||||
if requires_script_arguments:
|
||||
raises_exceptions = True
|
||||
cpp_arguments = ['scriptArguments.release()']
|
||||
@@ -624,12 +641,14 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
# it's not needed and should be just removed.
|
||||
arguments = arguments[:-1]
|
||||
|
||||
requires_script_execution_context = ext_attrs.get('CallWith') == 'ScriptExecutionContext'
|
||||
requires_script_execution_context = (ext_attrs.get('CallWith') == 'ScriptExecutionContext' or
|
||||
ext_attrs.get('ConstructorCallWith') == 'ScriptExecutionContext')
|
||||
if requires_script_execution_context:
|
||||
raises_exceptions = True
|
||||
cpp_arguments = ['context']
|
||||
|
||||
requires_script_state = ext_attrs.get('CallWith') == 'ScriptState'
|
||||
requires_script_state = (ext_attrs.get('CallWith') == 'ScriptState' or
|
||||
ext_attrs.get('ConstructorCallWith') == 'ScriptState')
|
||||
if requires_script_state:
|
||||
raises_exceptions = True
|
||||
cpp_arguments = ['&state']
|
||||
@@ -845,7 +864,14 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
interface_name = self._interface_type_info.native_type()
|
||||
cpp_type_name = _GetCPPTypeName(interface_name,
|
||||
node.id)
|
||||
if interface_name != cpp_type_name:
|
||||
# Hack to determine if this came from the _cpp_type_map.
|
||||
# In this case, the getter is mapped to a static method.
|
||||
if (not function_expression.startswith('receiver->') and
|
||||
not function_expression.startswith(interface_name + '::')):
|
||||
if 'childNodes' in callback_name:
|
||||
print function_expression
|
||||
print interface_name
|
||||
raise 'hell'
|
||||
if interface_name == 'DOMWindow' or interface_name == 'Navigator':
|
||||
cpp_arguments.insert(0, 'receiver')
|
||||
else:
|
||||
|
||||
@@ -206,20 +206,20 @@ class _DOMWindowCrossFrame extends NativeFieldWrapperClass1 implements
|
||||
_DOMWindowCrossFrame.internal();
|
||||
|
||||
// Fields.
|
||||
HistoryBase get history native "DOMWindow_history_cross_frame_Getter";
|
||||
LocationBase get location native "DOMWindow_location_cross_frame_Getter";
|
||||
bool get closed native "DOMWindow_closed_Getter";
|
||||
int get length native "DOMWindow_length_Getter";
|
||||
WindowBase get opener native "DOMWindow_opener_Getter";
|
||||
WindowBase get parent native "DOMWindow_parent_Getter";
|
||||
WindowBase get top native "DOMWindow_top_Getter";
|
||||
HistoryBase get history native "Window_history_cross_frame_Getter";
|
||||
LocationBase get location native "Window_location_cross_frame_Getter";
|
||||
bool get closed native "Window_closed_Getter";
|
||||
int get length native "Window_length_Getter";
|
||||
WindowBase get opener native "Window_opener_Getter";
|
||||
WindowBase get parent native "Window_parent_Getter";
|
||||
WindowBase get top native "Window_top_Getter";
|
||||
|
||||
// Methods.
|
||||
void close() native "DOMWindow_close_Callback";
|
||||
void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) native "DOMWindow_postMessage_Callback";
|
||||
void close() native "Window_close_Callback";
|
||||
void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) native "Window_postMessage_Callback";
|
||||
|
||||
// Implementation support.
|
||||
String get typeName => "DOMWindow";
|
||||
String get typeName => "Window";
|
||||
}
|
||||
|
||||
class _HistoryCrossFrame extends NativeFieldWrapperClass1 implements HistoryBase {
|
||||
|
||||
@@ -31,6 +31,8 @@ $TO_DART
|
||||
static Dart_NativeFunction resolver(Dart_Handle name, int argumentCount);
|
||||
};
|
||||
|
||||
Dart_Handle $(WEBCORE_CLASS_NAME_ESCAPED)_toDart(PassRefPtr< $WEBCORE_CLASS_NAME > value);
|
||||
|
||||
namespace Dart$(INTERFACE)Internal {
|
||||
$DECLARATIONS
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
$INCLUDES
|
||||
namespace WebCore {
|
||||
|
||||
Dart_Handle $(WEBCORE_CLASS_NAME_ESCAPED)_toDart(PassRefPtr< $WEBCORE_CLASS_NAME > value) {
|
||||
return Dart$INTERFACE::toDart(value);
|
||||
}
|
||||
|
||||
namespace Dart$(INTERFACE)Internal {
|
||||
$CALLBACKS
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ $if DART2JS
|
||||
* Note: The supplied [callback] needs to call [requestAnimationFrame] again
|
||||
* for the animation to continue.
|
||||
*/
|
||||
@DomName('DOMWindow.requestAnimationFrame')
|
||||
@DomName('Window.requestAnimationFrame')
|
||||
int requestAnimationFrame(RequestAnimationFrameCallback callback) {
|
||||
_ensureRequestAnimationFrame();
|
||||
return _requestAnimationFrame(callback);
|
||||
@@ -242,7 +242,7 @@ $endif
|
||||
return _requestFileSystem(persistent? 1 : 0, size);
|
||||
}
|
||||
|
||||
@DomName('DOMWindow.convertPointFromNodeToPage')
|
||||
@DomName('Window.convertPointFromNodeToPage')
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.SAFARI)
|
||||
@Experimental()
|
||||
@@ -252,7 +252,7 @@ $endif
|
||||
return new Point(result.x, result.y);
|
||||
}
|
||||
|
||||
@DomName('DOMWindow.convertPointFromPageToNode')
|
||||
@DomName('Window.convertPointFromPageToNode')
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.SAFARI)
|
||||
@Experimental()
|
||||
@@ -269,12 +269,12 @@ $endif
|
||||
static bool get supportsPointConversions => _DomPoint.supported;
|
||||
$!MEMBERS
|
||||
|
||||
@DomName('DOMWindow.beforeunloadEvent')
|
||||
@DomName('Window.beforeunloadEvent')
|
||||
@DocsEditable()
|
||||
static const EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent =
|
||||
const _BeforeUnloadEventStreamProvider('beforeunload');
|
||||
|
||||
@DomName('DOMWindow.onbeforeunload')
|
||||
@DomName('Window.onbeforeunload')
|
||||
@DocsEditable()
|
||||
Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user