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

Side by Side Diff: tools/dom/src/native_DOMImplementation.dart

Issue 13119007: Helper to support getContext options map analysis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 class _Utils { 7 class _Utils {
8 static double dateTimeToDouble(DateTime dateTime) => 8 static double dateTimeToDouble(DateTime dateTime) =>
9 dateTime.millisecondsSinceEpoch.toDouble(); 9 dateTime.millisecondsSinceEpoch.toDouble();
10 static DateTime doubleToDateTime(double dateTime) { 10 static DateTime doubleToDateTime(double dateTime) {
(...skipping 13 matching lines...) Expand all
24 result.setRange(0, length, list); 24 result.setRange(0, length, list);
25 return result; 25 return result;
26 } 26 }
27 27
28 static List convertMapToList(Map map) { 28 static List convertMapToList(Map map) {
29 List result = []; 29 List result = [];
30 map.forEach((k, v) => result.addAll([k, v])); 30 map.forEach((k, v) => result.addAll([k, v]));
31 return result; 31 return result;
32 } 32 }
33 33
34 static int convertCanvasElementGetContextMap(Map map) {
35 int result = 0;
36 if (map['alpha'] == true) result |= 0x01;
37 if (map['depth'] == true) result |= 0x02;
38 if (map['stencil'] == true) result |= 0x4;
39 if (map['antialias'] == true) result |= 0x08;
40 if (map['premultipliedAlpha'] == true) result |= 0x10;
41 if (map['preserveDrawingBuffer'] == true) result |= 0x20;
42
43 return result;
44 }
45
34 static void populateMap(Map result, List list) { 46 static void populateMap(Map result, List list) {
35 for (int i = 0; i < list.length; i += 2) { 47 for (int i = 0; i < list.length; i += 2) {
36 result[list[i]] = list[i + 1]; 48 result[list[i]] = list[i + 1];
37 } 49 }
38 } 50 }
39 51
40 static bool isMap(obj) => obj is Map; 52 static bool isMap(obj) => obj is Map;
41 53
42 static Map createMap() => {}; 54 static Map createMap() => {};
43 55
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 134
123 get _printClosure => (s) { 135 get _printClosure => (s) {
124 try { 136 try {
125 window.console.log(s); 137 window.console.log(s);
126 } catch (_) { 138 } catch (_) {
127 _Utils.print(s); 139 _Utils.print(s);
128 } 140 }
129 }; 141 };
130 142
131 final _forwardingPrintClosure = _Utils.forwardingPrint; 143 final _forwardingPrintClosure = _Utils.forwardingPrint;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698