OLD | NEW |
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DartCanvasPattern::returnToDart(args, style->canvasPattern()); | 63 DartCanvasPattern::returnToDart(args, style->canvasPattern()); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 DartUtilities::setDartStringReturnValue(args, style->color()); | 67 DartUtilities::setDartStringReturnValue(args, style->color()); |
68 } | 68 } |
69 | 69 |
70 static PassRefPtr<CanvasStyle> toCanvasStyle(Dart_Handle value) | 70 static PassRefPtr<CanvasStyle> toCanvasStyle(Dart_Handle value) |
71 { | 71 { |
72 Dart_Handle exception = 0; | 72 Dart_Handle exception = 0; |
73 DartDOMData* domData = DartDOMData::current(); | 73 if (DartDOMWrapper::subtypeOf(value, DartCanvasGradient::dartClassId)) |
74 if (DartDOMWrapper::instanceOf<DartCanvasGradient>(domData, value)) | |
75 return CanvasStyle::createFromGradient(DartCanvasGradient::toNative(valu
e, exception)); | 74 return CanvasStyle::createFromGradient(DartCanvasGradient::toNative(valu
e, exception)); |
76 | 75 |
77 if (DartDOMWrapper::instanceOf<DartCanvasPattern>(domData, value)) | 76 if (DartDOMWrapper::subtypeOf(value, DartCanvasPattern::dartClassId)) |
78 return CanvasStyle::createFromPattern(DartCanvasPattern::toNative(value,
exception)); | 77 return CanvasStyle::createFromPattern(DartCanvasPattern::toNative(value,
exception)); |
79 | 78 |
80 return 0; | 79 return 0; |
81 } | 80 } |
82 | 81 |
83 void strokeStyleGetter(Dart_NativeArguments args ) | 82 void strokeStyleGetter(Dart_NativeArguments args ) |
84 { | 83 { |
85 { | 84 { |
86 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); | 85 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend
eringContext2D>(args); |
87 | 86 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 145 } |
147 | 146 |
148 fail: | 147 fail: |
149 Dart_ThrowException(exception); | 148 Dart_ThrowException(exception); |
150 ASSERT_NOT_REACHED(); | 149 ASSERT_NOT_REACHED(); |
151 } | 150 } |
152 | 151 |
153 } // namespace DartCanvasRenderingContext2DInternal | 152 } // namespace DartCanvasRenderingContext2DInternal |
154 | 153 |
155 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |