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

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

Issue 30353003: 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
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 159 # "Private" members in the form $dom_foo.
160 # TODO(efortuna): Remove this set. This allows us to make the change of removing 160 # TODO(efortuna): Remove this set. This allows us to make the change of removing
Emily Fortuna 2013/10/21 21:57:48 can we delete this whole object and its comments t
blois 2013/10/21 23:23:35 Done.
161 # $dom in installments instead of all at once, but the intent is to move all of 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. 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', [ 163 dom_private_html_members = monitored.Set('htmlrenamer.private_html_members', [
164 'EventTarget.addEventListener',
165 'EventTarget.removeEventListener',
166 ]) 164 ])
167 165
168 # Classes where we have customized constructors, but we need to keep the old 166 # Classes where we have customized constructors, but we need to keep the old
169 # constructor for dispatch purposes. 167 # constructor for dispatch purposes.
170 custom_html_constructors = monitored.Set( 168 custom_html_constructors = monitored.Set(
171 'htmlrenamer.custom_html_constructors', [ 169 'htmlrenamer.custom_html_constructors', [
172 'HTMLOptionElement', 170 'HTMLOptionElement',
173 'MutationObserver', 171 'MutationObserver',
174 ]) 172 ])
175 173
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 'Element.getElementsByTagName', 224 'Element.getElementsByTagName',
227 'Element.scrollIntoView', 225 'Element.scrollIntoView',
228 'Element.scrollIntoViewIfNeeded', 226 'Element.scrollIntoViewIfNeeded',
229 'Element.removeAttribute', 227 'Element.removeAttribute',
230 'Element.removeAttributeNS', 228 'Element.removeAttributeNS',
231 'Element.hasAttribute', 229 'Element.hasAttribute',
232 'Element.hasAttributeNS', 230 'Element.hasAttributeNS',
233 'Element.innerHTML', 231 'Element.innerHTML',
234 'Element.querySelectorAll', 232 'Element.querySelectorAll',
235 'Event.initEvent', 233 'Event.initEvent',
234 'EventTarget.addEventListener',
235 'EventTarget.removeEventListener',
236 'Geolocation.clearWatch', 236 'Geolocation.clearWatch',
237 'Geolocation.getCurrentPosition', 237 'Geolocation.getCurrentPosition',
238 'Geolocation.watchPosition', 238 'Geolocation.watchPosition',
239 'HashChangeEvent.initHashChangeEvent', 239 'HashChangeEvent.initHashChangeEvent',
240 'HTMLCanvasElement.toDataURL', 240 'HTMLCanvasElement.toDataURL',
241 'HTMLTableElement.createCaption', 241 'HTMLTableElement.createCaption',
242 'HTMLTableElement.createTFoot', 242 'HTMLTableElement.createTFoot',
243 'HTMLTableElement.createTHead', 243 'HTMLTableElement.createTHead',
244 'HTMLTableElement.createTBody', 244 'HTMLTableElement.createTBody',
245 'HTMLTableElement.insertRow', 245 'HTMLTableElement.insertRow',
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 }) 760 })
761 761
762 _library_ids = monitored.Dict('htmlrenamer._library_names', { 762 _library_ids = monitored.Dict('htmlrenamer._library_names', {
763 'ANGLEInstancedArrays': 'WebGl', 763 'ANGLEInstancedArrays': 'WebGl',
764 'Database': 'WebSql', 764 'Database': 'WebSql',
765 'Navigator': 'Html', 765 'Navigator': 'Html',
766 'Window': 'Html', 766 'Window': 'Html',
767 }) 767 })
768 768
769 class HtmlRenamer(object): 769 class HtmlRenamer(object):
770 def __init__(self, database): 770 def __init__(self, database, metadata):
771 self._database = database 771 self._database = database
772 self._metadata = metadata
772 773
773 def RenameInterface(self, interface): 774 def RenameInterface(self, interface):
774 if 'Callback' in interface.ext_attrs: 775 if 'Callback' in interface.ext_attrs:
775 if interface.id in _removed_html_interfaces: 776 if interface.id in _removed_html_interfaces:
776 return None 777 return None
777 778
778 candidate = self.RenameInterfaceId(interface.id) 779 candidate = self.RenameInterfaceId(interface.id)
779 if candidate: 780 if candidate:
780 return candidate 781 return candidate
781 782
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 if dartify_name: 829 if dartify_name:
829 target_name = self._DartifyMemberName(target_name) 830 target_name = self._DartifyMemberName(target_name)
830 return target_name 831 return target_name
831 832
832 def ShouldSuppressMember(self, interface, member, member_prefix=''): 833 def ShouldSuppressMember(self, interface, member, member_prefix=''):
833 """ Returns true if the member should be suppressed.""" 834 """ Returns true if the member should be suppressed."""
834 if self._FindMatch(interface, member, member_prefix, removed_html_members): 835 if self._FindMatch(interface, member, member_prefix, removed_html_members):
835 return True 836 return True
836 if interface.id in _removed_html_interfaces: 837 if interface.id in _removed_html_interfaces:
837 return True 838 return True
839 metadata_member = member
840 if member_prefix == 'on:':
841 metadata_member = 'on' + metadata_member.lower()
842 if self._metadata.IsDeprecated(interface, metadata_member):
843 return True
838 return False 844 return False
839 845
840 def ShouldSuppressInterface(self, interface): 846 def ShouldSuppressInterface(self, interface):
841 """ Returns true if the interface should be suppressed.""" 847 """ Returns true if the interface should be suppressed."""
842 if interface.id in _removed_html_interfaces: 848 if interface.id in _removed_html_interfaces:
843 return True 849 return True
844 850
845 def _FindMatch(self, interface, member, member_prefix, candidates): 851 def _FindMatch(self, interface, member, member_prefix, candidates):
846 for interface in self._database.Hierarchy(interface): 852 for interface in self._database.Hierarchy(interface):
847 member_name = interface.id + '.' + member 853 member_name = interface.id + '.' + member
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 949
944 # We're looking for a sequence of letters which start with capital letter 950 # 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 951 # then a series of caps and finishes with either the end of the string or
946 # a capital letter. 952 # a capital letter.
947 # The [0-9] check is for names such as 2D or 3D 953 # The [0-9] check is for names such as 2D or 3D
948 # The following test cases should match as: 954 # The following test cases should match as:
949 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 955 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
950 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 956 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
951 # IFrameElement: (I)()(F)rameElement (no change) 957 # IFrameElement: (I)()(F)rameElement (no change)
952 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 958 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698