| Index: Source/core/html/HTMLVideoElement.cpp
|
| diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
|
| index d0b8b8d57e1bbd379de5dc66273ee639758867a4..13aa49d32cc3437d43f0218133bc36999e3d2cdd 100644
|
| --- a/Source/core/html/HTMLVideoElement.cpp
|
| +++ b/Source/core/html/HTMLVideoElement.cpp
|
| @@ -33,6 +33,7 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/html/HTMLImageLoader.h"
|
| +#include "core/html/canvas/CanvasRenderingContext.h"
|
| #include "core/html/parser/HTMLParserIdioms.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/rendering/RenderImage.h"
|
| @@ -173,7 +174,7 @@ void HTMLVideoElement::updateDisplayState()
|
| setDisplayMode(Poster);
|
| }
|
|
|
| -void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
|
| +void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect) const
|
| {
|
| MediaPlayer* player = HTMLMediaElement::player();
|
| if (!player)
|
| @@ -232,4 +233,32 @@ KURL HTMLVideoElement::mediaPlayerPosterURL()
|
| return posterImageURL();
|
| }
|
|
|
| +PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(HTMLCanvasElement* canvas, ExceptionState& exceptionState, CanvasImageSourceUsage usage, bool* isVolatile) const
|
| +{
|
| + ASSERT(usage != DrawCanvasImageSourceUsage); // Drawing should use paintCurrentFrameInContext
|
| + if (isVolatile)
|
| + *isVolatile = false;
|
| + if (!hasAvailableVideoFrame())
|
| + return nullptr;
|
| +
|
| + IntSize intrinsicSize(videoWidth(), videoHeight());
|
| + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize);
|
| + if (!imageBuffer)
|
| + return nullptr;
|
| +
|
| + paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), intrinsicSize));
|
| +
|
| + return imageBuffer->copyImage(imageBuffer->fastCopyImageMode(), Unscaled);
|
| +}
|
| +
|
| +bool HTMLVideoElement::wouldTaintOrigin(CanvasRenderingContext* destinationContext) const
|
| +{
|
| + return !hasSingleSecurityOrigin() || (!(player() && player()->didPassCORSAccessCheck()) && destinationContext->wouldTaintOrigin(currentSrc()));
|
| +}
|
| +
|
| +FloatSize HTMLVideoElement::sourceSize() const
|
| +{
|
| + return FloatSize(videoWidth(), videoHeight());
|
| +}
|
| +
|
| }
|
|
|