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

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

Issue 11047021: New cross frame base types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regen dart:html 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/dartium/html_dartium.dart ('k') | lib/html/scripts/systemhtml.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': 'LocalWindow',
9 'History': 'LocalHistory',
10 'Location': 'LocalLocation',
9 'WebKitAnimation': 'Animation', 11 'WebKitAnimation': 'Animation',
10 'WebKitAnimationEvent': 'AnimationEvent', 12 'WebKitAnimationEvent': 'AnimationEvent',
11 'WebKitAnimationList': 'AnimationList', 13 'WebKitAnimationList': 'AnimationList',
12 'WebKitBlobBuilder': 'BlobBuilder', 14 'WebKitBlobBuilder': 'BlobBuilder',
13 'WebKitCSSKeyframeRule': 'CSSKeyframeRule', 15 'WebKitCSSKeyframeRule': 'CSSKeyframeRule',
14 'WebKitCSSKeyframesRule': 'CSSKeyframesRule', 16 'WebKitCSSKeyframesRule': 'CSSKeyframesRule',
15 'WebKitCSSMatrix': 'CSSMatrix', 17 'WebKitCSSMatrix': 'CSSMatrix',
16 'WebKitCSSTransformValue': 'CSSTransformValue', 18 'WebKitCSSTransformValue': 'CSSTransformValue',
17 'WebKitFlags': 'Flags', 19 'WebKitFlags': 'Flags',
18 'WebKitLoseContext': 'LoseContext', 20 'WebKitLoseContext': 'LoseContext',
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 'Node.replaceChild', 86 'Node.replaceChild',
85 'ShadowRoot.getElementById', 87 'ShadowRoot.getElementById',
86 'ShadowRoot.getElementsByClassName', 88 'ShadowRoot.getElementsByClassName',
87 'ShadowRoot.getElementsByTagName', 89 'ShadowRoot.getElementsByTagName',
88 'Storage.length', 90 'Storage.length',
89 'Storage.clear', 91 'Storage.clear',
90 'Storage.getItem', 92 'Storage.getItem',
91 'Storage.key', 93 'Storage.key',
92 'Storage.removeItem', 94 'Storage.removeItem',
93 'Storage.setItem', 95 'Storage.setItem',
94 'Window.getComputedStyle', 96 'LocalWindow.getComputedStyle',
95 ]) 97 ])
96 98
97 # Members from the standard dom that exist in the dart:html library with 99 # Members from the standard dom that exist in the dart:html library with
98 # identical functionality but with cleaner names. 100 # identical functionality but with cleaner names.
99 _renamed_html_members = { 101 _renamed_html_members = {
100 'Document.defaultView': 'window', 102 'Document.defaultView': 'window',
101 'Element.webkitMatchesSelector' : 'matchesSelector', 103 'Element.webkitMatchesSelector' : 'matchesSelector',
102 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', 104 'Element.scrollIntoViewIfNeeded': 'scrollIntoView',
103 'Node.cloneNode': 'clone', 105 'Node.cloneNode': 'clone',
104 'Node.nextSibling': 'nextNode', 106 'Node.nextSibling': 'nextNode',
105 'Node.ownerDocument': 'document', 107 'Node.ownerDocument': 'document',
106 'Node.parentNode': 'parent', 108 'Node.parentNode': 'parent',
107 'Node.previousSibling': 'previousNode', 109 'Node.previousSibling': 'previousNode',
108 'Node.textContent': 'text', 110 'Node.textContent': 'text',
109 'SVGElement.className': '$dom_svgClassName', 111 'SVGElement.className': '$dom_svgClassName',
110 'SVGAnimatedString.className': '$dom_svgClassName', 112 'SVGAnimatedString.className': '$dom_svgClassName',
111 'SVGStylable.className': '$dom_svgClassName', 113 'SVGStylable.className': '$dom_svgClassName',
112 'Window.webkitCancelAnimationFrame': 'cancelAnimationFrame', 114 'LocalWindow.webkitCancelAnimationFrame': 'cancelAnimationFrame',
113 'Window.webkitCancelRequestAnimationFrame': 'cancelRequestAnimationFrame', 115 'LocalWindow.webkitCancelRequestAnimationFrame': 'cancelRequestAnimationFram e',
114 'Window.webkitRequestAnimationFrame': 'requestAnimationFrame', 116 'LocalWindow.webkitRequestAnimationFrame': 'requestAnimationFrame',
115 } 117 }
116 118
117 # Members and classes from the dom that should be removed completely from 119 # Members and classes from the dom that should be removed completely from
118 # dart:html. These could be expressed in the IDL instead but expressing this 120 # dart:html. These could be expressed in the IDL instead but expressing this
119 # as a simple table instead is more concise. 121 # as a simple table instead is more concise.
120 # Syntax is: ClassName.(get\.|set\.)?MemberName 122 # Syntax is: ClassName.(get\.|set\.)?MemberName
121 # Using get: and set: is optional and should only be used when a getter needs 123 # Using get: and set: is optional and should only be used when a getter needs
122 # to be suppressed but not the setter, etc. 124 # to be suppressed but not the setter, etc.
123 # TODO(jacobr): cleanup and augment this list. 125 # TODO(jacobr): cleanup and augment this list.
124 _removed_html_members = set([ 126 _removed_html_members = set([
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 "Node.set:nodeValue", 272 "Node.set:nodeValue",
271 "Node.get:CDATA_SECTION_NODE", 273 "Node.get:CDATA_SECTION_NODE",
272 "Node.get:nodeName", 274 "Node.get:nodeName",
273 "Node.lookupPrefix", 275 "Node.lookupPrefix",
274 "Node.get:PROCESSING_INSTRUCTION_NODE", 276 "Node.get:PROCESSING_INSTRUCTION_NODE",
275 'ShadowRoot.getElementsByTagNameNS', 277 'ShadowRoot.getElementsByTagNameNS',
276 "IFrameElement.get:contentDocument", 278 "IFrameElement.get:contentDocument",
277 "WheelEvent.wheelDelta", 279 "WheelEvent.wheelDelta",
278 "WheelEvent.wheelDeltaX", 280 "WheelEvent.wheelDeltaX",
279 "WheelEvent.wheelDeltaY", 281 "WheelEvent.wheelDeltaY",
280 "Window.get:frameElement", 282 "LocalWindow.get:frameElement",
281 "Window.webkitCancelRequestAnimationFrame", 283 "LocalWindow.webkitCancelRequestAnimationFrame",
282 ]) 284 ])
283 285
284 class HtmlRenamer(object): 286 class HtmlRenamer(object):
285 def __init__(self, database): 287 def __init__(self, database):
286 self._database = database 288 self._database = database
287 289
288 def RenameInterface(self, interface): 290 def RenameInterface(self, interface):
289 if interface.id.startswith('HTML'): 291 if interface.id.startswith('HTML'):
290 if any(interface.id in ['Element', 'Document'] 292 if any(interface.id in ['Element', 'Document']
291 for interface in self._database.Hierarchy(interface)): 293 for interface in self._database.Hierarchy(interface)):
(...skipping 22 matching lines...) Expand all
314 316
315 def _FindMatch(self, interface, member, member_prefix, candidates): 317 def _FindMatch(self, interface, member, member_prefix, candidates):
316 for interface in self._database.Hierarchy(interface): 318 for interface in self._database.Hierarchy(interface):
317 html_interface_name = self.RenameInterface(interface) 319 html_interface_name = self.RenameInterface(interface)
318 member_name = html_interface_name + '.' + member 320 member_name = html_interface_name + '.' + member
319 if member_name in candidates: 321 if member_name in candidates:
320 return member_name 322 return member_name
321 member_name = html_interface_name + '.' + member_prefix + member 323 member_name = html_interface_name + '.' + member_prefix + member
322 if member_name in candidates: 324 if member_name in candidates:
323 return member_name 325 return member_name
OLDNEW
« no previous file with comments | « lib/html/dartium/html_dartium.dart ('k') | lib/html/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698