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', | |
22 'HTMLDocument' : 'HtmlDocument', | 19 'HTMLDocument' : 'HtmlDocument', |
23 'HTMLFontElement' : '_FontElement', | |
24 'HTMLFrameElement' : '_FrameElement', | |
25 'HTMLFrameSetElement' : '_FrameSetElement', | |
26 'HTMLMarqueeElement' : '_MarqueeElement', | |
27 'IDBAny': '_Any', # Suppressed, but needs to exist for Dartium. | |
28 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. | 20 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. |
29 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', | 21 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', |
30 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', | 22 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', |
31 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. | 23 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. |
32 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. | 24 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. |
33 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. | 25 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. |
34 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. | 26 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. |
35 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', | 27 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', |
36 'WebKitAnimationEvent': 'AnimationEvent', | 28 'WebKitAnimationEvent': 'AnimationEvent', |
37 'WebKitCSSKeyframeRule': 'CssKeyframeRule', | 29 'WebKitCSSKeyframeRule': 'CssKeyframeRule', |
38 'WebKitCSSKeyframesRule': 'CssKeyframesRule', | 30 'WebKitCSSKeyframesRule': 'CssKeyframesRule', |
39 'WebKitCSSMatrix': 'CssMatrix', | 31 'WebKitCSSMatrix': 'CssMatrix', |
40 'WebKitCSSTransformValue': 'CssTransformValue', | 32 'WebKitCSSTransformValue': 'CssTransformValue', |
41 'WebKitPoint': 'DomPoint', | 33 'WebKitPoint': 'DomPoint', |
42 'WebKitTransitionEvent': 'TransitionEvent', | 34 'WebKitTransitionEvent': 'TransitionEvent', |
43 'XMLHttpRequest': 'HttpRequest', | 35 'XMLHttpRequest': 'HttpRequest', |
44 'XMLHttpRequestException': 'HttpRequestException', | 36 'XMLHttpRequestException': 'HttpRequestException', |
45 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', | 37 'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent', |
46 'XMLHttpRequestUpload': 'HttpRequestUpload', | 38 'XMLHttpRequestUpload': 'HttpRequestUpload', |
47 }) | 39 }) |
48 | 40 |
| 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 |
49 # Members from the standard dom that should not be exposed publicly in dart:html | 77 # Members from the standard dom that should not be exposed publicly in dart:html |
50 # but need to be exposed internally to implement dart:html on top of a standard | 78 # but need to be exposed internally to implement dart:html on top of a standard |
51 # browser. | 79 # browser. |
52 _private_html_members = monitored.Set('htmlrenamer._private_html_members', [ | 80 _private_html_members = monitored.Set('htmlrenamer._private_html_members', [ |
53 'CompositionEvent.initCompositionEvent', | 81 'CompositionEvent.initCompositionEvent', |
54 'CustomEvent.initCustomEvent', | 82 'CustomEvent.initCustomEvent', |
55 'DeviceOrientationEvent.initDeviceOrientationEvent', | 83 'DeviceOrientationEvent.initDeviceOrientationEvent', |
56 'Document.createElement', | 84 'Document.createElement', |
57 'Document.createElementNS', | 85 'Document.createElementNS', |
58 'Document.createEvent', | 86 'Document.createEvent', |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 574 |
547 # We're looking for a sequence of letters which start with capital letter | 575 # We're looking for a sequence of letters which start with capital letter |
548 # then a series of caps and finishes with either the end of the string or | 576 # then a series of caps and finishes with either the end of the string or |
549 # a capital letter. | 577 # a capital letter. |
550 # The [0-9] check is for names such as 2D or 3D | 578 # The [0-9] check is for names such as 2D or 3D |
551 # The following test cases should match as: | 579 # The following test cases should match as: |
552 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 580 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
553 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 581 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
554 # IFrameElement: (I)()(F)rameElement (no change) | 582 # IFrameElement: (I)()(F)rameElement (no change) |
555 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 583 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
OLD | NEW |