summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxidachen <xidachen@chromium.org>2015-11-27 06:12:36 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-27 14:13:34 +0000
commitd31679fb7972b298932f951831a221cbaf281504 (patch)
tree8586144848f2bf1d96673b8d8dcd7d2851caf0bd
parentedd3817ef4a1c3a41610855bfc2703b55359d444 (diff)
downloadchromium_src-d31679fb7972b298932f951831a221cbaf281504.zip
chromium_src-d31679fb7972b298932f951831a221cbaf281504.tar.gz
chromium_src-d31679fb7972b298932f951831a221cbaf281504.tar.bz2
Avoid static_cast in ImageBitmap
The current implementation of ImageBitmap has a static_cast from Image to its derived class StaticBitmapImage, which could lead to bad cast. This CL will elliminate the cast. BUG=561869 Review URL: https://codereview.chromium.org/1480903002 Cr-Commit-Position: refs/heads/master@{#361996}
-rw-r--r--third_party/WebKit/Source/core/frame/ImageBitmap.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index ddd4a86..24d94ca 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -21,7 +21,7 @@ static inline IntRect normalizeRect(const IntRect& rect)
std::max(rect.height(), -rect.height()));
}
-static PassRefPtr<StaticBitmapImage> cropImage(StaticBitmapImage* image, const IntRect& cropRect)
+static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& cropRect)
{
ASSERT(image);
@@ -48,7 +48,7 @@ static PassRefPtr<StaticBitmapImage> cropImage(StaticBitmapImage* image, const I
ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect)
{
- m_image = cropImage(static_cast<StaticBitmapImage*>(image->cachedImage()->image()), cropRect);
+ m_image = cropImage(image->cachedImage()->image(), cropRect);
}
ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
@@ -71,7 +71,7 @@ ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
{
ASSERT(canvas->isPaintable());
- m_image = cropImage(static_cast<StaticBitmapImage*>(canvas->copiedImage(BackBuffer, PreferAcceleration).get()), cropRect);
+ m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration).get(), cropRect);
}
ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
@@ -103,7 +103,7 @@ ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect)
ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect)
{
- m_image = cropImage(static_cast<StaticBitmapImage*>(image), cropRect);
+ m_image = cropImage(image, cropRect);
}
ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image)