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 | 5 |
6 """This module provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
8 | 8 |
9 import copy | 9 import copy |
10 import re | 10 import re |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 'Element.webkitMatchesSelector': ['@Experimental()'], | 621 'Element.webkitMatchesSelector': ['@Experimental()'], |
622 } | 622 } |
623 | 623 |
624 _indexed_db_annotations = [ | 624 _indexed_db_annotations = [ |
625 "@SupportedBrowser(SupportedBrowser.CHROME)", | 625 "@SupportedBrowser(SupportedBrowser.CHROME)", |
626 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", | 626 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", |
627 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 627 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
628 "@Experimental()", | 628 "@Experimental()", |
629 ] | 629 ] |
630 | 630 |
| 631 _file_system_annotations = [ |
| 632 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 633 "@Experimental()", |
| 634 ] |
| 635 |
631 _all_but_ie9_annotations = [ | 636 _all_but_ie9_annotations = [ |
632 "@SupportedBrowser(SupportedBrowser.CHROME)", | 637 "@SupportedBrowser(SupportedBrowser.CHROME)", |
633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 638 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
634 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 639 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
635 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 640 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
636 ] | 641 ] |
637 | 642 |
638 _history_annotations = _all_but_ie9_annotations | 643 _history_annotations = _all_but_ie9_annotations |
639 | 644 |
640 _performance_annotations = [ | 645 _performance_annotations = [ |
641 "@SupportedBrowser(SupportedBrowser.CHROME)", | 646 "@SupportedBrowser(SupportedBrowser.CHROME)", |
642 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 647 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
643 "@SupportedBrowser(SupportedBrowser.IE)", | 648 "@SupportedBrowser(SupportedBrowser.IE)", |
644 ] | 649 ] |
645 | 650 |
646 # Annotations to be placed on generated members. | 651 # Annotations to be placed on generated members. |
647 # The table is indexed as: | 652 # The table is indexed as: |
648 # INTERFACE: annotations to be added to the interface declaration | 653 # INTERFACE: annotations to be added to the interface declaration |
649 # INTERFACE.MEMBER: annotation to be added to the member declaration | 654 # INTERFACE.MEMBER: annotation to be added to the member declaration |
650 dart_annotations = { | 655 dart_annotations = { |
651 'ArrayBuffer': _all_but_ie9_annotations, | 656 'ArrayBuffer': _all_but_ie9_annotations, |
652 'ArrayBufferView': _all_but_ie9_annotations, | 657 'ArrayBufferView': _all_but_ie9_annotations, |
653 'DOMWindow.indexedDB': _indexed_db_annotations, | 658 'DOMWindow.indexedDB': _indexed_db_annotations, |
654 'DOMWindow.performance': _performance_annotations, | 659 'DOMWindow.performance': _performance_annotations, |
| 660 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, |
| 661 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, |
655 'Element.webkitCreateShadowRoot': [ | 662 'Element.webkitCreateShadowRoot': [ |
656 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 663 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
657 "@Experimental()", | 664 "@Experimental()", |
658 ], | 665 ], |
| 666 'FileSystem': _file_system_annotations, |
| 667 'FileSystemSync': _file_system_annotations, |
659 'History.pushState': _history_annotations, | 668 'History.pushState': _history_annotations, |
660 'History.replaceState': _history_annotations, | 669 'History.replaceState': _history_annotations, |
661 'HTMLContentElement': [ | 670 'HTMLContentElement': [ |
662 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 671 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
663 "@Experimental()", | 672 "@Experimental()", |
664 ], | 673 ], |
665 'HTMLDataListElement': _all_but_ie9_annotations, | 674 'HTMLDataListElement': _all_but_ie9_annotations, |
666 'HTMLDetailsElement': [ | 675 'HTMLDetailsElement': [ |
667 "@SupportedBrowser(SupportedBrowser.CHROME)", | 676 "@SupportedBrowser(SupportedBrowser.CHROME)", |
668 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 677 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 ], | 714 ], |
706 'IDBFactory': _indexed_db_annotations, | 715 'IDBFactory': _indexed_db_annotations, |
707 'IDBDatabase': _indexed_db_annotations, | 716 'IDBDatabase': _indexed_db_annotations, |
708 'Performance': _performance_annotations, | 717 'Performance': _performance_annotations, |
709 'ShadowRoot': [ | 718 'ShadowRoot': [ |
710 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 719 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
711 "@Experimental()", | 720 "@Experimental()", |
712 ], | 721 ], |
713 'WebSocket': _all_but_ie9_annotations, | 722 'WebSocket': _all_but_ie9_annotations, |
714 'WorkerContext.indexedDB': _indexed_db_annotations, | 723 'WorkerContext.indexedDB': _indexed_db_annotations, |
| 724 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, |
| 725 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, |
| 726 'WorkerContext.webkitResolveLocalFileSystemSyncURL': _file_system_annotations, |
| 727 'WorkerContext.webkitResolveLocalFileSystemURL': _file_system_annotations, |
715 } | 728 } |
716 | 729 |
717 def FindCommonAnnotations(interface_name, member_name=None): | 730 def FindCommonAnnotations(interface_name, member_name=None): |
718 """ Finds annotations common between dart2js and dartium. | 731 """ Finds annotations common between dart2js and dartium. |
719 """ | 732 """ |
720 if member_name: | 733 if member_name: |
721 return dart_annotations.get('%s.%s' % (interface_name, member_name)) | 734 return dart_annotations.get('%s.%s' % (interface_name, member_name)) |
722 else: | 735 else: |
723 return dart_annotations.get(interface_name) | 736 return dart_annotations.get(interface_name) |
724 | 737 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 self) | 1297 self) |
1285 | 1298 |
1286 if type_data.clazz == 'SVGTearOff': | 1299 if type_data.clazz == 'SVGTearOff': |
1287 dart_interface_name = self._renamer.RenameInterface( | 1300 dart_interface_name = self._renamer.RenameInterface( |
1288 self._database.GetInterface(type_name)) | 1301 self._database.GetInterface(type_name)) |
1289 return SVGTearOffIDLTypeInfo( | 1302 return SVGTearOffIDLTypeInfo( |
1290 type_name, type_data, dart_interface_name, self) | 1303 type_name, type_data, dart_interface_name, self) |
1291 | 1304 |
1292 class_name = '%sIDLTypeInfo' % type_data.clazz | 1305 class_name = '%sIDLTypeInfo' % type_data.clazz |
1293 return globals()[class_name](type_name, type_data) | 1306 return globals()[class_name](type_name, type_data) |
OLD | NEW |