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

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

Issue 10823352: Rename XMLHttpRequest to HttpRequest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « no previous file | lib/dom/src/_HttpRequestUtils.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 5
6 _html_strip_webkit_prefix_classes = [ 6 _html_strip_webkit_prefix_classes = [
7 'Animation', 7 'Animation',
8 'AnimationEvent', 8 'AnimationEvent',
9 'AnimationList', 9 'AnimationList',
10 'BlobBuilder', 10 'BlobBuilder',
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if interface.id.startswith('HTML'): 271 if interface.id.startswith('HTML'):
272 if any(interface.id in ['Element', 'Document'] 272 if any(interface.id in ['Element', 'Document']
273 for interface in self._database.Hierarchy(interface)): 273 for interface in self._database.Hierarchy(interface)):
274 return interface.id[len('HTML'):] 274 return interface.id[len('HTML'):]
275 elif interface.id.startswith('WebKit'): 275 elif interface.id.startswith('WebKit'):
276 stripped_name = interface.id[len('WebKit'):] 276 stripped_name = interface.id[len('WebKit'):]
277 if stripped_name in _html_strip_webkit_prefix_classes: 277 if stripped_name in _html_strip_webkit_prefix_classes:
278 return stripped_name 278 return stripped_name
279 elif interface.id == 'DOMWindow': 279 elif interface.id == 'DOMWindow':
280 return 'Window' 280 return 'Window'
281 elif interface.id.startswith('XML') and interface.id != 'XMLSerializer':
sra1 2012/08/16 19:10:33 I'd much prefer an explicit test. We are really ch
Emily Fortuna 2012/08/16 20:11:24 Done.
282 return interface.id[len('XML'):]
281 return interface.id 283 return interface.id
282 284
283 def RenameMember(self, interface_name, member, member_prefix=''): 285 def RenameMember(self, interface_name, member, member_prefix=''):
284 """ 286 """
285 Returns the name of the member in the HTML library or None if the member is 287 Returns the name of the member in the HTML library or None if the member is
286 suppressed in the HTML library 288 suppressed in the HTML library
287 """ 289 """
288 interface = self._database.GetInterface(interface_name) 290 interface = self._database.GetInterface(interface_name)
289 291
290 if self._FindMatch(interface, member, member_prefix, _removed_html_members): 292 if self._FindMatch(interface, member, member_prefix, _removed_html_members):
291 return None 293 return None
292 294
293 name = self._FindMatch(interface, member, member_prefix, 295 name = self._FindMatch(interface, member, member_prefix,
294 _renamed_html_members) 296 _renamed_html_members)
295 target_name = _renamed_html_members[name] if name else member 297 target_name = _renamed_html_members[name] if name else member
296 if self._FindMatch(interface, member, member_prefix, _private_html_members): 298 if self._FindMatch(interface, member, member_prefix, _private_html_members):
297 if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName 299 if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName
298 target_name = '$dom_' + target_name 300 target_name = '$dom_' + target_name
299 return target_name 301 return target_name
300 302
301 def _FindMatch(self, interface, member, member_prefix, candidates): 303 def _FindMatch(self, interface, member, member_prefix, candidates):
302 for interface in self._database.Hierarchy(interface): 304 for interface in self._database.Hierarchy(interface):
303 html_interface_name = self.RenameInterface(interface) 305 html_interface_name = self.RenameInterface(interface)
304 member_name = html_interface_name + '.' + member 306 member_name = html_interface_name + '.' + member
305 if member_name in candidates: 307 if member_name in candidates:
306 return member_name 308 return member_name
307 member_name = html_interface_name + '.' + member_prefix + member 309 member_name = html_interface_name + '.' + member_prefix + member
308 if member_name in candidates: 310 if member_name in candidates:
309 return member_name 311 return member_name
OLDNEW
« no previous file with comments | « no previous file | lib/dom/src/_HttpRequestUtils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698