Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(703)

Unified Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1532473002: Add a origin clean flag in ImageBitmap class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4c125cbc7f246cfec5f5c2638225402edbaee884..51db3cbd6de58e5ee1b7222594a4cad037315451 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -46,12 +46,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, bool originCleanFlag)
{
+ m_isOriginClean = originCleanFlag;
m_image = cropImage(image->cachedImage()->image(), cropRect);
}
-ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
+ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect, bool originCleanFlag)
{
IntSize playerSize;
if (video->webMediaPlayer())
@@ -65,6 +66,7 @@ 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 = originCleanFlag;
m_image = StaticBitmapImage::create(buffer->newSkImageSnapshot(PreferNoAcceleration));
}
@@ -122,16 +124,16 @@ ImageBitmap::~ImageBitmap()
{
}
-PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect)
+PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect, bool originCleanFlag)
{
IntRect normalizedCropRect = normalizeRect(cropRect);
- return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect));
+ return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect, originCleanFlag));
}
-PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect)
+PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect, bool originCleanFlag)
{
IntRect normalizedCropRect = normalizeRect(cropRect);
- return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect));
+ return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect, originCleanFlag));
}
PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect)

Powered by Google App Engine
This is Rietveld 408576698