| 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 _history_annotations = [ | 631 _all_but_ie9_annotations = [ |
| 632 "@SupportedBrowser(SupportedBrowser.CHROME)", | 632 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 634 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 634 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 635 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 635 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 636 ] | 636 ] |
| 637 | 637 |
| 638 _history_annotations = _all_but_ie9_annotations |
| 639 |
| 638 # Annotations to be placed on generated members. | 640 # Annotations to be placed on generated members. |
| 639 # The table is indexed as: | 641 # The table is indexed as: |
| 640 # INTERFACE: annotations to be added to the interface declaration | 642 # INTERFACE: annotations to be added to the interface declaration |
| 641 # INTERFACE.MEMBER: annotation to be added to the member declaration | 643 # INTERFACE.MEMBER: annotation to be added to the member declaration |
| 642 dart_annotations = { | 644 dart_annotations = { |
| 643 'ArrayBuffer': [ | 645 'ArrayBuffer': _all_but_ie9_annotations, |
| 644 "@SupportedBrowser(SupportedBrowser.CHROME)", | 646 'ArrayBufferView': _all_but_ie9_annotations, |
| 645 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | |
| 646 "@SupportedBrowser(SupportedBrowser.IE, '10')", | |
| 647 "@SupportedBrowser(SupportedBrowser.SAFARI)", | |
| 648 ], | |
| 649 'ArrayBufferView': [ | |
| 650 "@SupportedBrowser(SupportedBrowser.CHROME)", | |
| 651 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | |
| 652 "@SupportedBrowser(SupportedBrowser.IE, '10')", | |
| 653 "@SupportedBrowser(SupportedBrowser.SAFARI)", | |
| 654 ], | |
| 655 'DOMWindow.indexedDB': _indexed_db_annotations, | 647 'DOMWindow.indexedDB': _indexed_db_annotations, |
| 656 'Element.webkitCreateShadowRoot': [ | 648 'Element.webkitCreateShadowRoot': [ |
| 657 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 649 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 658 "@Experimental()", | 650 "@Experimental()", |
| 659 ], | 651 ], |
| 660 'History.pushState': _history_annotations, | 652 'History.pushState': _history_annotations, |
| 661 'History.replaceState': _history_annotations, | 653 'History.replaceState': _history_annotations, |
| 662 'HTMLContentElement': [ | 654 'HTMLContentElement': [ |
| 663 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 655 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 664 "@Experimental()", | 656 "@Experimental()", |
| 665 ], | 657 ], |
| 666 'HTMLDataListElement': [ | 658 'HTMLDataListElement': _all_but_ie9_annotations, |
| 667 "@SupportedBrowser(SupportedBrowser.CHROME)", | |
| 668 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | |
| 669 "@SupportedBrowser(SupportedBrowser.IE, '10')", | |
| 670 "@SupportedBrowser(SupportedBrowser.SAFARI)", | |
| 671 ], | |
| 672 'HTMLDetailsElement': [ | 659 'HTMLDetailsElement': [ |
| 673 "@SupportedBrowser(SupportedBrowser.CHROME)", | 660 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 674 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 661 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 675 "@Experimental()", | 662 "@Experimental()", |
| 676 ], | 663 ], |
| 677 'HTMLEmbedElement': [ | 664 'HTMLEmbedElement': [ |
| 678 "@SupportedBrowser(SupportedBrowser.CHROME)", | 665 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 679 "@SupportedBrowser(SupportedBrowser.IE)", | 666 "@SupportedBrowser(SupportedBrowser.IE)", |
| 680 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 667 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 681 ], | 668 ], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 692 'HTMLObjectElement': [ | 679 'HTMLObjectElement': [ |
| 693 "@SupportedBrowser(SupportedBrowser.CHROME)", | 680 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 694 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 681 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 695 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 682 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 696 ], | 683 ], |
| 697 'HTMLOutputElement': [ | 684 'HTMLOutputElement': [ |
| 698 "@SupportedBrowser(SupportedBrowser.CHROME)", | 685 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 699 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 686 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 700 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 687 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 701 ], | 688 ], |
| 702 'HTMLProgressElement': [ | 689 'HTMLProgressElement': _all_but_ie9_annotations, |
| 703 "@SupportedBrowser(SupportedBrowser.CHROME)", | |
| 704 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | |
| 705 "@SupportedBrowser(SupportedBrowser.IE, '10')", | |
| 706 "@SupportedBrowser(SupportedBrowser.SAFARI)", | |
| 707 ], | |
| 708 'HTMLShadowElement': [ | 690 'HTMLShadowElement': [ |
| 709 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 691 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 710 "@Experimental()", | 692 "@Experimental()", |
| 711 ], | 693 ], |
| 712 'HTMLTrackElement': [ | 694 'HTMLTrackElement': [ |
| 713 "@SupportedBrowser(SupportedBrowser.CHROME)", | 695 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 714 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 696 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 715 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 697 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 716 ], | 698 ], |
| 717 'IDBFactory': _indexed_db_annotations, | 699 'IDBFactory': _indexed_db_annotations, |
| 718 'IDBDatabase': _indexed_db_annotations, | 700 'IDBDatabase': _indexed_db_annotations, |
| 719 'ShadowRoot': [ | 701 'ShadowRoot': [ |
| 720 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 702 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 721 "@Experimental()", | 703 "@Experimental()", |
| 722 ], | 704 ], |
| 705 'WebSocket': _all_but_ie9_annotations, |
| 723 'WorkerContext.indexedDB': _indexed_db_annotations, | 706 'WorkerContext.indexedDB': _indexed_db_annotations, |
| 724 } | 707 } |
| 725 | 708 |
| 726 def FindCommonAnnotations(interface_name, member_name=None): | 709 def FindCommonAnnotations(interface_name, member_name=None): |
| 727 """ Finds annotations common between dart2js and dartium. | 710 """ Finds annotations common between dart2js and dartium. |
| 728 """ | 711 """ |
| 729 if member_name: | 712 if member_name: |
| 730 return dart_annotations.get('%s.%s' % (interface_name, member_name)) | 713 return dart_annotations.get('%s.%s' % (interface_name, member_name)) |
| 731 else: | 714 else: |
| 732 return dart_annotations.get(interface_name) | 715 return dart_annotations.get(interface_name) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 self) | 1281 self) |
| 1299 | 1282 |
| 1300 if type_data.clazz == 'SVGTearOff': | 1283 if type_data.clazz == 'SVGTearOff': |
| 1301 dart_interface_name = self._renamer.RenameInterface( | 1284 dart_interface_name = self._renamer.RenameInterface( |
| 1302 self._database.GetInterface(type_name)) | 1285 self._database.GetInterface(type_name)) |
| 1303 return SVGTearOffIDLTypeInfo( | 1286 return SVGTearOffIDLTypeInfo( |
| 1304 type_name, type_data, dart_interface_name, self) | 1287 type_name, type_data, dart_interface_name, self) |
| 1305 | 1288 |
| 1306 class_name = '%sIDLTypeInfo' % type_data.clazz | 1289 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1307 return globals()[class_name](type_name, type_data) | 1290 return globals()[class_name](type_name, type_data) |
| OLD | NEW |