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

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

Issue 10982053: Reapply FooList -> List<Foo> with Gamepad fix for dartium. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « lib/html/scripts/generator.py ('k') | lib/html/scripts/systemdart2js.py » ('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_interface_renames = { 6 html_interface_renames = {
7 'DOMFormData': 'FormData', 7 'DOMFormData': 'FormData',
8 'DOMWindow': 'Window', 8 'DOMWindow': 'Window',
9 'WebKitAnimation': 'Animation', 9 'WebKitAnimation': 'Animation',
10 'WebKitAnimationEvent': 'AnimationEvent', 10 'WebKitAnimationEvent': 'AnimationEvent',
11 'WebKitAnimationList': 'AnimationList', 11 'WebKitAnimationList': 'AnimationList',
12 'WebKitBlobBuilder': 'BlobBuilder', 12 'WebKitBlobBuilder': 'BlobBuilder',
13 'WebKitCSSKeyframeRule': 'CSSKeyframeRule', 13 'WebKitCSSKeyframeRule': 'CSSKeyframeRule',
14 'WebKitCSSKeyframesRule': 'CSSKeyframesRule', 14 'WebKitCSSKeyframesRule': 'CSSKeyframesRule',
15 'WebKitCSSMatrix': 'CSSMatrix', 15 'WebKitCSSMatrix': 'CSSMatrix',
16 'WebKitCSSTransformValue': 'CSSTransformValue', 16 'WebKitCSSTransformValue': 'CSSTransformValue',
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 class HtmlRenamer(object): 283 class HtmlRenamer(object):
284 def __init__(self, database): 284 def __init__(self, database):
285 self._database = database 285 self._database = database
286 286
287 def RenameInterface(self, interface): 287 def RenameInterface(self, interface):
288 if interface.id.startswith('HTML'): 288 if interface.id.startswith('HTML'):
289 if any(interface.id in ['Element', 'Document'] 289 if any(interface.id in ['Element', 'Document']
290 for interface in self._database.Hierarchy(interface)): 290 for interface in self._database.Hierarchy(interface)):
291 return interface.id[len('HTML'):] 291 return interface.id[len('HTML'):]
292 elif interface.id in _html_interface_renames: 292 elif interface.id in html_interface_renames:
293 return _html_interface_renames[interface.id] 293 return html_interface_renames[interface.id]
294 return interface.id 294 return interface.id
295 295
296 def RenameMember(self, interface_name, member, member_prefix=''): 296 def RenameMember(self, interface_name, member, member_prefix=''):
297 """ 297 """
298 Returns the name of the member in the HTML library or None if the member is 298 Returns the name of the member in the HTML library or None if the member is
299 suppressed in the HTML library 299 suppressed in the HTML library
300 """ 300 """
301 interface = self._database.GetInterface(interface_name) 301 interface = self._database.GetInterface(interface_name)
302 302
303 if self._FindMatch(interface, member, member_prefix, _removed_html_members): 303 if self._FindMatch(interface, member, member_prefix, _removed_html_members):
304 return None 304 return None
305 305
306 name = self._FindMatch(interface, member, member_prefix, 306 name = self._FindMatch(interface, member, member_prefix,
307 _renamed_html_members) 307 _renamed_html_members)
308 target_name = _renamed_html_members[name] if name else member 308 target_name = _renamed_html_members[name] if name else member
309 if self._FindMatch(interface, member, member_prefix, _private_html_members): 309 if self._FindMatch(interface, member, member_prefix, _private_html_members):
310 if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName 310 if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName
311 target_name = '$dom_' + target_name 311 target_name = '$dom_' + target_name
312 return target_name 312 return target_name
313 313
314 def _FindMatch(self, interface, member, member_prefix, candidates): 314 def _FindMatch(self, interface, member, member_prefix, candidates):
315 for interface in self._database.Hierarchy(interface): 315 for interface in self._database.Hierarchy(interface):
316 html_interface_name = self.RenameInterface(interface) 316 html_interface_name = self.RenameInterface(interface)
317 member_name = html_interface_name + '.' + member 317 member_name = html_interface_name + '.' + member
318 if member_name in candidates: 318 if member_name in candidates:
319 return member_name 319 return member_name
320 member_name = html_interface_name + '.' + member_prefix + member 320 member_name = html_interface_name + '.' + member_prefix + member
321 if member_name in candidates: 321 if member_name in candidates:
322 return member_name 322 return member_name
OLDNEW
« no previous file with comments | « lib/html/scripts/generator.py ('k') | lib/html/scripts/systemdart2js.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698