| OLD | NEW |
| 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', |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', | 98 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', |
| 99 'Node.cloneNode': 'clone', | 99 'Node.cloneNode': 'clone', |
| 100 'Node.nextSibling': 'nextNode', | 100 'Node.nextSibling': 'nextNode', |
| 101 'Node.ownerDocument': 'document', | 101 'Node.ownerDocument': 'document', |
| 102 'Node.parentNode': 'parent', | 102 'Node.parentNode': 'parent', |
| 103 'Node.previousSibling': 'previousNode', | 103 'Node.previousSibling': 'previousNode', |
| 104 'Node.textContent': 'text', | 104 'Node.textContent': 'text', |
| 105 'SVGElement.className': '$dom_svgClassName', | 105 'SVGElement.className': '$dom_svgClassName', |
| 106 'SVGAnimatedString.className': '$dom_svgClassName', | 106 'SVGAnimatedString.className': '$dom_svgClassName', |
| 107 'SVGStylable.className': '$dom_svgClassName', | 107 'SVGStylable.className': '$dom_svgClassName', |
| 108 'Window.webkitCancelAnimationFrame': 'cancelAnimationFrame', |
| 109 'Window.webkitCancelRequestAnimationFrame': 'cancelRequestAnimationFrame', |
| 110 'Window.webkitRequestAnimationFrame': 'requestAnimationFrame', |
| 108 } | 111 } |
| 109 | 112 |
| 110 # Members and classes from the dom that should be removed completely from | 113 # Members and classes from the dom that should be removed completely from |
| 111 # dart:html. These could be expressed in the IDL instead but expressing this | 114 # dart:html. These could be expressed in the IDL instead but expressing this |
| 112 # as a simple table instead is more concise. | 115 # as a simple table instead is more concise. |
| 113 # Syntax is: ClassName.(get\.|set\.)?MemberName | 116 # Syntax is: ClassName.(get\.|set\.)?MemberName |
| 114 # Using get: and set: is optional and should only be used when a getter needs | 117 # Using get: and set: is optional and should only be used when a getter needs |
| 115 # to be suppressed but not the setter, etc. | 118 # to be suppressed but not the setter, etc. |
| 116 # TODO(jacobr): cleanup and augment this list. | 119 # TODO(jacobr): cleanup and augment this list. |
| 117 _removed_html_members = set([ | 120 _removed_html_members = set([ |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 "Node.set:prefix", | 263 "Node.set:prefix", |
| 261 "Node.get:DOCUMENT_POSITION_PRECEDING", | 264 "Node.get:DOCUMENT_POSITION_PRECEDING", |
| 262 "Node.get:nodeValue", | 265 "Node.get:nodeValue", |
| 263 "Node.set:nodeValue", | 266 "Node.set:nodeValue", |
| 264 "Node.get:CDATA_SECTION_NODE", | 267 "Node.get:CDATA_SECTION_NODE", |
| 265 "Node.get:nodeName", | 268 "Node.get:nodeName", |
| 266 "Node.lookupPrefix", | 269 "Node.lookupPrefix", |
| 267 "Node.get:PROCESSING_INSTRUCTION_NODE", | 270 "Node.get:PROCESSING_INSTRUCTION_NODE", |
| 268 "IFrameElement.get:contentDocument", | 271 "IFrameElement.get:contentDocument", |
| 269 "Window.get:frameElement", | 272 "Window.get:frameElement", |
| 273 "Window.webkitCancelRequestAnimationFrame", |
| 270 ]) | 274 ]) |
| 271 | 275 |
| 272 class HtmlRenamer(object): | 276 class HtmlRenamer(object): |
| 273 def __init__(self, database): | 277 def __init__(self, database): |
| 274 self._database = database | 278 self._database = database |
| 275 | 279 |
| 276 def RenameInterface(self, interface): | 280 def RenameInterface(self, interface): |
| 277 if interface.id.startswith('HTML'): | 281 if interface.id.startswith('HTML'): |
| 278 if any(interface.id in ['Element', 'Document'] | 282 if any(interface.id in ['Element', 'Document'] |
| 279 for interface in self._database.Hierarchy(interface)): | 283 for interface in self._database.Hierarchy(interface)): |
| (...skipping 22 matching lines...) Expand all Loading... |
| 302 | 306 |
| 303 def _FindMatch(self, interface, member, member_prefix, candidates): | 307 def _FindMatch(self, interface, member, member_prefix, candidates): |
| 304 for interface in self._database.Hierarchy(interface): | 308 for interface in self._database.Hierarchy(interface): |
| 305 html_interface_name = self.RenameInterface(interface) | 309 html_interface_name = self.RenameInterface(interface) |
| 306 member_name = html_interface_name + '.' + member | 310 member_name = html_interface_name + '.' + member |
| 307 if member_name in candidates: | 311 if member_name in candidates: |
| 308 return member_name | 312 return member_name |
| 309 member_name = html_interface_name + '.' + member_prefix + member | 313 member_name = html_interface_name + '.' + member_prefix + member |
| 310 if member_name in candidates: | 314 if member_name in candidates: |
| 311 return member_name | 315 return member_name |
| OLD | NEW |