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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (!canvas->originClean()) { | 171 if (!canvas->originClean()) { |
172 exceptionState.throwSecurityError("The canvas element provided is tainte
d with cross-origin data."); | 172 exceptionState.throwSecurityError("The canvas element provided is tainte
d with cross-origin data."); |
173 return ScriptPromise(); | 173 return ScriptPromise(); |
174 } | 174 } |
175 if (!sw || !sh) { | 175 if (!sw || !sh) { |
176 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 176 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
177 return ScriptPromise(); | 177 return ScriptPromise(); |
178 } | 178 } |
179 | 179 |
180 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 180 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 |
181 return fulfillImageBitmap(scriptState, canvas->buffer() ? ImageBitmap::creat
e(canvas, IntRect(sx, sy, sw, sh)) : nullptr); | 181 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::
create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); |
182 } | 182 } |
183 | 183 |
184 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState) | 184 ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState) |
185 { | 185 { |
186 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create(
from(eventTarget), IntRect(), scriptState); | 186 ImageBitmapLoader* loader = ImageBitmapFactories::ImageBitmapLoader::create(
from(eventTarget), IntRect(), scriptState); |
187 ScriptPromise promise = loader->promise(); | 187 ScriptPromise promise = loader->promise(); |
188 from(eventTarget).addLoader(loader); | 188 from(eventTarget).addLoader(loader); |
189 loader->loadBlobAsync(eventTarget.executionContext(), blob); | 189 loader->loadBlobAsync(eventTarget.executionContext(), blob); |
190 return promise; | 190 return promise; |
191 } | 191 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 { | 330 { |
331 rejectPromise(); | 331 rejectPromise(); |
332 } | 332 } |
333 | 333 |
334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) | 334 void ImageBitmapFactories::ImageBitmapLoader::trace(Visitor* visitor) |
335 { | 335 { |
336 visitor->trace(m_factory); | 336 visitor->trace(m_factory); |
337 } | 337 } |
338 | 338 |
339 } // namespace blink | 339 } // namespace blink |
OLD | NEW |