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

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

Issue 444743002: Use Blink IDL parser for dart libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merged Created 6 years, 3 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/htmldartgenerator.py ('k') | tools/dom/scripts/idlnode.py » ('j') | 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
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('htmldartgenreator.renamed_overloads', { 399 renamed_overloads = monitored.Dict('htmldartgenerator.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
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.
483 overloaded_and_renamed = monitored.Set( 484 overloaded_and_renamed = monitored.Set(
484 'htmldartgenerator.overloaded_and_renamed', [ 485 'htmldartgenerator.overloaded_and_renamed', [
485 'WebGLRenderingContext.texImage2D', 486 'CanvasRenderingContext2D.clip',
486 'WebGLRenderingContext.texSubImage2D', 487 'CanvasRenderingContext2D.drawFocusIfNeeded',
487 'WebGLRenderingContext.bufferData', 488 'CanvasRenderingContext2D.fill',
488 'WebGLRenderingContext.bufferSubData', 489 'CanvasRenderingContext2D.isPointInPath',
490 'CanvasRenderingContext2D.isPointInStroke',
491 'CanvasRenderingContext2D.stroke',
492 'Navigator.sendBeacon',
493 'WebGLRenderingContextBase.bufferData',
494 'WebGLRenderingContextBase.bufferSubData',
495 'WebGLRenderingContextBase.texImage2D',
496 'WebGLRenderingContextBase.texSubImage2D',
489 ]) 497 ])
490 498
491 for member in convert_to_future_members: 499 for member in convert_to_future_members:
492 if member in renamed_html_members: 500 if member in renamed_html_members:
493 renamed_html_members[member] = '_' + renamed_html_members[member] 501 renamed_html_members[member] = '_' + renamed_html_members[member]
494 else: 502 else:
495 renamed_html_members[member] = '_' + member[member.find('.') + 1 :] 503 renamed_html_members[member] = '_' + member[member.find('.') + 1 :]
496 504
497 # Members and classes from the dom that should be removed completely from 505 # Members and classes from the dom that should be removed completely from
498 # dart:html. These could be expressed in the IDL instead but expressing this 506 # 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
987 995
988 # We're looking for a sequence of letters which start with capital letter 996 # We're looking for a sequence of letters which start with capital letter
989 # then a series of caps and finishes with either the end of the string or 997 # then a series of caps and finishes with either the end of the string or
990 # a capital letter. 998 # a capital letter.
991 # The [0-9] check is for names such as 2D or 3D 999 # The [0-9] check is for names such as 2D or 3D
992 # The following test cases should match as: 1000 # The following test cases should match as:
993 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 1001 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
994 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 1002 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
995 # IFrameElement: (I)()(F)rameElement (no change) 1003 # IFrameElement: (I)()(F)rameElement (no change)
996 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 1004 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/idlnode.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698