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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index e4979cc7de2d24a863cc1eac1b9c1a81f4e30fea..8d5fbe10d1ab1d52f47a76cdc08833292601f1a3 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -1720,7 +1720,7 @@ class CanvasRenderingContext2D extends CanvasRenderingContext {
@DocsEditable()
void fillRect(num x, num y, num width, num height) native "CanvasRenderingContext2D_fillRect_Callback";
- void fillText(String text, num x, num y, [num maxWidth]) {
+ void _fillText(String text, num x, num y, [num maxWidth]) {
if (maxWidth != null) {
_fillText_1(text, x, y, maxWidth);
return;
@@ -2084,8 +2084,26 @@ class CanvasRenderingContext2D extends CanvasRenderingContext {
// TODO(amouravski): Add Dartium native methods for drawImage once we figure
// out how to not break native bindings.
-}
+ /**
+ * 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]) {
+ _fillText(text, x, y, maxWidth);
+ }
+}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

Powered by Google App Engine
This is Rietveld 408576698