Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Unified Diff: client/dom/scripts/generator.py

Issue 9565006: Add missing includes (spotted while splitting cpp derived sources). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: client/dom/scripts/generator.py
diff --git a/client/dom/scripts/generator.py b/client/dom/scripts/generator.py
index 2a678ba393342a5a2d23c53aa3d0ac5fd32aa76b..c29a47bdcb2c731bf3e9407f71fefbca4bdefd72 100644
--- a/client/dom/scripts/generator.py
+++ b/client/dom/scripts/generator.py
@@ -450,7 +450,7 @@ def TypeName(typeIds, interface):
class IDLTypeInfo(object):
def __init__(self, idl_type, dart_type=None, native_type=None, ref_counted=True,
has_dart_wrapper=True, conversion_template=None,
- custom_to_dart=False):
+ custom_to_dart=False, conversion_includes=[]):
self._idl_type = idl_type
self._dart_type = dart_type
self._native_type = native_type
@@ -458,6 +458,7 @@ class IDLTypeInfo(object):
self._has_dart_wrapper = has_dart_wrapper
self._conversion_template = conversion_template
self._custom_to_dart = custom_to_dart
+ self._conversion_includes = conversion_includes
def idl_type(self):
return self._idl_type
@@ -485,18 +486,23 @@ class IDLTypeInfo(object):
def parameter_type(self):
return '%s*' % self.native_type()
- def webcore_include(self):
- if self._idl_type == 'SVGNumber' or self._idl_type == 'SVGPoint':
- return None
+ def webcore_includes(self):
+ if not self._idl_type.startswith('SVG'):
+ return [self._idl_type]
+
+ if self._idl_type in ['SVGNumber', 'SVGPoint']:
+ return []
if self._idl_type.startswith('SVGPathSeg'):
- return self._idl_type.replace('Abs', '').replace('Rel', '')
- return self._idl_type
+ include = self._idl_type.replace('Abs', '').replace('Rel', '')
+ else:
+ include = self._idl_type
+ return [include] + _svg_supplemental_includes
def receiver(self):
return 'receiver->'
- def conversion_include(self):
- return 'Dart%s' % self._idl_type
+ def conversion_includes(self):
+ return ['Dart%s' % include for include in [self.dart_type()] + self._conversion_includes]
def conversion_cast(self, expression):
if self._conversion_template:
@@ -528,8 +534,8 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
return 'const String&'
return self.native_type()
- def conversion_include(self):
- return None
+ def conversion_includes(self):
+ return []
def webcore_getter_name(self):
return self._webcore_getter_name
@@ -600,6 +606,7 @@ _idl_type_registry = {
'SerializedScriptValue': PrimitiveIDLTypeInfo('SerializedScriptValue', dart_type='Dynamic', ref_counted=True),
'WebKitFlags': PrimitiveIDLTypeInfo('WebKitFlags', dart_type='Object'),
+ 'CSSRule': IDLTypeInfo('CSSRule', conversion_includes=['CSSImportRule']),
'DOMException': IDLTypeInfo('DOMCoreException', dart_type='DOMException'),
'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True),
'Element': IDLTypeInfo('Element', custom_to_dart=True),
@@ -608,6 +615,7 @@ _idl_type_registry = {
'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True),
'MediaQueryListListener': IDLTypeInfo('MediaQueryListListener', has_dart_wrapper=False),
'OptionsObject': IDLTypeInfo('OptionsObject', has_dart_wrapper=False),
+ 'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet']),
'SVGElement': IDLTypeInfo('SVGElement', custom_to_dart=True),
'SVGAngle': SVGTearOffIDLTypeInfo('SVGAngle'),
@@ -626,6 +634,15 @@ _idl_type_registry = {
'SVGTransformList': SVGTearOffIDLTypeInfo('SVGTransformList', native_type='SVGTransformListPropertyTearOff', ref_counted=False)
}
+_svg_supplemental_includes = [
+ 'SVGAnimatedPropertyTearOff',
+ 'SVGAnimatedListPropertyTearOff',
+ 'SVGStaticListPropertyTearOff',
+ 'SVGAnimatedListPropertyTearOff',
+ 'SVGTransformListPropertyTearOff',
+ 'SVGPathSegListPropertyTearOff',
+]
+
def GetIDLTypeInfo(idl_type):
return GetIDLTypeInfoByName(idl_type.id)

Powered by Google App Engine
This is Rietveld 408576698