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

Unified Diff: tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate

Issue 29273005: CanvasRenderingContext2D.fillText now works correctly with null maxWidth. (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
« sdk/lib/html/dartium/html_dartium.dart ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bc72fef49e1b9c88919b8606bae8576a23dea489 100644
--- a/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate
+++ b/tools/dom/templates/html/impl/impl_CanvasRenderingContext2D.darttemplate
@@ -265,5 +265,29 @@ $else
// TODO(amouravski): Add Dartium native methods for drawImage once we figure
// out how to not break native bindings.
$endif
-}
+$if DART2JS
+ /**
+ * 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]) {
+ if (maxWidth != null) {
+ JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth);
+ } else {
+ JS('void', '#.fillText(#, #, #)', this, text, x, y);
+ }
+ }
+$endif
+}
« sdk/lib/html/dartium/html_dartium.dart ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698