| Index: Source/core/page/DOMWindow.cpp
|
| diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
|
| index 178157306b881b94804877d5f7b86e447e58210e..c30f77fb59cb5782dd8dbc8b3dcb94c0aff0228f 100644
|
| --- a/Source/core/page/DOMWindow.cpp
|
| +++ b/Source/core/page/DOMWindow.cpp
|
| @@ -55,6 +55,7 @@
|
| #include "core/dom/RequestAnimationFrameCallback.h"
|
| #include "core/dom/ScriptExecutionContext.h"
|
| #include "core/editing/Editor.h"
|
| +#include "core/fileapi/Blob.h"
|
| #include "core/history/BackForwardController.h"
|
| #include "core/html/HTMLCanvasElement.h"
|
| #include "core/html/HTMLFrameOwnerElement.h"
|
| @@ -1375,13 +1376,13 @@ static IntSize size(HTMLVideoElement* video)
|
| return IntSize();
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| LayoutSize s = size(image);
|
| createImageBitmap(image, callback, 0, 0, s.width(), s.height(), ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| if (!image) {
|
| ec = TypeError;
|
| @@ -1416,13 +1417,13 @@ void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitma
|
| scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| IntSize s = size(video);
|
| createImageBitmap(video, callback, 0, 0, s.width(), s.height(), ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| if (!video) {
|
| ec = TypeError;
|
| @@ -1461,22 +1462,22 @@ void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitma
|
| scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| createImageBitmap(context->canvas(), callback, ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| createImageBitmap(context->canvas(), callback, sx, sy, sw, sh, ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| createImageBitmap(canvas, callback, 0, 0, canvas->width(), canvas->height(), ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| if (!canvas) {
|
| ec = TypeError;
|
| @@ -1499,12 +1500,37 @@ void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBit
|
| scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(Blob* blob, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +{
|
| + if (!blob) {
|
| + ec = TypeError;
|
| + return;
|
| + }
|
| + // We pass 0 as width and height to indicate that there should be no cropping.
|
| + RefPtr<ImageBitmap> bitmap = ImageBitmap::create(this, callback, blob, IntRect(IntPoint(), IntSize()));
|
| + m_pendingImageBitmaps.add(bitmap);
|
| +}
|
| +
|
| +void DOMWindow::createImageBitmap(Blob* blob, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +{
|
| + if (!blob) {
|
| + ec = TypeError;
|
| + return;
|
| + }
|
| + if (!sw || !sh) {
|
| + ec = IndexSizeError;
|
| + return;
|
| + }
|
| + RefPtr<ImageBitmap> bitmap = ImageBitmap::create(this, callback, blob, IntRect(sx, sy, sw, sh));
|
| + m_pendingImageBitmaps.add(bitmap);
|
| +}
|
| +
|
| +void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| createImageBitmap(data, callback, 0, 0, data->width(), data->height(), ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| if (!data) {
|
| ec = TypeError;
|
| @@ -1523,12 +1549,12 @@ void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallbac
|
| scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec) const
|
| {
|
| createImageBitmap(bitmap, callback, 0, 0, bitmap->width(), bitmap->height(), ec);
|
| }
|
|
|
| -void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
|
| +void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec) const
|
| {
|
| if (!bitmap) {
|
| ec = TypeError;
|
| @@ -1547,6 +1573,11 @@ void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCal
|
| scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
|
| }
|
|
|
| +void DOMWindow::imageBitmapFinishedLoading(ImageBitmap* bitmap)
|
| +{
|
| + m_pendingImageBitmaps.remove(bitmap);
|
| +}
|
| +
|
| int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
|
| {
|
| callback->m_useLegacyTimeBase = false;
|
|
|