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

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

Issue 35013003: Revert "Revert "Removing some deprecated members"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/src/EventStreamProvider.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import logging 5 import logging
6 import monitored 6 import monitored
7 import re 7 import re
8 8
9 typed_array_renames = { 9 typed_array_renames = {
10 'ArrayBuffer': 'ByteBuffer', 10 'ArrayBuffer': 'ByteBuffer',
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 'RTCPeerConnection.setLocalDescription', 149 'RTCPeerConnection.setLocalDescription',
150 'RTCPeerConnection.setRemoteDescription', 150 'RTCPeerConnection.setRemoteDescription',
151 'StorageInfo.requestQuota', 151 'StorageInfo.requestQuota',
152 'StorageQuota.requestQuota', 152 'StorageQuota.requestQuota',
153 'Window.webkitRequestFileSystem', 153 'Window.webkitRequestFileSystem',
154 'Window.webkitResolveLocalFileSystemURL', 154 'Window.webkitResolveLocalFileSystemURL',
155 'WorkerGlobalScope.webkitRequestFileSystem', 155 'WorkerGlobalScope.webkitRequestFileSystem',
156 'WorkerGlobalScope.webkitResolveLocalFileSystemURL', 156 'WorkerGlobalScope.webkitResolveLocalFileSystemURL',
157 ]) 157 ])
158 158
159 # "Private" members in the form $dom_foo.
160 # TODO(efortuna): Remove this set. This allows us to make the change of removing
161 # $dom in installments instead of all at once, but the intent is to move all of
162 # these either into private_html_members or remove them from this list entirely.
163 dom_private_html_members = monitored.Set('htmlrenamer.private_html_members', [
164 'EventTarget.addEventListener',
165 'EventTarget.removeEventListener',
166 ])
167
168 # Classes where we have customized constructors, but we need to keep the old 159 # Classes where we have customized constructors, but we need to keep the old
169 # constructor for dispatch purposes. 160 # constructor for dispatch purposes.
170 custom_html_constructors = monitored.Set( 161 custom_html_constructors = monitored.Set(
171 'htmlrenamer.custom_html_constructors', [ 162 'htmlrenamer.custom_html_constructors', [
172 'HTMLOptionElement', 163 'HTMLOptionElement',
173 'MutationObserver', 164 'MutationObserver',
174 ]) 165 ])
175 166
176 # Members from the standard dom that should not be exposed publicly in dart:html 167 # Members from the standard dom that should not be exposed publicly in dart:html
177 # but need to be exposed internally to implement dart:html on top of a standard 168 # but need to be exposed internally to implement dart:html on top of a standard
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 }) 751 })
761 752
762 _library_ids = monitored.Dict('htmlrenamer._library_names', { 753 _library_ids = monitored.Dict('htmlrenamer._library_names', {
763 'ANGLEInstancedArrays': 'WebGl', 754 'ANGLEInstancedArrays': 'WebGl',
764 'Database': 'WebSql', 755 'Database': 'WebSql',
765 'Navigator': 'Html', 756 'Navigator': 'Html',
766 'Window': 'Html', 757 'Window': 'Html',
767 }) 758 })
768 759
769 class HtmlRenamer(object): 760 class HtmlRenamer(object):
770 def __init__(self, database): 761 def __init__(self, database, metadata):
771 self._database = database 762 self._database = database
763 self._metadata = metadata
772 764
773 def RenameInterface(self, interface): 765 def RenameInterface(self, interface):
774 if 'Callback' in interface.ext_attrs: 766 if 'Callback' in interface.ext_attrs:
775 if interface.id in _removed_html_interfaces: 767 if interface.id in _removed_html_interfaces:
776 return None 768 return None
777 769
778 candidate = self.RenameInterfaceId(interface.id) 770 candidate = self.RenameInterfaceId(interface.id)
779 if candidate: 771 if candidate:
780 return candidate 772 return candidate
781 773
(...skipping 27 matching lines...) Expand all
809 if 'CheckSecurityForNode' in member_node.ext_attrs: 801 if 'CheckSecurityForNode' in member_node.ext_attrs:
810 return None 802 return None
811 803
812 name = self._FindMatch(interface, member, member_prefix, 804 name = self._FindMatch(interface, member, member_prefix,
813 renamed_html_members) 805 renamed_html_members)
814 806
815 target_name = renamed_html_members[name] if name else member 807 target_name = renamed_html_members[name] if name else member
816 if self._FindMatch(interface, member, member_prefix, private_html_members): 808 if self._FindMatch(interface, member, member_prefix, private_html_members):
817 if not target_name.startswith('_'): # e.g. _svgClassName 809 if not target_name.startswith('_'): # e.g. _svgClassName
818 target_name = '_' + target_name 810 target_name = '_' + target_name
819 elif self._FindMatch(interface, member, member_prefix,
820 dom_private_html_members):
821 if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName
822 target_name = '$dom_' + target_name
823 811
824 if not name and target_name.startswith('webkit'): 812 if not name and target_name.startswith('webkit'):
825 target_name = member[len('webkit'):] 813 target_name = member[len('webkit'):]
826 target_name = target_name[:1].lower() + target_name[1:] 814 target_name = target_name[:1].lower() + target_name[1:]
827 815
828 if dartify_name: 816 if dartify_name:
829 target_name = self._DartifyMemberName(target_name) 817 target_name = self._DartifyMemberName(target_name)
830 return target_name 818 return target_name
831 819
832 def ShouldSuppressMember(self, interface, member, member_prefix=''): 820 def ShouldSuppressMember(self, interface, member, member_prefix=''):
833 """ Returns true if the member should be suppressed.""" 821 """ Returns true if the member should be suppressed."""
834 if self._FindMatch(interface, member, member_prefix, removed_html_members): 822 if self._FindMatch(interface, member, member_prefix, removed_html_members):
835 return True 823 return True
836 if interface.id in _removed_html_interfaces: 824 if interface.id in _removed_html_interfaces:
837 return True 825 return True
826 metadata_member = member
827 if member_prefix == 'on:':
828 metadata_member = 'on' + metadata_member.lower()
829 if self._metadata.IsDeprecated(interface, metadata_member):
830 return True
838 return False 831 return False
839 832
840 def ShouldSuppressInterface(self, interface): 833 def ShouldSuppressInterface(self, interface):
841 """ Returns true if the interface should be suppressed.""" 834 """ Returns true if the interface should be suppressed."""
842 if interface.id in _removed_html_interfaces: 835 if interface.id in _removed_html_interfaces:
843 return True 836 return True
844 837
845 def _FindMatch(self, interface, member, member_prefix, candidates): 838 def _FindMatch(self, interface, member, member_prefix, candidates):
846 for interface in self._database.Hierarchy(interface): 839 for interface in self._database.Hierarchy(interface):
847 member_name = interface.id + '.' + member 840 member_name = interface.id + '.' + member
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 936
944 # We're looking for a sequence of letters which start with capital letter 937 # We're looking for a sequence of letters which start with capital letter
945 # then a series of caps and finishes with either the end of the string or 938 # then a series of caps and finishes with either the end of the string or
946 # a capital letter. 939 # a capital letter.
947 # The [0-9] check is for names such as 2D or 3D 940 # The [0-9] check is for names such as 2D or 3D
948 # The following test cases should match as: 941 # The following test cases should match as:
949 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 942 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
950 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 943 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
951 # IFrameElement: (I)()(F)rameElement (no change) 944 # IFrameElement: (I)()(F)rameElement (no change)
952 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 945 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/src/EventStreamProvider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698