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

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

Issue 34733007: Add back unseparated out version of method overloads in dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 typed_array_renames = { 9 typed_array_renames = {
10 'ArrayBuffer': 'ByteBuffer', 10 'ArrayBuffer': 'ByteBuffer',
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 'Touch.screenX', 307 'Touch.screenX',
308 'Touch.screenY', 308 'Touch.screenY',
309 'TouchEvent.initTouchEvent', 309 'TouchEvent.initTouchEvent',
310 'UIEvent.charCode', 310 'UIEvent.charCode',
311 'UIEvent.initUIEvent', 311 'UIEvent.initUIEvent',
312 'UIEvent.keyCode', 312 'UIEvent.keyCode',
313 'UIEvent.layerX', 313 'UIEvent.layerX',
314 'UIEvent.layerY', 314 'UIEvent.layerY',
315 'UIEvent.pageX', 315 'UIEvent.pageX',
316 'UIEvent.pageY', 316 'UIEvent.pageY',
317 'WebGLRenderingContext.texImage2D',
318 'WheelEvent.initWebKitWheelEvent', 317 'WheelEvent.initWebKitWheelEvent',
319 'WheelEvent.deltaX', 318 'WheelEvent.deltaX',
320 'WheelEvent.deltaY', 319 'WheelEvent.deltaY',
321 'Window.getComputedStyle', 320 'Window.getComputedStyle',
322 'Window.clearInterval', 321 'Window.clearInterval',
323 'Window.clearTimeout', 322 'Window.clearTimeout',
324 'Window.moveTo', 323 'Window.moveTo',
325 'Window.requestAnimationFrame', 324 'Window.requestAnimationFrame',
326 'Window.setInterval', 325 'Window.setInterval',
327 'Window.setTimeout', 326 'Window.setTimeout',
(...skipping 18 matching lines...) Expand all
346 'Node.appendChild': 'append', 345 'Node.appendChild': 'append',
347 'Node.cloneNode': 'clone', 346 'Node.cloneNode': 'clone',
348 'Node.nextSibling': 'nextNode', 347 'Node.nextSibling': 'nextNode',
349 'Node.parentElement': 'parent', 348 'Node.parentElement': 'parent',
350 'Node.previousSibling': 'previousNode', 349 'Node.previousSibling': 'previousNode',
351 'Node.textContent': 'text', 350 'Node.textContent': 'text',
352 'SVGElement.className': '_svgClassName', 351 'SVGElement.className': '_svgClassName',
353 'SVGStopElement.offset': 'gradientOffset', 352 'SVGStopElement.offset': 'gradientOffset',
354 'URL.createObjectURL': 'createObjectUrl', 353 'URL.createObjectURL': 'createObjectUrl',
355 'URL.revokeObjectURL': 'revokeObjectUrl', 354 'URL.revokeObjectURL': 'revokeObjectUrl',
356 'WebGLRenderingContext.texSubImage2D': '_texSubImageImage2D',
357 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem', 355 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem',
358 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', 356 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync',
359 }) 357 })
360 358
361 # Members that have multiple definitions, but their types are vary, so we rename 359 # Members that have multiple definitions, but their types are vary, so we rename
362 # them to make them distinct. 360 # them to make them distinct.
363 renamed_overloads = monitored.Dict('htmldartgenreator.renamed_overloads', { 361 renamed_overloads = monitored.Dict('htmldartgenreator.renamed_overloads', {
364 'AudioContext.createBuffer(ArrayBuffer buffer, boolean mixToMono)': 362 'AudioContext.createBuffer(ArrayBuffer buffer, boolean mixToMono)':
365 'createBufferFromBuffer', 363 'createBufferFromBuffer',
366 'CSS.supports(DOMString conditionText)': 'supportsCondition', 364 'CSS.supports(DOMString conditionText)': 'supportsCondition',
367 'CanvasRenderingContext2D.createPattern(HTMLImageElement image, ' 365 'CanvasRenderingContext2D.createPattern(HTMLImageElement image, '
368 'DOMString repetitionType)': 'createPatternFromImage', 366 'DOMString repetitionType)': 'createPatternFromImage',
369 'DataTransferItemList.add(File file)': 'addFile', 367 'DataTransferItemList.add(File file)': 'addFile',
370 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData', 368 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData',
371 'Document.createElement(DOMString tagName)': None,
372 'Document.createElementNS(DOMString namespaceURI, DOMString qualifiedName)': N one,
373 'FormData.append(DOMString name, Blob value, DOMString filename)': 369 'FormData.append(DOMString name, Blob value, DOMString filename)':
374 'appendBlob', 370 'appendBlob',
375 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': 371 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)':
376 'transactionStores', 372 'transactionStores',
377 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)': 373 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)':
378 'transactionList', 374 'transactionList',
379 'IDBDatabase.transaction(DOMString storeName, DOMString mode)': 375 'IDBDatabase.transaction(DOMString storeName, DOMString mode)':
380 'transactionStore', 376 'transactionStore',
381 'ImageBitmapFactories.createImageBitmap(HTMLImageElement image)' : 'createImag eBitmap0',
382 'ImageBitmapFactories.createImageBitmap(HTMLImageElement image, long sx, long sy, long sw, long sh)' : 'createImageBitmap1',
383 'ImageBitmapFactories.createImageBitmap(HTMLVideoElement video)' : 'createImag eBitmap2',
384 'ImageBitmapFactories.createImageBitmap(HTMLVideoElement video, long sx, long sy, long sw, long sh)' : 'createImageBitmap3',
385 'ImageBitmapFactories.createImageBitmap(CanvasRenderingContext2D context)' : ' createImageBitmap4',
386 'ImageBitmapFactories.createImageBitmap(CanvasRenderingContext2D context, long sx, long sy, long sw, long sh)' : 'createImageBitmap5',
387 'ImageBitmapFactories.createImageBitmap(HTMLCanvasElement canvas)' : 'createIm ageBitmap6',
388 'ImageBitmapFactories.createImageBitmap(HTMLCanvasElement canvas, long sx, lon g sy, long sw, long sh)' : 'createImageBitmap7',
389 'ImageBitmapFactories.createImageBitmap(ImageData data)' : 'createImageBitmap8 ',
390 'ImageBitmapFactories.createImageBitmap(ImageData data, long sx, long sy, long sw, long sh)' : 'createImageBitmap9',
391 'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap)' : 'createImageBit map10',
392 'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh)' : 'createImageBitmap11',
393 'ImageBitmapFactories.createImageBitmap(Blob blob)' : 'createImageBitmap12',
394 'ImageBitmapFactories.createImageBitmap(Blob blob, long sx, long sy, long sw, long sh)' : 'createImageBitmap13',
395 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer', 377 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer',
396 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData', 378 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
397 'RTCDataChannel.send(Blob data)': 'sendBlob', 379 'RTCDataChannel.send(Blob data)': 'sendBlob',
398 'RTCDataChannel.send(DOMString data)': 'sendString', 380 'RTCDataChannel.send(DOMString data)': 'sendString',
399 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendBufferView', 381 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendTypedData',
400 'URL.createObjectURL(MediaSource source)': 382 'URL.createObjectURL(MediaSource source)':
401 'createObjectUrlFromSource', 383 'createObjectUrlFromSource',
402 'URL.createObjectURL(WebKitMediaSource source)': 384 'URL.createObjectURL(WebKitMediaSource source)':
403 '_createObjectUrlFromWebKitSource', 385 '_createObjectUrlFromWebKitSource',
404 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream', 386 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream',
405 'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob', 387 'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob',
406 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' 388 'WebGLRenderingContext.texImage2D(unsigned long target, long level, '
407 'unsigned long internalformat, unsigned long format, unsigned long ' 389 'unsigned long internalformat, unsigned long format, unsigned long '
408 'type, ImageData pixels)': 'texImage2DImageData', 390 'type, ImageData pixels)': 'texImage2DImageData',
409 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' 391 'WebGLRenderingContext.texImage2D(unsigned long target, long level, '
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 }) 424 })
443 425
444 # Members that have multiple definitions, but their types are identical (only 426 # Members that have multiple definitions, but their types are identical (only
445 # number of arguments vary), so we do not rename them as a _raw method. 427 # number of arguments vary), so we do not rename them as a _raw method.
446 keep_overloaded_members = monitored.Set( 428 keep_overloaded_members = monitored.Set(
447 'htmldartgenerator.keep_overloaded_members', [ 429 'htmldartgenerator.keep_overloaded_members', [
448 'AudioBufferSourceNode.start', 430 'AudioBufferSourceNode.start',
449 'CanvasRenderingContext2D.putImageData', 431 'CanvasRenderingContext2D.putImageData',
450 'CanvasRenderingContext2D.webkitPutImageDataHD', 432 'CanvasRenderingContext2D.webkitPutImageDataHD',
451 'DataTransferItemList.add', 433 'DataTransferItemList.add',
434 'Document.createElement',
435 'Document.createElementNS',
452 'HTMLInputElement.setRangeText', 436 'HTMLInputElement.setRangeText',
453 'HTMLTextAreaElement.setRangeText', 437 'HTMLTextAreaElement.setRangeText',
454 'IDBDatabase.transaction', 438 'IDBDatabase.transaction',
455 'RTCDataChannel.send', 439 'RTCDataChannel.send',
456 'URL.createObjectURL', 440 'URL.createObjectURL',
457 'WebSocket.send', 441 'WebSocket.send',
458 'XMLHttpRequest.send' 442 'XMLHttpRequest.send'
459 ]) 443 ])
460 444
445 overloaded_and_renamed = monitored.Set(
446 'htmldartgenerator.overloaded_and_renamed', [
447 'WebGLRenderingContext.texImage2D',
448 'WebGLRenderingContext.texSubImage2D',
449 'WebGLRenderingContext.bufferData',
450 'WebGLRenderingContext.bufferSubData',
451 ])
452
461 for member in convert_to_future_members: 453 for member in convert_to_future_members:
462 if member in renamed_html_members: 454 if member in renamed_html_members:
463 renamed_html_members[member] = '_' + renamed_html_members[member] 455 renamed_html_members[member] = '_' + renamed_html_members[member]
464 else: 456 else:
465 renamed_html_members[member] = '_' + member[member.find('.') + 1 :] 457 renamed_html_members[member] = '_' + member[member.find('.') + 1 :]
466 458
467 # Members and classes from the dom that should be removed completely from 459 # Members and classes from the dom that should be removed completely from
468 # dart:html. These could be expressed in the IDL instead but expressing this 460 # dart:html. These could be expressed in the IDL instead but expressing this
469 # as a simple table instead is more concise. 461 # as a simple table instead is more concise.
470 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName 462 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 933
942 # We're looking for a sequence of letters which start with capital letter 934 # We're looking for a sequence of letters which start with capital letter
943 # then a series of caps and finishes with either the end of the string or 935 # then a series of caps and finishes with either the end of the string or
944 # a capital letter. 936 # a capital letter.
945 # The [0-9] check is for names such as 2D or 3D 937 # The [0-9] check is for names such as 2D or 3D
946 # The following test cases should match as: 938 # The following test cases should match as:
947 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 939 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
948 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 940 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
949 # IFrameElement: (I)()(F)rameElement (no change) 941 # IFrameElement: (I)()(F)rameElement (no change)
950 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 942 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698