| OLD | NEW |
| (Empty) |
| 1 // Copyright 2011, Google Inc. | |
| 2 // All rights reserved. | |
| 3 // | |
| 4 // Redistribution and use in source and binary forms, with or without | |
| 5 // modification, are permitted provided that the following conditions are | |
| 6 // met: | |
| 7 // | |
| 8 // * Redistributions of source code must retain the above copyright | |
| 9 // notice, this list of conditions and the following disclaimer. | |
| 10 // * Redistributions in binary form must reproduce the above | |
| 11 // copyright notice, this list of conditions and the following disclaimer | |
| 12 // in the documentation and/or other materials provided with the | |
| 13 // distribution. | |
| 14 // * Neither the name of Google Inc. nor the names of its | |
| 15 // contributors may be used to endorse or promote products derived from | |
| 16 // this software without specific prior written permission. | |
| 17 // | |
| 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | |
| 30 #include "config.h" | |
| 31 #include "DartCanvasRenderingContext2D.h" | |
| 32 | |
| 33 #include "CanvasRenderingContext2D.h" | |
| 34 #include "DartDOMWrapper.h" | |
| 35 | |
| 36 namespace WebCore { | |
| 37 | |
| 38 namespace DartCanvasRenderingContext2DInternal { | |
| 39 | |
| 40 void drawImageCallback(Dart_NativeArguments) | |
| 41 { | |
| 42 // FIXME: proper implementation. | |
| 43 DART_UNIMPLEMENTED(); | |
| 44 } | |
| 45 | |
| 46 void setShadowCallback(Dart_NativeArguments) | |
| 47 { | |
| 48 // FIXME: proper implementation. | |
| 49 DART_UNIMPLEMENTED(); | |
| 50 } | |
| 51 | |
| 52 void createPatternCallback(Dart_NativeArguments) | |
| 53 { | |
| 54 // FIXME: proper implementation. | |
| 55 DART_UNIMPLEMENTED(); | |
| 56 } | |
| 57 | |
| 58 void webkitLineDashGetter(Dart_NativeArguments args) | |
| 59 { | |
| 60 // FIXME: implement this. | |
| 61 DART_UNIMPLEMENTED(); | |
| 62 } | |
| 63 | |
| 64 void webkitLineDashSetter(Dart_NativeArguments args) | |
| 65 { | |
| 66 // FIXME: implement this. | |
| 67 DART_UNIMPLEMENTED(); | |
| 68 } | |
| 69 | |
| 70 void setFillStyleCallback(Dart_NativeArguments args) | |
| 71 { | |
| 72 // void setFillStyle(in DOMString color) | |
| 73 | |
| 74 // FIXME: this should be a custom setter. | |
| 75 // FIXME: support other overloads. | |
| 76 DartApiScope dartApiScope; | |
| 77 Dart_Handle exception; | |
| 78 { | |
| 79 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); | |
| 80 | |
| 81 const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); | |
| 82 if (!color.conversionSuccessful()) { | |
| 83 exception = color.exception(); | |
| 84 goto fail; | |
| 85 } | |
| 86 | |
| 87 receiver->setFillColor(color); | |
| 88 return; | |
| 89 } | |
| 90 | |
| 91 fail: | |
| 92 Dart_ThrowException(exception); | |
| 93 ASSERT_NOT_REACHED(); | |
| 94 } | |
| 95 | |
| 96 void setStrokeStyleCallback(Dart_NativeArguments args) | |
| 97 { | |
| 98 // void setStrokeStyle(in DOMString color) | |
| 99 | |
| 100 // FIXME: this should be a custom setter. | |
| 101 // FIXME: support other overloads. | |
| 102 DartApiScope dartApiScope; | |
| 103 Dart_Handle exception; | |
| 104 { | |
| 105 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); | |
| 106 | |
| 107 const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); | |
| 108 if (!color.conversionSuccessful()) { | |
| 109 exception = color.exception(); | |
| 110 goto fail; | |
| 111 } | |
| 112 | |
| 113 receiver->setStrokeColor(color); | |
| 114 return; | |
| 115 } | |
| 116 | |
| 117 fail: | |
| 118 Dart_ThrowException(exception); | |
| 119 ASSERT_NOT_REACHED(); | |
| 120 } | |
| 121 | |
| 122 void strokeStyleGetter(Dart_NativeArguments) | |
| 123 { | |
| 124 // FIXME: proper implementation. | |
| 125 DART_UNIMPLEMENTED(); | |
| 126 } | |
| 127 | |
| 128 void strokeStyleSetter(Dart_NativeArguments args) | |
| 129 { | |
| 130 DartApiScope dartApiScope; | |
| 131 Dart_Handle exception; | |
| 132 { | |
| 133 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); | |
| 134 | |
| 135 // FIXME: support setting CanvasStyle. | |
| 136 const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); | |
| 137 if (!color.conversionSuccessful()) { | |
| 138 exception = color.exception(); | |
| 139 goto fail; | |
| 140 } | |
| 141 | |
| 142 receiver->setStrokeColor(color); | |
| 143 return; | |
| 144 } | |
| 145 | |
| 146 fail: | |
| 147 Dart_ThrowException(exception); | |
| 148 ASSERT_NOT_REACHED(); | |
| 149 } | |
| 150 | |
| 151 void fillStyleGetter(Dart_NativeArguments) | |
| 152 { | |
| 153 // FIXME: proper implementation. | |
| 154 DART_UNIMPLEMENTED(); | |
| 155 } | |
| 156 | |
| 157 void fillStyleSetter(Dart_NativeArguments args) | |
| 158 { | |
| 159 DartApiScope dartApiScope; | |
| 160 Dart_Handle exception; | |
| 161 { | |
| 162 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); | |
| 163 | |
| 164 // FIXME: support setting CanvasStyle. | |
| 165 const ParameterAdapter< String > color(Dart_GetNativeArgument(args, 1)); | |
| 166 if (!color.conversionSuccessful()) { | |
| 167 exception = color.exception(); | |
| 168 goto fail; | |
| 169 } | |
| 170 | |
| 171 receiver->setFillColor(color); | |
| 172 return; | |
| 173 } | |
| 174 | |
| 175 fail: | |
| 176 Dart_ThrowException(exception); | |
| 177 ASSERT_NOT_REACHED(); | |
| 178 } | |
| 179 | |
| 180 } // namespace DartCanvasRenderingContext2DInternal | |
| 181 | |
| 182 } // namespace WebCore | |
| OLD | NEW |