Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: tools/dom/scripts/generator.py

Issue 12038036: SVG Library cleanups and adding supported tag. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 from htmlrenamer import html_interface_renames 11 from htmlrenamer import html_interface_renames
12 12
13 _pure_interfaces = set([ 13 _pure_interfaces = set([
14 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>. 14 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>.
15 'DOMStringMap', 15 'DOMStringMap',
16 'ElementTimeControl', 16 'ElementTimeControl',
17 'ElementTraversal', 17 'ElementTraversal',
18 'EventListener', 18 'EventListener',
19 'MediaQueryListListener', 19 'MediaQueryListListener',
20 'MutationCallback', 20 'MutationCallback',
21 'NodeSelector', 21 'NodeSelector',
22 'SVGExternalResourcesRequired',
23 'SVGFilterPrimitiveStandardAttributes', 22 'SVGFilterPrimitiveStandardAttributes',
24 'SVGFitToViewBox', 23 'SVGFitToViewBox',
25 'SVGLangSpace',
26 'SVGLocatable', 24 'SVGLocatable',
27 'SVGStylable',
28 'SVGTests', 25 'SVGTests',
29 'SVGTransformable', 26 'SVGTransformable',
30 'SVGURIReference', 27 'SVGURIReference',
31 'SVGZoomAndPan', 28 'SVGZoomAndPan',
32 'TimeoutHandler']) 29 'TimeoutHandler'])
33 30
34 def IsPureInterface(interface_name): 31 def IsPureInterface(interface_name):
35 return interface_name in _pure_interfaces 32 return interface_name in _pure_interfaces
36 33
37 34
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 "@annotation_Returns_SerializedScriptValue", 643 "@annotation_Returns_SerializedScriptValue",
647 ], 644 ],
648 645
649 'SQLResultSetRowList.item': ["@Creates('=Object')"], 646 'SQLResultSetRowList.item': ["@Creates('=Object')"],
650 647
651 'XMLHttpRequest.response': [ 648 'XMLHttpRequest.response': [
652 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", 649 "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')",
653 ], 650 ],
654 } 651 }
655 652
656 # Placeholder to add experimental flag, implementation for this is
657 # pending in a separate CL.
658 dart_annotations = {
Emily Fortuna 2013/01/24 21:55:17 This was getting lost because dart_annotations was
659 'Element.webkitMatchesSelector': ['@Experimental()'],
660 }
661
662 _indexed_db_annotations = [ 653 _indexed_db_annotations = [
663 "@SupportedBrowser(SupportedBrowser.CHROME)", 654 "@SupportedBrowser(SupportedBrowser.CHROME)",
664 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", 655 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')",
665 "@SupportedBrowser(SupportedBrowser.IE, '10')", 656 "@SupportedBrowser(SupportedBrowser.IE, '10')",
666 "@Experimental()", 657 "@Experimental()",
667 ] 658 ]
668 659
669 _file_system_annotations = [ 660 _file_system_annotations = [
670 "@SupportedBrowser(SupportedBrowser.CHROME)", 661 "@SupportedBrowser(SupportedBrowser.CHROME)",
671 "@Experimental()", 662 "@Experimental()",
(...skipping 18 matching lines...) Expand all
690 "@SupportedBrowser(SupportedBrowser.CHROME)", 681 "@SupportedBrowser(SupportedBrowser.CHROME)",
691 "@SupportedBrowser(SupportedBrowser.FIREFOX)", 682 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
692 "@SupportedBrowser(SupportedBrowser.IE)", 683 "@SupportedBrowser(SupportedBrowser.IE)",
693 ] 684 ]
694 685
695 _speech_recognition_annotations = [ 686 _speech_recognition_annotations = [
696 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", 687 "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
697 "@Experimental()", 688 "@Experimental()",
698 ] 689 ]
699 690
691 _no_ie_annotations = [
692 "@SupportedBrowser(SupportedBrowser.CHROME)",
693 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
694 "@SupportedBrowser(SupportedBrowser.SAFARI)",
695 ]
696
697 _svg_annotations = _all_but_ie9_annotations;
698
700 # Annotations to be placed on generated members. 699 # Annotations to be placed on generated members.
701 # The table is indexed as: 700 # The table is indexed as:
702 # INTERFACE: annotations to be added to the interface declaration 701 # INTERFACE: annotations to be added to the interface declaration
703 # INTERFACE.MEMBER: annotation to be added to the member declaration 702 # INTERFACE.MEMBER: annotation to be added to the member declaration
704 dart_annotations = { 703 dart_annotations = {
705 'ArrayBuffer': _all_but_ie9_annotations, 704 'ArrayBuffer': _all_but_ie9_annotations,
706 'ArrayBufferView': _all_but_ie9_annotations, 705 'ArrayBufferView': _all_but_ie9_annotations,
707 'DOMApplicationCache': [ 706 'DOMApplicationCache': [
708 "@SupportedBrowser(SupportedBrowser.CHROME)", 707 "@SupportedBrowser(SupportedBrowser.CHROME)",
709 "@SupportedBrowser(SupportedBrowser.FIREFOX)", 708 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
710 "@SupportedBrowser(SupportedBrowser.IE, '10')", 709 "@SupportedBrowser(SupportedBrowser.IE, '10')",
711 "@SupportedBrowser(SupportedBrowser.OPERA)", 710 "@SupportedBrowser(SupportedBrowser.OPERA)",
712 "@SupportedBrowser(SupportedBrowser.SAFARI)", 711 "@SupportedBrowser(SupportedBrowser.SAFARI)",
713 ], 712 ],
714 'DOMWindow.indexedDB': _indexed_db_annotations, 713 'DOMWindow.indexedDB': _indexed_db_annotations,
715 'DOMWindow.performance': _performance_annotations, 714 'DOMWindow.performance': _performance_annotations,
716 'DOMWindow.webkitNotifications': _webkit_experimental_annotations, 715 'DOMWindow.webkitNotifications': _webkit_experimental_annotations,
717 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, 716 'DOMWindow.webkitRequestFileSystem': _file_system_annotations,
718 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, 717 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations,
718 # Placeholder to add experimental flag, implementation for this is
719 # pending in a separate CL.
720 'Element.webkitMatchesSelector': ['@Experimental()'],
719 'Element.webkitCreateShadowRoot': [ 721 'Element.webkitCreateShadowRoot': [
720 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", 722 "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
721 "@Experimental()", 723 "@Experimental()",
722 ], 724 ],
723 'FileSystem': _file_system_annotations, 725 'FileSystem': _file_system_annotations,
724 'FileSystemSync': _file_system_annotations, 726 'FileSystemSync': _file_system_annotations,
725 'HashChangeEvent': [ 727 'HashChangeEvent': [
726 "@SupportedBrowser(SupportedBrowser.CHROME)", 728 "@SupportedBrowser(SupportedBrowser.CHROME)",
727 "@SupportedBrowser(SupportedBrowser.FIREFOX)", 729 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
728 "@SupportedBrowser(SupportedBrowser.SAFARI)", 730 "@SupportedBrowser(SupportedBrowser.SAFARI)",
729 ], 731 ],
730 'History.pushState': _history_annotations, 732 'History.pushState': _history_annotations,
731 'History.replaceState': _history_annotations, 733 'History.replaceState': _history_annotations,
732 'HTMLContentElement': [ 734 'HTMLContentElement': [
733 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", 735 "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
734 "@Experimental()", 736 "@Experimental()",
735 ], 737 ],
736 'HTMLDataListElement': _all_but_ie9_annotations, 738 'HTMLDataListElement': _all_but_ie9_annotations,
737 'HTMLDetailsElement': _webkit_experimental_annotations, 739 'HTMLDetailsElement': _webkit_experimental_annotations,
738 'HTMLEmbedElement': [ 740 'HTMLEmbedElement': [
739 "@SupportedBrowser(SupportedBrowser.CHROME)", 741 "@SupportedBrowser(SupportedBrowser.CHROME)",
740 "@SupportedBrowser(SupportedBrowser.IE)", 742 "@SupportedBrowser(SupportedBrowser.IE)",
741 "@SupportedBrowser(SupportedBrowser.SAFARI)", 743 "@SupportedBrowser(SupportedBrowser.SAFARI)",
742 ], 744 ],
743 'HTMLKeygenElement': _webkit_experimental_annotations, 745 'HTMLKeygenElement': _webkit_experimental_annotations,
744 'HTMLMeterElement': [ 746 'HTMLMeterElement': _no_ie_annotations,
745 "@SupportedBrowser(SupportedBrowser.CHROME)", 747 'HTMLObjectElement': _no_ie_annotations,
746 "@SupportedBrowser(SupportedBrowser.FIREFOX)", 748 'HTMLOutputElement': _no_ie_annotations,
747 "@SupportedBrowser(SupportedBrowser.SAFARI)",
748 ],
749 'HTMLObjectElement': [
750 "@SupportedBrowser(SupportedBrowser.CHROME)",
751 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
752 "@SupportedBrowser(SupportedBrowser.SAFARI)",
753 ],
754 'HTMLOutputElement': [
755 "@SupportedBrowser(SupportedBrowser.CHROME)",
756 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
757 "@SupportedBrowser(SupportedBrowser.SAFARI)",
758 ],
759 'HTMLProgressElement': _all_but_ie9_annotations, 749 'HTMLProgressElement': _all_but_ie9_annotations,
760 'HTMLShadowElement': [ 750 'HTMLShadowElement': [
761 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", 751 "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
762 "@Experimental()", 752 "@Experimental()",
763 ], 753 ],
764 'HTMLTrackElement': [ 754 'HTMLTrackElement': [
765 "@SupportedBrowser(SupportedBrowser.CHROME)", 755 "@SupportedBrowser(SupportedBrowser.CHROME)",
766 "@SupportedBrowser(SupportedBrowser.IE, '10')", 756 "@SupportedBrowser(SupportedBrowser.IE, '10')",
767 "@SupportedBrowser(SupportedBrowser.SAFARI)", 757 "@SupportedBrowser(SupportedBrowser.SAFARI)",
768 ], 758 ],
(...skipping 10 matching lines...) Expand all
779 'PopStateEvent': _history_annotations, 769 'PopStateEvent': _history_annotations,
780 'ShadowRoot': [ 770 'ShadowRoot': [
781 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", 771 "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
782 "@Experimental()", 772 "@Experimental()",
783 ], 773 ],
784 'SpeechRecognition': _speech_recognition_annotations, 774 'SpeechRecognition': _speech_recognition_annotations,
785 'SpeechRecognitionAlternative': _speech_recognition_annotations, 775 'SpeechRecognitionAlternative': _speech_recognition_annotations,
786 'SpeechRecognitionError': _speech_recognition_annotations, 776 'SpeechRecognitionError': _speech_recognition_annotations,
787 'SpeechRecognitionEvent': _speech_recognition_annotations, 777 'SpeechRecognitionEvent': _speech_recognition_annotations,
788 'SpeechRecognitionResult': _speech_recognition_annotations, 778 'SpeechRecognitionResult': _speech_recognition_annotations,
779 'SVGAltGlyphElement': _no_ie_annotations,
780 'SVGAnimateElement': _no_ie_annotations,
781 'SVGAnimateMotionElement': _no_ie_annotations,
782 'SVGAnimateTransformElement': _no_ie_annotations,
783 'SVGFEBlendElement': _svg_annotations,
784 'SVGFEColorMatrixElement': _svg_annotations,
785 'SVGFEComponentTransferElement': _svg_annotations,
786 'SVGFEConvolveMatrixElement': _svg_annotations,
787 'SVGFEDiffuseLightingElement': _svg_annotations,
788 'SVGFEDisplacementMapElement': _svg_annotations,
789 'SVGFEDistantLightElement': _svg_annotations,
790 'SVGFEFloodElement': _svg_annotations,
791 'SVGFEFuncAElement': _svg_annotations,
792 'SVGFEFuncBElement': _svg_annotations,
793 'SVGFEFuncGElement': _svg_annotations,
794 'SVGFEFuncRElement': _svg_annotations,
795 'SVGFEGaussianBlurElement': _svg_annotations,
796 'SVGFEImageElement': _svg_annotations,
797 'SVGFEMergeElement': _svg_annotations,
798 'SVGFEMergeNodeElement': _svg_annotations,
799 'SVGFEMorphology': _svg_annotations,
800 'SVGFEOffsetElement': _svg_annotations,
801 'SVGFEPointLightElement': _svg_annotations,
802 'SVGFESpecularLightingElement': _svg_annotations,
803 'SVGFESpotLightElement': _svg_annotations,
804 'SVGFETileElement': _svg_annotations,
805 'SVGFETurbulenceElement': _svg_annotations,
806 'SVGFilterElement': _svg_annotations,
807 'SVGForeignObjectElement': _no_ie_annotations,
808 'SVGSetElement': _no_ie_annotations,
789 'WebSocket': _all_but_ie9_annotations, 809 'WebSocket': _all_but_ie9_annotations,
790 'WorkerContext.indexedDB': _indexed_db_annotations, 810 'WorkerContext.indexedDB': _indexed_db_annotations,
791 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, 811 'WorkerContext.webkitRequestFileSystem': _file_system_annotations,
792 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, 812 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations,
793 'WorkerContext.webkitResolveLocalFileSystemSyncURL': _file_system_annotations, 813 'WorkerContext.webkitResolveLocalFileSystemSyncURL': _file_system_annotations,
794 'WorkerContext.webkitResolveLocalFileSystemURL': _file_system_annotations, 814 'WorkerContext.webkitResolveLocalFileSystemURL': _file_system_annotations,
795 } 815 }
796 816
797 def FindCommonAnnotations(interface_name, member_name=None): 817 def FindCommonAnnotations(interface_name, member_name=None):
798 """ Finds annotations common between dart2js and dartium. 818 """ Finds annotations common between dart2js and dartium.
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 self) 1408 self)
1389 1409
1390 if type_data.clazz == 'SVGTearOff': 1410 if type_data.clazz == 'SVGTearOff':
1391 dart_interface_name = self._renamer.RenameInterface( 1411 dart_interface_name = self._renamer.RenameInterface(
1392 self._database.GetInterface(type_name)) 1412 self._database.GetInterface(type_name))
1393 return SVGTearOffIDLTypeInfo( 1413 return SVGTearOffIDLTypeInfo(
1394 type_name, type_data, dart_interface_name, self) 1414 type_name, type_data, dart_interface_name, self)
1395 1415
1396 class_name = '%sIDLTypeInfo' % type_data.clazz 1416 class_name = '%sIDLTypeInfo' % type_data.clazz
1397 return globals()[class_name](type_name, type_data) 1417 return globals()[class_name](type_name, type_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698