2010-08-19 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Aug 2010 12:41:23 +0000 (12:41 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Aug 2010 12:41:23 +0000 (12:41 +0000)
commit54eff55397d8ca00b97900f767b6bc535fb031c3
treebb47235fd287dfa51afb44d309e024cad20dd159
parente0665038b834f4fd23160f8d4f94300915d8e0e7
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
92 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-leopard/svg/batik/paints/patternRegions-expected.checksum
LayoutTests/platform/mac-leopard/svg/batik/paints/patternRegions-expected.png
LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.checksum
LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.png
LayoutTests/platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/batik/text/textEffect3-expected.checksum
LayoutTests/platform/mac/svg/batik/text/textEffect3-expected.png
LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.checksum
LayoutTests/platform/mac/svg/custom/absolute-sized-content-with-resources-expected.png
LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.checksum
LayoutTests/platform/mac/svg/custom/grayscale-gradient-mask-expected.png
LayoutTests/platform/mac/svg/custom/js-late-gradient-and-object-creation-expected.checksum
LayoutTests/platform/mac/svg/custom/js-late-gradient-and-object-creation-expected.png
LayoutTests/platform/mac/svg/custom/js-late-gradient-creation-expected.checksum
LayoutTests/platform/mac/svg/custom/js-late-gradient-creation-expected.png
LayoutTests/platform/mac/svg/custom/js-late-pattern-and-object-creation-expected.checksum
LayoutTests/platform/mac/svg/custom/js-late-pattern-and-object-creation-expected.png
LayoutTests/platform/mac/svg/custom/js-late-pattern-creation-expected.checksum
LayoutTests/platform/mac/svg/custom/js-late-pattern-creation-expected.png
LayoutTests/platform/mac/svg/custom/non-scaling-stroke-expected.checksum
LayoutTests/platform/mac/svg/custom/non-scaling-stroke-expected.png
LayoutTests/platform/mac/svg/custom/pattern-incorrect-tiling-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-incorrect-tiling-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-incorrect-tiling-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-no-pixelation-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-no-pixelation-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-no-pixelation-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/custom/pattern-rotate-expected.checksum
LayoutTests/platform/mac/svg/custom/pattern-rotate-expected.png
LayoutTests/platform/mac/svg/custom/stroked-pattern-expected.checksum
LayoutTests/platform/mac/svg/custom/stroked-pattern-expected.png
LayoutTests/platform/mac/svg/custom/text-rotated-gradient-expected.checksum
LayoutTests/platform/mac/svg/custom/text-rotated-gradient-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGPatternElement-dom-patternContentUnits-attr-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGPatternElement-dom-patternContentUnits-attr-expected.png
LayoutTests/platform/mac/svg/dynamic-updates/SVGPatternElement-svgdom-patternContentUnits-prop-expected.checksum
LayoutTests/platform/mac/svg/dynamic-updates/SVGPatternElement-svgdom-patternContentUnits-prop-expected.png
LayoutTests/platform/mac/svg/text/selection-background-color-expected.checksum
LayoutTests/platform/mac/svg/text/selection-background-color-expected.png
LayoutTests/platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.checksum
LayoutTests/platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.png
LayoutTests/platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.checksum
LayoutTests/platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.png
LayoutTests/platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.checksum
LayoutTests/platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.png
LayoutTests/svg/batik/paints/patternRegions-positioned-objects.svg [new file with mode: 0644]
LayoutTests/svg/custom/pattern-incorrect-tiling.svg [new file with mode: 0644]
LayoutTests/svg/custom/pattern-no-pixelation.svg [new file with mode: 0644]
LayoutTests/svg/transforms/text-with-mask-with-svg-transform.svg [new file with mode: 0644]
LayoutTests/svg/transforms/text-with-pattern-inside-transformed-html.xhtml
WebCore/ChangeLog
WebCore/rendering/PaintInfo.h
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayer.h
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderLayerCompositor.cpp
WebCore/rendering/RenderSVGResourceGradient.cpp
WebCore/rendering/RenderSVGResourceMasker.cpp
WebCore/rendering/RenderSVGResourceMasker.h
WebCore/rendering/RenderSVGResourcePattern.cpp
WebCore/rendering/RenderSVGResourcePattern.h
WebCore/rendering/SVGImageBufferTools.cpp
WebCore/rendering/SVGImageBufferTools.h
WebCore/rendering/SVGRenderSupport.cpp
WebCore/rendering/SVGRenderSupport.h
WebCore/svg/SVGSVGElement.cpp