| 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', |
| 11 'Clipboard': 'DataTransfer', | 11 'Clipboard': 'DataTransfer', |
| 12 'DOMApplicationCache': 'ApplicationCache', | 12 'DOMApplicationCache': 'ApplicationCache', |
| 13 'DOMCoreException': 'DomException', | 13 'DOMCoreException': 'DomException', |
| 14 'DOMFileSystem': 'FileSystem', | 14 'DOMFileSystem': 'FileSystem', |
| 15 'DOMFileSystemSync': 'FileSystemSync', | 15 'DOMFileSystemSync': 'FileSystemSync', |
| 16 'DOMFormData': 'FormData', | 16 'DOMFormData': 'FormData', |
| 17 'DOMURL': 'Url', | 17 'DOMURL': 'Url', |
| 18 'DOMWindow': 'Window', | 18 'DOMWindow': 'Window', |
| 19 'HTMLAppletElement' : '_AppletElement', |
| 20 'HTMLBaseFontElement' : '_BaseFontElement', |
| 21 'HTMLDirectoryElement' : '_DirectoryElement', |
| 19 'HTMLDocument' : 'HtmlDocument', | 22 'HTMLDocument' : 'HtmlDocument', |
| 23 'HTMLFontElement' : '_FontElement', |
| 24 'HTMLFrameElement' : '_FrameElement', |
| 25 'HTMLFrameSetElement' : '_FrameSetElement', |
| 26 'HTMLMarqueeElement' : '_MarqueeElement', |
| 27 'IDBAny': '_Any', # Suppressed, but needs to exist for Dartium. |
| 20 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. | 28 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. |
| 21 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', | 29 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', |
| 22 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', | 30 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', |
| 23 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. | 31 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. |
| 24 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. | 32 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. |
| 25 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. | 33 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. |
| 26 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. | 34 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. |
| 27 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', | 35 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', |
| 28 'WebKitAnimationEvent': 'AnimationEvent', | 36 'WebKitAnimationEvent': 'AnimationEvent', |
| 29 'WebKitCSSKeyframeRule': 'CssKeyframeRule', | 37 'WebKitCSSKeyframeRule': 'CssKeyframeRule', |
| 30 'WebKitCSSKeyframesRule': 'CssKeyframesRule', | 38 'WebKitCSSKeyframesRule': 'CssKeyframesRule', |
| 31 'WebKitCSSMatrix': 'CssMatrix', | 39 'WebKitCSSMatrix': 'CssMatrix', |
| 32 'WebKitCSSTransformValue': 'CssTransformValue', | 40 'WebKitCSSTransformValue': 'CssTransformValue', |
| 33 'WebKitPoint': 'DomPoint', | 41 'WebKitPoint': 'DomPoint', |
| 34 'WebKitTransitionEvent': 'TransitionEvent', | 42 'WebKitTransitionEvent': 'TransitionEvent', |
| 35 'XMLHttpRequest': 'HttpRequest', | 43 'XMLHttpRequest': 'HttpRequest', |
| 36 'XMLHttpRequestException': 'HttpRequestException', | 44 'XMLHttpRequestException': 'HttpRequestException', |
| 37 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', | 45 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', |
| 38 'XMLHttpRequestUpload': 'HttpRequestUpload', | 46 'XMLHttpRequestUpload': 'HttpRequestUpload', |
| 39 }) | 47 }) |
| 40 | 48 |
| 41 # Interfaces that are suppressed, but need to still exist for Dartium and to | |
| 42 # properly wrap DOM objects if/when encountered. | |
| 43 _removed_html_interfaces = [ | |
| 44 'HTMLAppletElement', | |
| 45 'HTMLBaseFontElement', | |
| 46 'HTMLDirectoryElement', | |
| 47 'HTMLFontElement', | |
| 48 'HTMLFrameElement', | |
| 49 'HTMLFrameSetElement', | |
| 50 'HTMLMarqueeElement', | |
| 51 'IDBAny', | |
| 52 'SVGAltGlyphDefElement', # Webkit only. | |
| 53 'SVGAltGlyphItemElement', # Webkit only. | |
| 54 'SVGAnimateColorElement', # Deprecated. Use AnimateElement instead. | |
| 55 'SVGComponentTransferFunctionElement', # Currently not supported anywhere. | |
| 56 'SVGCursorElement', # Webkit only. | |
| 57 'SVGGradientElement', # Currently not supported anywhere. | |
| 58 'SVGFEDropShadowElement', # Webkit only for the following: | |
| 59 'SVGFontElement', | |
| 60 'SVGFontFaceElement', | |
| 61 'SVGFontFaceFormatElement', | |
| 62 'SVGFontFaceNameElement', | |
| 63 'SVGFontFaceSrcElement', | |
| 64 'SVGFontFaceUriElement', | |
| 65 'SVGGlyphElement', | |
| 66 'SVGGlyphRefElement', | |
| 67 'SVGHKernElement', | |
| 68 'SVGMissingGlyphElement', | |
| 69 'SVGMPathElement', | |
| 70 'SVGTRefElement', | |
| 71 'SVGVKernElement', | |
| 72 ] | |
| 73 | |
| 74 for interface in _removed_html_interfaces: | |
| 75 html_interface_renames[interface] = '_' + interface | |
| 76 | |
| 77 # Members from the standard dom that should not be exposed publicly in dart:html | 49 # Members from the standard dom that should not be exposed publicly in dart:html |
| 78 # but need to be exposed internally to implement dart:html on top of a standard | 50 # but need to be exposed internally to implement dart:html on top of a standard |
| 79 # browser. | 51 # browser. |
| 80 _private_html_members = monitored.Set('htmlrenamer._private_html_members', [ | 52 _private_html_members = monitored.Set('htmlrenamer._private_html_members', [ |
| 81 'CompositionEvent.initCompositionEvent', | 53 'CompositionEvent.initCompositionEvent', |
| 82 'CustomEvent.initCustomEvent', | 54 'CustomEvent.initCustomEvent', |
| 83 'DeviceOrientationEvent.initDeviceOrientationEvent', | 55 'DeviceOrientationEvent.initDeviceOrientationEvent', |
| 84 'Document.createElement', | 56 'Document.createElement', |
| 85 'Document.createElementNS', | 57 'Document.createElementNS', |
| 86 'Document.createEvent', | 58 'Document.createEvent', |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 546 |
| 575 # We're looking for a sequence of letters which start with capital letter | 547 # We're looking for a sequence of letters which start with capital letter |
| 576 # then a series of caps and finishes with either the end of the string or | 548 # then a series of caps and finishes with either the end of the string or |
| 577 # a capital letter. | 549 # a capital letter. |
| 578 # The [0-9] check is for names such as 2D or 3D | 550 # The [0-9] check is for names such as 2D or 3D |
| 579 # The following test cases should match as: | 551 # The following test cases should match as: |
| 580 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 552 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
| 581 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 553 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
| 582 # IFrameElement: (I)()(F)rameElement (no change) | 554 # IFrameElement: (I)()(F)rameElement (no change) |
| 583 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 555 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
| OLD | NEW |