Index: third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
index 2d42f461bf49503a4ec7e1c1d82b4fc10b5c63db..c27daa7a26258ead247d77e636bc7bfe568cb1c0 100644 |
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp |
@@ -45,12 +45,13 @@ static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& crop |
return StaticBitmapImage::create(adoptRef(surface->newImageSnapshot())); |
} |
-ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect) |
+ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect, Document* document) |
{ |
+ m_isOriginClean = !image->wouldTaintOrigin(document->securityOrigin()); |
m_image = cropImage(image->cachedImage()->image(), cropRect); |
} |
-ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect) |
+ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, Document* document) |
{ |
IntSize playerSize; |
if (video->webMediaPlayer()) |
@@ -64,12 +65,14 @@ ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect) |
IntPoint dstPoint = IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())); |
video->paintCurrentFrame(buffer->canvas(), IntRect(dstPoint, srcRect.size()), nullptr); |
+ m_isOriginClean = !video->wouldTaintOrigin(document->securityOrigin()); |
m_image = StaticBitmapImage::create(buffer->newSkImageSnapshot(PreferNoAcceleration)); |
} |
ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect) |
{ |
ASSERT(canvas->isPaintable()); |
+ m_isOriginClean = canvas->originClean(); |
m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration).get(), cropRect); |
} |
@@ -97,16 +100,19 @@ ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect) |
ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect) |
{ |
+ m_isOriginClean = bitmap->originClean(); |
m_image = cropImage(bitmap->bitmapImage(), cropRect); |
} |
ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect) |
{ |
+ m_isOriginClean = !image->currentFrameHasSingleSecurityOrigin(); |
m_image = cropImage(image, cropRect); |
} |
ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) |
{ |
+ m_isOriginClean = !image->currentFrameHasSingleSecurityOrigin(); |
xidachen
2016/01/05 20:04:36
Is this what we want? For StaticBitmapImage&Image,
|
m_image = image; |
} |
@@ -121,16 +127,16 @@ ImageBitmap::~ImageBitmap() |
{ |
} |
-PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect) |
+PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect, Document* document) |
{ |
IntRect normalizedCropRect = normalizeRect(cropRect); |
- return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect)); |
+ return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, document)); |
} |
-PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect) |
+PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect, Document* document) |
{ |
IntRect normalizedCropRect = normalizeRect(cropRect); |
- return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect)); |
+ return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect, document)); |
} |
PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect) |