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

Unified Diff: lib/dom/scripts/dartgenerator.py

Issue 10014028: Remove EventListener attributes from Dart DOM API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « lib/dom/idl/dart/webkit-supplemental.idl ('k') | lib/dom/scripts/fremontcutbuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
« no previous file with comments | « lib/dom/idl/dart/webkit-supplemental.idl ('k') | lib/dom/scripts/fremontcutbuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698