Chromium Code Reviews| 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 import re | 5 import re |
| 6 | 6 |
| 7 html_interface_renames = { | 7 html_interface_renames = { |
| 8 'CDATASection': 'CDataSection', | 8 'CDATASection': 'CDataSection', |
| 9 'DOMApplicationCache': 'ApplicationCache', | 9 'DOMApplicationCache': 'ApplicationCache', |
| 10 'DOMCoreException': 'DomException', | 10 'DOMCoreException': 'DomException', |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 'WebKitFlags': 'Flags', | 31 'WebKitFlags': 'Flags', |
| 32 'WebKitLoseContext': 'LoseContext', | 32 'WebKitLoseContext': 'LoseContext', |
| 33 'WebKitPoint': 'Point', | 33 'WebKitPoint': 'Point', |
| 34 'WebKitTransitionEvent': 'TransitionEvent', | 34 'WebKitTransitionEvent': 'TransitionEvent', |
| 35 'XMLHttpRequest': 'HttpRequest', | 35 'XMLHttpRequest': 'HttpRequest', |
| 36 'XMLHttpRequestException': 'HttpRequestException', | 36 'XMLHttpRequestException': 'HttpRequestException', |
| 37 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', | 37 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', |
| 38 'XMLHttpRequestUpload': 'HttpRequestUpload', | 38 'XMLHttpRequestUpload': 'HttpRequestUpload', |
| 39 } | 39 } |
| 40 | 40 |
| 41 html_interface_removes = { | |
| 42 'AppletElement', | |
| 43 } | |
| 44 | |
| 41 # Members from the standard dom that should not be exposed publicly in dart:html | 45 # Members from the standard dom that should not be exposed publicly in dart:html |
| 42 # but need to be exposed internally to implement dart:html on top of a standard | 46 # but need to be exposed internally to implement dart:html on top of a standard |
| 43 # browser. | 47 # browser. |
| 44 _private_html_members = set([ | 48 _private_html_members = set([ |
| 45 'CustomEvent.initCustomEvent', | 49 'CustomEvent.initCustomEvent', |
| 46 'Document.createElement', | 50 'Document.createElement', |
| 47 'Document.createElementNS', | 51 'Document.createElementNS', |
| 48 'Document.createEvent', | 52 'Document.createEvent', |
| 49 'Document.createRange', | 53 'Document.createRange', |
| 50 'Document.createTextNode', | 54 'Document.createTextNode', |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 "Window.webkitIndexedDB", | 342 "Window.webkitIndexedDB", |
| 339 "Window.webkitCancelRequestAnimationFrame", | 343 "Window.webkitCancelRequestAnimationFrame", |
| 340 "WheelEvent.wheelDelta", | 344 "WheelEvent.wheelDelta", |
| 341 "WorkerContext.webkitIndexedDB", | 345 "WorkerContext.webkitIndexedDB", |
| 342 ]) | 346 ]) |
| 343 | 347 |
| 344 class HtmlRenamer(object): | 348 class HtmlRenamer(object): |
| 345 def __init__(self, database): | 349 def __init__(self, database): |
| 346 self._database = database | 350 self._database = database |
| 347 | 351 |
| 352 def FindInterface(self, interface): | |
|
blois
2013/01/07 16:55:29
Seems like it should be 'ShouldExportInterface' or
| |
| 353 if interface in html_interface_removes: | |
| 354 return interface | |
| 355 return None | |
| 356 | |
| 348 def RenameInterface(self, interface): | 357 def RenameInterface(self, interface): |
| 349 if interface.id in html_interface_renames: | 358 if interface.id in html_interface_renames: |
| 350 return html_interface_renames[interface.id] | 359 return html_interface_renames[interface.id] |
| 351 elif interface.id.startswith('HTML'): | 360 elif interface.id.startswith('HTML'): |
| 352 if any(interface.id in ['Element', 'Document'] | 361 if any(interface.id in ['Element', 'Document'] |
| 353 for interface in self._database.Hierarchy(interface)): | 362 for interface in self._database.Hierarchy(interface)): |
| 354 return interface.id[len('HTML'):] | 363 return interface.id[len('HTML'):] |
| 355 return self.DartifyTypeName(interface.id) | 364 return self.DartifyTypeName(interface.id) |
| 356 | 365 |
| 357 | 366 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 | 432 |
| 424 # We're looking for a sequence of letters which start with capital letter | 433 # We're looking for a sequence of letters which start with capital letter |
| 425 # then a series of caps and finishes with either the end of the string or | 434 # then a series of caps and finishes with either the end of the string or |
| 426 # a capital letter. | 435 # a capital letter. |
| 427 # The [0-9] check is for names such as 2D or 3D | 436 # The [0-9] check is for names such as 2D or 3D |
| 428 # The following test cases should match as: | 437 # The following test cases should match as: |
| 429 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 438 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
| 430 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 439 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
| 431 # IFrameElement: (I)()(F)rameElement (no change) | 440 # IFrameElement: (I)()(F)rameElement (no change) |
| 432 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 441 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
| OLD | NEW |