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

Side by Side Diff: tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate

Issue 35623004: Reapply lineDash with polyfill. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « tools/dom/scripts/systemhtml.py ('k') | 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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
8 $!MEMBERS 8 $!MEMBERS
9 9
10 /** 10 /**
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 $else 246 $else
247 void drawImageScaledFromSource(CanvasImageSource source, 247 void drawImageScaledFromSource(CanvasImageSource source,
248 num sourceX, num sourceY, num sourceWidth, num sourceHeight, 248 num sourceX, num sourceY, num sourceWidth, num sourceHeight,
249 num destX, num destY, num destWidth, num destHeight) { 249 num destX, num destY, num destWidth, num destHeight) {
250 _drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight, 250 _drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight,
251 destX, destY, destWidth, destHeight); 251 destX, destY, destWidth, destHeight);
252 } 252 }
253 $endif 253 $endif
254 254
255 $if DART2JS 255 $if DART2JS
256 @SupportedBrowser(SupportedBrowser.CHROME)
257 @SupportedBrowser(SupportedBrowser.SAFARI)
258 @SupportedBrowser(SupportedBrowser.IE, '11')
259 @Unstable()
256 @DomName('CanvasRenderingContext2D.lineDashOffset') 260 @DomName('CanvasRenderingContext2D.lineDashOffset')
261 // TODO(14316): Firefox has this functionality with mozDashOffset, but it
262 // needs to be polyfilled.
257 num get lineDashOffset => JS('num', 263 num get lineDashOffset => JS('num',
258 '#.lineDashOffset || #.webkitLineDashOffset', this, this); 264 '#.lineDashOffset || #.webkitLineDashOffset', this, this);
259 265
266 @SupportedBrowser(SupportedBrowser.CHROME)
267 @SupportedBrowser(SupportedBrowser.SAFARI)
268 @SupportedBrowser(SupportedBrowser.IE, '11')
269 @Unstable()
260 @DomName('CanvasRenderingContext2D.lineDashOffset') 270 @DomName('CanvasRenderingContext2D.lineDashOffset')
271 // TODO(14316): Firefox has this functionality with mozDashOffset, but it
272 // needs to be polyfilled.
261 void set lineDashOffset(num value) => JS('void', 273 void set lineDashOffset(num value) => JS('void',
262 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' 274 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : '
263 '#.webkitLineDashOffset = #', this, this, value, this, value); 275 '#.webkitLineDashOffset = #', this, this, value, this, value);
264 $else 276 $else
265 // TODO(amouravski): Add Dartium native methods for drawImage once we figure 277 // TODO(amouravski): Add Dartium native methods for drawImage once we figure
266 // out how to not break native bindings. 278 // out how to not break native bindings.
267 $endif 279 $endif
280
281 @SupportedBrowser(SupportedBrowser.CHROME)
282 @SupportedBrowser(SupportedBrowser.SAFARI)
283 @SupportedBrowser(SupportedBrowser.IE, '11')
284 @Unstable()
285 @DomName('CanvasRenderingContext2D.getLineDash')
286 List<num> getLineDash() {
287 // TODO(14316): Firefox has this functionality with mozDash, but it's a bit
288 // different.
289 $if DART2JS
290 if (JS('bool', '!!#.getLineDash', this)) {
291 return JS('List<num>', '#.getLineDash()', this);
292 } else if (JS('bool', '!!#.webkitLineDash', this)) {
293 return JS('List<num>', '#.webkitLineDash', this);
294 }
295 $else
296 var result = _getLineDash();
297 if (result == null) {
298 result = [];
299 }
300 return result;
301 $endif
302 }
303
304 $if DART2JS
305 @SupportedBrowser(SupportedBrowser.CHROME)
306 @SupportedBrowser(SupportedBrowser.SAFARI)
307 @SupportedBrowser(SupportedBrowser.IE, '11')
308 @Unstable()
309 @DomName('CanvasRenderingContext2D.setLineDash')
310 void setLineDash(List<num> dash) {
311 // TODO(14316): Firefox has this functionality with mozDash, but it's a bit
312 // different.
313 if (JS('bool', '!!#.setLineDash', this)) {
314 JS('void', '#.setLineDash(#)', this, dash);
315 } else if (JS('bool', '!!#.webkitLineDash', this)) {
316 JS('void', '#.webkitLineDash = #', this, dash);
317 }
318 }
319 $endif
320
268 $if DART2JS 321 $if DART2JS
269 322
270 /** 323 /**
271 * Draws text to the canvas. 324 * Draws text to the canvas.
272 * 325 *
273 * The text is drawn starting at coordinates ([x], [y]). 326 * The text is drawn starting at coordinates ([x], [y]).
274 * If [maxWidth] is provided and the [text] is computed to be wider than 327 * If [maxWidth] is provided and the [text] is computed to be wider than
275 * [maxWidth], then the drawn text is scaled down horizontally to fit. 328 * [maxWidth], then the drawn text is scaled down horizontally to fit.
276 * 329 *
277 * The text uses the current [CanvasRenderingContext2D.font] property for font 330 * The text uses the current [CanvasRenderingContext2D.font] property for font
278 * options, such as typeface and size, and the current 331 * options, such as typeface and size, and the current
279 * [CanvasRenderingContext2D.fillStyle] for style options such as color. 332 * [CanvasRenderingContext2D.fillStyle] for style options such as color.
280 * The current [CanvasRenderingContext2D.textAlign] and 333 * The current [CanvasRenderingContext2D.textAlign] and
281 * [CanvasRenderingContext2D.textBaseLine] properties are also applied to the 334 * [CanvasRenderingContext2D.textBaseLine] properties are also applied to the
282 * drawn text. 335 * drawn text.
283 */ 336 */
284 @DomName('CanvasRenderingContext2D.fillText') 337 @DomName('CanvasRenderingContext2D.fillText')
285 void fillText(String text, num x, num y, [num maxWidth]) { 338 void fillText(String text, num x, num y, [num maxWidth]) {
286 if (maxWidth != null) { 339 if (maxWidth != null) {
287 JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth); 340 JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth);
288 } else { 341 } else {
289 JS('void', '#.fillText(#, #, #)', this, text, x, y); 342 JS('void', '#.fillText(#, #, #)', this, text, x, y);
290 } 343 }
291 } 344 }
292 $endif 345 $endif
293 } 346 }
294 347
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698