Index: Source/WebCore/bindings/dart/custom/DartCanvasRenderingContext2DCustom.cpp |
diff --git a/Source/WebCore/bindings/dart/custom/DartCanvasRenderingContext2DCustom.cpp b/Source/WebCore/bindings/dart/custom/DartCanvasRenderingContext2DCustom.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..05657c52387de227cc0c32f2b9e1a1ac2df144c4 |
--- /dev/null |
+++ b/Source/WebCore/bindings/dart/custom/DartCanvasRenderingContext2DCustom.cpp |
@@ -0,0 +1,182 @@ |
+// Copyright 2011, Google Inc. |
+// All rights reserved. |
+// |
+// Redistribution and use in source and binary forms, with or without |
+// modification, are permitted provided that the following conditions are |
+// met: |
+// |
+// * Redistributions of source code must retain the above copyright |
+// notice, this list of conditions and the following disclaimer. |
+// * Redistributions in binary form must reproduce the above |
+// copyright notice, this list of conditions and the following disclaimer |
+// in the documentation and/or other materials provided with the |
+// distribution. |
+// * Neither the name of Google Inc. nor the names of its |
+// contributors may be used to endorse or promote products derived from |
+// this software without specific prior written permission. |
+// |
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ |
+#include "config.h" |
+#include "DartCanvasRenderingContext2D.h" |
+ |
+#include "CanvasRenderingContext2D.h" |
+#include "DartDOMWrapper.h" |
+ |
+namespace WebCore { |
+ |
+namespace DartCanvasRenderingContext2DInternal { |
+ |
+void drawImageCallback(Dart_NativeArguments) |
+{ |
+ // FIXME: proper implementation. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void setShadowCallback(Dart_NativeArguments) |
+{ |
+ // FIXME: proper implementation. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void createPatternCallback(Dart_NativeArguments) |
+{ |
+ // FIXME: proper implementation. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void webkitLineDashGetter(Dart_NativeArguments args) |
+{ |
+ // FIXME: implement this. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void webkitLineDashSetter(Dart_NativeArguments args) |
+{ |
+ // FIXME: implement this. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void setFillStyleCallback(Dart_NativeArguments args) |
+{ |
+ // void setFillStyle(in DOMString color) |
+ |
+ // FIXME: this should be a custom setter. |
+ // FIXME: support other overloads. |
+ DartApiScope dartApiScope; |
+ Dart_Handle exception; |
+ { |
+ CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRenderingContext2D>(args); |
+ |
+ const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); |
+ if (!color.conversionSuccessful()) { |
+ exception = color.exception(); |
+ goto fail; |
+ } |
+ |
+ receiver->setFillColor(color); |
+ return; |
+ } |
+ |
+fail: |
+ Dart_ThrowException(exception); |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
+void setStrokeStyleCallback(Dart_NativeArguments args) |
+{ |
+ // void setStrokeStyle(in DOMString color) |
+ |
+ // FIXME: this should be a custom setter. |
+ // FIXME: support other overloads. |
+ DartApiScope dartApiScope; |
+ Dart_Handle exception; |
+ { |
+ CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRenderingContext2D>(args); |
+ |
+ const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); |
+ if (!color.conversionSuccessful()) { |
+ exception = color.exception(); |
+ goto fail; |
+ } |
+ |
+ receiver->setStrokeColor(color); |
+ return; |
+ } |
+ |
+fail: |
+ Dart_ThrowException(exception); |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
+void strokeStyleGetter(Dart_NativeArguments) |
+{ |
+ // FIXME: proper implementation. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void strokeStyleSetter(Dart_NativeArguments args) |
+{ |
+ DartApiScope dartApiScope; |
+ Dart_Handle exception; |
+ { |
+ CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRenderingContext2D>(args); |
+ |
+ // FIXME: support setting CanvasStyle. |
+ const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); |
+ if (!color.conversionSuccessful()) { |
+ exception = color.exception(); |
+ goto fail; |
+ } |
+ |
+ receiver->setStrokeColor(color); |
+ return; |
+ } |
+ |
+fail: |
+ Dart_ThrowException(exception); |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
+void fillStyleGetter(Dart_NativeArguments) |
+{ |
+ // FIXME: proper implementation. |
+ DART_UNIMPLEMENTED(); |
+} |
+ |
+void fillStyleSetter(Dart_NativeArguments args) |
+{ |
+ DartApiScope dartApiScope; |
+ Dart_Handle exception; |
+ { |
+ CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRenderingContext2D>(args); |
+ |
+ // FIXME: support setting CanvasStyle. |
+ const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); |
+ if (!color.conversionSuccessful()) { |
+ exception = color.exception(); |
+ goto fail; |
+ } |
+ |
+ receiver->setFillColor(color); |
+ return; |
+ } |
+ |
+fail: |
+ Dart_ThrowException(exception); |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
+} // namespace DartCanvasRenderingContext2DInternal |
+ |
+} // namespace WebCore |