| 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 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', { | 9 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', { |
| 10 'CDATASection': 'CDataSection', | 10 'CDATASection': 'CDataSection', |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 'FileSystemCallback': '_FileSystemCallback', | 24 'FileSystemCallback': '_FileSystemCallback', |
| 25 'FileWriterCallback': '_FileWriterCallback', | 25 'FileWriterCallback': '_FileWriterCallback', |
| 26 'HTMLDocument' : 'HtmlDocument', | 26 'HTMLDocument' : 'HtmlDocument', |
| 27 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. | 27 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. |
| 28 'NamedNodeMap': '_NamedNodeMap', | 28 'NamedNodeMap': '_NamedNodeMap', |
| 29 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', | 29 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', |
| 30 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', | 30 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', |
| 31 'NotificationPermissionCallback': '_NotificationPermissionCallback', | 31 'NotificationPermissionCallback': '_NotificationPermissionCallback', |
| 32 'PositionCallback': '_PositionCallback', | 32 'PositionCallback': '_PositionCallback', |
| 33 'PositionErrorCallback': '_PositionErrorCallback', | 33 'PositionErrorCallback': '_PositionErrorCallback', |
| 34 'Rect': 'CssRect', | |
| 35 'RGBColor': 'CssRgbColor', | |
| 36 'RTCDTMFSender': 'RtcDtmfSender', | 34 'RTCDTMFSender': 'RtcDtmfSender', |
| 37 'RTCDTMFToneChangeEvent': 'RtcDtmfToneChangeEvent', | 35 'RTCDTMFToneChangeEvent': 'RtcDtmfToneChangeEvent', |
| 38 'RTCErrorCallback': '_RtcErrorCallback', | 36 'RTCErrorCallback': '_RtcErrorCallback', |
| 39 'RTCSessionDescriptionCallback': '_RtcSessionDescriptionCallback', | 37 'RTCSessionDescriptionCallback': '_RtcSessionDescriptionCallback', |
| 40 'StringCallback': '_StringCallback', | 38 'StringCallback': '_StringCallback', |
| 41 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. | 39 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. |
| 42 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. | 40 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. |
| 43 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. | 41 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. |
| 44 'SVGGradientElement': '_GradientElement', | 42 'SVGGradientElement': '_GradientElement', |
| 45 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. | 43 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. |
| 46 'WebGLVertexArrayObjectOES': 'VertexArrayObject', | 44 'WebGLVertexArrayObjectOES': 'VertexArrayObject', |
| 47 'WebKitAnimationEvent': 'AnimationEvent', | 45 'WebKitAnimationEvent': 'AnimationEvent', |
| 48 'WebKitCSSKeyframeRule': 'CssKeyframeRule', | 46 'WebKitCSSKeyframeRule': 'CssKeyframeRule', |
| 49 'WebKitCSSKeyframesRule': 'CssKeyframesRule', | 47 'WebKitCSSKeyframesRule': 'CssKeyframesRule', |
| 50 'WebKitCSSMatrix': 'CssMatrix', | |
| 51 'WebKitCSSTransformValue': 'CssTransformValue', | 48 'WebKitCSSTransformValue': 'CssTransformValue', |
| 52 'WebKitPoint': 'DomPoint', | 49 'WebKitPoint': '_DomPoint', |
| 53 'WebKitTransitionEvent': '_WebKitTransitionEvent', | 50 'WebKitTransitionEvent': '_WebKitTransitionEvent', |
| 54 'XMLHttpRequest': 'HttpRequest', | 51 'XMLHttpRequest': 'HttpRequest', |
| 55 'XMLHttpRequestException': 'HttpRequestException', | 52 'XMLHttpRequestException': 'HttpRequestException', |
| 56 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', | 53 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', |
| 57 'XMLHttpRequestUpload': 'HttpRequestUpload', | 54 'XMLHttpRequestUpload': 'HttpRequestUpload', |
| 58 }) | 55 }) |
| 59 | 56 |
| 60 # Interfaces that are suppressed, but need to still exist for Dartium and to | 57 # Interfaces that are suppressed, but need to still exist for Dartium and to |
| 61 # properly wrap DOM objects if/when encountered. | 58 # properly wrap DOM objects if/when encountered. |
| 62 _removed_html_interfaces = [ | 59 _removed_html_interfaces = [ |
| 60 'CSSPrimitiveValue', |
| 61 'CSSValue', |
| 62 'Counter', |
| 63 'DOMFileSystemSync', # Workers | 63 'DOMFileSystemSync', # Workers |
| 64 'DatabaseSync', # Workers | 64 'DatabaseSync', # Workers |
| 65 'DedicatedWorkerContext', # Workers | 65 'DedicatedWorkerContext', # Workers |
| 66 'DirectoryEntrySync', # Workers | 66 'DirectoryEntrySync', # Workers |
| 67 'DirectoryReaderSync', # Workers | 67 'DirectoryReaderSync', # Workers |
| 68 'EntrySync', # Workers | 68 'EntrySync', # Workers |
| 69 'FileEntrySync', # Workers | 69 'FileEntrySync', # Workers |
| 70 'FileReaderSync', # Workers | 70 'FileReaderSync', # Workers |
| 71 'FileWriterSync', # Workers | 71 'FileWriterSync', # Workers |
| 72 'HTMLAppletElement', | 72 'HTMLAppletElement', |
| 73 'HTMLBaseFontElement', | 73 'HTMLBaseFontElement', |
| 74 'HTMLDirectoryElement', | 74 'HTMLDirectoryElement', |
| 75 'HTMLFontElement', | 75 'HTMLFontElement', |
| 76 'HTMLFrameElement', | 76 'HTMLFrameElement', |
| 77 'HTMLFrameSetElement', | 77 'HTMLFrameSetElement', |
| 78 'HTMLMarqueeElement', | 78 'HTMLMarqueeElement', |
| 79 'IDBAny', | 79 'IDBAny', |
| 80 'RGBColor', |
| 81 'Rect', |
| 80 'SQLTransactionSync', # Workers | 82 'SQLTransactionSync', # Workers |
| 81 'SQLTransactionSyncCallback', # Workers | 83 'SQLTransactionSyncCallback', # Workers |
| 82 'SVGAltGlyphDefElement', # Webkit only. | 84 'SVGAltGlyphDefElement', # Webkit only. |
| 83 'SVGAltGlyphItemElement', # Webkit only. | 85 'SVGAltGlyphItemElement', # Webkit only. |
| 84 'SVGAnimateColorElement', # Deprecated. Use AnimateElement instead. | 86 'SVGAnimateColorElement', # Deprecated. Use AnimateElement instead. |
| 87 'SVGColor', |
| 85 'SVGComponentTransferFunctionElement', # Currently not supported anywhere. | 88 'SVGComponentTransferFunctionElement', # Currently not supported anywhere. |
| 86 'SVGCursorElement', # Webkit only. | 89 'SVGCursorElement', # Webkit only. |
| 87 'SVGFEDropShadowElement', # Webkit only for the following: | 90 'SVGFEDropShadowElement', # Webkit only for the following: |
| 88 'SVGFontElement', | 91 'SVGFontElement', |
| 89 'SVGFontFaceElement', | 92 'SVGFontFaceElement', |
| 90 'SVGFontFaceFormatElement', | 93 'SVGFontFaceFormatElement', |
| 91 'SVGFontFaceNameElement', | 94 'SVGFontFaceNameElement', |
| 92 'SVGFontFaceSrcElement', | 95 'SVGFontFaceSrcElement', |
| 93 'SVGFontFaceUriElement', | 96 'SVGFontFaceUriElement', |
| 94 'SVGGlyphElement', | 97 'SVGGlyphElement', |
| 95 'SVGGlyphRefElement', | 98 'SVGGlyphRefElement', |
| 99 'SVGGradientElement', # Currently not supported anywhere. |
| 96 'SVGHKernElement', | 100 'SVGHKernElement', |
| 97 'SVGMPathElement', | 101 'SVGMPathElement', |
| 102 'SVGPaint', |
| 98 'SVGMissingGlyphElement', | 103 'SVGMissingGlyphElement', |
| 99 'SVGTRefElement', | 104 'SVGTRefElement', |
| 100 'SVGVKernElement', | 105 'SVGVKernElement', |
| 101 'SharedWorker', # Workers | 106 'SharedWorker', # Workers |
| 102 'SharedWorkerContext', # Workers | 107 'SharedWorkerContext', # Workers |
| 108 'WebKitCSSFilterValue', |
| 109 'WebKitCSSMatrix', |
| 110 'WebKitCSSMixFunctionValue', |
| 111 'WebKitCSSTransformValue', |
| 103 'WorkerContext', # Workers | 112 'WorkerContext', # Workers |
| 104 'WorkerLocation', # Workers | 113 'WorkerLocation', # Workers |
| 105 'WorkerNavigator', # Workers | 114 'WorkerNavigator', # Workers |
| 106 ] | 115 ] |
| 107 | 116 |
| 108 for interface in _removed_html_interfaces: | 117 for interface in _removed_html_interfaces: |
| 109 html_interface_renames[interface] = '_' + interface | 118 html_interface_renames[interface] = '_' + interface |
| 110 | 119 |
| 111 convert_to_future_members = monitored.Set( | 120 convert_to_future_members = monitored.Set( |
| 112 'htmlrenamer.converted_to_future_members', [ | 121 'htmlrenamer.converted_to_future_members', [ |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 'DirectoryEntry.getFile': '_getFile', | 301 'DirectoryEntry.getFile': '_getFile', |
| 293 'Document.createCDATASection': 'createCDataSection', | 302 'Document.createCDATASection': 'createCDataSection', |
| 294 'Document.defaultView': 'window', | 303 'Document.defaultView': 'window', |
| 295 'Document.querySelector': 'query', | 304 'Document.querySelector': 'query', |
| 296 'DOMURL.createObjectURL': 'createObjectUrl', | 305 'DOMURL.createObjectURL': 'createObjectUrl', |
| 297 'DOMURL.revokeObjectURL': 'revokeObjectUrl', | 306 'DOMURL.revokeObjectURL': 'revokeObjectUrl', |
| 298 'DOMWindow.clearTimeout': '_clearTimeout', | 307 'DOMWindow.clearTimeout': '_clearTimeout', |
| 299 'DOMWindow.clearInterval': '_clearInterval', | 308 'DOMWindow.clearInterval': '_clearInterval', |
| 300 'DOMWindow.setTimeout': '_setTimeout', | 309 'DOMWindow.setTimeout': '_setTimeout', |
| 301 'DOMWindow.setInterval': '_setInterval', | 310 'DOMWindow.setInterval': '_setInterval', |
| 302 'DOMWindow.webkitConvertPointFromNodeToPage': 'convertPointFromNodeToPage', | 311 'DOMWindow.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage', |
| 303 'DOMWindow.webkitConvertPointFromPageToNode': 'convertPointFromPageToNode', | 312 'DOMWindow.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode', |
| 304 'DOMWindow.webkitNotifications': 'notifications', | 313 'DOMWindow.webkitNotifications': 'notifications', |
| 305 'DOMWindow.webkitRequestFileSystem': '_requestFileSystem', | 314 'DOMWindow.webkitRequestFileSystem': '_requestFileSystem', |
| 306 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', | 315 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', |
| 307 'Element.querySelector': 'query', | 316 'Element.querySelector': 'query', |
| 308 'Element.webkitCreateShadowRoot': 'createShadowRoot', | 317 'Element.webkitCreateShadowRoot': 'createShadowRoot', |
| 309 'Element.webkitMatchesSelector' : 'matches', | 318 'Element.webkitMatchesSelector' : 'matches', |
| 310 'Navigator.webkitGetUserMedia': '_getUserMedia', | 319 'Navigator.webkitGetUserMedia': '_getUserMedia', |
| 311 'Node.appendChild': 'append', | 320 'Node.appendChild': 'append', |
| 312 'Node.cloneNode': 'clone', | 321 'Node.cloneNode': 'clone', |
| 313 'Node.nextSibling': 'nextNode', | 322 'Node.nextSibling': 'nextNode', |
| (...skipping 18 matching lines...) Expand all Loading... |
| 332 | 341 |
| 333 # Members and classes from the dom that should be removed completely from | 342 # Members and classes from the dom that should be removed completely from |
| 334 # dart:html. These could be expressed in the IDL instead but expressing this | 343 # dart:html. These could be expressed in the IDL instead but expressing this |
| 335 # as a simple table instead is more concise. | 344 # as a simple table instead is more concise. |
| 336 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName | 345 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName |
| 337 # Using get: and set: is optional and should only be used when a getter needs | 346 # Using get: and set: is optional and should only be used when a getter needs |
| 338 # to be suppressed but not the setter, etc. | 347 # to be suppressed but not the setter, etc. |
| 339 # TODO(jacobr): cleanup and augment this list. | 348 # TODO(jacobr): cleanup and augment this list. |
| 340 _removed_html_members = monitored.Set('htmlrenamer._removed_html_members', [ | 349 _removed_html_members = monitored.Set('htmlrenamer._removed_html_members', [ |
| 341 'Attr.*', | 350 'Attr.*', |
| 351 'CSSStyleDeclaration.getPropertyCSSValue', |
| 342 'CanvasRenderingContext2D.clearShadow', | 352 'CanvasRenderingContext2D.clearShadow', |
| 343 'CanvasRenderingContext2D.drawImageFromRect', | 353 'CanvasRenderingContext2D.drawImageFromRect', |
| 344 'CanvasRenderingContext2D.setAlpha', | 354 'CanvasRenderingContext2D.setAlpha', |
| 345 'CanvasRenderingContext2D.setCompositeOperation', | 355 'CanvasRenderingContext2D.setCompositeOperation', |
| 346 'CanvasRenderingContext2D.setFillColor', | 356 'CanvasRenderingContext2D.setFillColor', |
| 347 'CanvasRenderingContext2D.setLineCap', | 357 'CanvasRenderingContext2D.setLineCap', |
| 348 'CanvasRenderingContext2D.setLineJoin', | 358 'CanvasRenderingContext2D.setLineJoin', |
| 349 'CanvasRenderingContext2D.setLineWidth', | 359 'CanvasRenderingContext2D.setLineWidth', |
| 350 'CanvasRenderingContext2D.setMiterLimit', | 360 'CanvasRenderingContext2D.setMiterLimit', |
| 351 'CanvasRenderingContext2D.setShadow', | 361 'CanvasRenderingContext2D.setShadow', |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 'Node.isDefaultNamespace', | 604 'Node.isDefaultNamespace', |
| 595 'Node.isEqualNode', | 605 'Node.isEqualNode', |
| 596 'Node.isSameNode', | 606 'Node.isSameNode', |
| 597 'Node.isSupported', | 607 'Node.isSupported', |
| 598 'Node.lookupNamespaceURI', | 608 'Node.lookupNamespaceURI', |
| 599 'Node.lookupPrefix', | 609 'Node.lookupPrefix', |
| 600 'Node.normalize', | 610 'Node.normalize', |
| 601 'Node.set:nodeValue', | 611 'Node.set:nodeValue', |
| 602 'NodeList.item', | 612 'NodeList.item', |
| 603 'ShadowRoot.getElementsByTagNameNS', | 613 'ShadowRoot.getElementsByTagNameNS', |
| 614 'SVGStyledElement.getPresentationAttribute', |
| 604 'WheelEvent.wheelDelta', | 615 'WheelEvent.wheelDelta', |
| 605 'WorkerContext.webkitIndexedDB', | 616 'WorkerContext.webkitIndexedDB', |
| 606 # TODO(jacobr): should these be removed? | 617 # TODO(jacobr): should these be removed? |
| 607 'Document.close', | 618 'Document.close', |
| 608 'Document.hasFocus', | 619 'Document.hasFocus', |
| 609 ]) | 620 ]) |
| 610 | 621 |
| 611 # Manual dart: library name lookup. | 622 # Manual dart: library name lookup. |
| 612 _library_names = monitored.Dict('htmlrenamer._library_names', { | 623 _library_names = monitored.Dict('htmlrenamer._library_names', { |
| 613 'DOMWindow': 'html', | 624 'DOMWindow': 'html', |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 744 |
| 734 # We're looking for a sequence of letters which start with capital letter | 745 # We're looking for a sequence of letters which start with capital letter |
| 735 # then a series of caps and finishes with either the end of the string or | 746 # then a series of caps and finishes with either the end of the string or |
| 736 # a capital letter. | 747 # a capital letter. |
| 737 # The [0-9] check is for names such as 2D or 3D | 748 # The [0-9] check is for names such as 2D or 3D |
| 738 # The following test cases should match as: | 749 # The following test cases should match as: |
| 739 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 750 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
| 740 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 751 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
| 741 # IFrameElement: (I)()(F)rameElement (no change) | 752 # IFrameElement: (I)()(F)rameElement (no change) |
| 742 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 753 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
| OLD | NEW |