Index: core/html/HTMLCanvasElement.idl |
diff --git a/core/html/HTMLCanvasElement.idl b/core/html/HTMLCanvasElement.idl |
index 47c796bd202b8ea22844b3f3e1a4fff50b9a1049..458e8ab62eefa8290ff77ce7d0925f43ac07393e 100644 |
--- a/core/html/HTMLCanvasElement.idl |
+++ b/core/html/HTMLCanvasElement.idl |
@@ -24,17 +24,32 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-interface HTMLCanvasElement : HTMLElement { |
+// https://html.spec.whatwg.org/#the-canvas-element |
+interface HTMLCanvasElement : HTMLElement { |
+ // FIXME: width and height should be unsigned long. |
attribute long width; |
attribute long height; |
- // FIXMEDART: Upstream: Added the optional quality param that V8 accepts. |
- [Custom, RaisesException] DOMString toDataURL([TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? type, optional float quality); |
+ // Note: this differs deliberately from the specified Web IDL for this function: |
+ // RenderingContext? getContext(DOMString contextId, any... arguments); |
+ // in order to eliminate the custom binding. It is functionally equivalent. |
+ // |
+ // The PermissiveDictionaryConversion extended attribute is needed to allow the |
+ // autogenerated code to match the behavior of the custom binding. Web IDL |
+ // requires throwing TypeError if the incoming argument is not an object type |
+ // (and is not undefined or null). The binding must ignore this. |
+ // |
+ // Also note: the only reason this must return type "any" is to allow the |
+ // InspectorInstrumentation wrappers to be called for canvases. If that could be |
+ // handled differently the return type could be changed to "RenderingContext?" |
+ // and the [CallWith=ScriptState] extended attribute removed. |
+ // |
+ // FIXME: The contextId argument should not be optional. |
+ [CallWith=ScriptState] any getContext([Default=Undefined] optional DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributes attributes); |
- // FIXMEDART: |
- // - Upstream: Added the optional quality param that V8 accepts. |
- // - Return RenderingContext. |
- // The custom binding is needed to handle context creation attributes. |
- [Custom] any getContext([Default=Undefined] optional DOMString contextId, optional Dictionary attrs); |
+ // Note: The arguments argument is variadic in the spec, but not here as |
+ // only one extra argument is actually used. |
+ // FIXME: type should not be nullable or have a default value. |
+ [RaisesException] DOMString toDataURL(optional DOMString? type = null, optional any arguments); |
}; |