| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 'SQLResultSetRowList.item': ["@Creates('=Object')"], | 649 'SQLResultSetRowList.item': ["@Creates('=Object')"], |
| 650 | 650 |
| 651 'XMLHttpRequest.response': [ | 651 'XMLHttpRequest.response': [ |
| 652 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", | 652 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", |
| 653 ], | 653 ], |
| 654 } | 654 } |
| 655 | 655 |
| 656 # Placeholder to add experimental flag, implementation for this is | 656 # Placeholder to add experimental flag, implementation for this is |
| 657 # pending in a separate CL. | 657 # pending in a separate CL. |
| 658 dart_annotations = { | 658 dart_annotations = { |
| 659 'Element.webkitMatchesSelector': ['@Experimental()'], | 659 'Element.webkitMatchesSelector': ['@Experimental'], |
| 660 } | 660 } |
| 661 | 661 |
| 662 _indexed_db_annotations = [ | 662 _indexed_db_annotations = [ |
| 663 "@SupportedBrowser(SupportedBrowser.CHROME)", | 663 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 664 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", | 664 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", |
| 665 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 665 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 666 "@Experimental()", | 666 "@Experimental", |
| 667 ] | 667 ] |
| 668 | 668 |
| 669 _file_system_annotations = [ | 669 _file_system_annotations = [ |
| 670 "@SupportedBrowser(SupportedBrowser.CHROME)", | 670 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 671 "@Experimental()", | 671 "@Experimental", |
| 672 ] | 672 ] |
| 673 | 673 |
| 674 _all_but_ie9_annotations = [ | 674 _all_but_ie9_annotations = [ |
| 675 "@SupportedBrowser(SupportedBrowser.CHROME)", | 675 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 676 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 676 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 677 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 677 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 678 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 678 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 679 ] | 679 ] |
| 680 | 680 |
| 681 _webkit_experimental_annotations = [ | 681 _webkit_experimental_annotations = [ |
| 682 "@SupportedBrowser(SupportedBrowser.CHROME)", | 682 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 683 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 683 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 684 "@Experimental()", | 684 "@Experimental", |
| 685 ] | 685 ] |
| 686 | 686 |
| 687 _history_annotations = _all_but_ie9_annotations | 687 _history_annotations = _all_but_ie9_annotations |
| 688 | 688 |
| 689 _performance_annotations = [ | 689 _performance_annotations = [ |
| 690 "@SupportedBrowser(SupportedBrowser.CHROME)", | 690 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 691 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 691 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 692 "@SupportedBrowser(SupportedBrowser.IE)", | 692 "@SupportedBrowser(SupportedBrowser.IE)", |
| 693 ] | 693 ] |
| 694 | 694 |
| 695 _speech_recognition_annotations = [ | 695 _speech_recognition_annotations = [ |
| 696 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 696 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 697 "@Experimental()", | 697 "@Experimental", |
| 698 ] | 698 ] |
| 699 | 699 |
| 700 # Annotations to be placed on generated members. | 700 # Annotations to be placed on generated members. |
| 701 # The table is indexed as: | 701 # The table is indexed as: |
| 702 # INTERFACE: annotations to be added to the interface declaration | 702 # INTERFACE: annotations to be added to the interface declaration |
| 703 # INTERFACE.MEMBER: annotation to be added to the member declaration | 703 # INTERFACE.MEMBER: annotation to be added to the member declaration |
| 704 dart_annotations = { | 704 dart_annotations = { |
| 705 'ArrayBuffer': _all_but_ie9_annotations, | 705 'ArrayBuffer': _all_but_ie9_annotations, |
| 706 'ArrayBufferView': _all_but_ie9_annotations, | 706 'ArrayBufferView': _all_but_ie9_annotations, |
| 707 'DOMApplicationCache': [ | 707 'DOMApplicationCache': [ |
| 708 "@SupportedBrowser(SupportedBrowser.CHROME)", | 708 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 709 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 709 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 710 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 710 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 711 "@SupportedBrowser(SupportedBrowser.OPERA)", | 711 "@SupportedBrowser(SupportedBrowser.OPERA)", |
| 712 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 712 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 713 ], | 713 ], |
| 714 'DOMWindow.indexedDB': _indexed_db_annotations, | 714 'DOMWindow.indexedDB': _indexed_db_annotations, |
| 715 'DOMWindow.performance': _performance_annotations, | 715 'DOMWindow.performance': _performance_annotations, |
| 716 'DOMWindow.webkitNotifications': _webkit_experimental_annotations, | 716 'DOMWindow.webkitNotifications': _webkit_experimental_annotations, |
| 717 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, | 717 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, |
| 718 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, | 718 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, |
| 719 'Element.webkitCreateShadowRoot': [ | 719 'Element.webkitCreateShadowRoot': [ |
| 720 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 720 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 721 "@Experimental()", | 721 "@Experimental", |
| 722 ], | 722 ], |
| 723 'FileSystem': _file_system_annotations, | 723 'FileSystem': _file_system_annotations, |
| 724 'FileSystemSync': _file_system_annotations, | 724 'FileSystemSync': _file_system_annotations, |
| 725 'HashChangeEvent': [ | 725 'HashChangeEvent': [ |
| 726 "@SupportedBrowser(SupportedBrowser.CHROME)", | 726 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 727 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 727 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 728 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 728 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 729 ], | 729 ], |
| 730 'History.pushState': _history_annotations, | 730 'History.pushState': _history_annotations, |
| 731 'History.replaceState': _history_annotations, | 731 'History.replaceState': _history_annotations, |
| 732 'HTMLContentElement': [ | 732 'HTMLContentElement': [ |
| 733 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 733 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 734 "@Experimental()", | 734 "@Experimental", |
| 735 ], | 735 ], |
| 736 'HTMLDataListElement': _all_but_ie9_annotations, | 736 'HTMLDataListElement': _all_but_ie9_annotations, |
| 737 'HTMLDetailsElement': _webkit_experimental_annotations, | 737 'HTMLDetailsElement': _webkit_experimental_annotations, |
| 738 'HTMLEmbedElement': [ | 738 'HTMLEmbedElement': [ |
| 739 "@SupportedBrowser(SupportedBrowser.CHROME)", | 739 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 740 "@SupportedBrowser(SupportedBrowser.IE)", | 740 "@SupportedBrowser(SupportedBrowser.IE)", |
| 741 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 741 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 742 ], | 742 ], |
| 743 'HTMLKeygenElement': _webkit_experimental_annotations, | 743 'HTMLKeygenElement': _webkit_experimental_annotations, |
| 744 'HTMLMeterElement': [ | 744 'HTMLMeterElement': [ |
| 745 "@SupportedBrowser(SupportedBrowser.CHROME)", | 745 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 746 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 746 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 747 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 747 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 748 ], | 748 ], |
| 749 'HTMLObjectElement': [ | 749 'HTMLObjectElement': [ |
| 750 "@SupportedBrowser(SupportedBrowser.CHROME)", | 750 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 751 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 751 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 752 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 752 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 753 ], | 753 ], |
| 754 'HTMLOutputElement': [ | 754 'HTMLOutputElement': [ |
| 755 "@SupportedBrowser(SupportedBrowser.CHROME)", | 755 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 756 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 756 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 757 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 757 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 758 ], | 758 ], |
| 759 'HTMLProgressElement': _all_but_ie9_annotations, | 759 'HTMLProgressElement': _all_but_ie9_annotations, |
| 760 'HTMLShadowElement': [ | 760 'HTMLShadowElement': [ |
| 761 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 761 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 762 "@Experimental()", | 762 "@Experimental", |
| 763 ], | 763 ], |
| 764 'HTMLTrackElement': [ | 764 'HTMLTrackElement': [ |
| 765 "@SupportedBrowser(SupportedBrowser.CHROME)", | 765 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 766 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 766 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 767 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 767 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 768 ], | 768 ], |
| 769 'IDBFactory': _indexed_db_annotations, | 769 'IDBFactory': _indexed_db_annotations, |
| 770 'IDBDatabase': _indexed_db_annotations, | 770 'IDBDatabase': _indexed_db_annotations, |
| 771 'MutationObserver': [ | 771 'MutationObserver': [ |
| 772 "@SupportedBrowser(SupportedBrowser.CHROME)", | 772 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 773 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 773 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 774 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 774 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 775 "@Experimental()", | 775 "@Experimental", |
| 776 ], | 776 ], |
| 777 'NotificationCenter': _webkit_experimental_annotations, | 777 'NotificationCenter': _webkit_experimental_annotations, |
| 778 'Performance': _performance_annotations, | 778 'Performance': _performance_annotations, |
| 779 'PopStateEvent': _history_annotations, | 779 'PopStateEvent': _history_annotations, |
| 780 'ShadowRoot': [ | 780 'ShadowRoot': [ |
| 781 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 781 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 782 "@Experimental()", | 782 "@Experimental", |
| 783 ], | 783 ], |
| 784 'SpeechRecognition': _speech_recognition_annotations, | 784 'SpeechRecognition': _speech_recognition_annotations, |
| 785 'SpeechRecognitionAlternative': _speech_recognition_annotations, | 785 'SpeechRecognitionAlternative': _speech_recognition_annotations, |
| 786 'SpeechRecognitionError': _speech_recognition_annotations, | 786 'SpeechRecognitionError': _speech_recognition_annotations, |
| 787 'SpeechRecognitionEvent': _speech_recognition_annotations, | 787 'SpeechRecognitionEvent': _speech_recognition_annotations, |
| 788 'SpeechRecognitionResult': _speech_recognition_annotations, | 788 'SpeechRecognitionResult': _speech_recognition_annotations, |
| 789 'WebSocket': _all_but_ie9_annotations, | 789 'WebSocket': _all_but_ie9_annotations, |
| 790 'WorkerContext.indexedDB': _indexed_db_annotations, | 790 'WorkerContext.indexedDB': _indexed_db_annotations, |
| 791 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, | 791 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, |
| 792 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, | 792 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 self) | 1389 self) |
| 1390 | 1390 |
| 1391 if type_data.clazz == 'SVGTearOff': | 1391 if type_data.clazz == 'SVGTearOff': |
| 1392 dart_interface_name = self._renamer.RenameInterface( | 1392 dart_interface_name = self._renamer.RenameInterface( |
| 1393 self._database.GetInterface(type_name)) | 1393 self._database.GetInterface(type_name)) |
| 1394 return SVGTearOffIDLTypeInfo( | 1394 return SVGTearOffIDLTypeInfo( |
| 1395 type_name, type_data, dart_interface_name, self) | 1395 type_name, type_data, dart_interface_name, self) |
| 1396 | 1396 |
| 1397 class_name = '%sIDLTypeInfo' % type_data.clazz | 1397 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1398 return globals()[class_name](type_name, type_data) | 1398 return globals()[class_name](type_name, type_data) |
| OLD | NEW |