LayoutTests/ChangeLog

 12010-07-14 Alex Nicolaou <anicolao@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Bug https://bugs.webkit.org/show_bug.cgi?id=42273
 6
 7 Fixed by clamping colour channel values to the alpha value so that
 8 r <= a, g <= a, and b <= a after the convolution is applied. See
 9 the bug for why I believe the SVG specification needs to be updated.
 10
 11 * platform/mac/svg/custom/sigfpe-expected.checksum: Added.
 12 * platform/mac/svg/custom/sigfpe-expected.png: Added.
 13 * platform/mac/svg/custom/sigfpe-expected.txt: Added.
 14 * svg/custom/sigfpe.svg: Added.
 15
1162010-07-13 Maciej Stachowiak <mjs@apple.com>
217
318 Reviewed by Oliver Hunt.

LayoutTests/platform/mac/svg/custom/sigfpe-expected.checksum

 1cb2e5300e5e7a04006f1140d5c8fa907
02\ No newline at end of file

LayoutTests/platform/mac/svg/custom/sigfpe-expected.png


Added

INVALID: Image lacks a checksum. This will fail with a MISSING error in run-webkit-tests. Always generate new png files using run-webkit-tests.

LayoutTests/platform/mac/svg/custom/sigfpe-expected.txt

 1layer at (0,0) size 800x600
 2 RenderView at (0,0) size 800x600
 3layer at (0,0) size 800x600
 4 RenderSVGRoot {svg} at (0,0) size 30x30
 5 RenderSVGHiddenContainer {defs} at (0,0) size 0x0
 6 RenderSVGResourceFilter {filter} [id="foo"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
 7 [feConvolveMatrix order="width=3 height=3" kernelMatrix="[0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, -1.00]" divisor="1.00" bias="0.00" target="(1,1)" edgeMode="DUPLICATE" kernelUnitLength="(0,0)" preserveAlpha="0"]
 8 [SourceGraphic]
 9 RenderSVGImage {image} at (0,0) size 3x4
 10 [filter="foo"] RenderSVGResourceFilter {filter} at (-0.20,-0.30) size 2.40x3.60
 11 RenderPath {rect} at (10,10) size 20x20 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,10.00 L30.00,10.00 L30.00,30.00 L10.00,30.00 Z"]

LayoutTests/svg/custom/sigfpe.svg

 1<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 2<defs> <filter id="foo"> <feConvolveMatrix kernelMatrix="0 0 0 0 1 0 0 0 -1"/> </filter> </defs>
 3<image width="2" height="3" xlink:href="bar" filter="url(#foo)" />
 4<!-- if we can draw the rectangle without crashing we passed -->
 5<rect x="10" y="10" width="20" height="20" fill="green"/>
 6</svg>

WebCore/ChangeLog

 12010-07-14 Alex Nicolaou <anicolao@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Bug https://bugs.webkit.org/show_bug.cgi?id=42273
 6
 7 Fixed by clamping colour channel values to the alpha value so that
 8 r <= a, g <= a, and b <= a after the convolution is applied. See
 9 the bug for why I believe the SVG specification needs to be updated.
 10
 11 * svg/graphics/filters/SVGFEConvolveMatrix.cpp:
 12 (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
 13 (WebCore::FEConvolveMatrix::fastSetOuterPixels):
 14
1152010-07-13 Sheriff Bot <webkit.review.bot@gmail.com>
216
317 Unreviewed, rolling out r63162.

WebCore/platform/graphics/skia/SkiaUtils.cpp

@@static U8CPU InvScaleByte(U8CPU component, uint32_t scale)
8282
8383SkColor SkPMColorToColor(SkPMColor pm)
8484{
85  if (0 == pm)
 85 if (!pm)
8686 return 0;
87 
8887 unsigned a = SkGetPackedA32(pm);
 88 if (!a) {
 89 SkASSERT(false); // invalid colour channels; r,g,b should be 0 if a=0
 90 // protect against sigfpe for production
 91 return 0;
 92 }
 93
8994 uint32_t scale = (255 << 16) / a;
9095
9196 return SkColorSetARGB(a,

WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp

3131#include "ImageData.h"
3232#include "SVGRenderTreeAsText.h"
3333
 34#include <math.h>
 35
3436namespace WebCore {
3537
3638FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,

@@ALWAYS_INLINE void FEConvolveMatrix::fastSetInteriorPixels(PaintingData& paintin
244246 }
245247 }
246248
247  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[0] / m_divisor + paintingData.bias));
248  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[1] / m_divisor + paintingData.bias));
249  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[2] / m_divisor + paintingData.bias));
250  if (!preserveAlphaValues)
251  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[3] / m_divisor + paintingData.bias));
252  else {
 249 if (!preserveAlphaValues) {
 250 unsigned char alpha = clampRGBAValue(totals[3] / m_divisor + paintingData.bias);
 251 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[0] / m_divisor + paintingData.bias), alpha));
 252 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[1] / m_divisor + paintingData.bias), alpha));
 253 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[2] / m_divisor + paintingData.bias), alpha));
 254 paintingData.dstPixelArray->set(pixel++, alpha);
 255 } else {
 256 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[0] / m_divisor + paintingData.bias));
 257 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[1] / m_divisor + paintingData.bias));
 258 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[2] / m_divisor + paintingData.bias));
253259 paintingData.dstPixelArray->set(pixel, paintingData.srcPixelArray->get(pixel));
254260 ++pixel;
255261 }

@@void FEConvolveMatrix::fastSetOuterPixels(PaintingData& paintingData, int x1, in
337343 }
338344 }
339345
340  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[0] / m_divisor + paintingData.bias));
341  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[1] / m_divisor + paintingData.bias));
342  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[2] / m_divisor + paintingData.bias));
343  if (!preserveAlphaValues)
344  paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[3] / m_divisor + paintingData.bias));
345  else {
 346 if (!preserveAlphaValues) {
 347 unsigned char alpha = clampRGBAValue(totals[3] / m_divisor + paintingData.bias);
 348 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[0] / m_divisor + paintingData.bias), alpha));
 349 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[1] / m_divisor + paintingData.bias), alpha));
 350 paintingData.dstPixelArray->set(pixel++, std::min(clampRGBAValue(totals[2] / m_divisor + paintingData.bias), alpha));
 351 paintingData.dstPixelArray->set(pixel++, alpha);
 352 } else {
 353 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[0] / m_divisor + paintingData.bias));
 354 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[1] / m_divisor + paintingData.bias));
 355 paintingData.dstPixelArray->set(pixel++, clampRGBAValue(totals[2] / m_divisor + paintingData.bias));
346356 paintingData.dstPixelArray->set(pixel, paintingData.srcPixelArray->get(pixel));
347357 ++pixel;
348358 }