| 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 logging | 5 import logging |
| 6 import monitored | 6 import monitored |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 typed_array_renames = { | 9 typed_array_renames = { |
| 10 'ArrayBuffer': 'ByteBuffer', | 10 'ArrayBuffer': 'ByteBuffer', |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 # identical functionality but with cleaner names. | 309 # identical functionality but with cleaner names. |
| 310 renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', { | 310 renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', { |
| 311 'CanvasRenderingContext2D.drawImage': '_drawImage', | 311 'CanvasRenderingContext2D.drawImage': '_drawImage', |
| 312 'CSSStyleDeclaration.getPropertyValue': '_getPropertyValue', | 312 'CSSStyleDeclaration.getPropertyValue': '_getPropertyValue', |
| 313 'CSSStyleDeclaration.setProperty': '_setProperty', | 313 'CSSStyleDeclaration.setProperty': '_setProperty', |
| 314 'DirectoryEntry.getDirectory': '_getDirectory', | 314 'DirectoryEntry.getDirectory': '_getDirectory', |
| 315 'DirectoryEntry.getFile': '_getFile', | 315 'DirectoryEntry.getFile': '_getFile', |
| 316 'Document.createCDATASection': 'createCDataSection', | 316 'Document.createCDATASection': 'createCDataSection', |
| 317 'Document.defaultView': 'window', | 317 'Document.defaultView': 'window', |
| 318 'Document.querySelector': 'query', | 318 'Document.querySelector': 'query', |
| 319 'DOMURL.createObjectURL': 'createObjectUrl', | |
| 320 'DOMURL.revokeObjectURL': 'revokeObjectUrl', | |
| 321 'DOMWindow.CSS': 'css', | 319 'DOMWindow.CSS': 'css', |
| 322 'DOMWindow.clearTimeout': '_clearTimeout', | 320 'DOMWindow.clearTimeout': '_clearTimeout', |
| 323 'DOMWindow.clearInterval': '_clearInterval', | 321 'DOMWindow.clearInterval': '_clearInterval', |
| 324 'DOMWindow.setTimeout': '_setTimeout', | 322 'DOMWindow.setTimeout': '_setTimeout', |
| 325 'DOMWindow.setInterval': '_setInterval', | 323 'DOMWindow.setInterval': '_setInterval', |
| 326 'DOMWindow.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage', | 324 'DOMWindow.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage', |
| 327 'DOMWindow.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode', | 325 'DOMWindow.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode', |
| 328 'DOMWindow.webkitNotifications': 'notifications', | 326 'DOMWindow.webkitNotifications': 'notifications', |
| 329 'DOMWindow.webkitRequestFileSystem': '_requestFileSystem', | 327 'DOMWindow.webkitRequestFileSystem': '_requestFileSystem', |
| 330 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', | 328 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', |
| 331 'Element.querySelector': 'query', | 329 'Element.querySelector': 'query', |
| 332 'Element.webkitCreateShadowRoot': 'createShadowRoot', | 330 'Element.webkitCreateShadowRoot': 'createShadowRoot', |
| 333 'Element.webkitMatchesSelector' : 'matches', | 331 'Element.webkitMatchesSelector' : 'matches', |
| 334 'MutationObserver.observe': '_observe', | 332 'MutationObserver.observe': '_observe', |
| 335 'Navigator.webkitGetUserMedia': '_getUserMedia', | 333 'Navigator.webkitGetUserMedia': '_getUserMedia', |
| 336 'Node.appendChild': 'append', | 334 'Node.appendChild': 'append', |
| 337 'Node.cloneNode': 'clone', | 335 'Node.cloneNode': 'clone', |
| 338 'Node.nextSibling': 'nextNode', | 336 'Node.nextSibling': 'nextNode', |
| 339 'Node.ownerDocument': 'document', | 337 'Node.ownerDocument': 'document', |
| 340 'Node.parentElement': 'parent', | 338 'Node.parentElement': 'parent', |
| 341 'Node.previousSibling': 'previousNode', | 339 'Node.previousSibling': 'previousNode', |
| 342 'Node.textContent': 'text', | 340 'Node.textContent': 'text', |
| 343 'RTCPeerConnection.createAnswer': '_createAnswer', | 341 'RTCPeerConnection.createAnswer': '_createAnswer', |
| 344 'RTCPeerConnection.createOffer': '_createOffer', | 342 'RTCPeerConnection.createOffer': '_createOffer', |
| 345 'StorageInfo.queryUsageAndQuota': '_queryUsageAndQuota', | 343 'StorageInfo.queryUsageAndQuota': '_queryUsageAndQuota', |
| 346 'SVGElement.className': '$dom_svgClassName', | 344 'SVGElement.className': '$dom_svgClassName', |
| 347 'SVGStopElement.offset': 'gradientOffset', | 345 'SVGStopElement.offset': 'gradientOffset', |
| 346 'URL.createObjectURL': 'createObjectUrl', |
| 347 'URL.revokeObjectURL': 'revokeObjectUrl', |
| 348 'WheelEvent.wheelDeltaX': '_wheelDeltaX', | 348 'WheelEvent.wheelDeltaX': '_wheelDeltaX', |
| 349 'WheelEvent.wheelDeltaY': '_wheelDeltaY', | 349 'WheelEvent.wheelDeltaY': '_wheelDeltaY', |
| 350 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem', | 350 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem', |
| 351 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', | 351 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', |
| 352 }) | 352 }) |
| 353 | 353 |
| 354 for member in convert_to_future_members: | 354 for member in convert_to_future_members: |
| 355 if member in renamed_html_members: | 355 if member in renamed_html_members: |
| 356 renamed_html_members[member] = '_' + renamed_html_members[member] | 356 renamed_html_members[member] = '_' + renamed_html_members[member] |
| 357 else: | 357 else: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 'DOMWindow.prompt', | 389 'DOMWindow.prompt', |
| 390 'DOMWindow.webkitCancelAnimationFrame', | 390 'DOMWindow.webkitCancelAnimationFrame', |
| 391 'DOMWindow.webkitCancelRequestAnimationFrame', | 391 'DOMWindow.webkitCancelRequestAnimationFrame', |
| 392 'DOMWindow.webkitIndexedDB', | 392 'DOMWindow.webkitIndexedDB', |
| 393 'DOMWindow.webkitRequestAnimationFrame', | 393 'DOMWindow.webkitRequestAnimationFrame', |
| 394 'Document.adoptNode', | 394 'Document.adoptNode', |
| 395 'Document.alinkColor', | 395 'Document.alinkColor', |
| 396 'Document.all', | 396 'Document.all', |
| 397 'Document.applets', | 397 'Document.applets', |
| 398 'Document.bgColor', | 398 'Document.bgColor', |
| 399 'Document.captureEvents', | |
| 400 'Document.clear', | 399 'Document.clear', |
| 401 'Document.createAttribute', | 400 'Document.createAttribute', |
| 402 'Document.createAttributeNS', | 401 'Document.createAttributeNS', |
| 403 'Document.createComment', | 402 'Document.createComment', |
| 404 'Document.createEntityReference', | |
| 405 'Document.createExpression', | 403 'Document.createExpression', |
| 406 'Document.createNSResolver', | 404 'Document.createNSResolver', |
| 407 'Document.createProcessingInstruction', | 405 'Document.createProcessingInstruction', |
| 408 'Document.designMode', | 406 'Document.designMode', |
| 409 'Document.dir', | 407 'Document.dir', |
| 410 'Document.evaluate', | 408 'Document.evaluate', |
| 411 'Document.fgColor', | 409 'Document.fgColor', |
| 412 'Document.get:URL', | 410 'Document.get:URL', |
| 413 'Document.get:anchors', | 411 'Document.get:anchors', |
| 414 'Document.get:characterSet', | 412 'Document.get:characterSet', |
| (...skipping 11 matching lines...) Expand all Loading... |
| 426 'Document.get:width', | 424 'Document.get:width', |
| 427 'Document.get:xmlEncoding', | 425 'Document.get:xmlEncoding', |
| 428 'Document.getElementsByTagNameNS', | 426 'Document.getElementsByTagNameNS', |
| 429 'Document.getOverrideStyle', | 427 'Document.getOverrideStyle', |
| 430 'Document.getSelection', | 428 'Document.getSelection', |
| 431 'Document.images', | 429 'Document.images', |
| 432 'Document.importNode', | 430 'Document.importNode', |
| 433 'Document.linkColor', | 431 'Document.linkColor', |
| 434 'Document.location', | 432 'Document.location', |
| 435 'Document.open', | 433 'Document.open', |
| 436 'Document.releaseEvents', | |
| 437 'Document.set:domain', | 434 'Document.set:domain', |
| 438 'Document.vlinkColor', | 435 'Document.vlinkColor', |
| 439 'Document.webkitCurrentFullScreenElement', | 436 'Document.webkitCurrentFullScreenElement', |
| 440 'Document.webkitFullScreenKeyboardInputAllowed', | 437 'Document.webkitFullScreenKeyboardInputAllowed', |
| 441 'Document.write', | 438 'Document.write', |
| 442 'Document.writeln', | 439 'Document.writeln', |
| 443 'Document.xmlStandalone', | 440 'Document.xmlStandalone', |
| 444 'Document.xmlVersion', | 441 'Document.xmlVersion', |
| 442 'DocumentFragment.children', |
| 445 'DocumentType.*', | 443 'DocumentType.*', |
| 446 'DOMCoreException.code', | 444 'DOMCoreException.code', |
| 447 'DOMCoreException.ABORT_ERR', | 445 'DOMCoreException.ABORT_ERR', |
| 448 'DOMCoreException.DATA_CLONE_ERR', | 446 'DOMCoreException.DATA_CLONE_ERR', |
| 449 'DOMCoreException.DOMSTRING_SIZE_ERR', | 447 'DOMCoreException.DOMSTRING_SIZE_ERR', |
| 450 'DOMCoreException.HIERARCHY_REQUEST_ERR', | 448 'DOMCoreException.HIERARCHY_REQUEST_ERR', |
| 451 'DOMCoreException.INDEX_SIZE_ERR', | 449 'DOMCoreException.INDEX_SIZE_ERR', |
| 452 'DOMCoreException.INUSE_ATTRIBUTE_ERR', | 450 'DOMCoreException.INUSE_ATTRIBUTE_ERR', |
| 453 'DOMCoreException.INVALID_ACCESS_ERR', | 451 'DOMCoreException.INVALID_ACCESS_ERR', |
| 454 'DOMCoreException.INVALID_CHARACTER_ERR', | 452 'DOMCoreException.INVALID_CHARACTER_ERR', |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 | 657 |
| 660 | 658 |
| 661 def RenameMember(self, interface_name, member_node, member, member_prefix='', | 659 def RenameMember(self, interface_name, member_node, member, member_prefix='', |
| 662 dartify_name=True): | 660 dartify_name=True): |
| 663 """ | 661 """ |
| 664 Returns the name of the member in the HTML library or None if the member is | 662 Returns the name of the member in the HTML library or None if the member is |
| 665 suppressed in the HTML library | 663 suppressed in the HTML library |
| 666 """ | 664 """ |
| 667 interface = self._database.GetInterface(interface_name) | 665 interface = self._database.GetInterface(interface_name) |
| 668 | 666 |
| 667 if not member: |
| 668 if 'ImplementedAs' in member_node.ext_attrs: |
| 669 member = member_node.ext_attrs['ImplementedAs'] |
| 670 |
| 669 if self.ShouldSuppressMember(interface, member, member_prefix): | 671 if self.ShouldSuppressMember(interface, member, member_prefix): |
| 670 return None | 672 return None |
| 671 | 673 |
| 672 if 'CheckSecurityForNode' in member_node.ext_attrs: | 674 if 'CheckSecurityForNode' in member_node.ext_attrs: |
| 673 return None | 675 return None |
| 674 | 676 |
| 675 name = self._FindMatch(interface, member, member_prefix, | 677 name = self._FindMatch(interface, member, member_prefix, |
| 676 renamed_html_members) | 678 renamed_html_members) |
| 677 | 679 |
| 678 target_name = renamed_html_members[name] if name else member | 680 target_name = renamed_html_members[name] if name else member |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 | 771 |
| 770 # We're looking for a sequence of letters which start with capital letter | 772 # We're looking for a sequence of letters which start with capital letter |
| 771 # then a series of caps and finishes with either the end of the string or | 773 # then a series of caps and finishes with either the end of the string or |
| 772 # a capital letter. | 774 # a capital letter. |
| 773 # The [0-9] check is for names such as 2D or 3D | 775 # The [0-9] check is for names such as 2D or 3D |
| 774 # The following test cases should match as: | 776 # The following test cases should match as: |
| 775 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 777 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
| 776 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 778 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
| 777 # IFrameElement: (I)()(F)rameElement (no change) | 779 # IFrameElement: (I)()(F)rameElement (no change) |
| 778 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 780 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
| OLD | NEW |