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

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 10700112: _html_library_custom members are only custom in frog. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 "Node.get:nodeValue", 264 "Node.get:nodeValue",
265 "Node.set:nodeValue", 265 "Node.set:nodeValue",
266 "Node.get:CDATA_SECTION_NODE", 266 "Node.get:CDATA_SECTION_NODE",
267 "Node.get:nodeName", 267 "Node.get:nodeName",
268 "Node.lookupPrefix", 268 "Node.lookupPrefix",
269 "Node.get:PROCESSING_INSTRUCTION_NODE", 269 "Node.get:PROCESSING_INSTRUCTION_NODE",
270 "IFrameElement.get:contentDocument", 270 "IFrameElement.get:contentDocument",
271 "Window.get:frameElement", 271 "Window.get:frameElement",
272 ]) 272 ])
273 273
274 _html_library_custom = set([ 274 _js_custom_members = set([
275 'IFrameElement.contentWindow', 275 'IFrameElement.contentWindow',
276 'Window.document', 276 'Window.document',
277 'Window.top', 277 'Window.top',
278 'Window.location', 278 'Window.location',
279 'Window.open', 279 'Window.open',
280 'IDBDatabase.transaction', 280 'IDBDatabase.transaction',
281 ]) 281 ])
282 282
283 # This map controls merging of interfaces in dart:html library. 283 # This map controls merging of interfaces in dart:html library.
284 # All constants, attributes, and operations of merged interface (key) are 284 # All constants, attributes, and operations of merged interface (key) are
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 TYPE=self._NarrowInputType(element_type)) 1235 TYPE=self._NarrowInputType(element_type))
1236 1236
1237 # TODO(sra): Use separate mixins for mutable implementations of List<T>. 1237 # TODO(sra): Use separate mixins for mutable implementations of List<T>.
1238 # TODO(sra): Use separate mixins for typed array implementations of List<T>. 1238 # TODO(sra): Use separate mixins for typed array implementations of List<T>.
1239 if self._interface.id != 'NodeList': 1239 if self._interface.id != 'NodeList':
1240 template_file = 'immutable_list_mixin.darttemplate' 1240 template_file = 'immutable_list_mixin.darttemplate'
1241 template = self._system._templates.Load(template_file) 1241 template = self._system._templates.Load(template_file)
1242 self._members_emitter.Emit(template, E=self._shared.DartType(element_type) ) 1242 self._members_emitter.Emit(template, E=self._shared.DartType(element_type) )
1243 1243
1244 def AddAttribute(self, attribute, html_name, read_only): 1244 def AddAttribute(self, attribute, html_name, read_only):
1245 if self._shared.IsCustomInHtmlLibrary(self._interface, attribute.id): 1245 if self._HasCustomImplementation(attribute.id):
1246 return 1246 return
1247 1247
1248 if attribute.id != html_name: 1248 if attribute.id != html_name:
1249 self._AddRenamingGetter(attribute, html_name) 1249 self._AddRenamingGetter(attribute, html_name)
1250 if not read_only: 1250 if not read_only:
1251 self._AddRenamingSetter(attribute, html_name) 1251 self._AddRenamingSetter(attribute, html_name)
1252 return 1252 return
1253 1253
1254 # If the attribute is shadowing, we can't generate a shadowing 1254 # If the attribute is shadowing, we can't generate a shadowing
1255 # field (Issue 1633). 1255 # field (Issue 1633).
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 ' native "this.$NAME = value;";\n', 1310 ' native "this.$NAME = value;";\n',
1311 HTML_NAME=html_name, 1311 HTML_NAME=html_name,
1312 NAME=attr.id, 1312 NAME=attr.id,
1313 TYPE=self._NarrowInputType(attr.type.id)) 1313 TYPE=self._NarrowInputType(attr.type.id))
1314 1314
1315 def AddOperation(self, info): 1315 def AddOperation(self, info):
1316 """ 1316 """
1317 Arguments: 1317 Arguments:
1318 info: An OperationInfo object. 1318 info: An OperationInfo object.
1319 """ 1319 """
1320 if self._shared.IsCustomInHtmlLibrary(self._interface, info.name): 1320 if self._HasCustomImplementation(info.name):
1321 return 1321 return
1322 1322
1323 html_name = self._shared.RenameInHtmlLibrary( 1323 html_name = self._shared.RenameInHtmlLibrary(
1324 self._interface.id, info.name, implementation_class=True) 1324 self._interface.id, info.name, implementation_class=True)
1325 if not html_name: 1325 if not html_name:
1326 return 1326 return
1327 1327
1328 # Do we need a native body? 1328 # Do we need a native body?
1329 if html_name != info.declared_name: 1329 if html_name != info.declared_name:
1330 return_type = self._NarrowOutputType(info.type_name) 1330 return_type = self._NarrowOutputType(info.type_name)
(...skipping 10 matching lines...) Expand all
1341 ' $TYPE $(HTML_NAME)($PARAMS) native "$NAME";\n') 1341 ' $TYPE $(HTML_NAME)($PARAMS) native "$NAME";\n')
1342 else: 1342 else:
1343 self._members_emitter.Emit( 1343 self._members_emitter.Emit(
1344 '\n' 1344 '\n'
1345 ' $TYPE $NAME($PARAMS) native;\n', 1345 ' $TYPE $NAME($PARAMS) native;\n',
1346 TYPE=self._NarrowOutputType(info.type_name), 1346 TYPE=self._NarrowOutputType(info.type_name),
1347 NAME=info.name, 1347 NAME=info.name,
1348 PARAMS=info.ParametersImplementationDeclaration( 1348 PARAMS=info.ParametersImplementationDeclaration(
1349 lambda type_name: self._NarrowInputType(type_name))) 1349 lambda type_name: self._NarrowInputType(type_name)))
1350 1350
1351 def _HasCustomImplementation(self, member_name):
1352 member_name = '%s.%s' % (self._html_interface_name, member_name)
1353 return member_name in _js_custom_members
1354
1351 # ------------------------------------------------------------------------------ 1355 # ------------------------------------------------------------------------------
1352 1356
1353 class HtmlFrogSystem(HtmlSystem): 1357 class HtmlFrogSystem(HtmlSystem):
1354 1358
1355 def __init__(self, templates, database, emitters, output_dir): 1359 def __init__(self, templates, database, emitters, output_dir):
1356 super(HtmlFrogSystem, self).__init__( 1360 super(HtmlFrogSystem, self).__init__(
1357 templates, database, emitters, output_dir) 1361 templates, database, emitters, output_dir)
1358 1362
1359 def ImplementationGenerator(self, interface): 1363 def ImplementationGenerator(self, interface):
1360 return HtmlFrogClassGenerator(self, interface) 1364 return HtmlFrogClassGenerator(self, interface)
(...skipping 25 matching lines...) Expand all
1386 Collect(database.GetInterface(parent.type.id), 1390 Collect(database.GetInterface(parent.type.id),
1387 seen, collected) 1391 seen, collected)
1388 1392
1389 inheritance_closure = {} 1393 inheritance_closure = {}
1390 for interface in database.GetInterfaces(): 1394 for interface in database.GetInterfaces():
1391 seen = set() 1395 seen = set()
1392 collected = [] 1396 collected = []
1393 Collect(interface, seen, collected) 1397 Collect(interface, seen, collected)
1394 inheritance_closure[interface.id] = collected 1398 inheritance_closure[interface.id] = collected
1395 return inheritance_closure 1399 return inheritance_closure
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698