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

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

Issue 23064024: Attempt to land Dartium roll a second time. (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') | tools/dom/scripts/systemnative.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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 'DataTransferItemList.add(File file)': 'addFile', 368 'DataTransferItemList.add(File file)': 'addFile',
369 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData', 369 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData',
370 'FormData.append(DOMString name, Blob value, DOMString filename)': 370 'FormData.append(DOMString name, Blob value, DOMString filename)':
371 'appendBlob', 371 'appendBlob',
372 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': 372 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)':
373 'transactionStores', 373 'transactionStores',
374 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)': 374 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)':
375 'transactionList', 375 'transactionList',
376 'IDBDatabase.transaction(DOMString storeName, DOMString mode)': 376 'IDBDatabase.transaction(DOMString storeName, DOMString mode)':
377 'transactionStore', 377 'transactionStore',
378 'ImageBitmapFactories.createImageBitmap(HTMLImageElement image)' : 'createImag eBitmap0',
379 'ImageBitmapFactories.createImageBitmap(HTMLImageElement image, long sx, long sy, long sw, long sh)' : 'createImageBitmap1',
380 'ImageBitmapFactories.createImageBitmap(HTMLVideoElement video)' : 'createImag eBitmap2',
381 'ImageBitmapFactories.createImageBitmap(HTMLVideoElement video, long sx, long sy, long sw, long sh)' : 'createImageBitmap3',
382 'ImageBitmapFactories.createImageBitmap(CanvasRenderingContext2D context)' : ' createImageBitmap4',
383 'ImageBitmapFactories.createImageBitmap(CanvasRenderingContext2D context, long sx, long sy, long sw, long sh)' : 'createImageBitmap5',
384 'ImageBitmapFactories.createImageBitmap(HTMLCanvasElement canvas)' : 'createIm ageBitmap6',
385 'ImageBitmapFactories.createImageBitmap(HTMLCanvasElement canvas, long sx, lon g sy, long sw, long sh)' : 'createImageBitmap7',
386 'ImageBitmapFactories.createImageBitmap(ImageData data)' : 'createImageBitmap8 ',
387 'ImageBitmapFactories.createImageBitmap(ImageData data, long sx, long sy, long sw, long sh)' : 'createImageBitmap9',
388 'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap)' : 'createImageBit map10',
389 'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh)' : 'createImageBitmap11',
378 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer', 390 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer',
379 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData', 391 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
380 'RTCDataChannel.send(Blob data)': 'sendBlob', 392 'RTCDataChannel.send(Blob data)': 'sendBlob',
381 'RTCDataChannel.send(DOMString data)': 'sendString', 393 'RTCDataChannel.send(DOMString data)': 'sendString',
382 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendBufferView', 394 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendBufferView',
383 'URL.createObjectURL(MediaSource source)': 395 'URL.createObjectURL(MediaSource source)':
384 'createObjectUrlFromSource', 396 'createObjectUrlFromSource',
385 'URL.createObjectURL(WebKitMediaSource source)': 397 'URL.createObjectURL(WebKitMediaSource source)':
386 '_createObjectUrlFromWebKitSource', 398 '_createObjectUrlFromWebKitSource',
387 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream', 399 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream',
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 743
732 class HtmlRenamer(object): 744 class HtmlRenamer(object):
733 def __init__(self, database): 745 def __init__(self, database):
734 self._database = database 746 self._database = database
735 747
736 def RenameInterface(self, interface): 748 def RenameInterface(self, interface):
737 if 'Callback' in interface.ext_attrs: 749 if 'Callback' in interface.ext_attrs:
738 if interface.id in _removed_html_interfaces: 750 if interface.id in _removed_html_interfaces:
739 return None 751 return None
740 752
741 if interface.id in html_interface_renames: 753 candidate = self.RenameInterfaceId(interface.id)
742 return html_interface_renames[interface.id] 754 if candidate:
743 elif interface.id.startswith('HTML'): 755 return candidate
756
757 if interface.id.startswith('HTML'):
744 if any(interface.id in ['Element', 'Document'] 758 if any(interface.id in ['Element', 'Document']
745 for interface in self._database.Hierarchy(interface)): 759 for interface in self._database.Hierarchy(interface)):
746 return interface.id[len('HTML'):] 760 return interface.id[len('HTML'):]
747 return self._DartifyName(interface.javascript_binding_name) 761 return self._DartifyName(interface.javascript_binding_name)
748 762
763 def RenameInterfaceId(self, interface_id):
764 if interface_id in html_interface_renames:
765 return html_interface_renames[interface_id]
766 return None;
749 767
750 768
751 def RenameMember(self, interface_name, member_node, member, member_prefix='', 769 def RenameMember(self, interface_name, member_node, member, member_prefix='',
752 dartify_name=True): 770 dartify_name=True):
753 """ 771 """
754 Returns the name of the member in the HTML library or None if the member is 772 Returns the name of the member in the HTML library or None if the member is
755 suppressed in the HTML library 773 suppressed in the HTML library
756 """ 774 """
757 interface = self._database.GetInterface(interface_name) 775 interface = self._database.GetInterface(interface_name)
758 776
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 884
867 # We're looking for a sequence of letters which start with capital letter 885 # We're looking for a sequence of letters which start with capital letter
868 # then a series of caps and finishes with either the end of the string or 886 # then a series of caps and finishes with either the end of the string or
869 # a capital letter. 887 # a capital letter.
870 # The [0-9] check is for names such as 2D or 3D 888 # The [0-9] check is for names such as 2D or 3D
871 # The following test cases should match as: 889 # The following test cases should match as:
872 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 890 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
873 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 891 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
874 # IFrameElement: (I)()(F)rameElement (no change) 892 # IFrameElement: (I)()(F)rameElement (no change)
875 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 893 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') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698