Chromium Code Reviews| Index: tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate |
| diff --git a/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate b/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate |
| index 1a5631b91f64fc68a22ddd4324a097ed1c19e092..59dd5212f398175fadcb133331567e2d86bd7570 100644 |
| --- a/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate |
| @@ -265,5 +265,31 @@ $else |
| // TODO(amouravski): Add Dartium native methods for drawImage once we figure |
| // out how to not break native bindings. |
| $endif |
| -} |
| + /** |
| + * Draws text to the canvas. |
| + * |
| + * The text is drawn starting at coordinates ([x], [y]). |
| + * If [maxWidth] is provided and the [text] is computed to be wider than |
| + * [maxWidth], then the drawn text is scaled down horizontally to fit. |
| + * |
| + * The text uses the current [CanvasRenderingContext2D.font] property for font |
| + * options, such as typeface and size, and the current |
| + * [CanvasRenderingContext2D.fillStyle] for style options such as color. |
| + * The current [CanvasRenderingContext2D.textAlign] and |
| + * [CanvasRenderingContext2D.textBaseLine] properties are also applied to the |
| + * drawn text. |
| + */ |
| + @DomName('CanvasRenderingContext2D.fillText') |
| + void fillText(String text, num x, num y, [num maxWidth]) { |
|
Emily Fortuna
2013/10/19 00:29:46
how about instead write this function this way:
$
Andrei Mouravski
2013/10/21 19:39:09
Done.
|
| +$if DART2JS |
| + if (maxWidth != null) { |
| + _fillText(text, x, y, maxWidth); |
| + } else { |
| + _fillText(text, x, y); |
| + } |
| +$else |
| + _fillText(text, x, y, maxWidth); |
| +$endif |
| + } |
| +} |