| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', | 101 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', |
| 102 'Node.cloneNode': 'clone', | 102 'Node.cloneNode': 'clone', |
| 103 'Node.nextSibling': 'nextNode', | 103 'Node.nextSibling': 'nextNode', |
| 104 'Node.ownerDocument': 'document', | 104 'Node.ownerDocument': 'document', |
| 105 'Node.parentNode': 'parent', | 105 'Node.parentNode': 'parent', |
| 106 'Node.previousSibling': 'previousNode', | 106 'Node.previousSibling': 'previousNode', |
| 107 'Node.textContent': 'text', | 107 'Node.textContent': 'text', |
| 108 'SVGElement.className': '$dom_svgClassName', | 108 'SVGElement.className': '$dom_svgClassName', |
| 109 'SVGAnimatedString.className': '$dom_svgClassName', | 109 'SVGAnimatedString.className': '$dom_svgClassName', |
| 110 'SVGStylable.className': '$dom_svgClassName', | 110 'SVGStylable.className': '$dom_svgClassName', |
| 111 'Window.webkitCancelAnimationFrame': 'cancelAnimationFrame', | |
| 112 'Window.webkitCancelRequestAnimationFrame': 'cancelRequestAnimationFrame', | |
| 113 'Window.webkitRequestAnimationFrame': 'requestAnimationFrame', | |
| 114 } | 111 } |
| 115 | 112 |
| 116 # 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 |
| 117 # 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 |
| 118 # as a simple table instead is more concise. | 115 # as a simple table instead is more concise. |
| 119 # Syntax is: ClassName.(get\.|set\.)?MemberName | 116 # Syntax is: ClassName.(get\.|set\.)?MemberName |
| 120 # 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 |
| 121 # to be suppressed but not the setter, etc. | 118 # to be suppressed but not the setter, etc. |
| 122 # TODO(jacobr): cleanup and augment this list. | 119 # TODO(jacobr): cleanup and augment this list. |
| 123 _removed_html_members = set([ | 120 _removed_html_members = set([ |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 "Node.get:DOCUMENT_POSITION_PRECEDING", | 264 "Node.get:DOCUMENT_POSITION_PRECEDING", |
| 268 "Node.get:nodeValue", | 265 "Node.get:nodeValue", |
| 269 "Node.set:nodeValue", | 266 "Node.set:nodeValue", |
| 270 "Node.get:CDATA_SECTION_NODE", | 267 "Node.get:CDATA_SECTION_NODE", |
| 271 "Node.get:nodeName", | 268 "Node.get:nodeName", |
| 272 "Node.lookupPrefix", | 269 "Node.lookupPrefix", |
| 273 "Node.get:PROCESSING_INSTRUCTION_NODE", | 270 "Node.get:PROCESSING_INSTRUCTION_NODE", |
| 274 'ShadowRoot.getElementsByTagNameNS', | 271 'ShadowRoot.getElementsByTagNameNS', |
| 275 "IFrameElement.get:contentDocument", | 272 "IFrameElement.get:contentDocument", |
| 276 "Window.get:frameElement", | 273 "Window.get:frameElement", |
| 277 "Window.webkitCancelRequestAnimationFrame", | |
| 278 ]) | 274 ]) |
| 279 | 275 |
| 280 class HtmlRenamer(object): | 276 class HtmlRenamer(object): |
| 281 def __init__(self, database): | 277 def __init__(self, database): |
| 282 self._database = database | 278 self._database = database |
| 283 | 279 |
| 284 def RenameInterface(self, interface): | 280 def RenameInterface(self, interface): |
| 285 if interface.id.startswith('HTML'): | 281 if interface.id.startswith('HTML'): |
| 286 if any(interface.id in ['Element', 'Document'] | 282 if any(interface.id in ['Element', 'Document'] |
| 287 for interface in self._database.Hierarchy(interface)): | 283 for interface in self._database.Hierarchy(interface)): |
| (...skipping 22 matching lines...) Expand all Loading... |
| 310 | 306 |
| 311 def _FindMatch(self, interface, member, member_prefix, candidates): | 307 def _FindMatch(self, interface, member, member_prefix, candidates): |
| 312 for interface in self._database.Hierarchy(interface): | 308 for interface in self._database.Hierarchy(interface): |
| 313 html_interface_name = self.RenameInterface(interface) | 309 html_interface_name = self.RenameInterface(interface) |
| 314 member_name = html_interface_name + '.' + member | 310 member_name = html_interface_name + '.' + member |
| 315 if member_name in candidates: | 311 if member_name in candidates: |
| 316 return member_name | 312 return member_name |
| 317 member_name = html_interface_name + '.' + member_prefix + member | 313 member_name = html_interface_name + '.' + member_prefix + member |
| 318 if member_name in candidates: | 314 if member_name in candidates: |
| 319 return member_name | 315 return member_name |
| OLD | NEW |