| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 'SerializedScriptValue': | 608 'SerializedScriptValue': |
| 609 "@annotation_Creates_SerializedScriptValue " | 609 "@annotation_Creates_SerializedScriptValue " |
| 610 "@annotation_Returns_SerializedScriptValue", | 610 "@annotation_Returns_SerializedScriptValue", |
| 611 | 611 |
| 612 'SQLResultSetRowList.item': "@Creates('=Object')", | 612 'SQLResultSetRowList.item': "@Creates('=Object')", |
| 613 | 613 |
| 614 'XMLHttpRequest.response': | 614 'XMLHttpRequest.response': |
| 615 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", | 615 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", |
| 616 } | 616 } |
| 617 | 617 |
| 618 # Placeholder to add experimental flag, implementation for this is | |
| 619 # pending in a separate CL. | |
| 620 dart_annotations = { | |
| 621 'Element.webkitMatchesSelector': ['@Experimental()'], | |
| 622 } | |
| 623 | |
| 624 _indexed_db_annotations = [ | 618 _indexed_db_annotations = [ |
| 625 "@SupportedBrowser(SupportedBrowser.CHROME)", | 619 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 626 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", | 620 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", |
| 627 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 621 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 628 "@Experimental()", | 622 "@Experimental()", |
| 629 ] | 623 ] |
| 630 | 624 |
| 631 _all_but_ie9_annotations = [ | 625 _all_but_ie9_annotations = [ |
| 632 "@SupportedBrowser(SupportedBrowser.CHROME)", | 626 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 627 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 634 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 628 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 635 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 629 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 636 ] | 630 ] |
| 637 | 631 |
| 638 _history_annotations = _all_but_ie9_annotations | 632 _history_annotations = _all_but_ie9_annotations |
| 639 | 633 |
| 634 _media_stream_annotations = [ |
| 635 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 636 "@Experimental()", |
| 637 ] |
| 638 |
| 640 # Annotations to be placed on generated members. | 639 # Annotations to be placed on generated members. |
| 641 # The table is indexed as: | 640 # The table is indexed as: |
| 642 # INTERFACE: annotations to be added to the interface declaration | 641 # INTERFACE: annotations to be added to the interface declaration |
| 643 # INTERFACE.MEMBER: annotation to be added to the member declaration | 642 # INTERFACE.MEMBER: annotation to be added to the member declaration |
| 644 dart_annotations = { | 643 dart_annotations = { |
| 645 'ArrayBuffer': _all_but_ie9_annotations, | 644 'ArrayBuffer': _all_but_ie9_annotations, |
| 646 'ArrayBufferView': _all_but_ie9_annotations, | 645 'ArrayBufferView': _all_but_ie9_annotations, |
| 647 'DOMWindow.indexedDB': _indexed_db_annotations, | 646 'DOMWindow.indexedDB': _indexed_db_annotations, |
| 648 'Element.webkitCreateShadowRoot': [ | 647 'Element.webkitCreateShadowRoot': [ |
| 649 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 648 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 650 "@Experimental()", | 649 "@Experimental()", |
| 651 ], | 650 ], |
| 651 'Element.webkitMatchesSelector': ['@Experimental()'], |
| 652 'History.pushState': _history_annotations, | 652 'History.pushState': _history_annotations, |
| 653 'History.replaceState': _history_annotations, | 653 'History.replaceState': _history_annotations, |
| 654 'HTMLContentElement': [ | 654 'HTMLContentElement': [ |
| 655 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 655 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 656 "@Experimental()", | 656 "@Experimental()", |
| 657 ], | 657 ], |
| 658 'HTMLDataListElement': _all_but_ie9_annotations, | 658 'HTMLDataListElement': _all_but_ie9_annotations, |
| 659 'HTMLDetailsElement': [ | 659 'HTMLDetailsElement': [ |
| 660 "@SupportedBrowser(SupportedBrowser.CHROME)", | 660 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 661 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 661 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| (...skipping 29 matching lines...) Expand all Loading... |
| 691 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 691 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 692 "@Experimental()", | 692 "@Experimental()", |
| 693 ], | 693 ], |
| 694 'HTMLTrackElement': [ | 694 'HTMLTrackElement': [ |
| 695 "@SupportedBrowser(SupportedBrowser.CHROME)", | 695 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 696 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 696 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 697 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 697 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 698 ], | 698 ], |
| 699 'IDBFactory': _indexed_db_annotations, | 699 'IDBFactory': _indexed_db_annotations, |
| 700 'IDBDatabase': _indexed_db_annotations, | 700 'IDBDatabase': _indexed_db_annotations, |
| 701 'Navigator.webkitGetUserMedia': _media_stream_annotations, |
| 701 'ShadowRoot': [ | 702 'ShadowRoot': [ |
| 702 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 703 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 703 "@Experimental()", | 704 "@Experimental()", |
| 704 ], | 705 ], |
| 705 'WebSocket': _all_but_ie9_annotations, | 706 'WebSocket': _all_but_ie9_annotations, |
| 706 'WorkerContext.indexedDB': _indexed_db_annotations, | 707 'WorkerContext.indexedDB': _indexed_db_annotations, |
| 707 } | 708 } |
| 708 | 709 |
| 709 def FindCommonAnnotations(interface_name, member_name=None): | 710 def FindCommonAnnotations(interface_name, member_name=None): |
| 710 """ Finds annotations common between dart2js and dartium. | 711 """ Finds annotations common between dart2js and dartium. |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 self) | 1282 self) |
| 1282 | 1283 |
| 1283 if type_data.clazz == 'SVGTearOff': | 1284 if type_data.clazz == 'SVGTearOff': |
| 1284 dart_interface_name = self._renamer.RenameInterface( | 1285 dart_interface_name = self._renamer.RenameInterface( |
| 1285 self._database.GetInterface(type_name)) | 1286 self._database.GetInterface(type_name)) |
| 1286 return SVGTearOffIDLTypeInfo( | 1287 return SVGTearOffIDLTypeInfo( |
| 1287 type_name, type_data, dart_interface_name, self) | 1288 type_name, type_data, dart_interface_name, self) |
| 1288 | 1289 |
| 1289 class_name = '%sIDLTypeInfo' % type_data.clazz | 1290 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1290 return globals()[class_name](type_name, type_data) | 1291 return globals()[class_name](type_name, type_data) |
| OLD | NEW |