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

Unified Diff: sdk/lib/html/html_common/conversions.dart

Issue 35863006: Fix for getContextAttributes which wraps bare dictionary into a Dart type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/html_common/html_common_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/conversions.dart
diff --git a/sdk/lib/html/html_common/conversions.dart b/sdk/lib/html/html_common/conversions.dart
index 5d608664bae24442226b39936558500053312224..35d6c688dc63e79e9216fb2c96ca90e19b7c4c54 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -294,6 +294,39 @@ convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) {
return copy;
}
+// Conversions for ContextAttributes.
+//
+// On Firefox, the returned ContextAttributes is a plain object.
+class _TypedContextAttributes implements gl.ContextAttributes {
+ bool alpha;
+ bool antialias;
+ bool depth;
+ bool premultipliedAlpha;
+ bool preserveDrawingBuffer;
+ bool stencil;
+
+ _TypedContextAttributes(this.alpha, this.antialias, this.depth,
+ this.premultipliedAlpha, this.preserveDrawingBuffer, this.stencil);
+}
+
+gl.ContextAttributes convertNativeToDart_ContextAttributes(
+ nativeContextAttributes) {
+ if (nativeContextAttributes is gl.ContextAttributes) {
+ return nativeContextAttributes;
+ }
+
+ // On Firefox the above test fails because ContextAttributes is a plain
+ // object so we create a _TypedContextAttributes.
+
+ return new _TypedContextAttributes(
+ JS('var', '#.alpha', nativeContextAttributes),
+ JS('var', '#.antialias', nativeContextAttributes),
+ JS('var', '#.depth', nativeContextAttributes),
+ JS('var', '#.premultipliedAlpha', nativeContextAttributes),
+ JS('var', '#.preserveDrawingBuffer', nativeContextAttributes),
+ JS('var', '#.stencil', nativeContextAttributes));
+}
+
// Conversions for ImageData
//
// On Firefox, the returned ImageData is a plain object.
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/html_common/html_common_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698