| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int s
h, ExceptionState& exceptionState) | 121 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int s
h, ExceptionState& exceptionState) |
| 122 { | 122 { |
| 123 // This variant does not work in worker threads. | 123 // This variant does not work in worker threads. |
| 124 ASSERT(eventTarget.toDOMWindow()); | 124 ASSERT(eventTarget.toDOMWindow()); |
| 125 | 125 |
| 126 if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { | 126 if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { |
| 127 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); | 127 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); |
| 128 return ScriptPromise(); | 128 return ScriptPromise(); |
| 129 } | 129 } |
| 130 // FIXME: Remove the below null check once we fix the bug 382721 | 130 if (video->readyState() <= HTMLMediaElement::HAVE_METADATA) { |
| 131 if (video->readyState() <= HTMLMediaElement::HAVE_METADATA || !video->webMed
iaPlayer()) { | |
| 132 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); | 131 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); |
| 133 return ScriptPromise(); | 132 return ScriptPromise(); |
| 134 } | 133 } |
| 135 if (!sw || !sh) { | 134 if (!sw || !sh) { |
| 136 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 135 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 137 return ScriptPromise(); | 136 return ScriptPromise(); |
| 138 } | 137 } |
| 139 if (!video->hasSingleSecurityOrigin()) { | 138 if (!video->hasSingleSecurityOrigin()) { |
| 140 exceptionState.throwSecurityError("The source video contains image data
from multiple origins."); | 139 exceptionState.throwSecurityError("The source video contains image data
from multiple origins."); |
| 141 return ScriptPromise(); | 140 return ScriptPromise(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 { | 330 { |
| 332 rejectPromise(); | 331 rejectPromise(); |
| 333 } | 332 } |
| 334 | 333 |
| 335 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) | 334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) |
| 336 { | 335 { |
| 337 visitor->trace(m_factory); | 336 visitor->trace(m_factory); |
| 338 } | 337 } |
| 339 | 338 |
| 340 } // namespace WebCore | 339 } // namespace WebCore |
| OLD | NEW |