Title: [93441] trunk/Source/WebCore
- Revision
- 93441
- Author
- jam...@google.com
- Date
- 2011-08-19 14:50:10 -0700 (Fri, 19 Aug 2011)
Log Message
REGRESSION(r91628): 3 canvas tests crash on Chromium Linux and one test fail on Chromium Mac
https://bugs.webkit.org/show_bug.cgi?id=65063
Reviewed by Darin Fisher.
Fixes crashes due to a bad cast from Image to BitmapImage on skia ports
that use BitmapImageSingleFrameSkia. In the skia port
Image::isBitmapImage() returning true does not necessarily mean that
Image is of type BitmapImage.
Covered by fast/canvas/canvas-as-image.html and many other canvas
tests.
Patch originally by Tom Hudson.
* platform/graphics/BitmapImage.h:
(WebCore::BitmapImage::currentFrameHasAlpha):
(WebCore::BitmapImage::notSolidColor):
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
(WebCore::Image::currentFrameHasAlpha):
(WebCore::Image::notSolidColor):
* platform/graphics/skia/BitmapImageSingleFrameSkia.h:
(WebCore::BitmapImageSingleFrameSkia::currentFrameHasAlpha):
(WebCore::BitmapImageSingleFrameSkia::notSolidColor):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::backgroundIsObscured):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93440 => 93441)
--- trunk/Source/WebCore/ChangeLog 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/ChangeLog 2011-08-19 21:50:10 UTC (rev 93441)
@@ -1,3 +1,34 @@
+2011-08-19 James Robinson <jam...@chromium.org>
+
+ REGRESSION(r91628): 3 canvas tests crash on Chromium Linux and one test fail on Chromium Mac
+ https://bugs.webkit.org/show_bug.cgi?id=65063
+
+ Reviewed by Darin Fisher.
+
+ Fixes crashes due to a bad cast from Image to BitmapImage on skia ports
+ that use BitmapImageSingleFrameSkia. In the skia port
+ Image::isBitmapImage() returning true does not necessarily mean that
+ Image is of type BitmapImage.
+
+ Covered by fast/canvas/canvas-as-image.html and many other canvas
+ tests.
+
+ Patch originally by Tom Hudson.
+
+ * platform/graphics/BitmapImage.h:
+ (WebCore::BitmapImage::currentFrameHasAlpha):
+ (WebCore::BitmapImage::notSolidColor):
+ * platform/graphics/Image.cpp:
+ (WebCore::Image::drawTiled):
+ * platform/graphics/Image.h:
+ (WebCore::Image::currentFrameHasAlpha):
+ (WebCore::Image::notSolidColor):
+ * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+ (WebCore::BitmapImageSingleFrameSkia::currentFrameHasAlpha):
+ (WebCore::BitmapImageSingleFrameSkia::notSolidColor):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::backgroundIsObscured):
+
2011-08-19 Emil A Eklund <e...@chromium.org>
Switch clipping for svg to to new layout types
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (93440 => 93441)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.h 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h 2011-08-19 21:50:10 UTC (rev 93441)
@@ -159,10 +159,10 @@
virtual NativeImagePtr nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); }
bool frameHasAlphaAtIndex(size_t);
- bool currentFrameHasAlpha() { return frameHasAlphaAtIndex(currentFrame()); }
+ virtual bool currentFrameHasAlpha() { return frameHasAlphaAtIndex(currentFrame()); }
#if !ASSERT_DISABLED
- bool notSolidColor()
+ virtual bool notSolidColor()
{
return size().width() != 1 || size().height() != 1 || frameCount() > 1;
}
Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (93440 => 93441)
--- trunk/Source/WebCore/platform/graphics/Image.cpp 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp 2011-08-19 21:50:10 UTC (rev 93441)
@@ -115,7 +115,7 @@
// See <https://webkit.org/b/59043>.
#if !PLATFORM(WX)
- ASSERT(!isBitmapImage() || static_cast<BitmapImage*>(this)->notSolidColor());
+ ASSERT(!isBitmapImage() || notSolidColor());
#endif
FloatSize intrinsicTileSize = size();
Modified: trunk/Source/WebCore/platform/graphics/Image.h (93440 => 93441)
--- trunk/Source/WebCore/platform/graphics/Image.h 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/platform/graphics/Image.h 2011-08-19 21:50:10 UTC (rev 93441)
@@ -88,6 +88,7 @@
static bool supportsType(const String&);
virtual bool isBitmapImage() const { return false; }
+ virtual bool currentFrameHasAlpha() { return false; }
// Derived classes should override this if they can assure that
// the image contains only resources from its own security origin.
@@ -157,6 +158,10 @@
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+#if !ASSERT_DISABLED
+ virtual bool notSolidColor() { return true; }
+#endif
+
protected:
Image(ImageObserver* = 0);
Modified: trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h (93440 => 93441)
--- trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h 2011-08-19 21:50:10 UTC (rev 93441)
@@ -53,6 +53,8 @@
virtual bool isBitmapImage() const { return true; }
+ virtual bool currentFrameHasAlpha() { return !m_nativeImage.isOpaque(); }
+
virtual IntSize size() const
{
return IntSize(m_nativeImage.width(), m_nativeImage.height());
@@ -72,6 +74,13 @@
return &m_nativeImage;
}
+#if !ASSERT_DISABLED
+ virtual bool notSolidColor()
+ {
+ return m_nativeImage.width() != 1 || m_nativeImage.height() != 1;
+ }
+#endif
+
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (93440 => 93441)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2011-08-19 21:40:27 UTC (rev 93440)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2011-08-19 21:50:10 UTC (rev 93441)
@@ -408,13 +408,9 @@
// Check for bitmap image with alpha.
Image* image = m_imageResource->image().get();
- if (!image || !image->isBitmapImage())
+ if (!image || !image->isBitmapImage() || image->currentFrameHasAlpha())
return false;
- BitmapImage* bitmapImage = static_cast<BitmapImage*>(image);
- if (bitmapImage->currentFrameHasAlpha())
- return false;
-
return true;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes