Chromium Code Reviews| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 { | 117 { |
| 118 IntSize s = sizeFor(video); | 118 IntSize s = sizeFor(video); |
| 119 return createImageBitmap(scriptState, eventTarget, video, 0, 0, s.width(), s .height(), exceptionState); | 119 return createImageBitmap(scriptState, eventTarget, video, 0, 0, s.width(), s .height(), exceptionState); |
| 120 } | 120 } |
| 121 | 121 |
| 122 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int s h, ExceptionState& exceptionState) | 122 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int s h, ExceptionState& exceptionState) |
| 123 { | 123 { |
| 124 // This variant does not work in worker threads. | 124 // This variant does not work in worker threads. |
| 125 ASSERT(eventTarget.toDOMWindow()); | 125 ASSERT(eventTarget.toDOMWindow()); |
| 126 | 126 |
| 127 if (!video->player()) { | 127 if (!video->webMediaPlayer()) { |
|
acolwell GONE FROM CHROMIUM
2014/06/06 05:51:09
I don't think you will need this given that the <=
Srirama
2014/06/06 06:41:42
Done.
| |
| 128 exceptionState.throwDOMException(InvalidStateError, "No player can be re trieved from the provided video element."); | 128 exceptionState.throwDOMException(InvalidStateError, "No player can be re trieved from the provided video element."); |
| 129 return ScriptPromise(); | 129 return ScriptPromise(); |
| 130 } | 130 } |
| 131 if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { | 131 if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { |
| 132 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t has not retrieved data."); | 132 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t has not retrieved data."); |
| 133 return ScriptPromise(); | 133 return ScriptPromise(); |
| 134 } | 134 } |
| 135 if (video->player()->readyState() <= MediaPlayer::HaveMetadata) { | 135 if (video->webMediaPlayer()->readyState() <= blink::WebMediaPlayer::ReadySta teHaveMetadata) { |
|
acolwell GONE FROM CHROMIUM
2014/06/06 05:51:09
This doesn't seem right. I believe this code shoul
Srirama
2014/06/06 06:41:42
Done.
| |
| 136 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t's player has no current data."); | 136 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t's player has no current data."); |
| 137 return ScriptPromise(); | 137 return ScriptPromise(); |
| 138 } | 138 } |
| 139 if (!sw || !sh) { | 139 if (!sw || !sh) { |
| 140 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); | 140 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); |
| 141 return ScriptPromise(); | 141 return ScriptPromise(); |
| 142 } | 142 } |
| 143 if (!video->hasSingleSecurityOrigin()) { | 143 if (!video->hasSingleSecurityOrigin()) { |
| 144 exceptionState.throwSecurityError("The source video contains image data from multiple origins."); | 144 exceptionState.throwSecurityError("The source video contains image data from multiple origins."); |
| 145 return ScriptPromise(); | 145 return ScriptPromise(); |
| 146 } | 146 } |
| 147 if (!(video->webMediaPlayer() && video->webMediaPlayer()->didPassCORSAccessC heck()) | 147 if (!video->webMediaPlayer()->didPassCORSAccessCheck() |
| 148 && eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas (video->currentSrc())) { | 148 && eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas (video->currentSrc())) { |
| 149 exceptionState.throwSecurityError("Cross-origin access to the source vid eo is denied."); | 149 exceptionState.throwSecurityError("Cross-origin access to the source vid eo is denied."); |
| 150 return ScriptPromise(); | 150 return ScriptPromise(); |
| 151 } | 151 } |
| 152 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 152 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 |
| 153 return fulfillImageBitmap(scriptState, ImageBitmap::create(video, IntRect(sx , sy, sw, sh))); | 153 return fulfillImageBitmap(scriptState, ImageBitmap::create(video, IntRect(sx , sy, sw, sh))); |
| 154 } | 154 } |
| 155 | 155 |
| 156 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, CanvasRenderingContext2D* context, ExceptionState& exc eptionState) | 156 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, CanvasRenderingContext2D* context, ExceptionState& exc eptionState) |
| 157 { | 157 { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 { | 335 { |
| 336 rejectPromise(); | 336 rejectPromise(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) | 339 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) |
| 340 { | 340 { |
| 341 visitor->trace(m_factory); | 341 visitor->trace(m_factory); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace WebCore | 344 } // namespace WebCore |
| OLD | NEW |