Chromium Code Reviews| Index: lib/dom/scripts/dartgenerator.py |
| diff --git a/lib/dom/scripts/dartgenerator.py b/lib/dom/scripts/dartgenerator.py |
| index 7e3d246ec89ce8dcb2be9c44ec308bb2091b3c2b..dd65ef5e466b799b24e748c9a3fd394a918bb18a 100755 |
| --- a/lib/dom/scripts/dartgenerator.py |
| +++ b/lib/dom/scripts/dartgenerator.py |
| @@ -326,6 +326,16 @@ class DartGenerator(object): |
| super_database.HasInterface(super_name)): |
| super_interface = super_name |
| + # Create fake EventTarget parent interface for interfaces that have |
| + # 'EventTarget' extended attribute. |
| + class EventTargetParentInterface(): |
| + def __init__(self): |
| + self.type = database.GetInterface('EventTarget') |
| + self.annotations = ['WebKit'] |
| + |
| + if 'EventTarget' in interface.ext_attrs: |
| + interface.parents.append(EventTargetParentInterface()) |
|
sra1
2012/04/11 20:23:05
We should really append an IDLParentInterface, oth
podivilov
2012/04/12 14:37:41
Done.
|
| + |
| interface_name = interface.id |
| auxiliary_file = self._auxiliary_files.get(interface_name) |
| if auxiliary_file is not None: |
| @@ -351,7 +361,6 @@ class DartGenerator(object): |
| for system in self._systems: |
| system.Finish() |
| - |
| def _PreOrderInterfaces(self, interfaces): |
| """Returns the interfaces in pre-order, i.e. parents first.""" |
| seen = set() |
| @@ -394,7 +403,7 @@ class DartGenerator(object): |
| generator.AddConstant(const) |
| attributes = [attr for attr in interface.attributes |
| - if not self._IsEventAttribute(interface, attr)] |
| + if attr.type.id != 'EventListener'] |
| for (getter, setter) in _PairUpAttributes(attributes): |
| for generator in generators: |
| generator.AddAttribute(getter, setter) |
| @@ -452,12 +461,6 @@ class DartGenerator(object): |
| generator.FinishInterface() |
| return |
| - def _IsEventAttribute(self, interface, attr): |
| - # Remove EventListener attributes like 'onclick' when addEventListener |
| - # is available. |
| - return (attr.type.id == 'EventListener' and |
| - 'EventTarget' in self._AllImplementedInterfaces(interface)) |
| - |
| def _TransitiveSecondaryParents(self, interface): |
| """Returns a list of all non-primary parents. |
| @@ -521,6 +524,8 @@ class DartGenerator(object): |
| seen = set() |
| collected = [] |
| Collect(interface, seen, collected) |
| + if 'EventTarget' in interface.ext_attrs: |
| + collected.append('EventTarget') |
|
sra1
2012/04/11 20:23:05
Why do you need this if you added a parent interfa
podivilov
2012/04/12 14:37:41
_ComputeInheritanceClosure is called too early, I
|
| self._inheritance_closure[interface.id] = collected |
| def _AllImplementedInterfaces(self, interface): |