Commit ad448306 authored by krit@webkit.org's avatar krit@webkit.org
Browse files

2010-03-12 Dirk Schulze <krit@webkit.org>

        Reviewed by Nikolas Zimmermann.

        SVG fallback color doesn't work for bogus gradients.
        https://bugs.webkit.org/show_bug.cgi?id=35479

        Use a given fallback color on ignored gradients if present. Gradients
        must be ignored, if one dimension of the objects boundingBox is zero.

        Test: svg/custom/gradient-with-1d-boundingbox.svg

        * svg/graphics/SVGPaintServer.cpp:
        (WebCore::SVGPaintServer::strokePaintServer):
        * svg/graphics/SVGPaintServerGradient.cpp:
        (WebCore::SVGPaintServerGradient::setup):
2010-03-12  Dirk Schulze  <krit@webkit.org>

        Reviewed by Nikolas Zimmermann.

        SVG fallback color doesn't work for bogus gradients.
        https://bugs.webkit.org/show_bug.cgi?id=35479

        We now use a fallback color on ignored gradients for one dimensional objects,
        either a given fallback color or black as default.
        This causes a change of one LayoutTest, because it was done manually in the
        gradient PaintServer, without respecting a given fallback color.

        * platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt:
        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum: Added.
        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png: Added.
        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.txt: Added.
        * svg/custom/gradient-with-1d-boundingbox.svg: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 37aceac7
2010-03-12 Dirk Schulze <krit@webkit.org>
Reviewed by Nikolas Zimmermann.
SVG fallback color doesn't work for bogus gradients.
https://bugs.webkit.org/show_bug.cgi?id=35479
We now use a fallback color on ignored gradients for one dimensional objects,
either a given fallback color or black as default.
This causes a change of one LayoutTest, because it was done manually in the
gradient PaintServer, without respecting a given fallback color.
* platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt:
* platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum: Added.
* platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png: Added.
* platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.txt: Added.
* svg/custom/gradient-with-1d-boundingbox.svg: Added.
2010-03-12 Dmitry Titov <dimich@chromium.org>
Not reviewed, build fix.
......
......@@ -10,9 +10,9 @@ layer at (0,0) size 480x360
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGContainer {g} at (49,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(50.00,100.00)}]
RenderPath {rect} at (49,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [data="M0.00,-60.00 L480.00,-60.00 L480.00,420.00 L0.00,420.00 Z"]
RenderPath {line} at (50,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#FFFFFF)]] [start=(0,0)] [end=(1,0)] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#FFFFFF)]] [start=(0,0)] [end=(1,0)] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#FFFFFF)]] [start=(0,0)] [end=(1,0)] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (50,151) size 144x6 [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,180.00 L480.00,180.00"]
RenderPath {line} at (68,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#FFFFFF)]] [start=(0,0)] [end=(1,0)] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M410.00,10.00 L70.00,350.00"]
RenderSVGText {text} at (84,250) size 72x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-14) size 72x18
......
b9f116b4a960c013825104fa2c8b2e78
\ No newline at end of file
KRenderingPaintServer {id="gradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#FF0000), (1.00,#008000)]] [start=(0,0)] [end=(1,0)]}
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (0,0) size 800x600
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderPath {line} at (0,40) size 200x20 [stroke={[type=SOLID] [color=#00FF00] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,50.00 L200.00,50.00"]
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Gradients can't applied on objects with a boundingBox, where either width or height is zero.
This test checks if we use a given alternative Color. -->
<defs>
<linearGradient id="gradient">
<stop offset="0" stop-color="red"/>
<stop offset="1" stop-color="green"/>
</linearGradient>
</defs>
<line x1="0" x2="200" y1="50" y2="50" stroke="url(#gradient) #0f0" stroke-width="20"/>
</svg>
2010-03-12 Dirk Schulze <krit@webkit.org>
Reviewed by Nikolas Zimmermann.
SVG fallback color doesn't work for bogus gradients.
https://bugs.webkit.org/show_bug.cgi?id=35479
Use a given fallback color on ignored gradients if present. Gradients
must be ignored, if one dimension of the objects boundingBox is zero.
Test: svg/custom/gradient-with-1d-boundingbox.svg
* svg/graphics/SVGPaintServer.cpp:
(WebCore::SVGPaintServer::strokePaintServer):
* svg/graphics/SVGPaintServerGradient.cpp:
(WebCore::SVGPaintServerGradient::setup):
2010-03-12 David Hyatt <hyatt@apple.com>
 
Reviewed by Dan Bernstein.
......
......@@ -123,8 +123,10 @@ SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, cons
SVGPaintServer* strokePaintServer = 0;
SVGPaint::SVGPaintType paintType = stroke->paintType();
if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
if ((paintType == SVGPaint::SVG_PAINTTYPE_URI
|| paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)
&& item->objectBoundingBox().width() != 0
&& item->objectBoundingBox().height() != 0) {
AtomicString id(SVGURIReference::getTarget(stroke->uri()));
strokePaintServer = getPaintServerById(item->document(), id, item);
......@@ -147,6 +149,11 @@ SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, cons
if (!strokePaintServerSolid->color().isValid())
strokePaintServer = 0;
}
if (!strokePaintServer) {
// default value (black), see bug 11017
strokePaintServer = sharedSolidPaintServer();
static_cast<SVGPaintServerSolid*>(strokePaintServer)->setColor(Color::black);
}
return strokePaintServer;
}
......
......@@ -223,13 +223,6 @@ bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject
if (boundingBoxMode()) {
#endif
FloatRect bbox = object->objectBoundingBox();
// Don't use gradients for 1d objects like horizontal/vertical
// lines or rectangles without width or height.
if (bbox.width() == 0 || bbox.height() == 0) {
Color color(0, 0, 0);
context->setStrokeColor(color, style->colorSpace());
return true;
}
matrix.translate(bbox.x(), bbox.y());
matrix.scaleNonUniform(bbox.width(), bbox.height());
}
......
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