From 5e47f9a8f2a24e580641ca0aa38cf7726439aa9b Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Tue, 17 Feb 2015 12:25:15 -0800 Subject: [PATCH] Make tests/clipping/canvas-rounded-corners.sky actually run. Because we dump dart errors to LOG(ERROR) (stderr) instead of console.log / stdout, tests with dart errors just "pass" and we don't notice they're not running. This was the case with canvas-rounded-corners.sky. I don't think this test actually passes yet, despite it claiming to, but I at least have made it run and not crash. Required me commenting out a ton of CanvasRenderingContext2D, but that's fine, it wasn't actually working and it's better to have it be compiling valid dart. R=abarth@chromium.org, ojan@chromium.org BUG= Review URL: https://codereview.chromium.org/936563002 --- engine/bindings/scripts/dart_interface.py | 3 + engine/core/css/CSS.idl | 3 +- .../html/canvas/CanvasRenderingContext2D.idl | 58 ++++++++++--------- engine/core/script/dart_controller.cc | 4 +- tests/clipping/canvas-rounded-corners.sky | 4 +- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/engine/bindings/scripts/dart_interface.py b/engine/bindings/scripts/dart_interface.py index 0b21bf46136..0b0223fa716 100644 --- a/engine/bindings/scripts/dart_interface.py +++ b/engine/bindings/scripts/dart_interface.py @@ -169,6 +169,9 @@ def interface_context(interface): # For overloaded methods, only generate one accessor ('overload_index' not in method or method['overload_index'] == 1)) + for method in methods: + assert 'overloads' not in method, 'Dart does not support overloads, %s in %s' % (method['name'], interface.name) + generate_method_native_entries(interface, methods, 'Method') context.update({ diff --git a/engine/core/css/CSS.idl b/engine/core/css/CSS.idl index 95be79b51af..582333fd208 100644 --- a/engine/core/css/CSS.idl +++ b/engine/core/css/CSS.idl @@ -31,6 +31,7 @@ NoInterfaceObject, ImplementedAs=DOMWindowCSS, ] interface CSS { - boolean supports(DOMString property, DOMString value); + // Dart does not support overloads. + // boolean supports(DOMString property, DOMString value); boolean supports(DOMString conditionText); }; diff --git a/engine/core/html/canvas/CanvasRenderingContext2D.idl b/engine/core/html/canvas/CanvasRenderingContext2D.idl index d50550df1c2..df98d1a6e12 100644 --- a/engine/core/html/canvas/CanvasRenderingContext2D.idl +++ b/engine/core/html/canvas/CanvasRenderingContext2D.idl @@ -68,7 +68,8 @@ enum CanvasFillRule { "nonzero", "evenodd" }; CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1); [RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, DOMString? repetitionType); - [RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMString? repetitionType); + // Dart does not support overloads! + // [RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMString? repetitionType); // shadows attribute unrestricted float shadowOffsetX; @@ -84,19 +85,19 @@ enum CanvasFillRule { "nonzero", "evenodd" }; // path API (see also CanvasPathMethods) void beginPath(); void fill(optional CanvasFillRule winding); - void fill(Path2D path, optional CanvasFillRule winding); + // void fill(Path2D path, optional CanvasFillRule winding); void stroke(); - void stroke(Path2D path); + // void stroke(Path2D path); // Focus rings void drawFocusIfNeeded(Element element); - void drawFocusIfNeeded(Path2D path, Element element); + // void drawFocusIfNeeded(Path2D path, Element element); void clip(optional CanvasFillRule winding); - void clip(Path2D path, optional CanvasFillRule winding); + // void clip(Path2D path, optional CanvasFillRule winding); boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasFillRule winding); - boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding); + // boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding); boolean isPointInStroke(unrestricted float x, unrestricted float y); - boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); + // boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); // text (see also the CanvasDrawingStyles interface) void fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth); @@ -105,21 +106,21 @@ enum CanvasFillRule { "nonzero", "evenodd" }; // drawing images [RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y); - [RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); - [RaisesException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); - [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y); - [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); - [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); - [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); - [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); - [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + //[RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + //[RaisesException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + //[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y); + //[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + //[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); + // [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); + //[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); + //[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); // pixel manipulation ImageData createImageData(ImageData imagedata); - [RaisesException] ImageData createImageData(float sw, float sh); + //[RaisesException] ImageData createImageData(float sw, float sh); [RaisesException] ImageData getImageData(float sx, float sy, float sw, float sh); void putImageData(ImageData imagedata, float dx, float dy); - void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); + //void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); // Context state // Should be merged with WebGL counterpart in CanvasRenderingContext, once no-longer experimental @@ -135,8 +136,9 @@ enum CanvasFillRule { "nonzero", "evenodd" }; attribute unrestricted float miterLimit; // (default 10) // dashed lines - void setLineDash(sequence dash); - sequence getLineDash(); + // TODO(eseidel): Generator doesn't handle List yet. + // void setLineDash(sequence dash); + // sequence getLineDash(); attribute unrestricted float lineDashOffset; // text @@ -153,20 +155,20 @@ enum CanvasFillRule { "nonzero", "evenodd" }; void setMiterLimit(unrestricted float limit); void clearShadow(); void setStrokeColor(DOMString color, optional unrestricted float alpha); - void setStrokeColor(unrestricted float grayLevel, optional unrestricted float alpha); - void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); - void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); + //void setStrokeColor(unrestricted float grayLevel, optional unrestricted float alpha); + //void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + //void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); void setFillColor(DOMString color, optional unrestricted float alpha); - void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha); - void setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); - void setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); + //void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha); + //void setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + //void setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); void drawImageFromRect( HTMLImageElement? image, optional unrestricted float sx, optional unrestricted float sy, optional unrestricted float sw, optional unrestricted float sh, optional unrestricted float dx, optional unrestricted float dy, optional unrestricted float dw, optional unrestricted float dh, optional DOMString compositeOperation); void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, optional DOMString color, optional unrestricted float alpha); - void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float grayLevel, optional unrestricted float alpha); - void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); - void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); + //void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float grayLevel, optional unrestricted float alpha); + //void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a); + //void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a); }; CanvasRenderingContext2D implements CanvasPathMethods; diff --git a/engine/core/script/dart_controller.cc b/engine/core/script/dart_controller.cc index 73d410f6dd1..a46fcc256a4 100644 --- a/engine/core/script/dart_controller.cc +++ b/engine/core/script/dart_controller.cc @@ -100,7 +100,9 @@ void DartController::ExecuteModule(RefPtr module) { DCHECK(Dart_CurrentIsolate() == dart_state()->isolate()); DartApiScope dart_api_scope; - LogIfError(Dart_FinalizeLoading(true)); + // Don't continue if we failed to load the module. + if (LogIfError(Dart_FinalizeLoading(true))) + return; Dart_Handle library = module->library()->dart_value(); const char* name = module->isApplication() ? "main" : "init"; Dart_Handle closure_name = Dart_NewStringFromCString(name); diff --git a/tests/clipping/canvas-rounded-corners.sky b/tests/clipping/canvas-rounded-corners.sky index d527ef0bc1d..80e9838d2b6 100644 --- a/tests/clipping/canvas-rounded-corners.sky +++ b/tests/clipping/canvas-rounded-corners.sky @@ -16,11 +16,13 @@