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

Side by Side Diff: sdk/lib/html/scripts/htmlrenamer.py

Issue 11443002: Revert "Moving AudioElement back to dart:html" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/scripts/idlnode.py » ('j') | 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 import re 5 import re
6 6
7 html_interface_renames = { 7 html_interface_renames = {
8 'DOMCoreException': 'DOMException', 8 'DOMCoreException': 'DOMException',
9 'DOMFormData': 'FormData', 9 'DOMFormData': 'FormData',
10 'DOMURL': 'Url', 10 'DOMURL': 'Url',
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 for interface in self._database.Hierarchy(interface): 354 for interface in self._database.Hierarchy(interface):
355 html_interface_name = self.RenameInterface(interface) 355 html_interface_name = self.RenameInterface(interface)
356 member_name = html_interface_name + '.' + member 356 member_name = html_interface_name + '.' + member
357 if member_name in candidates: 357 if member_name in candidates:
358 return member_name 358 return member_name
359 member_name = html_interface_name + '.' + member_prefix + member 359 member_name = html_interface_name + '.' + member_prefix + member
360 if member_name in candidates: 360 if member_name in candidates:
361 return member_name 361 return member_name
362 362
363 def GetLibraryName(self, interface): 363 def GetLibraryName(self, interface):
364 if interface.module_name == 'webaudio':
365 return 'web_audio'
366
367 if interface.module_name == 'svg':
368 return 'svg'
369
370 return self._GetLibraryName(interface.id) 364 return self._GetLibraryName(interface.id)
371 365
372 # TODO(blois): remove this method when all members are renamed.
373 def _GetLibraryName(self, idl_type_name): 366 def _GetLibraryName(self, idl_type_name):
374 """ 367 """
375 Gets the name of the library this type should live in. 368 Gets the name of the library this type should live in.
376 This is private because this should use interfaces to resolve the library. 369 This is private because this should use interfaces to resolve the library.
377 """ 370 """
378 if idl_type_name.startswith('SVG'): 371 if idl_type_name.startswith('SVG'):
379 return 'svg' 372 return 'svg'
373 if 'Audio' in idl_type_name:
374 return 'web_audio'
375
376 if self._database.HasInterface(idl_type_name):
377 interface = self._database.GetInterface(idl_type_name)
378 for parent in self._database.Hierarchy(interface):
379 if parent.id == 'AudioNode':
380 return 'web_audio'
380 381
381 return 'html' 382 return 'html'
382 383
383 384
384 def DartifyTypeName(self, type_name): 385 def DartifyTypeName(self, type_name):
385 """Converts a DOM name to a Dart-friendly class name. """ 386 """Converts a DOM name to a Dart-friendly class name. """
386 library_name = self._GetLibraryName(type_name) 387 library_name = self._GetLibraryName(type_name)
387 # Only renaming SVG for now. 388 # Only renaming SVG for now.
388 if library_name != 'svg': 389 if library_name != 'svg':
389 return type_name 390 return type_name
(...skipping 14 matching lines...) Expand all
404 405
405 # We're looking for a sequence of letters which start with capital letter 406 # We're looking for a sequence of letters which start with capital letter
406 # then a series of caps and finishes with either the end of the string or 407 # then a series of caps and finishes with either the end of the string or
407 # a capital letter. 408 # a capital letter.
408 # The [0-9] check is for names such as 2D or 3D 409 # The [0-9] check is for names such as 2D or 3D
409 # The following test cases should match as: 410 # The following test cases should match as:
410 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 411 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
411 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 412 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
412 # IFrameElement: (I)()(F)rameElement (no change) 413 # IFrameElement: (I)()(F)rameElement (no change)
413 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 414 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/scripts/idlnode.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698