| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| index 47dfe4296a9a8aeefa3b9b225774817d354caf02..2d2916c2f3c8af57d869f901cc1d27613cda52a8 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/fileapi/File.h"
|
| +#include "core/frame/ImageBitmap.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/html/ImageData.h"
|
| @@ -933,6 +934,26 @@ FloatSize HTMLCanvasElement::elementSize() const
|
| return FloatSize(width(), height());
|
| }
|
|
|
| +IntSize HTMLCanvasElement::bitmapSourceSize()
|
| +{
|
| + return IntSize(width(), height());
|
| +}
|
| +
|
| +ScriptPromise HTMLCanvasElement::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, ImageBitmapSource* bitmapSource, int sx, int sy, int sw, int sh, ExceptionState& exceptionState)
|
| +{
|
| + ASSERT(eventTarget.toDOMWindow());
|
| + HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(bitmapSource);
|
| + if (!canvas->originClean()) {
|
| + exceptionState.throwSecurityError("The canvas element provided is tainted with cross-origin data.");
|
| + return ScriptPromise();
|
| + }
|
| + if (!sw || !sh) {
|
| + exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width"));
|
| + return ScriptPromise();
|
| + }
|
| + return ImageBitmapSource::fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh)) : nullptr);
|
| +}
|
| +
|
| bool HTMLCanvasElement::isOpaque() const
|
| {
|
| return m_context && !m_context->hasAlpha();
|
|
|