haikuwebkit/LayoutTests/svg/transforms/text-with-mask-with-svg-tra...

55 lines
3.7 KiB
XML
Raw Permalink Normal View History

2010-08-19 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. Pattern is rasterized https://bugs.webkit.org/show_bug.cgi?id=41396 SVG pattern size changed when resizing browser https://bugs.webkit.org/show_bug.cgi?id=38704 Incorrect pattern tilling https://bugs.webkit.org/show_bug.cgi?id=41603 Apply same fixes to <pattern> that <mask> recently received. Build the tile image in absolute coordinates, to avoid pixelation, when the target element is scaled. Also fixes problems when zooming into patterns. Clamp ImageBuffer sizes to RenderSVGRoots viewport, now that gradient/pattern and mask buffers are created in absolute coordinates -> no more huge image buffer allocations, that could fail. Drop overflow="visible" support for <pattern>, which complicates the code a lot. Neither Opera nor Firefox support this, and SVG 1.1 2nd Edition says that the rendering behaviour is "undefined". Tests: svg/batik/paints/patternRegions-positioned-objects.svg svg/custom/pattern-incorrect-tiling.svg svg/custom/pattern-no-pixelation.svg svg/transforms/text-with-mask-with-svg-transform.svg * rendering/PaintInfo.h: (WebCore::PaintInfo::applyTransform): Don't alter the repaint rect if it's infinite (only affects SVG). (WebCore::PaintInfo::infiniteRect): Moved from RenderLayer into PaintInfo, as applyTransform() needs it. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): s/ClipRects::infiniteRect/PaintInfo::infiniteRect/ * rendering/RenderLayer.h: Moved infiniteRect() to PaintInfo. * rendering/RenderLayerBacking.cpp: (WebCore::clipBox): s/ClipRects::infiniteRect/PaintInfo::infiniteRect/ * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::clippedByAncestor): Ditto. * rendering/RenderSVGResourceGradient.cpp: (WebCore::createMaskAndSwapContextForTextGradient): Clamp image buffer size, use new SVGImageBufferTools helper methods for that. (WebCore::clipToTextMask): Adapt to renames/code changes in SVGImageBufferTools. (WebCore::RenderSVGResourceGradient::applyResource): Ditto. * rendering/RenderSVGResourceMasker.cpp: (WebCore::RenderSVGResourceMasker::applyResource): lamp image buffer size, use new SVGImageBufferTools helper methods for that. (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): Adapt to renames/code changes in SVGImageBufferTools. * rendering/RenderSVGResourceMasker.h: * rendering/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::applyResource): Rewrite to create tile image buffers in absolute coordinates, avoids pixelation artefacts. (WebCore::calculatePatternBoundaries): (WebCore::RenderSVGResourcePattern::buildTileImageTransform): (WebCore::RenderSVGResourcePattern::createTileImage): * rendering/RenderSVGResourcePattern.h: * rendering/SVGImageBufferTools.cpp: (WebCore::SVGImageBufferTools::transformationToOutermostSVGCoordinateSystem): Helper method, concating all localToParentTransforms() up until RenderSVGRoot is reached. (WebCore::SVGImageBufferTools::createImageBuffer): Simplified. (WebCore::SVGImageBufferTools::clipToImageBuffer): Rename absoluteTargetRect to clampedAbsoluteTargetRect. (WebCore::SVGImageBufferTools::roundedImageBufferSize): New helper method to centralize FloatSize -> IntSize rounding, when creating image buffers. (WebCore::SVGImageBufferTools::clampedAbsoluteTargetRectForRenderer): New helper methods to clamp an image buffer rect against the viewport. * rendering/SVGImageBufferTools.h: * rendering/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::renderSubtreeToImage): Use PaintInfo::infiniteRect() as repaint rect, to avoid any culling. (WebCore::SVGRenderSupport::findTreeRootObject): Renamed from svgRootTreeObject, and expose it. (WebCore::SVGRenderSupport::layoutChildren): s/svgRootTreeObject/findTreeRootObject/. * rendering/SVGRenderSupport.h: * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::setCurrentTranslate): Be sure to relayout on invalidation, otherwhise resources are not updated, and we have to update them, as they depend on the absolute transform. 2010-08-19 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. Pattern is rasterized https://bugs.webkit.org/show_bug.cgi?id=41396 SVG pattern size changed when resizing browser https://bugs.webkit.org/show_bug.cgi?id=38704 Incorrect pattern tilling https://bugs.webkit.org/show_bug.cgi?id=41603 Update pattern results after fixing the pixelation issues. * platform/mac-leopard/svg/batik/paints/patternRegions-expected.checksum: * platform/mac-leopard/svg/batik/paints/patternRegions-expected.png: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.checksum: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.png: * platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.checksum: Added. * platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.png: Added. * platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.txt: Added. * platform/mac/svg/batik/text/textEffect3-expected.checksum: * platform/mac/svg/batik/text/textEffect3-expected.png: * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum: * platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png: * platform/mac/svg/custom/grayscale-gradient-mask-expected.checksum: * platform/mac/svg/custom/grayscale-gradient-mask-expected.png: * platform/mac/svg/custom/js-late-gradient-and-object-creation-expected.checksum: * platform/mac/svg/custom/js-late-gradient-and-object-creation-expected.png: * platform/mac/svg/custom/js-late-gradient-creation-expected.checksum: * platform/mac/svg/custom/js-late-gradient-creation-expected.png: * platform/mac/svg/custom/js-late-pattern-and-object-creation-expected.checksum: * platform/mac/svg/custom/js-late-pattern-and-object-creation-expected.png: * platform/mac/svg/custom/js-late-pattern-creation-expected.checksum: * platform/mac/svg/custom/js-late-pattern-creation-expected.png: * platform/mac/svg/custom/non-scaling-stroke-expected.checksum: * platform/mac/svg/custom/non-scaling-stroke-expected.png: * platform/mac/svg/custom/pattern-incorrect-tiling-expected.checksum: Added. * platform/mac/svg/custom/pattern-incorrect-tiling-expected.png: Added. * platform/mac/svg/custom/pattern-incorrect-tiling-expected.txt: Added. * platform/mac/svg/custom/pattern-no-pixelation-expected.checksum: Added. * platform/mac/svg/custom/pattern-no-pixelation-expected.png: Added. * platform/mac/svg/custom/pattern-no-pixelation-expected.txt: Added. * platform/mac/svg/custom/pattern-rotate-expected.checksum: * platform/mac/svg/custom/pattern-rotate-expected.png: * platform/mac/svg/custom/stroked-pattern-expected.checksum: * platform/mac/svg/custom/stroked-pattern-expected.png: * platform/mac/svg/custom/text-rotated-gradient-expected.checksum: * platform/mac/svg/custom/text-rotated-gradient-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png: * platform/mac/svg/dynamic-updates/SVGPatternElement-dom-patternContentUnits-attr-expected.checksum: * platform/mac/svg/dynamic-updates/SVGPatternElement-dom-patternContentUnits-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGPatternElement-svgdom-patternContentUnits-prop-expected.checksum: * platform/mac/svg/dynamic-updates/SVGPatternElement-svgdom-patternContentUnits-prop-expected.png: * platform/mac/svg/text/selection-background-color-expected.checksum: * platform/mac/svg/text/selection-background-color-expected.png: * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.checksum: Added. * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.png: Added. * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.txt: Added. * platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.checksum: * platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.png: * platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.checksum: * platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.png: * platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.checksum: * platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.png: * svg/batik/paints/patternRegions-positioned-objects.svg: Added. * svg/custom/pattern-incorrect-tiling.svg: Added. * svg/custom/pattern-no-pixelation.svg: Added. * svg/transforms/text-with-mask-with-svg-transform.svg: Added. * svg/transforms/text-with-pattern-inside-transformed-html.xhtml: Canonical link: https://commits.webkit.org/56445@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-08-19 12:41:23 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" baseProfile="basic" width="100%" height="100%" viewBox="0 0 480 360">
<g id="test-body-content" transform="translate(50 50) scale(.5) rotate(30)">
<defs>
<font horiz-adv-x="313">
<!-- Converted from Larabie Anglepoise by Batik ttf2svg -->
<font-face font-family="larabie-anglepoise" units-per-em="1000" panose-1="0 0 4 0 0 0 0 0 0 0" ascent="703" descent="-300" alphabetic="0"/>
<missing-glyph horiz-adv-x="500" d="M63 0V700H438V0H63ZM125 63H375V638H125V63Z"/>
<glyph unicode="S" glyph-name="S" horiz-adv-x="385" d="M371 1H29V144H264Q264 151 264 166Q265 180 265 188Q265 212 249 212H132Q83 212 55 247Q29 279 29 329V566H335V422H136V375Q136 360 144 356Q148 355 168 355H279Q327 355 352 309Q371 273 371 221V1Z"/>
<glyph unicode="V" glyph-name="V" horiz-adv-x="351" d="M365 563L183 -33L0 563H101L183 296L270 563H365Z"/>
<glyph unicode="G" glyph-name="G" horiz-adv-x="367" d="M355 1H18V564H355V420H125V144H248V211H156V355H355V1Z"/>
<hkern g1="V" g2="G" k="-40"/>
</font>
</defs>
<text font-family="Arial" font-size="14" x="10" y="20">Test for mask support</text>
<!-- Draw a red rectangle in the background -->
<rect x="10" y="30" width="100" height="260" fill="red"/>
<!-- Apply a gradient ramp based opacity -->
<mask id="mask1" maskUnits="userSpaceOnUse" x="60" y="50" width="100" height="60">
<defs>
<linearGradient gradientUnits="userSpaceOnUse" id="Grad1" x1="60" y1="50" x2="60" y2="120">
<stop stop-color="white" stop-opacity="1" offset="0"/>
<stop stop-color="white" stop-opacity="0.5" offset="1"/>
</linearGradient>
</defs>
<rect x="60" y="50" width="100" height="60" fill="url(#Grad1)"/>
</mask>
<rect x="60" y="50" width="100" height="60" fill="lime" mask="url(#mask1)"/>
<text font-family="Arial" font-size="12" x="200" y="65">Mask with linear gradient from</text>
<text font-family="Arial" font-size="12" x="200" y="80">opacity=1 to opactity=0.5</text>
<!-- Simulate a uniform opacity using a mask -->
<mask id="mask2" maskUnits="userSpaceOnUse" x="60" y="120" width="100" height="30">
<rect x="60" y="120" width="100" height="30" fill-opacity="0.5" fill="white"/>
</mask>
<rect x="60" y="120" width="100" height="30" fill="lime" mask="url(#mask2)"/>
<text font-family="Arial" font-size="12" x="200" y="135">Mask with uniform opacity of 0.5</text>
<!-- Apply a uniform opacity -->
<rect x="60" y="160" width="100" height="30" fill="lime" fill-opacity="0.5"/>
<text font-family="Arial" font-size="12" x="200" y="175">Rectangle with uniform opacity of 0.5</text>
<!-- Apply a mask to text -->
<mask id="mask3" maskUnits="userSpaceOnUse" x="60" y="200" width="200" height="100">
<rect x="60" y="200" width="200" height="25" fill="white" fill-opacity="0.5"/>
<rect x="60" y="225" width="200" height="25" fill="white" fill-opacity="0.2"/>
<rect x="60" y="250" width="200" height="25" fill="white" fill-opacity="1"/>
<rect x="60" y="275" width="200" height="25" fill="white" fill-opacity="0.7"/>
</mask>
<text x="60" y="280" font-family="larabie-anglepoise" font-size="110" fill="lime" mask="url(#mask3)">SVG</text>
<text font-family="Arial" font-size="12" x="200" y="225">Text with mask containing rectangles</text>
<text font-family="Arial" font-size="12" x="200" y="240">of various opacities</text>
<text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.7 $</text>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</g>
</svg>