Changeset 55930 in webkit


Ignore:
Timestamp:
Mar 12, 2010 12:43:59 PM (14 years ago)
Author:
krit@webkit.org
Message:

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.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55926 r55930  
     12010-03-12  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG fallback color doesn't work for bogus gradients.
     6        https://bugs.webkit.org/show_bug.cgi?id=35479
     7
     8        We now use a fallback color on ignored gradients for one dimensional objects,
     9        either a given fallback color or black as default.
     10        This causes a change of one LayoutTest, because it was done manually in the
     11        gradient PaintServer, without respecting a given fallback color.
     12
     13        * platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt:
     14        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum: Added.
     15        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png: Added.
     16        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.txt: Added.
     17        * svg/custom/gradient-with-1d-boundingbox.svg: Added.
     18
    1192010-03-12  Dmitry Titov  <dimich@chromium.org>
    220
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt

    r54483 r55930  
    1111      RenderSVGContainer {g} at (49,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(50.00,100.00)}]
    1212        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"]
    13         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"]
    14         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"]
    15         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"]
     13        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"]
     14        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"]
     15        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"]
    1616        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"]
    1717      RenderSVGText {text} at (84,250) size 72x18 contains 1 chunk(s)
  • trunk/WebCore/ChangeLog

    r55928 r55930  
     12010-03-12  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG fallback color doesn't work for bogus gradients.
     6        https://bugs.webkit.org/show_bug.cgi?id=35479
     7
     8        Use a given fallback color on ignored gradients if present. Gradients
     9        must be ignored, if one dimension of the objects boundingBox is zero.
     10
     11        Test: svg/custom/gradient-with-1d-boundingbox.svg
     12
     13        * svg/graphics/SVGPaintServer.cpp:
     14        (WebCore::SVGPaintServer::strokePaintServer):
     15        * svg/graphics/SVGPaintServerGradient.cpp:
     16        (WebCore::SVGPaintServerGradient::setup):
     17
    1182010-03-12  David Hyatt  <hyatt@apple.com>
    219
  • trunk/WebCore/svg/graphics/SVGPaintServer.cpp

    r54556 r55930  
    124124    SVGPaintServer* strokePaintServer = 0;
    125125    SVGPaint::SVGPaintType paintType = stroke->paintType();
    126     if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
    127         paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
     126    if ((paintType == SVGPaint::SVG_PAINTTYPE_URI
     127        || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)
     128        && item->objectBoundingBox().width() != 0
     129        && item->objectBoundingBox().height() != 0) {
    128130        AtomicString id(SVGURIReference::getTarget(stroke->uri()));
    129131        strokePaintServer = getPaintServerById(item->document(), id, item);
     
    148150            strokePaintServer = 0;
    149151    }
     152    if (!strokePaintServer) {
     153        // default value (black), see bug 11017
     154        strokePaintServer = sharedSolidPaintServer();
     155        static_cast<SVGPaintServerSolid*>(strokePaintServer)->setColor(Color::black);
     156    }
    150157
    151158    return strokePaintServer;
  • trunk/WebCore/svg/graphics/SVGPaintServerGradient.cpp

    r55260 r55930  
    224224#endif
    225225        FloatRect bbox = object->objectBoundingBox();
    226         // Don't use gradients for 1d objects like horizontal/vertical
    227         // lines or rectangles without width or height.
    228         if (bbox.width() == 0 || bbox.height() == 0) {
    229             Color color(0, 0, 0);
    230             context->setStrokeColor(color, style->colorSpace());
    231             return true;
    232         }
    233226        matrix.translate(bbox.x(), bbox.y());
    234227        matrix.scaleNonUniform(bbox.width(), bbox.height());
Note: See TracChangeset for help on using the changeset viewer.