Index: Source/core/html/HTMLCanvasElement.idl |
diff --git a/Source/core/html/HTMLCanvasElement.idl b/Source/core/html/HTMLCanvasElement.idl |
index 5f97987d6c470a235eaebfe8727debe77b9489e2..80d13f626a6cc3d9b1559c7522aeede277207d09 100644 |
--- a/Source/core/html/HTMLCanvasElement.idl |
+++ b/Source/core/html/HTMLCanvasElement.idl |
@@ -24,6 +24,8 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
+typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; |
+ |
interface HTMLCanvasElement : HTMLElement { |
attribute long width; |
@@ -31,6 +33,18 @@ interface HTMLCanvasElement : HTMLElement { |
[Custom, RaisesException] DOMString toDataURL([TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? type); |
- // The custom binding is needed to handle context creation attributes. |
- [Custom] any getContext([Default=Undefined] optional DOMString contextId); |
+ // 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. |
+ [CallWith=ScriptState] any getContext([Default=Undefined] optional DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributes attributes); |
}; |