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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 12077039: Adding supported checks for WebGL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index dff7df3af8847da00e8423a632d99aec3ac067ba..57e33afa57c054d11028eb92cb1b1c0aeedb9ee1 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -1010,6 +1010,22 @@ class CanvasElement extends Element native "*HTMLCanvasElement" {
@DocsEditable
int width;
+ CanvasRenderingContext getContext(String contextId, [Map attrs]) {
+ if (?attrs) {
+ var attrs_1 = convertDartToNative_Dictionary(attrs);
+ return _getContext_1(contextId, attrs_1);
+ }
+ return _getContext_2(contextId);
+ }
+ @JSName('getContext')
+ @DomName('HTMLCanvasElement.getContext')
+ @DocsEditable
+ CanvasRenderingContext _getContext_1(contextId, attrs) native;
+ @JSName('getContext')
+ @DomName('HTMLCanvasElement.getContext')
+ @DocsEditable
+ CanvasRenderingContext _getContext_2(contextId) native;
+
@JSName('toDataURL')
/**
* Returns a data URI containing a representation of the image in the
@@ -1055,9 +1071,28 @@ class CanvasElement extends Element native "*HTMLCanvasElement" {
@DocsEditable
String toDataUrl(String type, [num quality]) native;
-
- CanvasRenderingContext getContext(String contextId) native;
CanvasRenderingContext2D get context2d => getContext('2d');
+
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @Experimental
+ WebGLRenderingContext getContext3d({alpha: true, depth: true, stencil: false,
+ antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false}) {
+
+ var options = {
+ 'alpha': alpha,
+ 'depth': depth,
+ 'stencil': stencil,
+ 'antialias': antialias,
+ 'premultipliedAlpha': premultipliedAlpha,
+ 'preserveDrawingBuffer': preserveDrawingBuffer,
+ };
+ var context = getContext('webgl', options);
+ if (context == null) {
+ context = getContext('experimental-webgl', options);
+ }
+ return context;
+ }
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -23958,8 +23993,14 @@ class WebGLRenderbuffer native "*WebGLRenderbuffer" {
@DocsEditable
@DomName('WebGLRenderingContext')
+@SupportedBrowser(SupportedBrowser.CHROME)
+@SupportedBrowser(SupportedBrowser.FIREFOX)
+@Experimental
class WebGLRenderingContext extends CanvasRenderingContext native "*WebGLRenderingContext" {
+ /// Checks if this type is supported on the current platform.
+ static bool get supported => JS('bool', '!!(window.WebGLRenderingContext)');
+
static const int ACTIVE_ATTRIBUTES = 0x8B89;
static const int ACTIVE_TEXTURE = 0x84E0;
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698