| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return toV8(style->canvasGradient(), creationContext, isolate); | 52 return toV8(style->canvasGradient(), creationContext, isolate); |
| 53 | 53 |
| 54 if (style->canvasPattern()) | 54 if (style->canvasPattern()) |
| 55 return toV8(style->canvasPattern(), creationContext, isolate); | 55 return toV8(style->canvasPattern(), creationContext, isolate); |
| 56 | 56 |
| 57 return v8String(isolate, style->color()); | 57 return v8String(isolate, style->color()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value, v8::Is
olate* isolate) | 60 static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value, v8::Is
olate* isolate) |
| 61 { | 61 { |
| 62 if (V8CanvasGradient::hasInstance(value, isolate, worldType(isolate))) | 62 if (V8CanvasGradient::hasInstance(value, isolate)) |
| 63 return CanvasStyle::createFromGradient(V8CanvasGradient::toNative(v8::Ha
ndle<v8::Object>::Cast(value))); | 63 return CanvasStyle::createFromGradient(V8CanvasGradient::toNative(v8::Ha
ndle<v8::Object>::Cast(value))); |
| 64 | 64 |
| 65 if (V8CanvasPattern::hasInstance(value, isolate, worldType(isolate))) | 65 if (V8CanvasPattern::hasInstance(value, isolate)) |
| 66 return CanvasStyle::createFromPattern(V8CanvasPattern::toNative(v8::Hand
le<v8::Object>::Cast(value))); | 66 return CanvasStyle::createFromPattern(V8CanvasPattern::toNative(v8::Hand
le<v8::Object>::Cast(value))); |
| 67 | 67 |
| 68 return 0; | 68 return 0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void V8CanvasRenderingContext2D::strokeStyleAttributeGetterCustom(const v8::Prop
ertyCallbackInfo<v8::Value>& info) | 71 void V8CanvasRenderingContext2D::strokeStyleAttributeGetterCustom(const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
| 72 { | 72 { |
| 73 CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.H
older()); | 73 CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.H
older()); |
| 74 v8SetReturnValue(info, toV8Object(impl->strokeStyle(), info.Holder(), info.G
etIsolate())); | 74 v8SetReturnValue(info, toV8Object(impl->strokeStyle(), info.Holder(), info.G
etIsolate())); |
| 75 } | 75 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 void V8CanvasRenderingContext2D::fillStyleAttributeSetterCustom(v8::Local<v8::Va
lue> value, const v8::PropertyCallbackInfo<void>& info) | 92 void V8CanvasRenderingContext2D::fillStyleAttributeSetterCustom(v8::Local<v8::Va
lue> value, const v8::PropertyCallbackInfo<void>& info) |
| 93 { | 93 { |
| 94 CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.H
older()); | 94 CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.H
older()); |
| 95 if (value->IsString()) | 95 if (value->IsString()) |
| 96 impl->setFillColor(toCoreString(value.As<v8::String>())); | 96 impl->setFillColor(toCoreString(value.As<v8::String>())); |
| 97 else | 97 else |
| 98 impl->setFillStyle(toCanvasStyle(value, info.GetIsolate())); | 98 impl->setFillStyle(toCanvasStyle(value, info.GetIsolate())); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace WebCore | 101 } // namespace WebCore |
| OLD | NEW |