| Index: Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
|
| index 24bd1e3bee912b6a8d843fb1362c0aff6b18c242..b5c40e284604ae206a35076b6341871fdc01b520 100644
|
| --- a/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -599,4 +599,38 @@ void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
|
| HTMLElement::didMoveToNewDocument(oldDocument);
|
| }
|
|
|
| +PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(ExceptionState& exceptionState, CanvasImageSourceUsage usage, bool* isVolatile) const
|
| +{
|
| + if (isVolatile)
|
| + *isVolatile = false;
|
| + if (!width() || !height()) {
|
| + if (usage == PatternCanvasImageSourceUsage)
|
| + exceptionState.throwDOMException(InvalidStateError, String::format("The source %s is 0.", width() ? "height" : "width"));
|
| + return nullptr;
|
| + }
|
| +
|
| + if (usage == PatternCanvasImageSourceUsage || usage == DrawToSelfCanvasImageSourceUsage)
|
| + return copiedImage();
|
| +
|
| + if (m_context && m_context->is3d()) {
|
| + m_context->paintRenderingResultsToCanvas();
|
| + // We leave isVolatile to false when the source is a 2D canvas because
|
| + // 2d canvas-to-canvas copies are not deferred and all 2D canvases live
|
| + // in the same graphics context so we can avoid triggering an
|
| + // unnecessary flush in CanvasRenderingContext2D::drawImage
|
| + *isVolatile = true;
|
| + }
|
| + return buffer() ? m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled) : nullptr;
|
| +}
|
| +
|
| +bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
|
| +{
|
| + return !originClean();
|
| +}
|
| +
|
| +FloatSize HTMLCanvasElement::sourceSize() const
|
| +{
|
| + return FloatSize(width(), height());
|
| +}
|
| +
|
| }
|
|
|