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

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

Issue 22352004: Regenerating DOM types from IDL roll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « tools/dom/scripts/htmleventgenerator.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 typed_array_renames = { 9 typed_array_renames = {
10 'ArrayBuffer': 'ByteBuffer', 10 'ArrayBuffer': 'ByteBuffer',
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 # Interfaces that are suppressed, but need to still exist for Dartium and to 65 # Interfaces that are suppressed, but need to still exist for Dartium and to
66 # properly wrap DOM objects if/when encountered. 66 # properly wrap DOM objects if/when encountered.
67 _removed_html_interfaces = [ 67 _removed_html_interfaces = [
68 'CSSPrimitiveValue', 68 'CSSPrimitiveValue',
69 'CSSValue', 69 'CSSValue',
70 'Counter', 70 'Counter',
71 'DOMFileSystemSync', # Workers 71 'DOMFileSystemSync', # Workers
72 'DatabaseSync', # Workers 72 'DatabaseSync', # Workers
73 'DataView', # Typed arrays 73 'DataView', # Typed arrays
74 'DedicatedWorkerContext', # Workers
75 'DirectoryEntrySync', # Workers 74 'DirectoryEntrySync', # Workers
76 'DirectoryReaderSync', # Workers 75 'DirectoryReaderSync', # Workers
77 'EntrySync', # Workers 76 'EntrySync', # Workers
78 'FileEntrySync', # Workers 77 'FileEntrySync', # Workers
79 'FileReaderSync', # Workers 78 'FileReaderSync', # Workers
80 'FileWriterSync', # Workers 79 'FileWriterSync', # Workers
81 'HTMLAppletElement', 80 'HTMLAppletElement',
82 'HTMLBaseFontElement', 81 'HTMLBaseFontElement',
83 'HTMLDirectoryElement', 82 'HTMLDirectoryElement',
84 'HTMLFontElement', 83 'HTMLFontElement',
(...skipping 22 matching lines...) Expand all
107 'SVGFontFaceUriElement', 106 'SVGFontFaceUriElement',
108 'SVGGlyphElement', 107 'SVGGlyphElement',
109 'SVGGlyphRefElement', 108 'SVGGlyphRefElement',
110 'SVGHKernElement', 109 'SVGHKernElement',
111 'SVGMPathElement', 110 'SVGMPathElement',
112 'SVGPaint', 111 'SVGPaint',
113 'SVGMissingGlyphElement', 112 'SVGMissingGlyphElement',
114 'SVGTRefElement', 113 'SVGTRefElement',
115 'SVGVKernElement', 114 'SVGVKernElement',
116 'SharedWorker', # Workers 115 'SharedWorker', # Workers
117 'SharedWorkerContext', # Workers
118 'WebKitMediaSource', 116 'WebKitMediaSource',
119 'WebKitSourceBuffer', 117 'WebKitSourceBuffer',
120 'WebKitSourceBufferList', 118 'WebKitSourceBufferList',
121 'WorkerContext', # Workers
122 'WorkerLocation', # Workers 119 'WorkerLocation', # Workers
123 'WorkerNavigator', # Workers 120 'WorkerNavigator', # Workers
124 ] 121 ]
125 122
126 for interface in _removed_html_interfaces: 123 for interface in _removed_html_interfaces:
127 html_interface_renames[interface] = '_' + interface 124 html_interface_renames[interface] = '_' + interface
128 125
129 convert_to_future_members = monitored.Set( 126 convert_to_future_members = monitored.Set(
130 'htmlrenamer.converted_to_future_members', [ 127 'htmlrenamer.converted_to_future_members', [
131 'AudioContext.decodeAudioData', 128 'AudioContext.decodeAudioData',
132 'DataTransferItem.getAsString', 129 'DataTransferItem.getAsString',
133 'DirectoryEntry.getDirectory', 130 'DirectoryEntry.getDirectory',
134 'DirectoryEntry.getFile', 131 'DirectoryEntry.getFile',
135 'DirectoryEntry.removeRecursively', 132 'DirectoryEntry.removeRecursively',
136 'DirectoryReader.readEntries', 133 'DirectoryReader.readEntries',
137 'Window.webkitRequestFileSystem', 134 'Window.webkitRequestFileSystem',
138 'Window.webkitResolveLocalFileSystemURL', 135 'Window.webkitResolveLocalFileSystemURL',
139 'Entry.copyTo', 136 'Entry.copyTo',
140 'Entry.getMetadata', 137 'Entry.getMetadata',
141 'Entry.getParent', 138 'Entry.getParent',
142 'Entry.moveTo', 139 'Entry.moveTo',
143 'Entry.remove', 140 'Entry.remove',
144 'FileEntry.createWriter', 141 'FileEntry.createWriter',
145 'FileEntry.file', 142 'FileEntry.file',
146 'Notification.requestPermission', 143 'Notification.requestPermission',
147 'NotificationCenter.requestPermission', 144 'NotificationCenter.requestPermission',
148 'RTCPeerConnection.setLocalDescription', 145 'RTCPeerConnection.setLocalDescription',
149 'RTCPeerConnection.setRemoteDescription', 146 'RTCPeerConnection.setRemoteDescription',
150 'StorageInfo.requestQuota', 147 'StorageInfo.requestQuota',
151 'WorkerContext.webkitResolveLocalFileSystemURL', 148 'WorkerGlobalScope.webkitResolveLocalFileSystemURL',
152 'WorkerContext.webkitRequestFileSystem', 149 'WorkerGlobalScope.webkitRequestFileSystem',
153 ]) 150 ])
154 151
155 # Members from the standard dom that should not be exposed publicly in dart:html 152 # Members from the standard dom that should not be exposed publicly in dart:html
156 # but need to be exposed internally to implement dart:html on top of a standard 153 # but need to be exposed internally to implement dart:html on top of a standard
157 # browser. 154 # browser.
158 private_html_members = monitored.Set('htmlrenamer.private_html_members', [ 155 private_html_members = monitored.Set('htmlrenamer.private_html_members', [
159 'AudioNode.connect', 156 'AudioNode.connect',
160 'CanvasRenderingContext2D.arc', 157 'CanvasRenderingContext2D.arc',
161 'CompositionEvent.initCompositionEvent', 158 'CompositionEvent.initCompositionEvent',
162 'CustomEvent.initCustomEvent', 159 'CustomEvent.initCustomEvent',
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 'Window.clearTimeout': '_clearTimeout', 319 'Window.clearTimeout': '_clearTimeout',
323 'Window.clearInterval': '_clearInterval', 320 'Window.clearInterval': '_clearInterval',
324 'Window.setTimeout': '_setTimeout', 321 'Window.setTimeout': '_setTimeout',
325 'Window.setInterval': '_setInterval', 322 'Window.setInterval': '_setInterval',
326 'Window.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage', 323 'Window.webkitConvertPointFromNodeToPage': '_convertPointFromNodeToPage',
327 'Window.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode', 324 'Window.webkitConvertPointFromPageToNode': '_convertPointFromPageToNode',
328 'Window.webkitNotifications': 'notifications', 325 'Window.webkitNotifications': 'notifications',
329 'Window.webkitRequestFileSystem': '_requestFileSystem', 326 'Window.webkitRequestFileSystem': '_requestFileSystem',
330 'Window.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', 327 'Window.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
331 'Element.querySelector': 'query', 328 'Element.querySelector': 'query',
332 'Element.webkitCreateShadowRoot': 'createShadowRoot',
333 'Element.webkitMatchesSelector' : 'matches', 329 'Element.webkitMatchesSelector' : 'matches',
334 'MutationObserver.observe': '_observe', 330 'MutationObserver.observe': '_observe',
335 'Navigator.webkitGetUserMedia': '_getUserMedia', 331 'Navigator.webkitGetUserMedia': '_getUserMedia',
336 'Node.appendChild': 'append', 332 'Node.appendChild': 'append',
337 'Node.cloneNode': 'clone', 333 'Node.cloneNode': 'clone',
338 'Node.nextSibling': 'nextNode', 334 'Node.nextSibling': 'nextNode',
339 'Node.ownerDocument': 'document', 335 'Node.ownerDocument': 'document',
340 'Node.parentElement': 'parent', 336 'Node.parentElement': 'parent',
341 'Node.previousSibling': 'previousNode', 337 'Node.previousSibling': 'previousNode',
342 'Node.textContent': 'text', 338 'Node.textContent': 'text',
(...skipping 30 matching lines...) Expand all
373 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': 369 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)':
374 'transactionStores', 370 'transactionStores',
375 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)': 371 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)':
376 'transactionList', 372 'transactionList',
377 'IDBDatabase.transaction(DOMString storeName, DOMString mode)': 373 'IDBDatabase.transaction(DOMString storeName, DOMString mode)':
378 'transactionStore', 374 'transactionStore',
379 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer', 375 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer',
380 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData', 376 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
381 'RTCDataChannel.send(Blob data)': 'sendBlob', 377 'RTCDataChannel.send(Blob data)': 'sendBlob',
382 'RTCDataChannel.send(DOMString data)': 'sendString', 378 'RTCDataChannel.send(DOMString data)': 'sendString',
383 'SourceBuffer.appendBuffer(ArrayBufferView view)': 'appendBufferView', 379 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendBufferView',
384 'URL.createObjectURL(MediaSource source)': 380 'URL.createObjectURL(MediaSource source)':
385 'createObjectUrlFromSource', 381 'createObjectUrlFromSource',
386 'URL.createObjectURL(WebKitMediaSource source)': 382 'URL.createObjectURL(WebKitMediaSource source)':
387 '_createObjectUrlFromWebKitSource', 383 '_createObjectUrlFromWebKitSource',
388 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream', 384 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream',
389 'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob', 385 'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob',
390 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' 386 'WebGLRenderingContext.texImage2D(unsigned long target, long level, '
391 'unsigned long internalformat, unsigned long format, unsigned long ' 387 'unsigned long internalformat, unsigned long format, unsigned long '
392 'type, ImageData pixels)': 'texImage2DImageData', 388 'type, ImageData pixels)': 'texImage2DImageData',
393 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' 389 'WebGLRenderingContext.texImage2D(unsigned long target, long level, '
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 'Document.fgColor', 495 'Document.fgColor',
500 'Document.get:URL', 496 'Document.get:URL',
501 'Document.get:anchors', 497 'Document.get:anchors',
502 'Document.get:characterSet', 498 'Document.get:characterSet',
503 'Document.get:compatMode', 499 'Document.get:compatMode',
504 'Document.get:defaultCharset', 500 'Document.get:defaultCharset',
505 'Document.get:doctype', 501 'Document.get:doctype',
506 'Document.get:documentURI', 502 'Document.get:documentURI',
507 'Document.get:embeds', 503 'Document.get:embeds',
508 'Document.get:forms', 504 'Document.get:forms',
509 'Document.get:height',
510 'Document.get:inputEncoding', 505 'Document.get:inputEncoding',
511 'Document.get:links', 506 'Document.get:links',
512 'Document.get:plugins', 507 'Document.get:plugins',
513 'Document.get:scripts', 508 'Document.get:scripts',
514 'Document.get:width',
515 'Document.get:xmlEncoding', 509 'Document.get:xmlEncoding',
516 'Document.getElementsByTagNameNS', 510 'Document.getElementsByTagNameNS',
517 'Document.getOverrideStyle', 511 'Document.getOverrideStyle',
518 'Document.getSelection', 512 'Document.getSelection',
519 'Document.images', 513 'Document.images',
520 'Document.linkColor', 514 'Document.linkColor',
521 'Document.location', 515 'Document.location',
522 'Document.open', 516 'Document.open',
523 'Document.set:domain', 517 'Document.set:domain',
524 'Document.vlinkColor', 518 'Document.vlinkColor',
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 'Performance.webkitClearMarks', 703 'Performance.webkitClearMarks',
710 'Performance.webkitClearMeasures', 704 'Performance.webkitClearMeasures',
711 'Performance.webkitGetEntries', 705 'Performance.webkitGetEntries',
712 'Performance.webkitGetEntriesByName', 706 'Performance.webkitGetEntriesByName',
713 'Performance.webkitGetEntriesByType', 707 'Performance.webkitGetEntriesByType',
714 'Performance.webkitMark', 708 'Performance.webkitMark',
715 'Performance.webkitMeasure', 709 'Performance.webkitMeasure',
716 'ShadowRoot.getElementsByTagNameNS', 710 'ShadowRoot.getElementsByTagNameNS',
717 'SVGStyledElement.getPresentationAttribute', 711 'SVGStyledElement.getPresentationAttribute',
718 'WheelEvent.wheelDelta', 712 'WheelEvent.wheelDelta',
719 'WorkerContext.webkitIndexedDB',
720 # TODO(jacobr): should these be removed? 713 # TODO(jacobr): should these be removed?
721 'Document.close', 714 'Document.close',
722 'Document.hasFocus', 715 'Document.hasFocus',
723 ]) 716 ])
724 717
725 # Manual dart: library name lookup. 718 # Manual dart: library name lookup.
726 _library_names = monitored.Dict('htmlrenamer._library_names', { 719 _library_names = monitored.Dict('htmlrenamer._library_names', {
727 'ANGLEInstancedArrays': 'web_gl', 720 'ANGLEInstancedArrays': 'web_gl',
728 'Database': 'web_sql', 721 'Database': 'web_sql',
729 'Navigator': 'html', 722 'Navigator': 'html',
730 'Window': 'html', 723 'Window': 'html',
731 'WorkerContext': 'html',
732 }) 724 })
733 725
734 class HtmlRenamer(object): 726 class HtmlRenamer(object):
735 def __init__(self, database): 727 def __init__(self, database):
736 self._database = database 728 self._database = database
737 729
738 def RenameInterface(self, interface): 730 def RenameInterface(self, interface):
739 if 'Callback' in interface.ext_attrs: 731 if 'Callback' in interface.ext_attrs:
740 if interface.id in _removed_html_interfaces: 732 if interface.id in _removed_html_interfaces:
741 return None 733 return None
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 860
869 # We're looking for a sequence of letters which start with capital letter 861 # We're looking for a sequence of letters which start with capital letter
870 # then a series of caps and finishes with either the end of the string or 862 # then a series of caps and finishes with either the end of the string or
871 # a capital letter. 863 # a capital letter.
872 # The [0-9] check is for names such as 2D or 3D 864 # The [0-9] check is for names such as 2D or 3D
873 # The following test cases should match as: 865 # The following test cases should match as:
874 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 866 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
875 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 867 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
876 # IFrameElement: (I)()(F)rameElement (no change) 868 # IFrameElement: (I)()(F)rameElement (no change)
877 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 869 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmleventgenerator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698