Chromium Code Reviews| Index: Source/core/html/HTMLCanvasElement.cpp |
| diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
| index 24bd1e3bee912b6a8d843fb1362c0aff6b18c242..202c5f6bdef313e1242e16c6a2a99ec5006c85f3 100644 |
| --- a/Source/core/html/HTMLCanvasElement.cpp |
| +++ b/Source/core/html/HTMLCanvasElement.cpp |
| @@ -599,4 +599,34 @@ void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) |
| HTMLElement::didMoveToNewDocument(oldDocument); |
| } |
| +PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(HTMLCanvasElement* canvas, ExceptionState& exceptionState, CanvasImageSourceUsage usage, bool* isVolatile) const |
| +{ |
| + if (isVolatile) |
| + *isVolatile = false; |
| + if (!width() || !height()) { |
| + if (usage == PatternCanvasImageSourceUsage) |
| + exceptionState.throwDOMException(InvalidStateError, String::format("The canvas %s is 0.", canvas->width() ? "height" : "width")); |
| + return nullptr; |
| + } |
| + |
| + if (usage == PatternCanvasImageSourceUsage || canvas == this) |
| + return copiedImage(); |
|
Stephen White
2014/02/27 18:53:41
You might want to check the canvas-to-canvas self-
|
| + |
| + if (m_context && m_context->is3d()) { |
| + m_context->paintRenderingResultsToCanvas(); |
| + *isVolatile = true; |
|
Stephen White
2014/02/27 18:53:41
Please add a comment here indicating that this onl
|
| + } |
| + return buffer() ? m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled) : nullptr; |
| +} |
| + |
| +bool HTMLCanvasElement::wouldTaintOrigin(CanvasRenderingContext* dst) const |
| +{ |
| + return !originClean(); |
| +} |
| + |
| +FloatSize HTMLCanvasElement::sourceSize() const |
| +{ |
| + return FloatSize(width(), height()); |
| +} |
| + |
| } |