Commit 5b0c5989 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2009-11-30 Dirk Schulze <krit@webkit.org>

        Reviewed by Nikolas Zimmermann.

        Complex test of mask with every combination of maskUnits and maskContentUnits
        as well as different values for size and position of the mask and it's content.

        * platform/mac/svg/custom/mask-with-all-units-expected.checksum: Added.
        * platform/mac/svg/custom/mask-with-all-units-expected.png: Added.
        * platform/mac/svg/custom/mask-with-all-units-expected.txt: Added.
        * svg/custom/mask-with-all-units.svg: Added.
2009-11-30  Dirk Schulze  <krit@webkit.org>

        Reviewed by Nikolas Zimmermann.

        REGRESSION (r49757): masking-mask-01-b.svg rendered incorrectly
        [https://bugs.webkit.org/show_bug.cgi?id=31980]

        It turns out, that we did not handle maskUnits="userSpaceOnUse"
        correctly. We just need to move the context of the maskImage
        if maskContentUnits="objectBoundingBox". The context gets scaled
        on this unit combination, so we have to substract the position of
        the targetRect. On userSpaceOnUse the position just depends on the
        position of the mask element.
        I added a test with some senseless and reasonable values for size
        and postion of the mask and it's contents. I also used every
        combination of maskUnits and maskContentUnits to be sure, that it
        is fixed this time.

        Test: svg/custom/mask-with-all-units.svg

        * svg/SVGMaskElement.cpp:
        (WebCore::SVGMaskElement::drawMaskerContent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54abffc6
2009-11-30 Dirk Schulze <krit@webkit.org>
Reviewed by Nikolas Zimmermann.
Complex test of mask with every combination of maskUnits and maskContentUnits
as well as different values for size and position of the mask and it's content.
* platform/mac/svg/custom/mask-with-all-units-expected.checksum: Added.
* platform/mac/svg/custom/mask-with-all-units-expected.png: Added.
* platform/mac/svg/custom/mask-with-all-units-expected.txt: Added.
* svg/custom/mask-with-all-units.svg: Added.
2009-11-30 Csaba Osztrogonác <ossy@webkit.org>
 
[Qt] Put tests into skiplist because of missing features.
e6daa98bd6d12385f6de6d058112c256
\ No newline at end of file
KCanvasResource {id="mask1" [type=MASKER]}
KCanvasResource {id="mask2" [type=MASKER]}
KCanvasResource {id="mask3" [type=MASKER]}
KCanvasResource {id="mask4" [type=MASKER]}
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 250x250
RenderSVGRoot {svg} at (10,10) size 210x210
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGContainer {mask} at (60,60) size 50x50
RenderPath {rect} at (60,60) size 50x50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,60.00 L110.00,60.00 L110.00,110.00 L60.00,110.00 Z"]
RenderSVGContainer {mask} at (0.50,0.50) size 125x0.50
RenderPath {rect} at (0.50,0.50) size 125x0.50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M0.50,0.50 L125.50,0.50 L125.50,1.00 L0.50,1.00 Z"]
RenderSVGContainer {mask} at (60,170) size 50x50
RenderPath {rect} at (60,170) size 50x50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M60.00,170.00 L110.00,170.00 L110.00,220.00 L60.00,220.00 Z"]
RenderSVGContainer {mask} at (0.50,0.50) size 0.50x0.50
RenderPath {rect} at (0.50,0.50) size 0.50x0.50 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.50]}] [data="M0.50,0.50 L1.00,0.50 L1.00,1.00 L0.50,1.00 Z"]
RenderPath {rect} at (10,10) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,10.00 L110.00,10.00 L110.00,110.00 L10.00,110.00 Z"]
RenderPath {rect} at (120,10) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M120.00,10.00 L220.00,10.00 L220.00,110.00 L120.00,110.00 Z"]
RenderPath {rect} at (10,120) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,120.00 L110.00,120.00 L110.00,220.00 L10.00,220.00 Z"]
RenderPath {rect} at (120,120) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M120.00,120.00 L220.00,120.00 L220.00,220.00 L120.00,220.00 Z"]
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="250" height="250">
<!-- You should see 4 rects with the same size, filled with green and a fill opacity of 0.5 -->
<defs>
<mask id="mask1" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" x="10" y="10" width="100" height="100">
<rect x="60" y="60" width="20%" height="50" fill-opacity="0.5" fill="white"/>
</mask>
<mask id="mask2" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
<rect x="0.5" y="0.2%" width="50%" height="0.5" fill-opacity="0.5" fill="white"/>
</mask>
<mask id="mask3" maskUnits="objectBoundingBox" maskContentUnits="userSpaceOnUse" y="50%">
<rect x="24%" y="170" width="20%" height="50" fill-opacity="0.5" fill="white"/>
</mask>
<mask id="mask4" maskUnits="userSpaceOnUse" maskContentUnits="objectBoundingBox" x="120" y="120" width="100" height="100">
<rect x="0.5" y="0.2%" width="0.5" height="0.2%" fill-opacity="0.5" fill="white"/>
</mask>
</defs>
<rect x="10" y="10" width="100" height="100" fill="green" mask="url(#mask1)"/>
<rect x="120" y="10" width="100" height="100" fill="green" mask="url(#mask2)"/>
<rect x="10" y="120" width="100" height="100" fill="green" mask="url(#mask3)"/>
<rect x="120" y="120" width="100" height="100" fill="green" mask="url(#mask4)"/>
</svg>
2009-11-30 Dirk Schulze <krit@webkit.org>
Reviewed by Nikolas Zimmermann.
REGRESSION (r49757): masking-mask-01-b.svg rendered incorrectly
[https://bugs.webkit.org/show_bug.cgi?id=31980]
It turns out, that we did not handle maskUnits="userSpaceOnUse"
correctly. We just need to move the context of the maskImage
if maskContentUnits="objectBoundingBox". The context gets scaled
on this unit combination, so we have to substract the position of
the targetRect. On userSpaceOnUse the position just depends on the
position of the mask element.
I added a test with some senseless and reasonable values for size
and postion of the mask and it's contents. I also used every
combination of maskUnits and maskContentUnits to be sure, that it
is fixed this time.
Test: svg/custom/mask-with-all-units.svg
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::drawMaskerContent):
2009-11-30 Steve Block <steveblock@google.com>
 
Reviewed by Eric Seidel.
......@@ -2,6 +2,7 @@
Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
2005 Alexander Kellett <lypanov@kde.org>
2009 Dirk Schulze <krit@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -156,11 +157,14 @@ PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targe
return 0;
FloatPoint maskContextLocation = maskDestRect.location();
if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
maskDestRect.move(targetRect.x(), targetRect.y());
if (maskContentUnits() != SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
maskContextLocation.move(targetRect.x(), targetRect.y());
} else {
if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
maskContextLocation.move(-targetRect.x(), -targetRect.y());
}
GraphicsContext* maskImageContext = maskImage->context();
ASSERT(maskImageContext);
......
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