haikuwebkit/LayoutTests/svg/custom/mask-with-all-units.svg

23 lines
1.3 KiB
XML
Raw Permalink Normal View History

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): Canonical link: https://commits.webkit.org/42924@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-11-30 17:25:00 +00:00
<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>