Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: tools/dom/scripts/htmlrenamer.py

Issue 12857006: Removing CssValue APIs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 14 matching lines...) Expand all
25 'FileSystemCallback': '_FileSystemCallback', 25 'FileSystemCallback': '_FileSystemCallback',
26 'FileWriterCallback': '_FileWriterCallback', 26 'FileWriterCallback': '_FileWriterCallback',
27 'HTMLDocument' : 'HtmlDocument', 27 'HTMLDocument' : 'HtmlDocument',
28 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. 28 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts.
29 'NamedNodeMap': '_NamedNodeMap', 29 'NamedNodeMap': '_NamedNodeMap',
30 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback', 30 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback',
31 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback', 31 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback',
32 'NotificationPermissionCallback': '_NotificationPermissionCallback', 32 'NotificationPermissionCallback': '_NotificationPermissionCallback',
33 'PositionCallback': '_PositionCallback', 33 'PositionCallback': '_PositionCallback',
34 'PositionErrorCallback': '_PositionErrorCallback', 34 'PositionErrorCallback': '_PositionErrorCallback',
35 'Rect': 'CssRect',
36 'RGBColor': 'CssRgbColor',
37 'RTCErrorCallback': '_RtcErrorCallback', 35 'RTCErrorCallback': '_RtcErrorCallback',
38 'RTCSessionDescriptionCallback': '_RtcSessionDescriptionCallback', 36 'RTCSessionDescriptionCallback': '_RtcSessionDescriptionCallback',
39 'StorageInfoErrorCallback': '_StorageInfoErrorCallback', 37 'StorageInfoErrorCallback': '_StorageInfoErrorCallback',
40 'StorageInfoUsageCallback': '_StorageInfoUsageCallback', 38 'StorageInfoUsageCallback': '_StorageInfoUsageCallback',
41 'StringCallback': '_StringCallback', 39 'StringCallback': '_StringCallback',
42 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. 40 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts.
43 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. 41 'SVGElement': 'SvgElement', # Manual to avoid name conflicts.
44 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. 42 'SVGException': 'SvgException', # Manual of avoid conflict with Exception.
45 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. 43 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts.
46 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', 44 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject',
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 'HTMLAppletElement', 63 'HTMLAppletElement',
64 'HTMLBaseFontElement', 64 'HTMLBaseFontElement',
65 'HTMLDirectoryElement', 65 'HTMLDirectoryElement',
66 'HTMLFontElement', 66 'HTMLFontElement',
67 'HTMLFrameElement', 67 'HTMLFrameElement',
68 'HTMLFrameSetElement', 68 'HTMLFrameSetElement',
69 'HTMLMarqueeElement', 69 'HTMLMarqueeElement',
70 'IDBAny', 70 'IDBAny',
71 'RGBColor',
72 'Rect',
71 'SVGAltGlyphDefElement', # Webkit only. 73 'SVGAltGlyphDefElement', # Webkit only.
72 'SVGAltGlyphItemElement', # Webkit only. 74 'SVGAltGlyphItemElement', # Webkit only.
73 'SVGAnimateColorElement', # Deprecated. Use AnimateElement instead. 75 'SVGAnimateColorElement', # Deprecated. Use AnimateElement instead.
76 'SVGColor',
74 'SVGComponentTransferFunctionElement', # Currently not supported anywhere. 77 'SVGComponentTransferFunctionElement', # Currently not supported anywhere.
75 'SVGCursorElement', # Webkit only. 78 'SVGCursorElement', # Webkit only.
76 'SVGGradientElement', # Currently not supported anywhere.
77 'SVGFEDropShadowElement', # Webkit only for the following: 79 'SVGFEDropShadowElement', # Webkit only for the following:
78 'SVGFontElement', 80 'SVGFontElement',
79 'SVGFontFaceElement', 81 'SVGFontFaceElement',
80 'SVGFontFaceFormatElement', 82 'SVGFontFaceFormatElement',
81 'SVGFontFaceNameElement', 83 'SVGFontFaceNameElement',
82 'SVGFontFaceSrcElement', 84 'SVGFontFaceSrcElement',
83 'SVGFontFaceUriElement', 85 'SVGFontFaceUriElement',
84 'SVGGlyphElement', 86 'SVGGlyphElement',
85 'SVGGlyphRefElement', 87 'SVGGlyphRefElement',
88 'SVGGradientElement', # Currently not supported anywhere.
86 'SVGHKernElement', 89 'SVGHKernElement',
90 'SVGMPathElement',
91 'SVGPaint',
87 'SVGMissingGlyphElement', 92 'SVGMissingGlyphElement',
88 'SVGMPathElement',
89 'SVGTRefElement', 93 'SVGTRefElement',
90 'SVGVKernElement', 94 'SVGVKernElement',
95 'WebKitCSSFilterValue',
96 'WebKitCSSMatrix',
97 'WebKitCSSMixFunctionValue',
98 'WebKitCSSTransformValue',
91 ] 99 ]
92 100
93 for interface in _removed_html_interfaces: 101 for interface in _removed_html_interfaces:
94 html_interface_renames[interface] = '_' + interface 102 html_interface_renames[interface] = '_' + interface
95 103
96 convert_to_future_members = monitored.Set( 104 convert_to_future_members = monitored.Set(
97 'htmlrenamer.converted_to_future_members', [ 105 'htmlrenamer.converted_to_future_members', [
98 'DataTransferItem.getAsString', 106 'DataTransferItem.getAsString',
99 'DirectoryEntry.getDirectory', 107 'DirectoryEntry.getDirectory',
100 'DirectoryEntry.getFile', 108 'DirectoryEntry.getFile',
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', { 292 renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', {
285 'Document.createCDATASection': 'createCDataSection', 293 'Document.createCDATASection': 'createCDataSection',
286 'Document.defaultView': 'window', 294 'Document.defaultView': 'window',
287 'Document.querySelector': 'query', 295 'Document.querySelector': 'query',
288 'DOMURL.createObjectURL': 'createObjectUrl', 296 'DOMURL.createObjectURL': 'createObjectUrl',
289 'DOMURL.revokeObjectURL': 'revokeObjectUrl', 297 'DOMURL.revokeObjectURL': 'revokeObjectUrl',
290 'DOMWindow.clearTimeout': '_clearTimeout', 298 'DOMWindow.clearTimeout': '_clearTimeout',
291 'DOMWindow.clearInterval': '_clearInterval', 299 'DOMWindow.clearInterval': '_clearInterval',
292 'DOMWindow.setTimeout': '_setTimeout', 300 'DOMWindow.setTimeout': '_setTimeout',
293 'DOMWindow.setInterval': '_setInterval', 301 'DOMWindow.setInterval': '_setInterval',
294 'DOMWindow.webkitConvertPointFromNodeToPage': 'convertPointFromNodeToPage', 302 'DOMWindow.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage',
295 'DOMWindow.webkitConvertPointFromPageToNode': 'convertPointFromPageToNode', 303 'DOMWindow.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode',
296 'DOMWindow.webkitNotifications': 'notifications', 304 'DOMWindow.webkitNotifications': 'notifications',
297 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem', 305 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem',
298 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', 306 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
299 'Element.querySelector': 'query', 307 'Element.querySelector': 'query',
300 'Element.webkitCreateShadowRoot': 'createShadowRoot', 308 'Element.webkitCreateShadowRoot': 'createShadowRoot',
301 'Element.webkitMatchesSelector' : 'matches', 309 'Element.webkitMatchesSelector' : 'matches',
302 'Navigator.webkitGetUserMedia': '_getUserMedia', 310 'Navigator.webkitGetUserMedia': '_getUserMedia',
303 'Node.appendChild': 'append', 311 'Node.appendChild': 'append',
304 'Node.cloneNode': 'clone', 312 'Node.cloneNode': 'clone',
305 'Node.nextSibling': 'nextNode', 313 'Node.nextSibling': 'nextNode',
(...skipping 23 matching lines...) Expand all
329 337
330 # Members and classes from the dom that should be removed completely from 338 # Members and classes from the dom that should be removed completely from
331 # dart:html. These could be expressed in the IDL instead but expressing this 339 # dart:html. These could be expressed in the IDL instead but expressing this
332 # as a simple table instead is more concise. 340 # as a simple table instead is more concise.
333 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName 341 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName
334 # Using get: and set: is optional and should only be used when a getter needs 342 # Using get: and set: is optional and should only be used when a getter needs
335 # to be suppressed but not the setter, etc. 343 # to be suppressed but not the setter, etc.
336 # TODO(jacobr): cleanup and augment this list. 344 # TODO(jacobr): cleanup and augment this list.
337 _removed_html_members = monitored.Set('htmlrenamer._removed_html_members', [ 345 _removed_html_members = monitored.Set('htmlrenamer._removed_html_members', [
338 'Attr.*', 346 'Attr.*',
347 'CSSStyleDeclaration.getPropertyCSSValue',
339 'CanvasRenderingContext2D.clearShadow', 348 'CanvasRenderingContext2D.clearShadow',
340 'CanvasRenderingContext2D.drawImageFromRect', 349 'CanvasRenderingContext2D.drawImageFromRect',
341 'CanvasRenderingContext2D.setAlpha', 350 'CanvasRenderingContext2D.setAlpha',
342 'CanvasRenderingContext2D.setCompositeOperation', 351 'CanvasRenderingContext2D.setCompositeOperation',
343 'CanvasRenderingContext2D.setFillColor', 352 'CanvasRenderingContext2D.setFillColor',
344 'CanvasRenderingContext2D.setLineCap', 353 'CanvasRenderingContext2D.setLineCap',
345 'CanvasRenderingContext2D.setLineJoin', 354 'CanvasRenderingContext2D.setLineJoin',
346 'CanvasRenderingContext2D.setLineWidth', 355 'CanvasRenderingContext2D.setLineWidth',
347 'CanvasRenderingContext2D.setMiterLimit', 356 'CanvasRenderingContext2D.setMiterLimit',
348 'CanvasRenderingContext2D.setShadow', 357 'CanvasRenderingContext2D.setShadow',
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 'Node.isDefaultNamespace', 597 'Node.isDefaultNamespace',
589 'Node.isEqualNode', 598 'Node.isEqualNode',
590 'Node.isSameNode', 599 'Node.isSameNode',
591 'Node.isSupported', 600 'Node.isSupported',
592 'Node.lookupNamespaceURI', 601 'Node.lookupNamespaceURI',
593 'Node.lookupPrefix', 602 'Node.lookupPrefix',
594 'Node.normalize', 603 'Node.normalize',
595 'Node.set:nodeValue', 604 'Node.set:nodeValue',
596 'NodeList.item', 605 'NodeList.item',
597 'ShadowRoot.getElementsByTagNameNS', 606 'ShadowRoot.getElementsByTagNameNS',
607 'SVGStyledElement.getPresentationAttribute',
598 'WheelEvent.wheelDelta', 608 'WheelEvent.wheelDelta',
599 'WorkerContext.webkitIndexedDB', 609 'WorkerContext.webkitIndexedDB',
600 # TODO(jacobr): should these be removed? 610 # TODO(jacobr): should these be removed?
601 'Document.close', 611 'Document.close',
602 'Document.hasFocus', 612 'Document.hasFocus',
603 ]) 613 ])
604 614
605 class HtmlRenamer(object): 615 class HtmlRenamer(object):
606 def __init__(self, database): 616 def __init__(self, database):
607 self._database = database 617 self._database = database
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 714
705 # We're looking for a sequence of letters which start with capital letter 715 # We're looking for a sequence of letters which start with capital letter
706 # then a series of caps and finishes with either the end of the string or 716 # then a series of caps and finishes with either the end of the string or
707 # a capital letter. 717 # a capital letter.
708 # The [0-9] check is for names such as 2D or 3D 718 # The [0-9] check is for names such as 2D or 3D
709 # The following test cases should match as: 719 # The following test cases should match as:
710 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 720 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
711 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 721 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
712 # IFrameElement: (I)()(F)rameElement (no change) 722 # IFrameElement: (I)()(F)rameElement (no change)
713 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 723 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698