| Index: Source/core/html/HTMLVideoElement.cpp
|
| diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
|
| index d0b8b8d57e1bbd379de5dc66273ee639758867a4..3cc8b3d6c64828ca37e946a7e8259ca623eae76f 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,34 @@ KURL HTMLVideoElement::mediaPlayerPosterURL()
|
| return posterImageURL();
|
| }
|
|
|
| +PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageMode mode, SourceImageStatus* status) const
|
| +{
|
| + if (!hasAvailableVideoFrame()) {
|
| + *status = InvalidSourceImageStatus;
|
| + return nullptr;
|
| + }
|
| +
|
| + IntSize intrinsicSize(videoWidth(), videoHeight());
|
| + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize);
|
| + if (!imageBuffer) {
|
| + *status = InvalidSourceImageStatus;
|
| + return nullptr;
|
| + }
|
| +
|
| + paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), intrinsicSize));
|
| +
|
| + *status = NormalSourceImageStatus;
|
| + return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackingStore : DontCopyBackingStore, Unscaled);
|
| +}
|
| +
|
| +bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const
|
| +{
|
| + return !hasSingleSecurityOrigin() || (!(player() && player()->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSrc()));
|
| +}
|
| +
|
| +FloatSize HTMLVideoElement::sourceSize() const
|
| +{
|
| + return FloatSize(videoWidth(), videoHeight());
|
| +}
|
| +
|
| }
|
|
|