Commit e09f5ef7 authored by hclam@chromium.org's avatar hclam@chromium.org

[skia] Handle mask box image.

https://bugs.webkit.org/show_bug.cgi?id=100570

Reviewed by James Robinson.

Source/WebCore:

When drawing an image with source rectangle it should intersect with image rectangle.
This should be the case for drawing single image and tiling an image.

Test: fast/images/mask-box-image-crash.html

* platform/graphics/skia/ImageSkia.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImageSingleFrameSkia::draw):

LayoutTests:

Added a test for -webkit-mask-box-image. Test should complete without crashes.
Output image should be blank.

* fast/images/mask-box-image-crash-expected.png: Added.
* fast/images/mask-box-image-crash-expected.txt: Added.
* fast/images/mask-box-image-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d6763783
2012-10-29 Alpha Lam <hclam@chromium.org>
[skia] Handle mask box image.
https://bugs.webkit.org/show_bug.cgi?id=100570
Reviewed by James Robinson.
Added a test for -webkit-mask-box-image. Test should complete without crashes.
Output image should be blank.
* fast/images/mask-box-image-crash-expected.png: Added.
* fast/images/mask-box-image-crash-expected.txt: Added.
* fast/images/mask-box-image-crash.html: Added.
2012-10-29 David Barton <dbarton@mathscribe.com>
Unreviewed gardening. LayoutTests/mathml/msubsup-fuzz.html passes locally but not on
<script>
if (window.testRunner)
testRunner.dumpAsText(true);
</script>
<fieldset style="-webkit-margin-end: 99999;
-webkit-mask-box-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE\
IAAABCAQAAAADLLz1FAAAACXZwQWcAAABCAAAAQgCVDTvpAAAAFElEQVQoz2P4DwUHGEZZo6xBwQI\
ANWY/j0PofaAAAAAASUVORK5CYII=') 10000% 10000 9999999999%;">
</fieldset>
<div style="position: absolute;
top: 0px;
left: 0px;
width: 100px;
height: 100px;
z-index: 1;
background-color: white;"></div>
2012-10-29 Alpha Lam <hclam@chromium.org>
[skia] Handle mask box image.
https://bugs.webkit.org/show_bug.cgi?id=100570
Reviewed by James Robinson.
When drawing an image with source rectangle it should intersect with image rectangle.
This should be the case for drawing single image and tiling an image.
Test: fast/images/mask-box-image-crash.html
* platform/graphics/skia/ImageSkia.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImageSingleFrameSkia::draw):
2012-10-29 Eric Carlson <eric.carlson@apple.com>
Support captions when PLUGIN_PROXY_FOR_VIDEO
......@@ -472,14 +472,15 @@ void Image::drawPattern(GraphicsContext* context,
#if PLATFORM(CHROMIUM)
TRACE_EVENT0("skia", "Image::drawPattern");
#endif
FloatRect normSrcRect = normalizeRect(floatSrcRect);
if (destRect.isEmpty() || normSrcRect.isEmpty())
return; // nothing to draw
NativeImageSkia* bitmap = nativeImageForCurrentFrame();
if (!bitmap)
return;
FloatRect normSrcRect = normalizeRect(floatSrcRect);
normSrcRect.intersect(FloatRect(0, 0, bitmap->bitmap().width(), bitmap->bitmap().height()));
if (destRect.isEmpty() || normSrcRect.isEmpty())
return; // nothing to draw
SkMatrix ctm = context->platformContext()->canvas()->getTotalMatrix();
SkMatrix totalMatrix;
totalMatrix.setConcat(ctm, patternTransform);
......@@ -605,6 +606,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
FloatRect normDstRect = normalizeRect(dstRect);
FloatRect normSrcRect = normalizeRect(srcRect);
normSrcRect.intersect(FloatRect(0, 0, bm->bitmap().width(), bm->bitmap().height()));
if (normSrcRect.isEmpty() || normDstRect.isEmpty())
return; // Nothing to draw.
......@@ -650,6 +652,7 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,
{
FloatRect normDstRect = normalizeRect(dstRect);
FloatRect normSrcRect = normalizeRect(srcRect);
normSrcRect.intersect(FloatRect(0, 0, m_nativeImage.bitmap().width(), m_nativeImage.bitmap().height()));
if (normSrcRect.isEmpty() || normDstRect.isEmpty())
return; // Nothing to draw.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment