| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 static IntSize sizeFor(HTMLVideoElement* video) | 62 static IntSize sizeFor(HTMLVideoElement* video) |
| 63 { | 63 { |
| 64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) | 64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) |
| 65 return webMediaPlayer->naturalSize(); | 65 return webMediaPlayer->naturalSize(); |
| 66 return IntSize(); | 66 return IntSize(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill
BeRawPtr<ImageBitmap> imageBitmap) | 69 static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWill
BeRawPtr<ImageBitmap> imageBitmap) |
| 70 { | 70 { |
| 71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 71 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 72 ScriptPromise promise = resolver->promise(); | 72 ScriptPromise promise = resolver->promise(); |
| 73 if (imageBitmap) { | 73 if (imageBitmap) { |
| 74 resolver->resolve(imageBitmap); | 74 resolver->resolve(imageBitmap); |
| 75 } else { | 75 } else { |
| 76 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate(
)))); | 76 resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate(
)))); |
| 77 } | 77 } |
| 78 return promise; | 78 return promise; |
| 79 } | 79 } |
| 80 | 80 |
| 81 ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptS
tate, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& excepti
onState) | 81 ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptS
tate, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& excepti
onState) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (!sw || !sh) { | 177 if (!sw || !sh) { |
| 178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 179 return ScriptPromise(); | 179 return ScriptPromise(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 |
| 183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::
create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); | 183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::
create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |