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

Unified Diff: Source/core/html/HTMLCanvasElement.idl

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/core/html/canvas/Canvas2DContextAttributes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/core/html/canvas/Canvas2DContextAttributes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698