Index: tools/dom/scripts/htmlrenamer.py |
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py |
index 92951d0be65e49c9880dcc7fa2272e157a04f21b..73ab63c3f3257569ee2391bf5378bb02331215a5 100644 |
--- a/tools/dom/scripts/htmlrenamer.py |
+++ b/tools/dom/scripts/htmlrenamer.py |
@@ -151,7 +151,8 @@ convert_to_future_members = monitored.Set( |
# Members from the standard dom that should not be exposed publicly in dart:html |
# but need to be exposed internally to implement dart:html on top of a standard |
# browser. |
-_private_html_members = monitored.Set('htmlrenamer._private_html_members', [ |
+private_html_members = monitored.Set('htmlrenamer.private_html_members', [ |
+ 'AudioNode.connect', |
'CanvasRenderingContext2D.arc', |
'CompositionEvent.initCompositionEvent', |
'CustomEvent.initCustomEvent', |
@@ -348,6 +349,82 @@ renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', { |
#'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync', |
}) |
+# Members that have multiple definitions, but their types are vary, so we rename |
+# them to make them distinct. |
+renamed_overloads = monitored.Dict('htmldartgenreator.renamed_overloads', { |
+ 'AudioContext.createBuffer(ArrayBuffer buffer, boolean mixToMono)': |
+ 'createBufferFromBuffer', |
+ 'CSS.supports(DOMString conditionText)': 'supportsCondition', |
+ 'CanvasRenderingContext2D.createPattern(HTMLImageElement image, ' |
+ 'DOMString repetitionType)': 'createPatternFromImage', |
+ 'DataTransferItemList.add(File file)': 'addFile', |
+ 'DataTransferItemList.add(DOMString data, DOMString type)': 'addData', |
+ 'IDBDatabase.transaction(DOMStringList storeNames, DOMString mode)': |
+ 'transactionStores', |
+ 'IDBDatabase.transaction(sequence<DOMString> storeNames, DOMString mode)': |
+ 'transactionList', |
+ 'IDBDatabase.transaction(DOMString storeName, DOMString mode)': |
+ 'transactionStore', |
+ 'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer', |
+ 'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData', |
+ 'RTCDataChannel.send(Blob data)': 'sendBlob', |
+ 'RTCDataChannel.send(DOMString data)': 'sendString', |
+ 'URL.createObjectURL(WebKitMediaSource source)': |
+ 'createObjectUrlFromSource', |
+ 'URL.createObjectURL(MediaStream stream)': 'createObjectUrlFromStream', |
+ 'URL.createObjectURL(Blob blob)': 'createObjectUrlFromBlob', |
+ 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' |
+ 'unsigned long internalformat, unsigned long format, unsigned long ' |
+ 'type, ImageData pixels)': 'texImage2DImageData', |
+ 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' |
+ 'unsigned long internalformat, unsigned long format, unsigned long ' |
+ 'type, HTMLImageElement image)': 'texImage2DImage', |
+ 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' |
+ 'unsigned long internalformat, unsigned long format, unsigned long ' |
+ 'type, HTMLCanvasElement canvas)': 'texImage2DCanvas', |
+ 'WebGLRenderingContext.texImage2D(unsigned long target, long level, ' |
+ 'unsigned long internalformat, unsigned long format, unsigned long ' |
+ 'type, HTMLVideoElement video)': 'texImage2DVideo', |
+ 'WebGLRenderingContext.texSubImage2D(unsigned long target, long level, ' |
+ 'long xoffset, long yoffset, unsigned long format, unsigned long type, ' |
+ 'ImageData pixels)': 'texSubImage2DImageData', |
+ 'WebGLRenderingContext.texSubImage2D(unsigned long target, long level, ' |
+ 'long xoffset, long yoffset, unsigned long format, unsigned long type, ' |
+ 'HTMLImageElement image)': 'texSubImage2DImage', |
+ 'WebGLRenderingContext.texSubImage2D(unsigned long target, long level, ' |
+ 'long xoffset, long yoffset, unsigned long format, unsigned long type, ' |
+ 'HTMLCanvasElement canvas)': 'texSubImage2DCanvas', |
+ 'WebGLRenderingContext.texSubImage2D(unsigned long target, long level, ' |
+ 'long xoffset, long yoffset, unsigned long format, unsigned long type, ' |
+ 'HTMLVideoElement video)': 'texSubImage2DVideo', |
+ 'WebGLRenderingContext.bufferData(unsigned long target, ArrayBuffer data, ' |
+ 'unsigned long usage)': 'bufferByteData', |
+ 'WebGLRenderingContext.bufferData(unsigned long target, ' |
+ 'ArrayBufferView data, unsigned long usage)': 'bufferDataTyped', |
+ 'WebGLRenderingContext.bufferSubData(unsigned long target, ' |
+ 'long long offset, ArrayBuffer data)': 'bufferSubByteData', |
+ 'WebGLRenderingContext.bufferSubData(unsigned long target, ' |
+ 'long long offset, ArrayBufferView data)': 'bufferSubDataTyped', |
+}) |
+ |
+# Members that have multiple definitions, but their types are identical (only |
+# number of arguments vary), so we do not rename them as a _raw method. |
+keep_overloaded_members = monitored.Set( |
+ 'htmldartgenerator.keep_overloaded_members', [ |
+ 'AudioBufferSourceNode.start', |
+ 'CanvasRenderingContext2D.putImageData', |
+ 'CanvasRenderingContext2D.webkitPutImageDataHD', |
+ 'DataTransferItemList.add', |
+ 'FormData.append', # TODO(efortuna): Split out into appendBlob. |
+ 'HTMLInputElement.setRangeText', |
+ 'HTMLTextAreaElement.setRangeText', |
+ 'IDBDatabase.transaction', |
+ 'RTCDataChannel.send', |
+ 'URL.createObjectURL', |
+ 'WebSocket.send', # TODO(efortuna): Add sendBlob, sendString, and family. |
+ 'XMLHttpRequest.send' |
+]) |
+ |
for member in convert_to_future_members: |
if member in renamed_html_members: |
renamed_html_members[member] = '_' + renamed_html_members[member] |
@@ -361,7 +438,7 @@ for member in convert_to_future_members: |
# Using get: and set: is optional and should only be used when a getter needs |
# to be suppressed but not the setter, etc. |
# TODO(jacobr): cleanup and augment this list. |
-_removed_html_members = monitored.Set('htmlrenamer._removed_html_members', [ |
+removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [ |
'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation |
'CSSStyleDeclaration.getPropertyCSSValue', |
'CanvasRenderingContext2D.clearShadow', |
@@ -675,7 +752,7 @@ class HtmlRenamer(object): |
renamed_html_members) |
target_name = renamed_html_members[name] if name else member |
- if self._FindMatch(interface, member, member_prefix, _private_html_members): |
+ if self._FindMatch(interface, member, member_prefix, private_html_members): |
if not target_name.startswith('$dom_'): # e.g. $dom_svgClassName |
target_name = '$dom_' + target_name |
@@ -689,8 +766,7 @@ class HtmlRenamer(object): |
def ShouldSuppressMember(self, interface, member, member_prefix=''): |
""" Returns true if the member should be suppressed.""" |
- if self._FindMatch(interface, member, member_prefix, |
- _removed_html_members): |
+ if self._FindMatch(interface, member, member_prefix, removed_html_members): |
return True |
if interface.id in _removed_html_interfaces: |
return True |