| OLD | NEW |
| 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 logging | 5 import logging |
| 6 import monitored | 6 import monitored |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', { | 9 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', { |
| 10 'CDATASection': 'CDataSection', | 10 'CDATASection': 'CDataSection', |
| 11 'Clipboard': 'DataTransfer', | 11 'Clipboard': 'DataTransfer', |
| 12 'Database': 'SqlDatabase', # Avoid conflict with Index DB's Database. |
| 13 'DatabaseSync': 'SqlDatabaseSync', |
| 12 'DOMApplicationCache': 'ApplicationCache', | 14 'DOMApplicationCache': 'ApplicationCache', |
| 13 'DOMCoreException': 'DomException', | 15 'DOMCoreException': 'DomException', |
| 14 'DOMFileSystem': 'FileSystem', | 16 'DOMFileSystem': 'FileSystem', |
| 15 'DOMFileSystemSync': 'FileSystemSync', | 17 'DOMFileSystemSync': 'FileSystemSync', |
| 16 'DOMFormData': 'FormData', | 18 'DOMFormData': 'FormData', |
| 17 'DOMURL': 'Url', | 19 'DOMURL': 'Url', |
| 18 'DOMWindow': 'Window', | 20 'DOMWindow': 'Window', |
| 19 'HTMLDocument' : 'HtmlDocument', | 21 'HTMLDocument' : 'HtmlDocument', |
| 20 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. | 22 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. |
| 21 'NamedNodeMap': '_NamedNodeMap', | 23 'NamedNodeMap': '_NamedNodeMap', |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 return member_name | 569 return member_name |
| 568 | 570 |
| 569 def GetLibraryName(self, interface): | 571 def GetLibraryName(self, interface): |
| 570 if 'Conditional' in interface.ext_attrs: | 572 if 'Conditional' in interface.ext_attrs: |
| 571 if 'WEB_AUDIO' in interface.ext_attrs['Conditional']: | 573 if 'WEB_AUDIO' in interface.ext_attrs['Conditional']: |
| 572 return 'web_audio' | 574 return 'web_audio' |
| 573 if 'SVG' in interface.ext_attrs['Conditional']: | 575 if 'SVG' in interface.ext_attrs['Conditional']: |
| 574 return 'svg' | 576 return 'svg' |
| 575 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']: | 577 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']: |
| 576 return 'indexed_db' | 578 return 'indexed_db' |
| 579 if 'SQL_DATABASE' in interface.ext_attrs['Conditional']: |
| 580 # WorkerContext has attributes merged in from many other interfaces. |
| 581 if interface.id != 'WorkerContext': |
| 582 return 'web_sql' |
| 577 | 583 |
| 578 return 'html' | 584 return 'html' |
| 579 | 585 |
| 580 def DartifyTypeName(self, type_name): | 586 def DartifyTypeName(self, type_name): |
| 581 """Converts a DOM name to a Dart-friendly class name. """ | 587 """Converts a DOM name to a Dart-friendly class name. """ |
| 582 | 588 |
| 583 if type_name in html_interface_renames: | 589 if type_name in html_interface_renames: |
| 584 return html_interface_renames[type_name] | 590 return html_interface_renames[type_name] |
| 585 | 591 |
| 586 # Strip off any standard prefixes. | 592 # Strip off any standard prefixes. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 601 | 607 |
| 602 # We're looking for a sequence of letters which start with capital letter | 608 # We're looking for a sequence of letters which start with capital letter |
| 603 # then a series of caps and finishes with either the end of the string or | 609 # then a series of caps and finishes with either the end of the string or |
| 604 # a capital letter. | 610 # a capital letter. |
| 605 # The [0-9] check is for names such as 2D or 3D | 611 # The [0-9] check is for names such as 2D or 3D |
| 606 # The following test cases should match as: | 612 # The following test cases should match as: |
| 607 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 613 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
| 608 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 614 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
| 609 # IFrameElement: (I)()(F)rameElement (no change) | 615 # IFrameElement: (I)()(F)rameElement (no change) |
| 610 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 616 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
| OLD | NEW |