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 typed_array_renames = { | 9 typed_array_renames = { |
10 'ArrayBuffer': 'ByteBuffer', | 10 'ArrayBuffer': 'ByteBuffer', |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 'SVGElement.className': '_svgClassName', | 389 'SVGElement.className': '_svgClassName', |
390 'SVGStopElement.offset': 'gradientOffset', | 390 'SVGStopElement.offset': 'gradientOffset', |
391 'URL.createObjectURL': 'createObjectUrl', | 391 'URL.createObjectURL': 'createObjectUrl', |
392 'URL.revokeObjectURL': 'revokeObjectUrl', | 392 'URL.revokeObjectURL': 'revokeObjectUrl', |
393 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem', | 393 #'WorkerContext.webkitRequestFileSystem': '_requestFileSystem', |
394 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', | 394 #'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', |
395 }) | 395 }) |
396 | 396 |
397 # Members that have multiple definitions, but their types are vary, so we rename | 397 # Members that have multiple definitions, but their types are vary, so we rename |
398 # them to make them distinct. | 398 # them to make them distinct. |
399 renamed_overloads = monitored.Dict('htmldartgenerator.renamed_overloads', { | 399 renamed_overloads = monitored.Dict('htmldartgenreator.renamed_overloads', { |
400 'AudioContext.createBuffer(ArrayBuffer buffer, boolean mixToMono)': | 400 'AudioContext.createBuffer(ArrayBuffer buffer, boolean mixToMono)': |
401 'createBufferFromBuffer', | 401 'createBufferFromBuffer', |
402 'CSS.supports(DOMString conditionText)': 'supportsCondition', | 402 'CSS.supports(DOMString conditionText)': 'supportsCondition', |
403 'CanvasRenderingContext2D.createPattern(HTMLImageElement image, ' | 403 'CanvasRenderingContext2D.createPattern(HTMLImageElement image, ' |
404 'DOMString repetitionType)': 'createPatternFromImage', | 404 'DOMString repetitionType)': 'createPatternFromImage', |
405 'DataTransferItemList.add(File file)': 'addFile', | 405 'DataTransferItemList.add(File file)': 'addFile', |
406 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData', | 406 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData', |
407 'FormData.append(DOMString name, Blob value, DOMString filename)': | 407 'FormData.append(DOMString name, Blob value, DOMString filename)': |
408 'appendBlob', | 408 'appendBlob', |
409 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': | 409 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 'Document.createElementNS', | 473 'Document.createElementNS', |
474 'HTMLInputElement.setRangeText', | 474 'HTMLInputElement.setRangeText', |
475 'HTMLTextAreaElement.setRangeText', | 475 'HTMLTextAreaElement.setRangeText', |
476 'IDBDatabase.transaction', | 476 'IDBDatabase.transaction', |
477 'RTCDataChannel.send', | 477 'RTCDataChannel.send', |
478 'URL.createObjectURL', | 478 'URL.createObjectURL', |
479 'WebSocket.send', | 479 'WebSocket.send', |
480 'XMLHttpRequest.send' | 480 'XMLHttpRequest.send' |
481 ]) | 481 ]) |
482 | 482 |
483 # Members that can be overloaded. | |
484 overloaded_and_renamed = monitored.Set( | 483 overloaded_and_renamed = monitored.Set( |
485 'htmldartgenerator.overloaded_and_renamed', [ | 484 'htmldartgenerator.overloaded_and_renamed', [ |
486 'CanvasRenderingContext2D.clip', | 485 'WebGLRenderingContext.texImage2D', |
487 'CanvasRenderingContext2D.drawFocusIfNeeded', | 486 'WebGLRenderingContext.texSubImage2D', |
488 'CanvasRenderingContext2D.fill', | 487 'WebGLRenderingContext.bufferData', |
489 'CanvasRenderingContext2D.isPointInPath', | 488 'WebGLRenderingContext.bufferSubData', |
490 'CanvasRenderingContext2D.isPointInStroke', | |
491 'CanvasRenderingContext2D.stroke', | |
492 'Navigator.sendBeacon', | |
493 'WebGLRenderingContextBase.bufferData', | |
494 'WebGLRenderingContextBase.bufferSubData', | |
495 'WebGLRenderingContextBase.texImage2D', | |
496 'WebGLRenderingContextBase.texSubImage2D', | |
497 ]) | 489 ]) |
498 | 490 |
499 for member in convert_to_future_members: | 491 for member in convert_to_future_members: |
500 if member in renamed_html_members: | 492 if member in renamed_html_members: |
501 renamed_html_members[member] = '_' + renamed_html_members[member] | 493 renamed_html_members[member] = '_' + renamed_html_members[member] |
502 else: | 494 else: |
503 renamed_html_members[member] = '_' + member[member.find('.') + 1 :] | 495 renamed_html_members[member] = '_' + member[member.find('.') + 1 :] |
504 | 496 |
505 # Members and classes from the dom that should be removed completely from | 497 # Members and classes from the dom that should be removed completely from |
506 # dart:html. These could be expressed in the IDL instead but expressing this | 498 # dart:html. These could be expressed in the IDL instead but expressing this |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 | 987 |
996 # We're looking for a sequence of letters which start with capital letter | 988 # We're looking for a sequence of letters which start with capital letter |
997 # then a series of caps and finishes with either the end of the string or | 989 # then a series of caps and finishes with either the end of the string or |
998 # a capital letter. | 990 # a capital letter. |
999 # The [0-9] check is for names such as 2D or 3D | 991 # The [0-9] check is for names such as 2D or 3D |
1000 # The following test cases should match as: | 992 # The following test cases should match as: |
1001 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue | 993 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue |
1002 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) | 994 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) |
1003 # IFrameElement: (I)()(F)rameElement (no change) | 995 # IFrameElement: (I)()(F)rameElement (no change) |
1004 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) | 996 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) |
OLD | NEW |