summaryrefslogtreecommitdiffstats
path: root/WebCore/svg
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg')
-rw-r--r--WebCore/svg/ColorDistance.cpp34
-rw-r--r--WebCore/svg/ColorDistance.h34
-rw-r--r--WebCore/svg/ElementTimeControl.h2
-rw-r--r--WebCore/svg/ElementTimeControl.idl2
-rw-r--r--WebCore/svg/GradientAttributes.h127
-rw-r--r--WebCore/svg/LinearGradientAttributes.h37
-rw-r--r--WebCore/svg/PatternAttributes.h215
-rw-r--r--WebCore/svg/RadialGradientAttributes.h37
-rw-r--r--WebCore/svg/SVGAElement.cpp50
-rw-r--r--WebCore/svg/SVGAElement.h40
-rw-r--r--WebCore/svg/SVGAElement.idl6
-rw-r--r--WebCore/svg/SVGAllInOne.cpp16
-rw-r--r--WebCore/svg/SVGAltGlyphElement.cpp38
-rw-r--r--WebCore/svg/SVGAltGlyphElement.h40
-rw-r--r--WebCore/svg/SVGAltGlyphElement.idl6
-rw-r--r--WebCore/svg/SVGAngle.cpp36
-rw-r--r--WebCore/svg/SVGAngle.h37
-rw-r--r--WebCore/svg/SVGAngle.idl40
-rw-r--r--WebCore/svg/SVGAnimateColorElement.cpp38
-rw-r--r--WebCore/svg/SVGAnimateColorElement.h38
-rw-r--r--WebCore/svg/SVGAnimateColorElement.idl6
-rw-r--r--WebCore/svg/SVGAnimateElement.cpp131
-rw-r--r--WebCore/svg/SVGAnimateElement.h53
-rw-r--r--WebCore/svg/SVGAnimateElement.idl6
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.cpp71
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.h38
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.cpp81
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.h42
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.idl6
-rw-r--r--WebCore/svg/SVGAnimatedAngle.idl6
-rw-r--r--WebCore/svg/SVGAnimatedBoolean.idl6
-rw-r--r--WebCore/svg/SVGAnimatedEnumeration.idl6
-rw-r--r--WebCore/svg/SVGAnimatedInteger.idl6
-rw-r--r--WebCore/svg/SVGAnimatedLength.idl6
-rw-r--r--WebCore/svg/SVGAnimatedLengthList.idl6
-rw-r--r--WebCore/svg/SVGAnimatedNumber.idl6
-rw-r--r--WebCore/svg/SVGAnimatedNumberList.idl6
-rw-r--r--WebCore/svg/SVGAnimatedPathData.cpp36
-rw-r--r--WebCore/svg/SVGAnimatedPathData.h36
-rw-r--r--WebCore/svg/SVGAnimatedPathData.idl6
-rw-r--r--WebCore/svg/SVGAnimatedPoints.cpp36
-rw-r--r--WebCore/svg/SVGAnimatedPoints.h36
-rw-r--r--WebCore/svg/SVGAnimatedPoints.idl6
-rw-r--r--WebCore/svg/SVGAnimatedPreserveAspectRatio.idl6
-rw-r--r--WebCore/svg/SVGAnimatedProperty.h44
-rw-r--r--WebCore/svg/SVGAnimatedPropertySynchronizer.h34
-rw-r--r--WebCore/svg/SVGAnimatedPropertyTraits.h36
-rw-r--r--WebCore/svg/SVGAnimatedRect.idl6
-rw-r--r--WebCore/svg/SVGAnimatedString.idl10
-rw-r--r--WebCore/svg/SVGAnimatedTemplate.h38
-rw-r--r--WebCore/svg/SVGAnimatedTransformList.idl6
-rw-r--r--WebCore/svg/SVGAnimationElement.cpp166
-rw-r--r--WebCore/svg/SVGAnimationElement.h44
-rw-r--r--WebCore/svg/SVGAnimationElement.idl6
-rw-r--r--WebCore/svg/SVGCircleElement.cpp80
-rw-r--r--WebCore/svg/SVGCircleElement.h43
-rw-r--r--WebCore/svg/SVGCircleElement.idl6
-rw-r--r--WebCore/svg/SVGClipPathElement.cpp84
-rw-r--r--WebCore/svg/SVGClipPathElement.h81
-rw-r--r--WebCore/svg/SVGClipPathElement.idl6
-rw-r--r--WebCore/svg/SVGColor.cpp39
-rw-r--r--WebCore/svg/SVGColor.h36
-rw-r--r--WebCore/svg/SVGColor.idl52
-rw-r--r--WebCore/svg/SVGComponentTransferFunctionElement.cpp40
-rw-r--r--WebCore/svg/SVGComponentTransferFunctionElement.h38
-rw-r--r--WebCore/svg/SVGComponentTransferFunctionElement.idl11
-rw-r--r--WebCore/svg/SVGCursorElement.cpp39
-rw-r--r--WebCore/svg/SVGCursorElement.h38
-rw-r--r--WebCore/svg/SVGCursorElement.idl6
-rw-r--r--WebCore/svg/SVGDefsElement.cpp36
-rw-r--r--WebCore/svg/SVGDefsElement.h36
-rw-r--r--WebCore/svg/SVGDefsElement.idl6
-rw-r--r--WebCore/svg/SVGDescElement.cpp36
-rw-r--r--WebCore/svg/SVGDescElement.h36
-rw-r--r--WebCore/svg/SVGDescElement.idl6
-rw-r--r--WebCore/svg/SVGDocument.cpp40
-rw-r--r--WebCore/svg/SVGDocument.h42
-rw-r--r--WebCore/svg/SVGDocument.idl44
-rw-r--r--WebCore/svg/SVGDocumentExtensions.cpp110
-rw-r--r--WebCore/svg/SVGDocumentExtensions.h66
-rw-r--r--WebCore/svg/SVGElement.cpp111
-rw-r--r--WebCore/svg/SVGElement.h48
-rw-r--r--WebCore/svg/SVGElement.idl46
-rw-r--r--WebCore/svg/SVGElementInstance.cpp54
-rw-r--r--WebCore/svg/SVGElementInstance.h34
-rw-r--r--WebCore/svg/SVGElementInstance.idl19
-rw-r--r--WebCore/svg/SVGElementInstanceList.cpp34
-rw-r--r--WebCore/svg/SVGElementInstanceList.h34
-rw-r--r--WebCore/svg/SVGElementInstanceList.idl4
-rw-r--r--WebCore/svg/SVGElementRareData.h1
-rw-r--r--WebCore/svg/SVGEllipseElement.cpp83
-rw-r--r--WebCore/svg/SVGEllipseElement.h43
-rw-r--r--WebCore/svg/SVGEllipseElement.idl6
-rw-r--r--WebCore/svg/SVGException.h1
-rw-r--r--WebCore/svg/SVGException.idl3
-rw-r--r--WebCore/svg/SVGExternalResourcesRequired.cpp39
-rw-r--r--WebCore/svg/SVGExternalResourcesRequired.h40
-rw-r--r--WebCore/svg/SVGExternalResourcesRequired.idl6
-rw-r--r--WebCore/svg/SVGFEBlendElement.cpp54
-rw-r--r--WebCore/svg/SVGFEBlendElement.h64
-rw-r--r--WebCore/svg/SVGFEBlendElement.idl13
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.cpp91
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.h60
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.idl13
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.cpp55
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.h56
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.idl6
-rw-r--r--WebCore/svg/SVGFECompositeElement.cpp54
-rw-r--r--WebCore/svg/SVGFECompositeElement.h72
-rw-r--r--WebCore/svg/SVGFECompositeElement.idl13
-rw-r--r--WebCore/svg/SVGFEConvolveMatrixElement.cpp161
-rw-r--r--WebCore/svg/SVGFEConvolveMatrixElement.h59
-rw-r--r--WebCore/svg/SVGFEConvolveMatrixElement.idl54
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.cpp62
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.h75
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.idl6
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.cpp52
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.h68
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.idl13
-rw-r--r--WebCore/svg/SVGFEDistantLightElement.cpp32
-rw-r--r--WebCore/svg/SVGFEDistantLightElement.h32
-rw-r--r--WebCore/svg/SVGFEDistantLightElement.idl6
-rw-r--r--WebCore/svg/SVGFEFloodElement.cpp46
-rw-r--r--WebCore/svg/SVGFEFloodElement.h48
-rw-r--r--WebCore/svg/SVGFEFloodElement.idl6
-rw-r--r--WebCore/svg/SVGFEFuncAElement.cpp36
-rw-r--r--WebCore/svg/SVGFEFuncAElement.h36
-rw-r--r--WebCore/svg/SVGFEFuncAElement.idl6
-rw-r--r--WebCore/svg/SVGFEFuncBElement.cpp36
-rw-r--r--WebCore/svg/SVGFEFuncBElement.h36
-rw-r--r--WebCore/svg/SVGFEFuncBElement.idl6
-rw-r--r--WebCore/svg/SVGFEFuncGElement.cpp36
-rw-r--r--WebCore/svg/SVGFEFuncGElement.h36
-rw-r--r--WebCore/svg/SVGFEFuncGElement.idl6
-rw-r--r--WebCore/svg/SVGFEFuncRElement.cpp36
-rw-r--r--WebCore/svg/SVGFEFuncRElement.h36
-rw-r--r--WebCore/svg/SVGFEFuncRElement.idl6
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.cpp52
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.h66
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.idl6
-rw-r--r--WebCore/svg/SVGFEImageElement.cpp71
-rw-r--r--WebCore/svg/SVGFEImageElement.h83
-rw-r--r--WebCore/svg/SVGFEImageElement.idl6
-rw-r--r--WebCore/svg/SVGFELightElement.cpp68
-rw-r--r--WebCore/svg/SVGFELightElement.h78
-rw-r--r--WebCore/svg/SVGFEMergeElement.cpp50
-rw-r--r--WebCore/svg/SVGFEMergeElement.h48
-rw-r--r--WebCore/svg/SVGFEMergeElement.idl6
-rw-r--r--WebCore/svg/SVGFEMergeNodeElement.cpp40
-rw-r--r--WebCore/svg/SVGFEMergeNodeElement.h38
-rw-r--r--WebCore/svg/SVGFEMergeNodeElement.idl6
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.cpp55
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.h66
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.idl11
-rw-r--r--WebCore/svg/SVGFEOffsetElement.cpp61
-rw-r--r--WebCore/svg/SVGFEOffsetElement.h65
-rw-r--r--WebCore/svg/SVGFEOffsetElement.idl6
-rw-r--r--WebCore/svg/SVGFEPointLightElement.cpp32
-rw-r--r--WebCore/svg/SVGFEPointLightElement.h32
-rw-r--r--WebCore/svg/SVGFEPointLightElement.idl6
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.cpp57
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.h80
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.idl6
-rw-r--r--WebCore/svg/SVGFESpotLightElement.cpp39
-rw-r--r--WebCore/svg/SVGFESpotLightElement.h32
-rw-r--r--WebCore/svg/SVGFESpotLightElement.idl6
-rw-r--r--WebCore/svg/SVGFETileElement.cpp51
-rw-r--r--WebCore/svg/SVGFETileElement.h56
-rw-r--r--WebCore/svg/SVGFETileElement.idl6
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.cpp51
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.h88
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.idl13
-rw-r--r--WebCore/svg/SVGFilterElement.cpp156
-rw-r--r--WebCore/svg/SVGFilterElement.h125
-rw-r--r--WebCore/svg/SVGFilterElement.idl6
-rw-r--r--WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp68
-rw-r--r--WebCore/svg/SVGFilterPrimitiveStandardAttributes.h84
-rw-r--r--WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl6
-rw-r--r--WebCore/svg/SVGFitToViewBox.cpp89
-rw-r--r--WebCore/svg/SVGFitToViewBox.h43
-rw-r--r--WebCore/svg/SVGFitToViewBox.idl6
-rw-r--r--WebCore/svg/SVGFont.cpp59
-rw-r--r--WebCore/svg/SVGFontData.cpp2
-rw-r--r--WebCore/svg/SVGFontData.h1
-rw-r--r--WebCore/svg/SVGFontElement.cpp225
-rw-r--r--WebCore/svg/SVGFontElement.h115
-rw-r--r--WebCore/svg/SVGFontElement.idl4
-rw-r--r--WebCore/svg/SVGFontFaceElement.cpp44
-rw-r--r--WebCore/svg/SVGFontFaceElement.h40
-rw-r--r--WebCore/svg/SVGFontFaceElement.idl4
-rw-r--r--WebCore/svg/SVGFontFaceFormatElement.cpp32
-rw-r--r--WebCore/svg/SVGFontFaceFormatElement.h32
-rw-r--r--WebCore/svg/SVGFontFaceFormatElement.idl4
-rw-r--r--WebCore/svg/SVGFontFaceNameElement.cpp32
-rw-r--r--WebCore/svg/SVGFontFaceNameElement.h32
-rw-r--r--WebCore/svg/SVGFontFaceNameElement.idl4
-rw-r--r--WebCore/svg/SVGFontFaceSrcElement.cpp32
-rw-r--r--WebCore/svg/SVGFontFaceSrcElement.h32
-rw-r--r--WebCore/svg/SVGFontFaceSrcElement.idl4
-rw-r--r--WebCore/svg/SVGFontFaceUriElement.cpp38
-rw-r--r--WebCore/svg/SVGFontFaceUriElement.h50
-rw-r--r--WebCore/svg/SVGFontFaceUriElement.idl4
-rw-r--r--WebCore/svg/SVGForeignObjectElement.cpp147
-rw-r--r--WebCore/svg/SVGForeignObjectElement.h41
-rw-r--r--WebCore/svg/SVGForeignObjectElement.idl6
-rw-r--r--WebCore/svg/SVGGElement.cpp73
-rw-r--r--WebCore/svg/SVGGElement.h40
-rw-r--r--WebCore/svg/SVGGElement.idl6
-rw-r--r--WebCore/svg/SVGGlyphElement.cpp48
-rw-r--r--WebCore/svg/SVGGlyphElement.h40
-rw-r--r--WebCore/svg/SVGGlyphElement.idl4
-rw-r--r--WebCore/svg/SVGGlyphMap.h32
-rw-r--r--WebCore/svg/SVGGradientElement.cpp126
-rw-r--r--WebCore/svg/SVGGradientElement.h57
-rw-r--r--WebCore/svg/SVGGradientElement.idl19
-rw-r--r--WebCore/svg/SVGHKernElement.cpp65
-rw-r--r--WebCore/svg/SVGHKernElement.h57
-rw-r--r--WebCore/svg/SVGHKernElement.idl34
-rw-r--r--WebCore/svg/SVGImageElement.cpp89
-rw-r--r--WebCore/svg/SVGImageElement.h42
-rw-r--r--WebCore/svg/SVGImageElement.idl6
-rw-r--r--WebCore/svg/SVGImageLoader.cpp38
-rw-r--r--WebCore/svg/SVGImageLoader.h36
-rw-r--r--WebCore/svg/SVGLangSpace.cpp40
-rw-r--r--WebCore/svg/SVGLangSpace.h42
-rw-r--r--WebCore/svg/SVGLangSpace.idl10
-rw-r--r--WebCore/svg/SVGLength.cpp171
-rw-r--r--WebCore/svg/SVGLength.h179
-rw-r--r--WebCore/svg/SVGLength.idl40
-rw-r--r--WebCore/svg/SVGLengthList.cpp36
-rw-r--r--WebCore/svg/SVGLengthList.h36
-rw-r--r--WebCore/svg/SVGLengthList.idl6
-rw-r--r--WebCore/svg/SVGLineElement.cpp83
-rw-r--r--WebCore/svg/SVGLineElement.h43
-rw-r--r--WebCore/svg/SVGLineElement.idl6
-rw-r--r--WebCore/svg/SVGLinearGradientElement.cpp145
-rw-r--r--WebCore/svg/SVGLinearGradientElement.h47
-rw-r--r--WebCore/svg/SVGLinearGradientElement.idl6
-rw-r--r--WebCore/svg/SVGList.h36
-rw-r--r--WebCore/svg/SVGListTraits.h36
-rw-r--r--WebCore/svg/SVGLocatable.cpp96
-rw-r--r--WebCore/svg/SVGLocatable.h64
-rw-r--r--WebCore/svg/SVGLocatable.idl6
-rw-r--r--WebCore/svg/SVGMPathElement.cpp36
-rw-r--r--WebCore/svg/SVGMPathElement.h36
-rw-r--r--WebCore/svg/SVGMarkerElement.cpp130
-rw-r--r--WebCore/svg/SVGMarkerElement.h152
-rw-r--r--WebCore/svg/SVGMarkerElement.idl6
-rw-r--r--WebCore/svg/SVGMaskElement.cpp217
-rw-r--r--WebCore/svg/SVGMaskElement.h60
-rw-r--r--WebCore/svg/SVGMaskElement.idl6
-rw-r--r--WebCore/svg/SVGMatrix.idl40
-rw-r--r--WebCore/svg/SVGMetadataElement.cpp36
-rw-r--r--WebCore/svg/SVGMetadataElement.h36
-rw-r--r--WebCore/svg/SVGMetadataElement.idl38
-rw-r--r--WebCore/svg/SVGMissingGlyphElement.cpp34
-rw-r--r--WebCore/svg/SVGMissingGlyphElement.h32
-rw-r--r--WebCore/svg/SVGMissingGlyphElement.idl4
-rw-r--r--WebCore/svg/SVGNumber.idl40
-rw-r--r--WebCore/svg/SVGNumberList.cpp36
-rw-r--r--WebCore/svg/SVGNumberList.h39
-rw-r--r--WebCore/svg/SVGNumberList.idl6
-rw-r--r--WebCore/svg/SVGPaint.cpp57
-rw-r--r--WebCore/svg/SVGPaint.h42
-rw-r--r--WebCore/svg/SVGPaint.idl6
-rw-r--r--WebCore/svg/SVGParserUtilities.cpp806
-rw-r--r--WebCore/svg/SVGParserUtilities.h47
-rw-r--r--WebCore/svg/SVGPathBlender.cpp292
-rw-r--r--WebCore/svg/SVGPathBlender.h62
-rw-r--r--WebCore/svg/SVGPathBuilder.cpp72
-rw-r--r--WebCore/svg/SVGPathBuilder.h66
-rw-r--r--WebCore/svg/SVGPathByteStream.h70
-rw-r--r--WebCore/svg/SVGPathByteStreamBuilder.cpp117
-rw-r--r--WebCore/svg/SVGPathByteStreamBuilder.h99
-rw-r--r--WebCore/svg/SVGPathByteStreamSource.cpp120
-rw-r--r--WebCore/svg/SVGPathByteStreamSource.h106
-rw-r--r--WebCore/svg/SVGPathConsumer.h73
-rw-r--r--WebCore/svg/SVGPathElement.cpp85
-rw-r--r--WebCore/svg/SVGPathElement.h40
-rw-r--r--WebCore/svg/SVGPathElement.idl9
-rw-r--r--WebCore/svg/SVGPathParser.cpp492
-rw-r--r--WebCore/svg/SVGPathParser.h74
-rw-r--r--WebCore/svg/SVGPathParserFactory.cpp288
-rw-r--r--WebCore/svg/SVGPathParserFactory.h61
-rw-r--r--WebCore/svg/SVGPathSeg.cpp (renamed from WebCore/svg/graphics/SVGPaintServerSolid.h)52
-rw-r--r--WebCore/svg/SVGPathSeg.h168
-rw-r--r--WebCore/svg/SVGPathSeg.idl4
-rw-r--r--WebCore/svg/SVGPathSegArc.cpp36
-rw-r--r--WebCore/svg/SVGPathSegArc.h49
-rw-r--r--WebCore/svg/SVGPathSegArcAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegArcRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegClosePath.cpp36
-rw-r--r--WebCore/svg/SVGPathSegClosePath.h63
-rw-r--r--WebCore/svg/SVGPathSegClosePath.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubic.cpp36
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubic.h39
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp36
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicSmooth.h41
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadratic.cpp36
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadratic.h39
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp36
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h37
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegLineto.cpp36
-rw-r--r--WebCore/svg/SVGPathSegLineto.h37
-rw-r--r--WebCore/svg/SVGPathSegLinetoAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegLinetoHorizontal.cpp36
-rw-r--r--WebCore/svg/SVGPathSegLinetoHorizontal.h39
-rw-r--r--WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegLinetoHorizontalRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegLinetoRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegLinetoVertical.cpp36
-rw-r--r--WebCore/svg/SVGPathSegLinetoVertical.h39
-rw-r--r--WebCore/svg/SVGPathSegLinetoVerticalAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegLinetoVerticalRel.idl6
-rw-r--r--WebCore/svg/SVGPathSegList.cpp268
-rw-r--r--WebCore/svg/SVGPathSegList.h62
-rw-r--r--WebCore/svg/SVGPathSegList.idl6
-rw-r--r--WebCore/svg/SVGPathSegListBuilder.cpp159
-rw-r--r--WebCore/svg/SVGPathSegListBuilder.h65
-rw-r--r--WebCore/svg/SVGPathSegListSource.cpp167
-rw-r--r--WebCore/svg/SVGPathSegListSource.h69
-rw-r--r--WebCore/svg/SVGPathSegMoveto.cpp36
-rw-r--r--WebCore/svg/SVGPathSegMoveto.h37
-rw-r--r--WebCore/svg/SVGPathSegMovetoAbs.idl6
-rw-r--r--WebCore/svg/SVGPathSegMovetoRel.idl6
-rw-r--r--WebCore/svg/SVGPathSource.h54
-rw-r--r--WebCore/svg/SVGPathStringBuilder.cpp110
-rw-r--r--WebCore/svg/SVGPathStringBuilder.h61
-rw-r--r--WebCore/svg/SVGPathStringSource.cpp247
-rw-r--r--WebCore/svg/SVGPathStringSource.h66
-rw-r--r--WebCore/svg/SVGPathTraversalStateBuilder.cpp87
-rw-r--r--WebCore/svg/SVGPathTraversalStateBuilder.h65
-rw-r--r--WebCore/svg/SVGPatternElement.cpp208
-rw-r--r--WebCore/svg/SVGPatternElement.h56
-rw-r--r--WebCore/svg/SVGPatternElement.idl6
-rw-r--r--WebCore/svg/SVGPoint.idl40
-rw-r--r--WebCore/svg/SVGPointList.cpp65
-rw-r--r--WebCore/svg/SVGPointList.h41
-rw-r--r--WebCore/svg/SVGPointList.idl6
-rw-r--r--WebCore/svg/SVGPolyElement.cpp70
-rw-r--r--WebCore/svg/SVGPolyElement.h39
-rw-r--r--WebCore/svg/SVGPolygonElement.cpp36
-rw-r--r--WebCore/svg/SVGPolygonElement.h36
-rw-r--r--WebCore/svg/SVGPolygonElement.idl6
-rw-r--r--WebCore/svg/SVGPolylineElement.cpp36
-rw-r--r--WebCore/svg/SVGPolylineElement.h36
-rw-r--r--WebCore/svg/SVGPolylineElement.idl6
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.cpp38
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.h38
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.idl6
-rw-r--r--WebCore/svg/SVGRadialGradientElement.cpp191
-rw-r--r--WebCore/svg/SVGRadialGradientElement.h47
-rw-r--r--WebCore/svg/SVGRadialGradientElement.idl6
-rw-r--r--WebCore/svg/SVGRect.idl40
-rw-r--r--WebCore/svg/SVGRectElement.cpp89
-rw-r--r--WebCore/svg/SVGRectElement.h43
-rw-r--r--WebCore/svg/SVGRectElement.idl6
-rw-r--r--WebCore/svg/SVGRenderingIntent.h34
-rw-r--r--WebCore/svg/SVGRenderingIntent.idl6
-rw-r--r--WebCore/svg/SVGSVGElement.cpp199
-rw-r--r--WebCore/svg/SVGSVGElement.h49
-rw-r--r--WebCore/svg/SVGSVGElement.idl49
-rw-r--r--WebCore/svg/SVGScriptElement.cpp60
-rw-r--r--WebCore/svg/SVGScriptElement.h43
-rw-r--r--WebCore/svg/SVGScriptElement.idl6
-rw-r--r--WebCore/svg/SVGSetElement.cpp36
-rw-r--r--WebCore/svg/SVGSetElement.h36
-rw-r--r--WebCore/svg/SVGSetElement.idl6
-rw-r--r--WebCore/svg/SVGStopElement.cpp65
-rw-r--r--WebCore/svg/SVGStopElement.h42
-rw-r--r--WebCore/svg/SVGStopElement.idl6
-rw-r--r--WebCore/svg/SVGStringList.cpp36
-rw-r--r--WebCore/svg/SVGStringList.h36
-rw-r--r--WebCore/svg/SVGStringList.idl32
-rw-r--r--WebCore/svg/SVGStylable.cpp36
-rw-r--r--WebCore/svg/SVGStylable.h38
-rw-r--r--WebCore/svg/SVGStylable.idl10
-rw-r--r--WebCore/svg/SVGStyleElement.cpp74
-rw-r--r--WebCore/svg/SVGStyleElement.h85
-rw-r--r--WebCore/svg/SVGStyleElement.idl12
-rw-r--r--WebCore/svg/SVGStyledElement.cpp221
-rw-r--r--WebCore/svg/SVGStyledElement.h63
-rw-r--r--WebCore/svg/SVGStyledLocatableElement.cpp48
-rw-r--r--WebCore/svg/SVGStyledLocatableElement.h44
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.cpp51
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.h47
-rw-r--r--WebCore/svg/SVGSwitchElement.cpp36
-rw-r--r--WebCore/svg/SVGSwitchElement.h36
-rw-r--r--WebCore/svg/SVGSwitchElement.idl6
-rw-r--r--WebCore/svg/SVGSymbolElement.cpp51
-rw-r--r--WebCore/svg/SVGSymbolElement.h41
-rw-r--r--WebCore/svg/SVGSymbolElement.idl6
-rw-r--r--WebCore/svg/SVGTRefElement.cpp41
-rw-r--r--WebCore/svg/SVGTRefElement.h38
-rw-r--r--WebCore/svg/SVGTRefElement.idl6
-rw-r--r--WebCore/svg/SVGTSpanElement.cpp36
-rw-r--r--WebCore/svg/SVGTSpanElement.h36
-rw-r--r--WebCore/svg/SVGTSpanElement.idl6
-rw-r--r--WebCore/svg/SVGTests.cpp40
-rw-r--r--WebCore/svg/SVGTests.h44
-rw-r--r--WebCore/svg/SVGTests.idl8
-rw-r--r--WebCore/svg/SVGTextContentElement.cpp387
-rw-r--r--WebCore/svg/SVGTextContentElement.h41
-rw-r--r--WebCore/svg/SVGTextContentElement.idl6
-rw-r--r--WebCore/svg/SVGTextElement.cpp72
-rw-r--r--WebCore/svg/SVGTextElement.h46
-rw-r--r--WebCore/svg/SVGTextElement.idl6
-rw-r--r--WebCore/svg/SVGTextPathElement.cpp63
-rw-r--r--WebCore/svg/SVGTextPathElement.h40
-rw-r--r--WebCore/svg/SVGTextPathElement.idl4
-rw-r--r--WebCore/svg/SVGTextPositioningElement.cpp82
-rw-r--r--WebCore/svg/SVGTextPositioningElement.h40
-rw-r--r--WebCore/svg/SVGTextPositioningElement.idl6
-rw-r--r--WebCore/svg/SVGTitleElement.cpp36
-rw-r--r--WebCore/svg/SVGTitleElement.h36
-rw-r--r--WebCore/svg/SVGTitleElement.idl6
-rw-r--r--WebCore/svg/SVGTransform.cpp36
-rw-r--r--WebCore/svg/SVGTransform.h37
-rw-r--r--WebCore/svg/SVGTransform.idl38
-rw-r--r--WebCore/svg/SVGTransformDistance.cpp34
-rw-r--r--WebCore/svg/SVGTransformDistance.h34
-rw-r--r--WebCore/svg/SVGTransformList.cpp36
-rw-r--r--WebCore/svg/SVGTransformList.h39
-rw-r--r--WebCore/svg/SVGTransformList.idl6
-rw-r--r--WebCore/svg/SVGTransformable.cpp55
-rw-r--r--WebCore/svg/SVGTransformable.h44
-rw-r--r--WebCore/svg/SVGTransformable.idl6
-rw-r--r--WebCore/svg/SVGURIReference.cpp53
-rw-r--r--WebCore/svg/SVGURIReference.h40
-rw-r--r--WebCore/svg/SVGURIReference.idl6
-rw-r--r--WebCore/svg/SVGUnitTypes.h42
-rw-r--r--WebCore/svg/SVGUnitTypes.idl6
-rw-r--r--WebCore/svg/SVGUseElement.cpp212
-rw-r--r--WebCore/svg/SVGUseElement.h44
-rw-r--r--WebCore/svg/SVGUseElement.idl6
-rw-r--r--WebCore/svg/SVGVKernElement.cpp84
-rw-r--r--WebCore/svg/SVGVKernElement.h51
-rw-r--r--WebCore/svg/SVGVKernElement.idl25
-rw-r--r--WebCore/svg/SVGViewElement.cpp39
-rw-r--r--WebCore/svg/SVGViewElement.h38
-rw-r--r--WebCore/svg/SVGViewElement.idl6
-rw-r--r--WebCore/svg/SVGViewSpec.cpp54
-rw-r--r--WebCore/svg/SVGViewSpec.h34
-rw-r--r--WebCore/svg/SVGViewSpec.idl4
-rw-r--r--WebCore/svg/SVGZoomAndPan.cpp40
-rw-r--r--WebCore/svg/SVGZoomAndPan.h40
-rw-r--r--WebCore/svg/SVGZoomAndPan.idl6
-rw-r--r--WebCore/svg/SVGZoomEvent.cpp38
-rw-r--r--WebCore/svg/SVGZoomEvent.h38
-rw-r--r--WebCore/svg/SVGZoomEvent.idl8
-rw-r--r--WebCore/svg/animation/SMILTime.cpp2
-rw-r--r--WebCore/svg/animation/SMILTime.h2
-rw-r--r--WebCore/svg/animation/SMILTimeContainer.cpp5
-rw-r--r--WebCore/svg/animation/SMILTimeContainer.h8
-rw-r--r--WebCore/svg/animation/SVGSMILElement.cpp72
-rw-r--r--WebCore/svg/animation/SVGSMILElement.h7
-rw-r--r--WebCore/svg/graphics/SVGImage.cpp66
-rw-r--r--WebCore/svg/graphics/SVGImage.h9
-rw-r--r--WebCore/svg/graphics/SVGPaintServer.cpp232
-rw-r--r--WebCore/svg/graphics/SVGPaintServer.h96
-rw-r--r--WebCore/svg/graphics/SVGPaintServerGradient.cpp293
-rw-r--r--WebCore/svg/graphics/SVGPaintServerGradient.h98
-rw-r--r--WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp74
-rw-r--r--WebCore/svg/graphics/SVGPaintServerLinearGradient.h62
-rw-r--r--WebCore/svg/graphics/SVGPaintServerPattern.cpp183
-rw-r--r--WebCore/svg/graphics/SVGPaintServerPattern.h85
-rw-r--r--WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp87
-rw-r--r--WebCore/svg/graphics/SVGPaintServerRadialGradient.h66
-rw-r--r--WebCore/svg/graphics/SVGPaintServerSolid.cpp93
-rw-r--r--WebCore/svg/graphics/SVGResource.cpp139
-rw-r--r--WebCore/svg/graphics/SVGResource.h102
-rw-r--r--WebCore/svg/graphics/SVGResourceClipper.cpp170
-rw-r--r--WebCore/svg/graphics/SVGResourceClipper.h98
-rw-r--r--WebCore/svg/graphics/SVGResourceFilter.cpp228
-rw-r--r--WebCore/svg/graphics/SVGResourceFilter.h112
-rw-r--r--WebCore/svg/graphics/SVGResourceListener.h0
-rw-r--r--WebCore/svg/graphics/SVGResourceMarker.cpp111
-rw-r--r--WebCore/svg/graphics/SVGResourceMarker.h79
-rw-r--r--WebCore/svg/graphics/SVGResourceMasker.cpp99
-rw-r--r--WebCore/svg/graphics/SVGResourceMasker.h76
-rw-r--r--WebCore/svg/graphics/filters/SVGDistantLightSource.h89
-rw-r--r--WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp396
-rw-r--r--WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h149
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp75
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h118
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp84
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDisplacementMap.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFEFlood.cpp49
-rw-r--r--WebCore/svg/graphics/filters/SVGFEFlood.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFEImage.cpp48
-rw-r--r--WebCore/svg/graphics/filters/SVGFEImage.h44
-rw-r--r--WebCore/svg/graphics/filters/SVGFELighting.cpp270
-rw-r--r--WebCore/svg/graphics/filters/SVGFELighting.h99
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMerge.cpp59
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMerge.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMorphology.cpp79
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMorphology.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFEOffset.cpp50
-rw-r--r--WebCore/svg/graphics/filters/SVGFEOffset.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp77
-rw-r--r--WebCore/svg/graphics/filters/SVGFESpecularLighting.h104
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.cpp48
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.h40
-rw-r--r--WebCore/svg/graphics/filters/SVGFETurbulence.cpp325
-rw-r--r--WebCore/svg/graphics/filters/SVGFETurbulence.h126
-rw-r--r--WebCore/svg/graphics/filters/SVGFilter.cpp26
-rw-r--r--WebCore/svg/graphics/filters/SVGFilter.h26
-rw-r--r--WebCore/svg/graphics/filters/SVGFilterBuilder.cpp27
-rw-r--r--WebCore/svg/graphics/filters/SVGFilterBuilder.h42
-rw-r--r--WebCore/svg/graphics/filters/SVGLightSource.cpp144
-rw-r--r--WebCore/svg/graphics/filters/SVGLightSource.h97
-rw-r--r--WebCore/svg/graphics/filters/SVGPointLightSource.h76
-rw-r--r--WebCore/svg/graphics/filters/SVGSpotLightSource.h110
-rw-r--r--WebCore/svg/svgattrs.in3
-rw-r--r--WebCore/svg/svgtags.in6
523 files changed, 14703 insertions, 13148 deletions
diff --git a/WebCore/svg/ColorDistance.cpp b/WebCore/svg/ColorDistance.cpp
index 9e632ae..c2fd1a6 100644
--- a/WebCore/svg/ColorDistance.cpp
+++ b/WebCore/svg/ColorDistance.cpp
@@ -1,22 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/ColorDistance.h b/WebCore/svg/ColorDistance.h
index b7cc029..de52df3 100644
--- a/WebCore/svg/ColorDistance.h
+++ b/WebCore/svg/ColorDistance.h
@@ -1,22 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef ColorDistance_h
diff --git a/WebCore/svg/ElementTimeControl.h b/WebCore/svg/ElementTimeControl.h
index 4800cb1..c0b4fdb 100644
--- a/WebCore/svg/ElementTimeControl.h
+++ b/WebCore/svg/ElementTimeControl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/WebCore/svg/ElementTimeControl.idl b/WebCore/svg/ElementTimeControl.idl
index 4ac01c4..3e2cef4 100644
--- a/WebCore/svg/ElementTimeControl.idl
+++ b/WebCore/svg/ElementTimeControl.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/WebCore/svg/GradientAttributes.h b/WebCore/svg/GradientAttributes.h
index ba513b8..4b02fae 100644
--- a/WebCore/svg/GradientAttributes.h
+++ b/WebCore/svg/GradientAttributes.h
@@ -1,71 +1,92 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef GradientAttributes_h
#define GradientAttributes_h
#if ENABLE(SVG)
+#include "Color.h"
+#include "Gradient.h"
+#include "SVGLength.h"
namespace WebCore {
- struct GradientAttributes {
- GradientAttributes()
- : m_spreadMethod(SpreadMethodPad)
- , m_boundingBoxMode(true)
- , m_spreadMethodSet(false)
- , m_boundingBoxModeSet(false)
- , m_gradientTransformSet(false)
- , m_stopsSet(false)
- {
- }
- GradientSpreadMethod spreadMethod() const { return m_spreadMethod; }
- bool boundingBoxMode() const { return m_boundingBoxMode; }
- AffineTransform gradientTransform() const { return m_gradientTransform; }
- const Vector<SVGGradientStop>& stops() const { return m_stops; }
+struct GradientAttributes {
+ GradientAttributes()
+ : m_spreadMethod(SpreadMethodPad)
+ , m_boundingBoxMode(true)
+ , m_spreadMethodSet(false)
+ , m_boundingBoxModeSet(false)
+ , m_gradientTransformSet(false)
+ , m_stopsSet(false)
+ {
+ }
+
+ GradientSpreadMethod spreadMethod() const { return m_spreadMethod; }
+ bool boundingBoxMode() const { return m_boundingBoxMode; }
+ AffineTransform gradientTransform() const { return m_gradientTransform; }
+ const Vector<Gradient::ColorStop>& stops() const { return m_stops; }
- void setSpreadMethod(GradientSpreadMethod value) { m_spreadMethod = value; m_spreadMethodSet = true; }
- void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; }
- void setGradientTransform(const AffineTransform& value) { m_gradientTransform = value; m_gradientTransformSet = true; }
- void setStops(const Vector<SVGGradientStop>& value) { m_stops = value; m_stopsSet = true; }
+ void setSpreadMethod(GradientSpreadMethod value)
+ {
+ m_spreadMethod = value;
+ m_spreadMethodSet = true;
+ }
- bool hasSpreadMethod() const { return m_spreadMethodSet; }
- bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
- bool hasGradientTransform() const { return m_gradientTransformSet; }
- bool hasStops() const { return m_stopsSet; }
+ void setBoundingBoxMode(bool value)
+ {
+ m_boundingBoxMode = value;
+ m_boundingBoxModeSet = true;
+ }
- private:
- // Properties
- GradientSpreadMethod m_spreadMethod;
- bool m_boundingBoxMode;
- AffineTransform m_gradientTransform;
- Vector<SVGGradientStop> m_stops;
+ void setGradientTransform(const AffineTransform& value)
+ {
+ m_gradientTransform = value;
+ m_gradientTransformSet = true;
+ }
- // Property states
- bool m_spreadMethodSet : 1;
- bool m_boundingBoxModeSet : 1;
- bool m_gradientTransformSet : 1;
- bool m_stopsSet : 1;
- };
+ void setStops(const Vector<Gradient::ColorStop>& value)
+ {
+ m_stops = value;
+ m_stopsSet = true;
+ }
+
+ bool hasSpreadMethod() const { return m_spreadMethodSet; }
+ bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
+ bool hasGradientTransform() const { return m_gradientTransformSet; }
+ bool hasStops() const { return m_stopsSet; }
+
+private:
+ // Properties
+ GradientSpreadMethod m_spreadMethod;
+ bool m_boundingBoxMode;
+ AffineTransform m_gradientTransform;
+ Vector<Gradient::ColorStop> m_stops;
+
+ // Property states
+ bool m_spreadMethodSet : 1;
+ bool m_boundingBoxModeSet : 1;
+ bool m_gradientTransformSet : 1;
+ bool m_stopsSet : 1;
+};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/LinearGradientAttributes.h b/WebCore/svg/LinearGradientAttributes.h
index b71dc22..9f37860 100644
--- a/WebCore/svg/LinearGradientAttributes.h
+++ b/WebCore/svg/LinearGradientAttributes.h
@@ -1,28 +1,27 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef LinearGradientAttributes_h
#define LinearGradientAttributes_h
-#include "GradientAttributes.h"
-
#if ENABLE(SVG)
+#include "GradientAttributes.h"
namespace WebCore {
struct LinearGradientAttributes : GradientAttributes {
diff --git a/WebCore/svg/PatternAttributes.h b/WebCore/svg/PatternAttributes.h
index 2d25763..613ab94 100644
--- a/WebCore/svg/PatternAttributes.h
+++ b/WebCore/svg/PatternAttributes.h
@@ -1,100 +1,141 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef PatternAttributes_h
#define PatternAttributes_h
#if ENABLE(SVG)
+#include "SVGLength.h"
namespace WebCore {
- struct PatternAttributes {
- PatternAttributes()
- : m_x()
- , m_y()
- , m_width()
- , m_height()
- , m_boundingBoxMode(true)
- , m_boundingBoxModeContent(false)
- , m_patternContentElement(0)
- , m_xSet(false)
- , m_ySet(false)
- , m_widthSet(false)
- , m_heightSet(false)
- , m_boundingBoxModeSet(false)
- , m_boundingBoxModeContentSet(false)
- , m_patternTransformSet(false)
- , m_patternContentElementSet(false)
- {
- }
-
- SVGLength x() const { return m_x; }
- SVGLength y() const { return m_y; }
- SVGLength width() const { return m_width; }
- SVGLength height() const { return m_height; }
- bool boundingBoxMode() const { return m_boundingBoxMode; }
- bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
- AffineTransform patternTransform() const { return m_patternTransform; }
- const SVGPatternElement* patternContentElement() const { return m_patternContentElement; }
-
- void setX(const SVGLength& value) { m_x = value; m_xSet = true; }
- void setY(const SVGLength& value) { m_y = value; m_ySet = true; }
- void setWidth(const SVGLength& value) { m_width = value; m_widthSet = true; }
- void setHeight(const SVGLength& value) { m_height = value; m_heightSet = true; }
- void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; }
- void setBoundingBoxModeContent(bool value) { m_boundingBoxModeContent = value; m_boundingBoxModeContentSet = true; }
- void setPatternTransform(const AffineTransform& value) { m_patternTransform = value; m_patternTransformSet = true; }
- void setPatternContentElement(const SVGPatternElement* value) { m_patternContentElement = value; m_patternContentElementSet = true; }
-
- bool hasX() const { return m_xSet; }
- bool hasY() const { return m_ySet; }
- bool hasWidth() const { return m_widthSet; }
- bool hasHeight() const { return m_heightSet; }
- bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
- bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
- bool hasPatternTransform() const { return m_patternTransformSet; }
- bool hasPatternContentElement() const { return m_patternContentElementSet; }
-
- private:
- // Properties
- SVGLength m_x;
- SVGLength m_y;
- SVGLength m_width;
- SVGLength m_height;
- bool m_boundingBoxMode;
- bool m_boundingBoxModeContent;
- AffineTransform m_patternTransform;
- const SVGPatternElement* m_patternContentElement;
-
- // Property states
- bool m_xSet : 1;
- bool m_ySet : 1;
- bool m_widthSet : 1;
- bool m_heightSet : 1;
- bool m_boundingBoxModeSet : 1;
- bool m_boundingBoxModeContentSet : 1;
- bool m_patternTransformSet : 1;
- bool m_patternContentElementSet : 1;
- };
+
+class SVGPatternElement;
+
+struct PatternAttributes {
+ PatternAttributes()
+ : m_x()
+ , m_y()
+ , m_width()
+ , m_height()
+ , m_boundingBoxMode(true)
+ , m_boundingBoxModeContent(false)
+ , m_patternContentElement(0)
+ , m_xSet(false)
+ , m_ySet(false)
+ , m_widthSet(false)
+ , m_heightSet(false)
+ , m_boundingBoxModeSet(false)
+ , m_boundingBoxModeContentSet(false)
+ , m_patternTransformSet(false)
+ , m_patternContentElementSet(false)
+ {
+ }
+
+ SVGLength x() const { return m_x; }
+ SVGLength y() const { return m_y; }
+ SVGLength width() const { return m_width; }
+ SVGLength height() const { return m_height; }
+ bool boundingBoxMode() const { return m_boundingBoxMode; }
+ bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
+ AffineTransform patternTransform() const { return m_patternTransform; }
+ const SVGPatternElement* patternContentElement() const { return m_patternContentElement; }
+
+ void setX(const SVGLength& value)
+ {
+ m_x = value;
+ m_xSet = true;
+ }
+
+ void setY(const SVGLength& value)
+ {
+ m_y = value;
+ m_ySet = true;
+ }
+
+ void setWidth(const SVGLength& value)
+ {
+ m_width = value;
+ m_widthSet = true;
+ }
+
+ void setHeight(const SVGLength& value)
+ {
+ m_height = value;
+ m_heightSet = true;
+ }
+
+ void setBoundingBoxMode(bool value)
+ {
+ m_boundingBoxMode = value;
+ m_boundingBoxModeSet = true;
+ }
+
+ void setBoundingBoxModeContent(bool value)
+ {
+ m_boundingBoxModeContent = value;
+ m_boundingBoxModeContentSet = true;
+ }
+
+ void setPatternTransform(const AffineTransform& value)
+ {
+ m_patternTransform = value;
+ m_patternTransformSet = true;
+ }
+
+ void setPatternContentElement(const SVGPatternElement* value)
+ {
+ m_patternContentElement = value;
+ m_patternContentElementSet = true;
+ }
+
+ bool hasX() const { return m_xSet; }
+ bool hasY() const { return m_ySet; }
+ bool hasWidth() const { return m_widthSet; }
+ bool hasHeight() const { return m_heightSet; }
+ bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
+ bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; }
+ bool hasPatternTransform() const { return m_patternTransformSet; }
+ bool hasPatternContentElement() const { return m_patternContentElementSet; }
+
+private:
+ // Properties
+ SVGLength m_x;
+ SVGLength m_y;
+ SVGLength m_width;
+ SVGLength m_height;
+ bool m_boundingBoxMode;
+ bool m_boundingBoxModeContent;
+ AffineTransform m_patternTransform;
+ const SVGPatternElement* m_patternContentElement;
+
+ // Property states
+ bool m_xSet : 1;
+ bool m_ySet : 1;
+ bool m_widthSet : 1;
+ bool m_heightSet : 1;
+ bool m_boundingBoxModeSet : 1;
+ bool m_boundingBoxModeContentSet : 1;
+ bool m_patternTransformSet : 1;
+ bool m_patternContentElementSet : 1;
+};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/RadialGradientAttributes.h b/WebCore/svg/RadialGradientAttributes.h
index 76a78ec..7e2875b 100644
--- a/WebCore/svg/RadialGradientAttributes.h
+++ b/WebCore/svg/RadialGradientAttributes.h
@@ -1,28 +1,27 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef RadialGradientAttributes_h
#define RadialGradientAttributes_h
-#include "GradientAttributes.h"
-
#if ENABLE(SVG)
+#include "GradientAttributes.h"
namespace WebCore {
struct RadialGradientAttributes : GradientAttributes {
diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp
index b344a4e..a2a4e73 100644
--- a/WebCore/svg/SVGAElement.cpp
+++ b/WebCore/svg/SVGAElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
- 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -25,6 +25,7 @@
#include "SVGAElement.h"
#include "Attr.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "Document.h"
#include "EventHandler.h"
@@ -33,7 +34,6 @@
#include "FrameLoader.h"
#include "FrameLoaderTypes.h"
#include "KeyboardEvent.h"
-#include "MappedAttribute.h"
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
#include "RenderSVGInline.h"
@@ -60,10 +60,16 @@ SVGAElement::~SVGAElement()
String SVGAElement::title() const
{
- return getAttribute(XLinkNames::titleAttr);
+ // If the xlink:title is set (non-empty string), use it.
+ const AtomicString& title = getAttribute(XLinkNames::titleAttr);
+ if (!title.isEmpty())
+ return title;
+
+ // Otherwise, use the title of this element.
+ return SVGStyledElement::title();
}
-void SVGAElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::targetAttr)
setTargetBaseValue(attr->value());
diff --git a/WebCore/svg/SVGAElement.h b/WebCore/svg/SVGAElement.h
index 36046d3..3debf8a 100644
--- a/WebCore/svg/SVGAElement.h
+++ b/WebCore/svg/SVGAElement.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAElement_h
#define SVGAElement_h
@@ -44,7 +44,7 @@ namespace WebCore {
virtual String title() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGAElement.idl b/WebCore/svg/SVGAElement.idl
index 88b46fc..8f2dc24 100644
--- a/WebCore/svg/SVGAElement.idl
+++ b/WebCore/svg/SVGAElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAllInOne.cpp b/WebCore/svg/SVGAllInOne.cpp
index 067adf2..2cb63af 100644
--- a/WebCore/svg/SVGAllInOne.cpp
+++ b/WebCore/svg/SVGAllInOne.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,6 +54,7 @@
#include "SVGFEColorMatrixElement.cpp"
#include "SVGFEComponentTransferElement.cpp"
#include "SVGFECompositeElement.cpp"
+#include "SVGFEConvolveMatrixElement.cpp"
#include "SVGFEDiffuseLightingElement.cpp"
#include "SVGFEDisplacementMapElement.cpp"
#include "SVGFEDistantLightElement.cpp"
@@ -106,7 +107,14 @@
#include "SVGNumberList.cpp"
#include "SVGPaint.cpp"
#include "SVGParserUtilities.cpp"
+#include "SVGPathBlender.cpp"
+#include "SVGPathBuilder.cpp"
+#include "SVGPathByteStreamBuilder.cpp"
+#include "SVGPathByteStreamSource.cpp"
#include "SVGPathElement.cpp"
+#include "SVGPathParser.cpp"
+#include "SVGPathParserFactory.cpp"
+#include "SVGPathSeg.cpp"
#include "SVGPathSegArc.cpp"
#include "SVGPathSegClosePath.cpp"
#include "SVGPathSegCurvetoCubic.cpp"
@@ -117,7 +125,12 @@
#include "SVGPathSegLinetoHorizontal.cpp"
#include "SVGPathSegLinetoVertical.cpp"
#include "SVGPathSegList.cpp"
+#include "SVGPathSegListBuilder.cpp"
+#include "SVGPathSegListSource.cpp"
#include "SVGPathSegMoveto.cpp"
+#include "SVGPathStringBuilder.cpp"
+#include "SVGPathStringSource.cpp"
+#include "SVGPathTraversalStateBuilder.cpp"
#include "SVGPatternElement.cpp"
#include "SVGPointList.cpp"
#include "SVGPolyElement.cpp"
@@ -152,6 +165,7 @@
#include "SVGTransformList.cpp"
#include "SVGURIReference.cpp"
#include "SVGUseElement.cpp"
+#include "SVGVKernElement.cpp"
#include "SVGViewElement.cpp"
#include "SVGViewSpec.cpp"
#include "SVGZoomAndPan.cpp"
diff --git a/WebCore/svg/SVGAltGlyphElement.cpp b/WebCore/svg/SVGAltGlyphElement.cpp
index 8371867..16808b9 100644
--- a/WebCore/svg/SVGAltGlyphElement.cpp
+++ b/WebCore/svg/SVGAltGlyphElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Computer, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGAltGlyphElement.h b/WebCore/svg/SVGAltGlyphElement.h
index a28bbad..cc5364b 100644
--- a/WebCore/svg/SVGAltGlyphElement.h
+++ b/WebCore/svg/SVGAltGlyphElement.h
@@ -1,31 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Computer, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAltGlyphElement_h
#define SVGAltGlyphElement_h
#if ENABLE(SVG_FONTS)
-#include "AtomicString.h"
#include "SVGTextPositioningElement.h"
#include "SVGURIReference.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/svg/SVGAltGlyphElement.idl b/WebCore/svg/SVGAltGlyphElement.idl
index a00e346..83ddc0e 100644
--- a/WebCore/svg/SVGAltGlyphElement.idl
+++ b/WebCore/svg/SVGAltGlyphElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Computer, Inc.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAngle.cpp b/WebCore/svg/SVGAngle.cpp
index a0cffa0..4d65ad0 100644
--- a/WebCore/svg/SVGAngle.cpp
+++ b/WebCore/svg/SVGAngle.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#include "SVGAngle.h"
diff --git a/WebCore/svg/SVGAngle.h b/WebCore/svg/SVGAngle.h
index 3d0bdeb..289b8c6 100644
--- a/WebCore/svg/SVGAngle.h
+++ b/WebCore/svg/SVGAngle.h
@@ -1,29 +1,28 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAngle_h
#define SVGAngle_h
#if ENABLE(SVG)
#include "PlatformString.h"
-#include "SVGNames.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGAngle.idl b/WebCore/svg/SVGAngle.idl
index 023fb39..cb5148c 100644
--- a/WebCore/svg/SVGAngle.idl
+++ b/WebCore/svg/SVGAngle.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGAnimateColorElement.cpp b/WebCore/svg/SVGAnimateColorElement.cpp
index ab48f18..d5166cf 100644
--- a/WebCore/svg/SVGAnimateColorElement.cpp
+++ b/WebCore/svg/SVGAnimateColorElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG_ANIMATION)
diff --git a/WebCore/svg/SVGAnimateColorElement.h b/WebCore/svg/SVGAnimateColorElement.h
index 9071185..ad9a774 100644
--- a/WebCore/svg/SVGAnimateColorElement.h
+++ b/WebCore/svg/SVGAnimateColorElement.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimateColorElement_h
#define SVGAnimateColorElement_h
diff --git a/WebCore/svg/SVGAnimateColorElement.idl b/WebCore/svg/SVGAnimateColorElement.idl
index 4df1847..b184332 100644
--- a/WebCore/svg/SVGAnimateColorElement.idl
+++ b/WebCore/svg/SVGAnimateColorElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimateElement.cpp b/WebCore/svg/SVGAnimateElement.cpp
index 31d681b..df0c3bc 100644
--- a/WebCore/svg/SVGAnimateElement.cpp
+++ b/WebCore/svg/SVGAnimateElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
@@ -27,7 +27,9 @@
#include "FloatConversion.h"
#include "SVGColor.h"
#include "SVGParserUtilities.h"
+#include "SVGPathParserFactory.h"
#include "SVGPathSegList.h"
+#include "SVGPointList.h"
#include <math.h>
using namespace std;
@@ -40,6 +42,7 @@ SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document* doc
, m_fromNumber(0)
, m_toNumber(0)
, m_animatedNumber(numeric_limits<double>::infinity())
+ , m_animatedPathPointer(0)
{
}
@@ -80,6 +83,8 @@ SVGAnimateElement::PropertyType SVGAnimateElement::determinePropertyType(const S
return ColorProperty;
if (attribute == "d")
return PathProperty;
+ if (attribute == "points")
+ return PointsProperty;
if (attribute == "color" || attribute == "fill" || attribute == "stroke")
return ColorProperty;
return NumberProperty;
@@ -127,19 +132,47 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
}
AnimationMode animationMode = this->animationMode();
if (m_propertyType == PathProperty) {
+ if (!percentage) {
+ ASSERT(m_fromPath);
+ ASSERT(percentage >= 0);
+ results->m_animatedPathPointer = m_fromPath.get();
+ } else if (percentage == 1.f) {
+ ASSERT(m_toPath);
+ results->m_animatedPathPointer = m_toPath.get();
+ } else {
+ if (m_fromPath && m_toPath) {
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ if (!factory->buildAnimatedSVGPathByteStream(m_fromPath.get(), m_toPath.get(), results->m_animatedPath, percentage)) {
+ results->m_animatedPath.clear();
+ results->m_animatedPathPointer = 0;
+ } else
+ results->m_animatedPathPointer = results->m_animatedPath.get();
+ } else
+ results->m_animatedPathPointer = 0;
+ // Fall back to discrete animation if the paths are not compatible
+ if (!results->m_animatedPathPointer) {
+ ASSERT(m_fromPath);
+ ASSERT(m_toPath);
+ ASSERT(!results->m_animatedPath);
+ results->m_animatedPathPointer = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f)
+ ? m_toPath.get() : m_fromPath.get();
+ }
+ }
+ return;
+ } else if (m_propertyType == PointsProperty) {
if (percentage == 0)
- results->m_animatedPath = m_fromPath;
+ results->m_animatedPoints = m_fromPoints;
else if (percentage == 1.f)
- results->m_animatedPath = m_toPath;
+ results->m_animatedPoints = m_toPoints;
else {
- if (m_fromPath && m_toPath)
- results->m_animatedPath = SVGPathSegList::createAnimated(m_fromPath.get(), m_toPath.get(), percentage);
+ if (m_fromPoints && m_toPoints)
+ results->m_animatedPoints = SVGPointList::createAnimated(m_fromPoints.get(), m_toPoints.get(), percentage);
else
- results->m_animatedPath.clear();
- // Fall back to discrete animation if the paths are not compatible
- if (!results->m_animatedPath)
- results->m_animatedPath = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f)
- ? m_toPath : m_fromPath;
+ results->m_animatedPoints.clear();
+ // Fall back to discrete animation if the points are not compatible
+ if (!results->m_animatedPoints)
+ results->m_animatedPoints = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f)
+ ? m_toPoints : m_fromPoints;
}
return;
}
@@ -159,7 +192,7 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
if (m_propertyType == ColorProperty) {
m_fromColor = SVGColor::colorFromRGBColorString(fromString);
m_toColor = SVGColor::colorFromRGBColorString(toString);
- if (m_fromColor.isValid() && m_toColor.isValid())
+ if ((m_fromColor.isValid() && m_toColor.isValid()) || (m_toColor.isValid() && animationMode() == ToAnimation))
return true;
} else if (m_propertyType == NumberProperty) {
m_numberUnit = String();
@@ -169,14 +202,22 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
return true;
}
} else if (m_propertyType == PathProperty) {
- m_fromPath = SVGPathSegList::create(SVGNames::dAttr);
- if (pathSegListFromSVGData(m_fromPath.get(), fromString)) {
- m_toPath = SVGPathSegList::create(SVGNames::dAttr);
- if (pathSegListFromSVGData(m_toPath.get(), toString))
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ if (factory->buildSVGPathByteStreamFromString(fromString, m_fromPath, UnalteredParsing)) {
+ if (factory->buildSVGPathByteStreamFromString(toString, m_toPath, UnalteredParsing))
return true;
}
m_fromPath.clear();
m_toPath.clear();
+ } else if (m_propertyType == PointsProperty) {
+ m_fromPoints = SVGPointList::create(SVGNames::pointsAttr);
+ if (pointsListFromSVGData(m_fromPoints.get(), fromString)) {
+ m_toPoints = SVGPointList::create(SVGNames::pointsAttr);
+ if (pointsListFromSVGData(m_toPoints.get(), toString))
+ return true;
+ }
+ m_fromPoints.clear();
+ m_toPoints.clear();
}
m_fromString = fromString;
m_toString = toString;
@@ -208,11 +249,14 @@ bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const
void SVGAnimateElement::resetToBaseValue(const String& baseString)
{
m_animatedString = baseString;
+ PropertyType lastType = m_propertyType;
m_propertyType = determinePropertyType(attributeName());
if (m_propertyType == ColorProperty) {
m_animatedColor = baseString.isEmpty() ? Color() : SVGColor::colorFromRGBColorString(baseString);
- if (m_animatedColor.isValid())
+ if (isContributing(elapsed())) {
+ m_propertyType = lastType;
return;
+ }
} else if (m_propertyType == NumberProperty) {
if (baseString.isEmpty()) {
m_animatedNumber = 0;
@@ -223,6 +267,10 @@ void SVGAnimateElement::resetToBaseValue(const String& baseString)
return;
} else if (m_propertyType == PathProperty) {
m_animatedPath.clear();
+ m_animatedPathPointer = 0;
+ return;
+ } else if (m_propertyType == PointsProperty) {
+ m_animatedPoints.clear();
return;
}
m_propertyType = StringProperty;
@@ -236,20 +284,21 @@ void SVGAnimateElement::applyResultsToTarget()
else if (m_propertyType == NumberProperty)
valueToApply = String::number(m_animatedNumber) + m_numberUnit;
else if (m_propertyType == PathProperty) {
- if (!m_animatedPath || !m_animatedPath->numberOfItems())
+ if (!m_animatedPathPointer || m_animatedPathPointer->isEmpty())
valueToApply = m_animatedString;
else {
// We need to keep going to string and back because we are currently only able to paint
// "processed" paths where complex shapes are replaced with simpler ones. Path
// morphing needs to be done with unprocessed paths.
// FIXME: This could be optimized if paths were not processed at parse time.
- unsigned itemCount = m_animatedPath->numberOfItems();
- ExceptionCode ec;
- for (unsigned n = 0; n < itemCount; ++n) {
- RefPtr<SVGPathSeg> segment = m_animatedPath->getItem(n, ec);
- valueToApply.append(segment->toString() + " ");
- }
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ factory->buildStringFromByteStream(m_animatedPathPointer, valueToApply, UnalteredParsing);
}
+ } else if (m_propertyType == PointsProperty) {
+ if (!m_animatedPoints || !m_animatedPoints->numberOfItems())
+ valueToApply = m_animatedString;
+ else
+ valueToApply = m_animatedPoints->valueAsString();
} else
valueToApply = m_animatedString;
diff --git a/WebCore/svg/SVGAnimateElement.h b/WebCore/svg/SVGAnimateElement.h
index ac5883c..43522a7 100644
--- a/WebCore/svg/SVGAnimateElement.h
+++ b/WebCore/svg/SVGAnimateElement.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimateElement_h
#define SVGAnimateElement_h
@@ -26,9 +26,12 @@
#include "Color.h"
#include "SVGAnimationElement.h"
+#include "SVGPathByteStream.h"
+#include <wtf/OwnPtr.h>
namespace WebCore {
class SVGPathSegList;
+ class SVGPointList;
class SVGAnimateElement : public SVGAnimationElement {
public:
@@ -44,7 +47,7 @@ namespace WebCore {
virtual float calculateDistance(const String& fromString, const String& toString);
private:
- enum PropertyType { NumberProperty, ColorProperty, StringProperty, PathProperty };
+ enum PropertyType { NumberProperty, ColorProperty, StringProperty, PathProperty, PointsProperty };
PropertyType determinePropertyType(const String& attribute) const;
PropertyType m_propertyType;
@@ -58,9 +61,13 @@ namespace WebCore {
String m_fromString;
String m_toString;
String m_animatedString;
- RefPtr<SVGPathSegList> m_fromPath;
- RefPtr<SVGPathSegList> m_toPath;
- RefPtr<SVGPathSegList> m_animatedPath;
+ OwnPtr<SVGPathByteStream> m_fromPath;
+ OwnPtr<SVGPathByteStream> m_toPath;
+ OwnPtr<SVGPathByteStream> m_animatedPath;
+ SVGPathByteStream* m_animatedPathPointer;
+ RefPtr<SVGPointList> m_fromPoints;
+ RefPtr<SVGPointList> m_toPoints;
+ RefPtr<SVGPointList> m_animatedPoints;
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGAnimateElement.idl b/WebCore/svg/SVGAnimateElement.idl
index aaf7791..a5e1201 100644
--- a/WebCore/svg/SVGAnimateElement.idl
+++ b/WebCore/svg/SVGAnimateElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp
index 9355436..4ddda73 100644
--- a/WebCore/svg/SVGAnimateMotionElement.cpp
+++ b/WebCore/svg/SVGAnimateMotionElement.cpp
@@ -1,36 +1,36 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- (C) 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Inc. All Rights Reserved.
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
#include "SVGAnimateMotionElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
+#include "RenderSVGResource.h"
#include "SVGElementInstance.h"
#include "SVGMPathElement.h"
#include "SVGParserUtilities.h"
+#include "SVGPathParserFactory.h"
#include "SVGPathElement.h"
#include "SVGTransformList.h"
#include <math.h>
@@ -83,11 +83,12 @@ bool SVGAnimateMotionElement::hasValidTarget() const
return false;
}
-void SVGAnimateMotionElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimateMotionElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::pathAttr) {
m_path = Path();
- pathFromSVGData(m_path, attr->value());
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ factory->buildPathFromString(attr->value(), m_path);
} else
SVGAnimationElement::parseMappedAttribute(attr);
}
@@ -179,7 +180,10 @@ void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned,
AffineTransform* transform = target->supplementalTransform();
if (!transform)
return;
-
+
+ if (target->renderer())
+ target->renderer()->setNeedsTransformUpdate();
+
if (!isAdditive())
transform->makeIdentity();
@@ -211,9 +215,12 @@ void SVGAnimateMotionElement::applyResultsToTarget()
{
// We accumulate to the target element transform list so there is not much to do here.
SVGElement* targetElement = this->targetElement();
- if (targetElement && targetElement->renderer())
- targetElement->renderer()->setNeedsLayout(true);
-
+ if (!targetElement)
+ return;
+
+ if (RenderObject* renderer = targetElement->renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+
// ...except in case where we have additional instances in <use> trees.
const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement();
const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
@@ -223,8 +230,10 @@ void SVGAnimateMotionElement::applyResultsToTarget()
AffineTransform* transform = shadowTreeElement->supplementalTransform();
AffineTransform* t = targetElement->supplementalTransform();
transform->setMatrix(t->a(), t->b(), t->c(), t->d(), t->e(), t->f());
- if (shadowTreeElement->renderer())
- shadowTreeElement->renderer()->setNeedsLayout(true);
+ if (RenderObject* renderer = shadowTreeElement->renderer()) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ }
}
}
@@ -243,5 +252,3 @@ float SVGAnimateMotionElement::calculateDistance(const String& fromString, const
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGAnimateMotionElement.h b/WebCore/svg/SVGAnimateMotionElement.h
index f401220..ec189f9 100644
--- a/WebCore/svg/SVGAnimateMotionElement.h
+++ b/WebCore/svg/SVGAnimateMotionElement.h
@@ -1,23 +1,21 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2008 Apple Inc. All Rights Reserved.
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGAnimateMotionElement_h
@@ -36,7 +34,7 @@ namespace WebCore {
virtual bool hasValidTarget() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
virtual void resetToBaseValue(const String&);
diff --git a/WebCore/svg/SVGAnimateTransformElement.cpp b/WebCore/svg/SVGAnimateTransformElement.cpp
index 8e077a4..0c27f0a 100644
--- a/WebCore/svg/SVGAnimateTransformElement.cpp
+++ b/WebCore/svg/SVGAnimateTransformElement.cpp
@@ -1,26 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2008 Apple Inc. All Rights Reserved.
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -28,10 +26,12 @@
#include "SVGAnimateTransformElement.h"
#include "AffineTransform.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
+#include "RenderSVGResource.h"
#include "SVGAngle.h"
#include "SVGElementInstance.h"
+#include "SVGGradientElement.h"
#include "SVGParserUtilities.h"
#include "SVGSVGElement.h"
#include "SVGStyledTransformableElement.h"
@@ -60,10 +60,14 @@ SVGAnimateTransformElement::~SVGAnimateTransformElement()
bool SVGAnimateTransformElement::hasValidTarget() const
{
SVGElement* targetElement = this->targetElement();
- return SVGAnimationElement::hasValidTarget() && (targetElement->isStyledTransformable() || targetElement->hasTagName(SVGNames::textTag));
+ return SVGAnimationElement::hasValidTarget()
+ && (targetElement->isStyledTransformable()
+ || targetElement->hasTagName(SVGNames::textTag)
+ || targetElement->hasTagName(SVGNames::linearGradientTag)
+ || targetElement->hasTagName(SVGNames::radialGradientTag));
}
-void SVGAnimateTransformElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimateTransformElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::typeAttr) {
if (attr->value() == "translate")
@@ -88,6 +92,8 @@ static PassRefPtr<SVGTransformList> transformListFor(SVGElement* element)
return static_cast<SVGStyledTransformableElement*>(element)->transform();
if (element->hasTagName(SVGNames::textTag))
return static_cast<SVGTextElement*>(element)->transform();
+ if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag))
+ return static_cast<SVGGradientElement*>(element)->gradientTransform();
return 0;
}
@@ -95,6 +101,12 @@ void SVGAnimateTransformElement::resetToBaseValue(const String& baseValue)
{
if (!hasValidTarget())
return;
+
+ if (targetElement()->hasTagName(SVGNames::linearGradientTag) || targetElement()->hasTagName(SVGNames::radialGradientTag)) {
+ targetElement()->setAttribute(SVGNames::gradientTransformAttr, baseValue.isEmpty() ? "matrix(1 0 0 1 0 0)" : baseValue);
+ return;
+ }
+
if (baseValue.isEmpty()) {
ExceptionCode ec;
RefPtr<SVGTransformList> list = transformListFor(targetElement());
@@ -159,9 +171,14 @@ void SVGAnimateTransformElement::applyResultsToTarget()
return;
// We accumulate to the target element transform list so there is not much to do here.
SVGElement* targetElement = this->targetElement();
- if (targetElement->renderer())
- targetElement->renderer()->setNeedsLayout(true);
-
+ if (!targetElement)
+ return;
+
+ if (RenderObject* renderer = targetElement->renderer()) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ }
+
// ...except in case where we have additional instances in <use> trees.
const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement();
RefPtr<SVGTransformList> transformList = transformListFor(targetElement);
@@ -173,8 +190,12 @@ void SVGAnimateTransformElement::applyResultsToTarget()
static_cast<SVGStyledTransformableElement*>(shadowTreeElement)->setTransformBaseValue(transformList.get());
else if (shadowTreeElement->hasTagName(SVGNames::textTag))
static_cast<SVGTextElement*>(shadowTreeElement)->setTransformBaseValue(transformList.get());
- if (shadowTreeElement->renderer())
- shadowTreeElement->renderer()->setNeedsLayout(true);
+ else if (shadowTreeElement->hasTagName(SVGNames::linearGradientTag) || shadowTreeElement->hasTagName(SVGNames::radialGradientTag))
+ static_cast<SVGGradientElement*>(shadowTreeElement)->setGradientTransformBaseValue(transformList.get());
+ if (RenderObject* renderer = shadowTreeElement->renderer()) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ }
}
}
diff --git a/WebCore/svg/SVGAnimateTransformElement.h b/WebCore/svg/SVGAnimateTransformElement.h
index c93e694..bf3de36 100644
--- a/WebCore/svg/SVGAnimateTransformElement.h
+++ b/WebCore/svg/SVGAnimateTransformElement.h
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2008 Apple Inc. All Rights Reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimateTransformElement_h
#define SVGAnimateTransformElement_h
@@ -39,7 +39,7 @@ public:
virtual bool hasValidTarget() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
private:
virtual void resetToBaseValue(const String&);
diff --git a/WebCore/svg/SVGAnimateTransformElement.idl b/WebCore/svg/SVGAnimateTransformElement.idl
index 80d8108..d993450 100644
--- a/WebCore/svg/SVGAnimateTransformElement.idl
+++ b/WebCore/svg/SVGAnimateTransformElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedAngle.idl b/WebCore/svg/SVGAnimatedAngle.idl
index c400c19..76d4b71 100644
--- a/WebCore/svg/SVGAnimatedAngle.idl
+++ b/WebCore/svg/SVGAnimatedAngle.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedBoolean.idl b/WebCore/svg/SVGAnimatedBoolean.idl
index 4664991..e4b831e 100644
--- a/WebCore/svg/SVGAnimatedBoolean.idl
+++ b/WebCore/svg/SVGAnimatedBoolean.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedEnumeration.idl b/WebCore/svg/SVGAnimatedEnumeration.idl
index 5a3988a..26d5064 100644
--- a/WebCore/svg/SVGAnimatedEnumeration.idl
+++ b/WebCore/svg/SVGAnimatedEnumeration.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedInteger.idl b/WebCore/svg/SVGAnimatedInteger.idl
index 1119008..6ea9138 100644
--- a/WebCore/svg/SVGAnimatedInteger.idl
+++ b/WebCore/svg/SVGAnimatedInteger.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedLength.idl b/WebCore/svg/SVGAnimatedLength.idl
index a6a85e4..7ace261 100644
--- a/WebCore/svg/SVGAnimatedLength.idl
+++ b/WebCore/svg/SVGAnimatedLength.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedLengthList.idl b/WebCore/svg/SVGAnimatedLengthList.idl
index 358920f..a68724a 100644
--- a/WebCore/svg/SVGAnimatedLengthList.idl
+++ b/WebCore/svg/SVGAnimatedLengthList.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedNumber.idl b/WebCore/svg/SVGAnimatedNumber.idl
index 3c3a161..dea9d96 100644
--- a/WebCore/svg/SVGAnimatedNumber.idl
+++ b/WebCore/svg/SVGAnimatedNumber.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedNumberList.idl b/WebCore/svg/SVGAnimatedNumberList.idl
index aaa5919..a207ac1 100644
--- a/WebCore/svg/SVGAnimatedNumberList.idl
+++ b/WebCore/svg/SVGAnimatedNumberList.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedPathData.cpp b/WebCore/svg/SVGAnimatedPathData.cpp
index 0f43f2c..8ae4acd 100644
--- a/WebCore/svg/SVGAnimatedPathData.cpp
+++ b/WebCore/svg/SVGAnimatedPathData.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGAnimatedPathData.h b/WebCore/svg/SVGAnimatedPathData.h
index 79bd586..399b61b 100644
--- a/WebCore/svg/SVGAnimatedPathData.h
+++ b/WebCore/svg/SVGAnimatedPathData.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedPathData_h
#define SVGAnimatedPathData_h
diff --git a/WebCore/svg/SVGAnimatedPathData.idl b/WebCore/svg/SVGAnimatedPathData.idl
index 63a5209..eae1340 100644
--- a/WebCore/svg/SVGAnimatedPathData.idl
+++ b/WebCore/svg/SVGAnimatedPathData.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedPoints.cpp b/WebCore/svg/SVGAnimatedPoints.cpp
index 57101b3..1b73309 100644
--- a/WebCore/svg/SVGAnimatedPoints.cpp
+++ b/WebCore/svg/SVGAnimatedPoints.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGAnimatedPoints.h b/WebCore/svg/SVGAnimatedPoints.h
index 9f44e1f..ec2f2ae 100644
--- a/WebCore/svg/SVGAnimatedPoints.h
+++ b/WebCore/svg/SVGAnimatedPoints.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedPoints_h
#define SVGAnimatedPoints_h
diff --git a/WebCore/svg/SVGAnimatedPoints.idl b/WebCore/svg/SVGAnimatedPoints.idl
index 056b139..11314df 100644
--- a/WebCore/svg/SVGAnimatedPoints.idl
+++ b/WebCore/svg/SVGAnimatedPoints.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl b/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl
index b98ae36..204c145 100644
--- a/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl
+++ b/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedProperty.h b/WebCore/svg/SVGAnimatedProperty.h
index 0e3ceda..d9cbeec 100644
--- a/WebCore/svg/SVGAnimatedProperty.h
+++ b/WebCore/svg/SVGAnimatedProperty.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedProperty_h
#define SVGAnimatedProperty_h
@@ -48,13 +48,13 @@ public:
virtual void setBaseVal(PassType type)
{
m_creator.setBaseValue(type);
- m_contextElement->setSynchronizedSVGAttributes(false);
+ m_contextElement->invalidateSVGAttributes();
}
virtual void setAnimVal(PassType type)
{
m_creator.setValue(type);
- m_contextElement->setSynchronizedSVGAttributes(false);
+ m_contextElement->invalidateSVGAttributes();
}
virtual ReturnType baseVal() const { return m_creator.baseValue(); }
@@ -181,14 +181,14 @@ public: \
{ \
m_##LowerProperty.setValue(type); \
SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
- contextElement->setSynchronizedSVGAttributes(false); \
+ contextElement->invalidateSVGAttributes(); \
} \
\
void set##UpperProperty##BaseValue(SVGAnimatedPropertyTraits<AnimatedType>::PassType type) \
{ \
m_##LowerProperty.setBaseValue(type); \
SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
- contextElement->setSynchronizedSVGAttributes(false); \
+ contextElement->invalidateSVGAttributes(); \
} \
\
void synchronize##UpperProperty() \
diff --git a/WebCore/svg/SVGAnimatedPropertySynchronizer.h b/WebCore/svg/SVGAnimatedPropertySynchronizer.h
index ddd0493..55f77b1 100644
--- a/WebCore/svg/SVGAnimatedPropertySynchronizer.h
+++ b/WebCore/svg/SVGAnimatedPropertySynchronizer.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) Research In Motion Limited 2010. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedPropertySynchronizer_h
#define SVGAnimatedPropertySynchronizer_h
diff --git a/WebCore/svg/SVGAnimatedPropertyTraits.h b/WebCore/svg/SVGAnimatedPropertyTraits.h
index 4e34dbe..5cc69a9 100644
--- a/WebCore/svg/SVGAnimatedPropertyTraits.h
+++ b/WebCore/svg/SVGAnimatedPropertyTraits.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) Research In Motion Limited 2010. All rights reserved.
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedPropertyTraits_h
#define SVGAnimatedPropertyTraits_h
diff --git a/WebCore/svg/SVGAnimatedRect.idl b/WebCore/svg/SVGAnimatedRect.idl
index 1ba4e29..a825c40 100644
--- a/WebCore/svg/SVGAnimatedRect.idl
+++ b/WebCore/svg/SVGAnimatedRect.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimatedString.idl b/WebCore/svg/SVGAnimatedString.idl
index 888c762..3430c2c 100644
--- a/WebCore/svg/SVGAnimatedString.idl
+++ b/WebCore/svg/SVGAnimatedString.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -26,9 +26,9 @@
module svg {
interface [Conditional=SVG] SVGAnimatedString {
- attribute core::DOMString baseVal
+ attribute DOMString baseVal
/*setter raises(DOMException)*/;
- readonly attribute core::DOMString animVal;
+ readonly attribute DOMString animVal;
};
}
diff --git a/WebCore/svg/SVGAnimatedTemplate.h b/WebCore/svg/SVGAnimatedTemplate.h
index 589d724..307c66a 100644
--- a/WebCore/svg/SVGAnimatedTemplate.h
+++ b/WebCore/svg/SVGAnimatedTemplate.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimatedTemplate_h
#define SVGAnimatedTemplate_h
#if ENABLE(SVG)
#include "SVGAnimatedPropertyTraits.h"
+#include <wtf/Forward.h>
#include <wtf/HashMap.h>
namespace WebCore {
@@ -33,7 +34,6 @@ namespace WebCore {
class SVGNumberList;
class SVGPreserveAspectRatio;
class SVGTransformList;
- class String;
class QualifiedName;
struct SVGAnimatedTypeWrapperKey {
diff --git a/WebCore/svg/SVGAnimatedTransformList.idl b/WebCore/svg/SVGAnimatedTransformList.idl
index 280960e..72614a1 100644
--- a/WebCore/svg/SVGAnimatedTransformList.idl
+++ b/WebCore/svg/SVGAnimatedTransformList.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGAnimationElement.cpp b/WebCore/svg/SVGAnimationElement.cpp
index 39abbfc..513274e 100644
--- a/WebCore/svg/SVGAnimationElement.cpp
+++ b/WebCore/svg/SVGAnimationElement.cpp
@@ -1,42 +1,47 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
- Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG_ANIMATION)
#include "SVGAnimationElement.h"
+#include "Attribute.h"
#include "CSSComputedStyleDeclaration.h"
#include "CSSParser.h"
#include "CSSPropertyNames.h"
+#include "Color.h"
#include "Document.h"
#include "Event.h"
#include "EventListener.h"
#include "FloatConversion.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
+#include "PlatformString.h"
+#include "RenderObject.h"
#include "SVGElementInstance.h"
#include "SVGNames.h"
+#include "SVGParserUtilities.h"
#include "SVGURIReference.h"
#include "SVGUseElement.h"
#include "XLinkNames.h"
@@ -87,32 +92,55 @@ fail:
static void parseKeySplines(const String& parse, Vector<UnitBezier>& result)
{
result.clear();
- Vector<String> parseList;
- parse.split(';', parseList);
- for (unsigned n = 0; n < parseList.size(); ++n) {
- Vector<String> parseSpline;
- parseList[n].split(',', parseSpline);
- // The spec says the sepator is a space, all tests use commas. Weird.
- if (parseSpline.size() == 1)
- parseList[n].split(' ', parseSpline);
- if (parseSpline.size() != 4)
- goto fail;
- double curveValues[4];
- for (unsigned i = 0; i < 4; ++i) {
- String parseNumber = parseSpline[i];
- bool ok;
- curveValues[i] = parseNumber.toDouble(&ok);
- if (!ok || curveValues[i] < 0.0 || curveValues[i] > 1.0)
- goto fail;
+ if (parse.isEmpty())
+ return;
+ const UChar* cur = parse.characters();
+ const UChar* end = cur + parse.length();
+
+ skipOptionalSpaces(cur, end);
+
+ bool delimParsed = false;
+ while (cur < end) {
+ delimParsed = false;
+ float posA = 0.0f;
+ if (!parseNumber(cur, end, posA)) {
+ result.clear();
+ return;
}
- result.append(UnitBezier(curveValues[0], curveValues[1], curveValues[2], curveValues[3]));
+
+ float posB = 0.0f;
+ if (!parseNumber(cur, end, posB)) {
+ result.clear();
+ return;
+ }
+
+ float posC = 0.0f;
+ if (!parseNumber(cur, end, posC)) {
+ result.clear();
+ return;
+ }
+
+ float posD = 0.0f;
+ if (!parseNumber(cur, end, posD, false)) {
+ result.clear();
+ return;
+ }
+
+ skipOptionalSpaces(cur, end);
+
+ if (cur < end && *cur == ';') {
+ delimParsed = true;
+ cur++;
+ }
+ skipOptionalSpaces(cur, end);
+
+ result.append(UnitBezier(posA, posB, posC, posD));
}
- return;
-fail:
- result.clear();
+ if (!(cur == end && !delimParsed))
+ result.clear();
}
-void SVGAnimationElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGAnimationElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::valuesAttr)
attr->value().string().split(';', m_values);
@@ -468,6 +496,14 @@ void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float&
effectivePercent = calculatePercentForSpline(effectivePercent, index);
}
}
+static inline void adjustForCurrentColor(String& value, SVGElement* target)
+{
+ if (!target || !target->isStyled() || value != "currentColor")
+ return;
+
+ if (RenderObject* targetRenderer = target->renderer())
+ value = targetRenderer->style()->visitedDependentColor(CSSPropertyColor).name();
+}
void SVGAnimationElement::startedActiveInterval()
{
@@ -476,21 +512,41 @@ void SVGAnimationElement::startedActiveInterval()
if (!hasValidTarget())
return;
+ // These validations are appropriate for all animation modes.
+ if (hasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() != m_keyTimes.size())
+ return;
+
+ CalcMode calcMode = this->calcMode();
+ if (calcMode == CalcModeSpline) {
+ unsigned num = m_keySplines.size() + 1;
+ if ((hasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() != num) || m_values.size() != num)
+ return;
+ }
+
+ String from = fromValue();
+ String to = toValue();
+ String by = byValue();
+ SVGElement* target = targetElement();
AnimationMode animationMode = this->animationMode();
if (animationMode == NoAnimation)
return;
- if (animationMode == FromToAnimation)
- m_animationValid = calculateFromAndToValues(fromValue(), toValue());
- else if (animationMode == ToAnimation) {
+ if (animationMode == FromToAnimation) {
+ adjustForCurrentColor(from, target);
+ adjustForCurrentColor(to, target);
+ m_animationValid = calculateFromAndToValues(from, to);
+ } else if (animationMode == ToAnimation) {
// For to-animations the from value is the current accumulated value from lower priority animations.
// The value is not static and is determined during the animation.
- m_animationValid = calculateFromAndToValues(String(), toValue());
- } else if (animationMode == FromByAnimation)
- m_animationValid = calculateFromAndByValues(fromValue(), byValue());
- else if (animationMode == ByAnimation)
- m_animationValid = calculateFromAndByValues(String(), byValue());
- else if (animationMode == ValuesAnimation) {
- CalcMode calcMode = this->calcMode();
+ adjustForCurrentColor(to, target);
+ m_animationValid = calculateFromAndToValues(String(), to);
+ } else if (animationMode == FromByAnimation) {
+ adjustForCurrentColor(from, target);
+ adjustForCurrentColor(by, target);
+ m_animationValid = calculateFromAndByValues(from, by);
+ } else if (animationMode == ByAnimation) {
+ adjustForCurrentColor(by, target);
+ m_animationValid = calculateFromAndByValues(String(), by);
+ } else if (animationMode == ValuesAnimation) {
m_animationValid = m_values.size() > 1
&& (calcMode == CalcModePaced || !hasAttribute(SVGNames::keyTimesAttr) || hasAttribute(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
&& (calcMode == CalcModeDiscrete || !m_keyTimes.size() || m_keyTimes.last() == 1.0)
@@ -499,7 +555,7 @@ void SVGAnimationElement::startedActiveInterval()
if (calcMode == CalcModePaced && m_animationValid)
calculateKeyTimesForCalcModePaced();
} else if (animationMode == PathAnimation)
- m_animationValid = calcMode() == CalcModePaced || !hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
+ m_animationValid = calcMode == CalcModePaced || !hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
}
void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement)
diff --git a/WebCore/svg/SVGAnimationElement.h b/WebCore/svg/SVGAnimationElement.h
index 27cec88..8e49460 100644
--- a/WebCore/svg/SVGAnimationElement.h
+++ b/WebCore/svg/SVGAnimationElement.h
@@ -1,25 +1,25 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
- Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGAnimationElement_h
#define SVGAnimationElement_h
@@ -47,7 +47,7 @@ namespace WebCore {
SVGAnimationElement(const QualifiedName&, Document*);
virtual ~SVGAnimationElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGAnimationElement.idl b/WebCore/svg/SVGAnimationElement.idl
index e221545..f39f0b8 100644
--- a/WebCore/svg/SVGAnimationElement.idl
+++ b/WebCore/svg/SVGAnimationElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGCircleElement.cpp b/WebCore/svg/SVGCircleElement.cpp
index 10da742..ffbaa7b 100644
--- a/WebCore/svg/SVGCircleElement.cpp
+++ b/WebCore/svg/SVGCircleElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGCircleElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -46,7 +47,7 @@ SVGCircleElement::~SVGCircleElement()
{
}
-void SVGCircleElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGCircleElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -71,16 +72,33 @@ void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ bool isLengthAttribute = attrName == SVGNames::cxAttr
+ || attrName == SVGNames::cyAttr
+ || attrName == SVGNames::rAttr;
+
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
return;
- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr ||
- attrName == SVGNames::rAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (isLengthAttribute) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGCircleElement::synchronizeProperty(const QualifiedName& attrName)
@@ -110,9 +128,11 @@ Path SVGCircleElement::toPathData() const
return Path::createCircle(FloatPoint(cx().value(this), cy().value(this)), r().value(this));
}
-bool SVGCircleElement::hasRelativeValues() const
+bool SVGCircleElement::selfHasRelativeLengths() const
{
- return (cx().isRelative() || cy().isRelative() || r().isRelative());
+ return cx().isRelative()
+ || cy().isRelative()
+ || r().isRelative();
}
}
diff --git a/WebCore/svg/SVGCircleElement.h b/WebCore/svg/SVGCircleElement.h
index 027918c..f436b3c 100644
--- a/WebCore/svg/SVGCircleElement.h
+++ b/WebCore/svg/SVGCircleElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGCircleElement_h
#define SVGCircleElement_h
@@ -39,16 +39,15 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual Path toPathData() const;
- protected:
- virtual bool hasRelativeValues() const;
-
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGCircleElement, SVGNames::cxAttr, SVGLength, Cx, cx)
DECLARE_ANIMATED_PROPERTY(SVGCircleElement, SVGNames::cyAttr, SVGLength, Cy, cy)
DECLARE_ANIMATED_PROPERTY(SVGCircleElement, SVGNames::rAttr, SVGLength, R, r)
diff --git a/WebCore/svg/SVGCircleElement.idl b/WebCore/svg/SVGCircleElement.idl
index a6cb2b2..8381a61 100644
--- a/WebCore/svg/SVGCircleElement.idl
+++ b/WebCore/svg/SVGCircleElement.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp
index 0fa12ff..baaae96 100644
--- a/WebCore/svg/SVGClipPathElement.cpp
+++ b/WebCore/svg/SVGClipPathElement.cpp
@@ -1,32 +1,33 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGClipPathElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
#include "Document.h"
-#include "MappedAttribute.h"
-#include "RenderSVGHiddenContainer.h"
+#include "RenderSVGResourceClipper.h"
#include "SVGNames.h"
#include "SVGTransformList.h"
#include "SVGUnitTypes.h"
@@ -46,7 +47,7 @@ SVGClipPathElement::~SVGClipPathElement()
{
}
-void SVGClipPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGClipPathElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::clipPathUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
@@ -68,7 +69,8 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!m_clipper)
+ RenderObject* object = renderer();
+ if (!object)
return;
if (attrName == SVGNames::clipPathUnitsAttr ||
@@ -76,7 +78,7 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName)
SVGLangSpace::isKnownAttribute(attrName) ||
SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
SVGStyledTransformableElement::isKnownAttribute(attrName))
- m_clipper->invalidate();
+ object->setNeedsLayout(true);
}
void SVGClipPathElement::synchronizeProperty(const QualifiedName& attrName)
@@ -99,44 +101,16 @@ void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang
{
SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- if (!m_clipper)
+ if (changedByParser)
return;
- m_clipper->invalidate();
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
RenderObject* SVGClipPathElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- return new (arena) RenderSVGHiddenContainer(this);
-}
-
-SVGResource* SVGClipPathElement::canvasResource(const RenderObject*)
-{
- if (!m_clipper)
- m_clipper = SVGResourceClipper::create();
- else
- m_clipper->resetClipData();
-
- bool bbox = clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
-
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyledTransformable())
- continue;
- SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(node);
- RenderStyle* style = styled->renderer() ? styled->renderer()->style() : 0;
- if (!style || style->display() == NONE)
- continue;
- Path pathData = styled->toClipPath();
- if (pathData.isEmpty())
- continue;
- m_clipper->addClipData(pathData, style->svgStyle()->clipRule(), bbox);
- }
- if (m_clipper->clipData().isEmpty()) {
- Path pathData;
- pathData.addRect(FloatRect());
- m_clipper->addClipData(pathData, RULE_EVENODD, bbox);
- }
- return m_clipper.get();
+ return new (arena) RenderSVGResourceClipper(this);
}
}
diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h
index cf7ff2b..85dd05e 100644
--- a/WebCore/svg/SVGClipPathElement.h
+++ b/WebCore/svg/SVGClipPathElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGClipPathElement_h
#define SVGClipPathElement_h
@@ -25,40 +25,37 @@
#include "RenderObject.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
-#include "SVGResourceClipper.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
namespace WebCore {
- class SVGClipPathElement : public SVGStyledTransformableElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired {
- public:
- SVGClipPathElement(const QualifiedName&, Document*);
- virtual ~SVGClipPathElement();
+class SVGClipPathElement : public SVGStyledTransformableElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired {
+public:
+ SVGClipPathElement(const QualifiedName&, Document*);
+ virtual ~SVGClipPathElement();
- virtual bool isValid() const { return SVGTests::isValid(); }
+ virtual bool isValid() const { return SVGTests::isValid(); }
+ virtual bool needsPendingResourceHandling() const { return false; }
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void svgAttributeChanged(const QualifiedName&);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual SVGResource* canvasResource(const RenderObject*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGClipPathElement, SVGNames::clipPathUnitsAttr, int, ClipPathUnits, clipPathUnits)
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGClipPathElement, SVGNames::clipPathUnitsAttr, int, ClipPathUnits, clipPathUnits)
- // SVGExternalResourcesRequired
- DECLARE_ANIMATED_PROPERTY(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+ // SVGExternalResourcesRequired
+ DECLARE_ANIMATED_PROPERTY(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+};
- RefPtr<SVGResourceClipper> m_clipper;
- };
+}
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
+#endif
#endif
diff --git a/WebCore/svg/SVGClipPathElement.idl b/WebCore/svg/SVGClipPathElement.idl
index 40eca87..3dbc609 100644
--- a/WebCore/svg/SVGClipPathElement.idl
+++ b/WebCore/svg/SVGClipPathElement.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGColor.cpp b/WebCore/svg/SVGColor.cpp
index ede0b0a..bacead9 100644
--- a/WebCore/svg/SVGColor.cpp
+++ b/WebCore/svg/SVGColor.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
@@ -77,10 +77,7 @@ void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec)
Color SVGColor::colorFromRGBColorString(const String& colorString)
{
String s = colorString.stripWhiteSpace();
- // hsl, hsla and rgba are not in the SVG spec.
// FIXME: rework css parser so it is more svg aware
- if (s.startsWith("hsl") || s.startsWith("rgba"))
- return Color();
RGBA32 color;
if (CSSParser::parseColor(color, s))
return color;
diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h
index 406166b..c181b6b 100644
--- a/WebCore/svg/SVGColor.h
+++ b/WebCore/svg/SVGColor.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGColor_h
#define SVGColor_h
diff --git a/WebCore/svg/SVGColor.idl b/WebCore/svg/SVGColor.idl
index 32a2683..d7af0e9 100644
--- a/WebCore/svg/SVGColor.idl
+++ b/WebCore/svg/SVGColor.idl
@@ -1,27 +1,27 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
- interface [Conditional=SVG] SVGColor : css::CSSValue {
+ interface [Conditional=SVG] SVGColor : CSSValue {
// Color Types
const unsigned short SVG_COLORTYPE_UNKNOWN = 0;
const unsigned short SVG_COLORTYPE_RGBCOLOR = 1;
@@ -29,17 +29,17 @@ module svg {
const unsigned short SVG_COLORTYPE_CURRENTCOLOR = 3;
readonly attribute unsigned short colorType;
- readonly attribute css::RGBColor rgbColor;
+ readonly attribute RGBColor rgbColor;
/*readonly attribute SVGICCColor iccColor;*/
- void setRGBColor(in core::DOMString rgbColor)
+ void setRGBColor(in DOMString rgbColor)
raises(SVGException);
- void setRGBColorICCColor(in core::DOMString rgbColor,
- in core::DOMString iccColor)
+ void setRGBColorICCColor(in DOMString rgbColor,
+ in DOMString iccColor)
raises(SVGException);
void setColor(in unsigned short colorType,
- in core::DOMString rgbColor,
- in core::DOMString iccColor)
+ in DOMString rgbColor,
+ in DOMString iccColor)
raises(SVGException);
};
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
index f61b2ea..7c6cb85 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.cpp
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
@@ -1,29 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGComponentTransferFunctionElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGFEComponentTransferElement.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
@@ -44,7 +44,7 @@ SVGComponentTransferFunctionElement::~SVGComponentTransferFunctionElement()
{
}
-void SVGComponentTransferFunctionElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGComponentTransferFunctionElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.h b/WebCore/svg/SVGComponentTransferFunctionElement.h
index 9862a99..91f0767 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.h
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGComponentTransferFunctionElement_h
#define SVGComponentTransferFunctionElement_h
@@ -34,7 +34,7 @@ namespace WebCore {
SVGComponentTransferFunctionElement(const QualifiedName&, Document*);
virtual ~SVGComponentTransferFunctionElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
ComponentTransferFunction transferFunction() const;
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.idl b/WebCore/svg/SVGComponentTransferFunctionElement.idl
index 950f77d..e4a2596 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.idl
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,7 +25,10 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGComponentTransferFunctionElement : SVGElement {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGComponentTransferFunctionElement : SVGElement {
// Component Transfer Types
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1;
diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp
index e904516..cc3dfd1 100644
--- a/WebCore/svg/SVGCursorElement.cpp
+++ b/WebCore/svg/SVGCursorElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -25,7 +25,6 @@
#include "Attr.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -48,7 +47,7 @@ SVGCursorElement::~SVGCursorElement()
(*it)->setCursorElement(0);
}
-void SVGCursorElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGCursorElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
diff --git a/WebCore/svg/SVGCursorElement.h b/WebCore/svg/SVGCursorElement.h
index 0978124..fe2d647 100644
--- a/WebCore/svg/SVGCursorElement.h
+++ b/WebCore/svg/SVGCursorElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGCursorElement_h
#define SVGCursorElement_h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGCursorElement.idl b/WebCore/svg/SVGCursorElement.idl
index f307933..3ff701f 100644
--- a/WebCore/svg/SVGCursorElement.idl
+++ b/WebCore/svg/SVGCursorElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGDefsElement.cpp b/WebCore/svg/SVGDefsElement.cpp
index e7bf51d..660e0d1 100644
--- a/WebCore/svg/SVGDefsElement.cpp
+++ b/WebCore/svg/SVGDefsElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGDefsElement.h b/WebCore/svg/SVGDefsElement.h
index cb62d45..1d84dd5 100644
--- a/WebCore/svg/SVGDefsElement.h
+++ b/WebCore/svg/SVGDefsElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGDefsElement_h
#define SVGDefsElement_h
diff --git a/WebCore/svg/SVGDefsElement.idl b/WebCore/svg/SVGDefsElement.idl
index ed432cc..e90b0b6 100644
--- a/WebCore/svg/SVGDefsElement.idl
+++ b/WebCore/svg/SVGDefsElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGDescElement.cpp b/WebCore/svg/SVGDescElement.cpp
index 319dfda..58a7e01 100644
--- a/WebCore/svg/SVGDescElement.cpp
+++ b/WebCore/svg/SVGDescElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGDescElement.h b/WebCore/svg/SVGDescElement.h
index 846a23e..23374ef 100644
--- a/WebCore/svg/SVGDescElement.h
+++ b/WebCore/svg/SVGDescElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGDescElement_h
#define SVGDescElement_h
diff --git a/WebCore/svg/SVGDescElement.idl b/WebCore/svg/SVGDescElement.idl
index 720f487..eceab2d 100644
--- a/WebCore/svg/SVGDescElement.idl
+++ b/WebCore/svg/SVGDescElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGDocument.cpp b/WebCore/svg/SVGDocument.cpp
index 2264a11..c31ca9e 100644
--- a/WebCore/svg/SVGDocument.cpp
+++ b/WebCore/svg/SVGDocument.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
@@ -35,8 +35,8 @@
namespace WebCore {
-SVGDocument::SVGDocument(Frame* frame)
- : Document(frame, false, false)
+SVGDocument::SVGDocument(Frame* frame, const KURL& url)
+ : Document(frame, url, false, false)
{
}
diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h
index c7006f9..b5d4076 100644
--- a/WebCore/svg/SVGDocument.h
+++ b/WebCore/svg/SVGDocument.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGDocument_h
#define SVGDocument_h
@@ -33,9 +33,9 @@ namespace WebCore {
class SVGDocument : public Document {
public:
- static PassRefPtr<SVGDocument> create(Frame* frame)
+ static PassRefPtr<SVGDocument> create(Frame* frame, const KURL& url)
{
- return adoptRef(new SVGDocument(frame));
+ return adoptRef(new SVGDocument(frame, url));
}
virtual ~SVGDocument();
@@ -51,7 +51,7 @@ namespace WebCore {
void updatePan(const FloatPoint& pos) const;
private:
- SVGDocument(Frame*);
+ SVGDocument(Frame*, const KURL&);
virtual bool isSVGDocument() const { return true; }
diff --git a/WebCore/svg/SVGDocument.idl b/WebCore/svg/SVGDocument.idl
index 26b70d1..fbf02ea 100644
--- a/WebCore/svg/SVGDocument.idl
+++ b/WebCore/svg/SVGDocument.idl
@@ -1,32 +1,32 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
- interface [Conditional=SVG] SVGDocument : core::Document {
+ interface [Conditional=SVG] SVGDocument : Document {
readonly attribute SVGSVGElement rootElement;
// Overwrite the one in events::DocumentEvent
- events::Event createEvent(in core::DOMString eventType)
- raises(core::DOMException);
+ Event createEvent(in DOMString eventType)
+ raises(DOMException);
};
}
diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp
index b2492b4..819d12b 100644
--- a/WebCore/svg/SVGDocumentExtensions.cpp
+++ b/WebCore/svg/SVGDocumentExtensions.cpp
@@ -1,32 +1,29 @@
/*
- Copyright (C) 2006 Apple Computer, Inc.
- 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2007 Rob Buis <buis@kde.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGDocumentExtensions.h"
-#include "AtomicString.h"
#include "Console.h"
#include "DOMWindow.h"
#include "Document.h"
@@ -34,16 +31,18 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "Page.h"
+#include "SMILTimeContainer.h"
#include "SVGSMILElement.h"
#include "SVGSVGElement.h"
-#include "SMILTimeContainer.h"
-#include "XMLTokenizer.h"
#include "ScriptController.h"
+#include "ScriptableDocumentParser.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
SVGDocumentExtensions::SVGDocumentExtensions(Document* doc)
: m_doc(doc)
+ , m_resourcesCache(new SVGResourcesCache)
{
}
@@ -62,6 +61,33 @@ void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element)
m_timeContainers.remove(element);
}
+void SVGDocumentExtensions::addResource(const AtomicString& id, RenderSVGResourceContainer* resource)
+{
+ ASSERT(resource);
+
+ if (id.isEmpty())
+ return;
+
+ // Replaces resource if already present, to handle potential id changes
+ m_resources.set(id, resource);
+}
+
+void SVGDocumentExtensions::removeResource(const AtomicString& id)
+{
+ if (id.isEmpty() || !m_resources.contains(id))
+ return;
+
+ m_resources.remove(id);
+}
+
+RenderSVGResourceContainer* SVGDocumentExtensions::resourceById(const AtomicString& id) const
+{
+ if (id.isEmpty())
+ return 0;
+
+ return m_resources.get(id);
+}
+
void SVGDocumentExtensions::startAnimations()
{
// FIXME: Eventually every "Time Container" will need a way to latch on to some global timer
@@ -89,6 +115,12 @@ void SVGDocumentExtensions::unpauseAnimations()
bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time)
{
+#if !ENABLE(SVG_ANIMATION)
+ UNUSED_PARAM(elementId);
+ UNUSED_PARAM(element);
+ UNUSED_PARAM(time);
+ return false;
+#else
ASSERT(element);
SMILTimeContainer* container = element->timeContainer();
if (!container || container->isPaused())
@@ -96,18 +128,32 @@ bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSM
container->sampleAnimationAtTime(elementId, time);
return true;
+#endif
+}
+
+// FIXME: Callers should probably use ScriptController::eventHandlerLineNumber()
+static int parserLineNumber(Document* document)
+{
+ ScriptableDocumentParser* parser = document->scriptableDocumentParser();
+ if (!parser)
+ return 1;
+ return parser->lineNumber();
+}
+
+static void reportMessage(Document* document, MessageLevel level, const String& message)
+{
+ if (Frame* frame = document->frame())
+ frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, parserLineNumber(document), String());
}
void SVGDocumentExtensions::reportWarning(const String& message)
{
- if (Frame* frame = m_doc->frame())
- frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+ reportMessage(m_doc, WarningMessageLevel, "Warning: " + message);
}
void SVGDocumentExtensions::reportError(const String& message)
{
- if (Frame* frame = m_doc->frame())
- frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+ reportMessage(m_doc, ErrorMessageLevel, "Error: " + message);
}
void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
@@ -120,7 +166,7 @@ void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyled
if (m_pendingResources.contains(id))
m_pendingResources.get(id)->add(obj);
else {
- HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>();
+ HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>;
set->add(obj);
m_pendingResources.add(id, set);
@@ -135,13 +181,13 @@ bool SVGDocumentExtensions::isPendingResource(const AtomicString& id) const
return m_pendingResources.contains(id);
}
-std::auto_ptr<HashSet<SVGStyledElement*> > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
+PassOwnPtr<HashSet<SVGStyledElement*> > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
{
ASSERT(m_pendingResources.contains(id));
- std::auto_ptr<HashSet<SVGStyledElement*> > set(m_pendingResources.get(id));
+ OwnPtr<HashSet<SVGStyledElement*> > set(m_pendingResources.get(id));
m_pendingResources.remove(id);
- return set;
+ return set.release();
}
}
diff --git a/WebCore/svg/SVGDocumentExtensions.h b/WebCore/svg/SVGDocumentExtensions.h
index 050e6f6..da23cd0 100644
--- a/WebCore/svg/SVGDocumentExtensions.h
+++ b/WebCore/svg/SVGDocumentExtensions.h
@@ -1,41 +1,39 @@
/*
- Copyright (C) 2006 Apple Computer, Inc.
- 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGDocumentExtensions_h
#define SVGDocumentExtensions_h
#if ENABLE(SVG)
-#include <memory>
-
-#include <wtf/HashSet.h>
+#include "SVGResourcesCache.h"
+#include <wtf/Forward.h>
#include <wtf/HashMap.h>
-
-#include "StringHash.h"
-#include "StringImpl.h"
+#include <wtf/HashSet.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/StringImpl.h>
namespace WebCore {
class Document;
-class String;
+class RenderSVGResourceContainer;
class SVGStyledElement;
class SVGSMILElement;
class SVGSVGElement;
@@ -47,7 +45,11 @@ public:
void addTimeContainer(SVGSVGElement*);
void removeTimeContainer(SVGSVGElement*);
-
+
+ void addResource(const AtomicString& id, RenderSVGResourceContainer*);
+ void removeResource(const AtomicString& id);
+ RenderSVGResourceContainer* resourceById(const AtomicString& id) const;
+
void startAnimations();
void pauseAnimations();
void unpauseAnimations();
@@ -56,10 +58,14 @@ public:
void reportWarning(const String&);
void reportError(const String&);
+ SVGResourcesCache* resourcesCache() const { return m_resourcesCache.get(); }
+
private:
Document* m_doc; // weak reference
HashSet<SVGSVGElement*> m_timeContainers; // For SVG 1.2 support this will need to be made more general.
- HashMap<String, HashSet<SVGStyledElement*>*> m_pendingResources;
+ HashMap<AtomicString, RenderSVGResourceContainer*> m_resources;
+ HashMap<AtomicString, HashSet<SVGStyledElement*>*> m_pendingResources;
+ OwnPtr<SVGResourcesCache> m_resourcesCache;
SVGDocumentExtensions(const SVGDocumentExtensions&);
SVGDocumentExtensions& operator=(const SVGDocumentExtensions&);
@@ -70,7 +76,7 @@ public:
// For instance, dynamically build gradients / patterns / clippers...
void addPendingResource(const AtomicString& id, SVGStyledElement*);
bool isPendingResource(const AtomicString& id) const;
- std::auto_ptr<HashSet<SVGStyledElement*> > removePendingResource(const AtomicString& id);
+ PassOwnPtr<HashSet<SVGStyledElement*> > removePendingResource(const AtomicString& id);
};
}
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index 19c5f3b..37e4930 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
- Copyright (C) 2008 Alp Toker <alp@atoker.com>
- Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
+ * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGElement.h"
+#include "Attribute.h"
#include "CSSCursorImageValue.h"
#include "DOMImplementation.h"
#include "Document.h"
@@ -34,14 +35,12 @@
#include "EventNames.h"
#include "FrameView.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "RegisteredEventListener.h"
#include "RenderObject.h"
#include "SVGCursorElement.h"
#include "SVGElementInstance.h"
#include "SVGElementRareData.h"
#include "SVGNames.h"
-#include "SVGResource.h"
#include "SVGSVGElement.h"
#include "SVGURIReference.h"
#include "SVGUseElement.h"
@@ -53,7 +52,7 @@ namespace WebCore {
using namespace HTMLNames;
SVGElement::SVGElement(const QualifiedName& tagName, Document* document)
- : StyledElement(tagName, document, CreateElementZeroRefCount)
+ : StyledElement(tagName, document, CreateSVGElementZeroRefCount)
{
}
@@ -96,7 +95,7 @@ SVGElementRareData* SVGElement::ensureRareSVGData()
ASSERT(!SVGElementRareData::rareDataMap().contains(this));
SVGElementRareData* data = new SVGElementRareData;
SVGElementRareData::rareDataMap().set(this, data);
- m_hasRareSVGData = true;
+ setHasRareSVGData();
return data;
}
@@ -190,7 +189,7 @@ void SVGElement::setCursorImageValue(CSSCursorImageValue* cursorImageValue)
ensureRareSVGData()->setCursorImageValue(cursorImageValue);
}
-void SVGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGElement::parseMappedAttribute(Attribute* attr)
{
// standard events
if (attr->name() == onloadAttr)
@@ -208,9 +207,9 @@ void SVGElement::parseMappedAttribute(MappedAttribute* attr)
else if (attr->name() == onmouseupAttr)
setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, attr));
else if (attr->name() == SVGNames::onfocusinAttr)
- setAttributeEventListener(eventNames().DOMFocusInEvent, createAttributeEventListener(this, attr));
+ setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attr));
else if (attr->name() == SVGNames::onfocusoutAttr)
- setAttributeEventListener(eventNames().DOMFocusOutEvent, createAttributeEventListener(this, attr));
+ setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attr));
else if (attr->name() == SVGNames::onactivateAttr)
setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, attr));
else
@@ -279,22 +278,22 @@ bool SVGElement::childShouldCreateRenderer(Node* child) const
void SVGElement::insertedIntoDocument()
{
StyledElement::insertedIntoDocument();
- SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
-
- String resourceId = SVGURIReference::getTarget(getAttribute(idAttributeName()));
- if (extensions->isPendingResource(resourceId)) {
- std::auto_ptr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId));
- if (clients->isEmpty())
- return;
- HashSet<SVGStyledElement*>::const_iterator it = clients->begin();
- const HashSet<SVGStyledElement*>::const_iterator end = clients->end();
+ if (!needsPendingResourceHandling())
+ return;
- for (; it != end; ++it)
- (*it)->buildPendingResource();
+ SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
+ String resourceId = getIdAttribute();
+ if (!extensions->isPendingResource(resourceId))
+ return;
+
+ OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId));
+ if (clients->isEmpty())
+ return;
- SVGResource::invalidateClients(*clients);
- }
+ const HashSet<SVGStyledElement*>::const_iterator end = clients->end();
+ for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it)
+ (*it)->buildPendingResource();
}
void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
@@ -304,31 +303,39 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
return;
StyledElement::attributeChanged(attr, preserveDecls);
- svgAttributeChanged(attr->name());
+
+ // When an animated SVG property changes through SVG DOM, svgAttributeChanged() is called, not attributeChanged().
+ // Next time someone tries to access the XML attributes, the synchronization code starts. During that synchronization
+ // SVGAnimatedPropertySynchronizer may call NamedNodeMap::removeAttribute(), which in turn calls attributeChanged().
+ // At this point we're not allowed to call svgAttributeChanged() again - it may lead to extra work being done, or crashes
+ // see bug https://bugs.webkit.org/show_bug.cgi?id=40994.
+ if (isSynchronizingSVGAttributes())
+ return;
+
+ // Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods),
+ // so we don't want changes to the style attribute to result in extra work here.
+ if (attr->name() != HTMLNames::styleAttr)
+ svgAttributeChanged(attr->name());
}
void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const
{
- ASSERT(!m_areSVGAttributesValid);
-
- if (m_synchronizingSVGAttributes)
+ if (isSynchronizingSVGAttributes() || areSVGAttributesValid())
return;
- m_synchronizingSVGAttributes = true;
+ setIsSynchronizingSVGAttributes();
const_cast<SVGElement*>(this)->synchronizeProperty(name);
if (name == anyQName())
- m_areSVGAttributesValid = true;
+ setAreSVGAttributesValid();
- m_synchronizingSVGAttributes = false;
+ clearIsSynchronizingSVGAttributes();
}
ContainerNode* SVGElement::eventParentNode()
{
- if (Node* shadowParent = shadowParentNode()) {
- ASSERT(shadowParent->isContainerNode());
- return static_cast<ContainerNode*>(shadowParent);
- }
+ if (ContainerNode* shadowParent = shadowParentNode())
+ return shadowParent;
return StyledElement::eventParentNode();
}
diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 88d7412..255c7be 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2009 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGElement_h
#define SVGElement_h
@@ -49,7 +49,7 @@ namespace WebCore {
SVGDocumentExtensions* accessDocumentSVGExtensions() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual bool isStyled() const { return false; }
virtual bool isStyledTransformable() const { return false; }
@@ -72,20 +72,21 @@ namespace WebCore {
virtual AffineTransform* supplementalTransform() { return 0; }
- void setSynchronizedSVGAttributes(bool value) { m_areSVGAttributesValid = value; }
+ void invalidateSVGAttributes() { clearAreSVGAttributesValid(); }
const HashSet<SVGElementInstance*>& instancesForElement() const;
void setCursorElement(SVGCursorElement*);
void setCursorImageValue(CSSCursorImageValue*);
+ virtual void updateAnimatedSVGAttribute(const QualifiedName&) const;
+
protected:
SVGElement(const QualifiedName&, Document*);
virtual void finishParsingChildren();
virtual void insertedIntoDocument();
virtual void attributeChanged(Attribute*, bool preserveDecls = false);
- virtual void updateAnimatedSVGAttribute(const QualifiedName&) const;
SVGElementRareData* rareSVGData() const;
SVGElementRareData* ensureRareSVGData();
@@ -93,10 +94,11 @@ namespace WebCore {
private:
friend class SVGElementInstance;
- virtual bool isSVGElement() const { return true; }
virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
virtual ContainerNode* eventParentNode();
+
+ virtual bool needsPendingResourceHandling() const { return true; }
virtual void buildPendingResource() { }
void mapInstanceToElement(SVGElementInstance*);
diff --git a/WebCore/svg/SVGElement.idl b/WebCore/svg/SVGElement.idl
index 27fcb8d..956fa32 100644
--- a/WebCore/svg/SVGElement.idl
+++ b/WebCore/svg/SVGElement.idl
@@ -1,32 +1,30 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
interface [GenerateNativeConverter, Conditional=SVG] SVGElement : Element {
- attribute [ConvertNullToNullString, Reflect] DOMString id
- setter raises(DOMException);
- attribute [ConvertNullToNullString] DOMString xmlbase
- setter raises(DOMException);
+ attribute [Reflect] DOMString id setter raises(DOMException);
+ attribute [ConvertNullToNullString] DOMString xmlbase setter raises(DOMException);
readonly attribute SVGSVGElement ownerSVGElement;
readonly attribute SVGElement viewportElement;
};
diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp
index ca0a70c..f2812dd 100644
--- a/WebCore/svg/SVGElementInstance.cpp
+++ b/WebCore/svg/SVGElementInstance.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) Research In Motion Limited 2010. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -89,7 +89,7 @@ void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child)
void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element)
{
- if (!element)
+ if (!element || !element->inDocument())
return;
if (element->isStyled() && static_cast<SVGStyledElement*>(element)->instanceUpdatesBlocked())
@@ -105,6 +105,9 @@ void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element)
ASSERT((*it)->correspondingElement() == element);
(*it)->correspondingUseElement()->invalidateShadowTree();
}
+
+ // Be sure to rebuild use trees, if needed
+ element->document()->updateLayoutIgnorePendingStylesheets();
}
ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const
@@ -144,15 +147,18 @@ bool SVGElementInstance::dispatchEvent(PassRefPtr<Event> prpEvent)
EventTargetData* SVGElementInstance::eventTargetData()
{
- return m_element->eventTargetData();
+ // EventTarget would use these methods if we were actually using its add/removeEventListener logic.
+ // As we're forwarding those calls to the correspondingElement(), no one should ever call this function.
+ ASSERT_NOT_REACHED();
+ return 0;
}
EventTargetData* SVGElementInstance::ensureEventTargetData()
{
- // Avoid crashing - return a default dummy value
- DEFINE_STATIC_LOCAL(EventTargetData, dummyEventTargetData, ());
- dummyEventTargetData.eventListenerMap.clear();
- return &dummyEventTargetData;
+ // EventTarget would use these methods if we were actually using its add/removeEventListener logic.
+ // As we're forwarding those calls to the correspondingElement(), no one should ever call this function.
+ ASSERT_NOT_REACHED();
+ return 0;
}
}
diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h
index 58152be..54471c1 100644
--- a/WebCore/svg/SVGElementInstance.h
+++ b/WebCore/svg/SVGElementInstance.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGElementInstance_h
#define SVGElementInstance_h
diff --git a/WebCore/svg/SVGElementInstance.idl b/WebCore/svg/SVGElementInstance.idl
index cd4213c..f5c2cb8 100644
--- a/WebCore/svg/SVGElementInstance.idl
+++ b/WebCore/svg/SVGElementInstance.idl
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -28,10 +28,7 @@ module svg {
interface [
Conditional=SVG,
- CustomListeners,
CustomMarkFunction,
- CustomPushEventHandlerScope,
- CustomToJS,
GenerateNativeConverter
] SVGElementInstance
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
@@ -90,12 +87,12 @@ module svg {
attribute [DontEnum] EventListener onsubmit;
attribute [DontEnum] EventListener onunload;
- [Custom] void addEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
- [Custom] void removeEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
+ void addEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ void removeEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
boolean dispatchEvent(in Event event)
raises(EventException);
#endif /* defined(LANGUAGE_OBJECTIVE_C) */
diff --git a/WebCore/svg/SVGElementInstanceList.cpp b/WebCore/svg/SVGElementInstanceList.cpp
index 9404734..0c04e10 100644
--- a/WebCore/svg/SVGElementInstanceList.cpp
+++ b/WebCore/svg/SVGElementInstanceList.cpp
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGElementInstanceList.h b/WebCore/svg/SVGElementInstanceList.h
index 9da4cdc..4a4bbcb 100644
--- a/WebCore/svg/SVGElementInstanceList.h
+++ b/WebCore/svg/SVGElementInstanceList.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGElementInstanceList_h
#define SVGElementInstanceList_h
diff --git a/WebCore/svg/SVGElementInstanceList.idl b/WebCore/svg/SVGElementInstanceList.idl
index 434ad19..ea26fc2 100644
--- a/WebCore/svg/SVGElementInstanceList.idl
+++ b/WebCore/svg/SVGElementInstanceList.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGElementRareData.h b/WebCore/svg/SVGElementRareData.h
index 4e7f671..4276c4a 100644
--- a/WebCore/svg/SVGElementRareData.h
+++ b/WebCore/svg/SVGElementRareData.h
@@ -15,7 +15,6 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
#ifndef SVGElementRareData_h
diff --git a/WebCore/svg/SVGEllipseElement.cpp b/WebCore/svg/SVGEllipseElement.cpp
index a7400fa..128b5e0 100644
--- a/WebCore/svg/SVGEllipseElement.cpp
+++ b/WebCore/svg/SVGEllipseElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGEllipseElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -47,7 +48,7 @@ SVGEllipseElement::~SVGEllipseElement()
{
}
-void SVGEllipseElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGEllipseElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -76,16 +77,34 @@ void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ bool isLengthAttribute = attrName == SVGNames::cxAttr
+ || attrName == SVGNames::cyAttr
+ || attrName == SVGNames::rxAttr
+ || attrName == SVGNames::ryAttr;
+
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
return;
- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr ||
- attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (isLengthAttribute) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGEllipseElement::synchronizeProperty(const QualifiedName& attrName)
@@ -119,10 +138,12 @@ Path SVGEllipseElement::toPathData() const
rx().value(this), ry().value(this));
}
-bool SVGEllipseElement::hasRelativeValues() const
+bool SVGEllipseElement::selfHasRelativeLengths() const
{
- return (cx().isRelative() || cy().isRelative() ||
- rx().isRelative() || ry().isRelative());
+ return cx().isRelative()
+ || cy().isRelative()
+ || rx().isRelative()
+ || ry().isRelative();
}
}
diff --git a/WebCore/svg/SVGEllipseElement.h b/WebCore/svg/SVGEllipseElement.h
index adaa0d2..85ec4c8 100644
--- a/WebCore/svg/SVGEllipseElement.h
+++ b/WebCore/svg/SVGEllipseElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGEllipseElement_h
#define SVGEllipseElement_h
@@ -39,16 +39,15 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual Path toPathData() const;
- protected:
- virtual bool hasRelativeValues() const;
-
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGEllipseElement, SVGNames::cxAttr, SVGLength, Cx, cx)
DECLARE_ANIMATED_PROPERTY(SVGEllipseElement, SVGNames::cyAttr, SVGLength, Cy, cy)
DECLARE_ANIMATED_PROPERTY(SVGEllipseElement, SVGNames::rxAttr, SVGLength, Rx, rx)
diff --git a/WebCore/svg/SVGEllipseElement.idl b/WebCore/svg/SVGEllipseElement.idl
index d3b2422..bb9f95c 100644
--- a/WebCore/svg/SVGEllipseElement.idl
+++ b/WebCore/svg/SVGEllipseElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGException.h b/WebCore/svg/SVGException.h
index b82adf7..ef54080 100644
--- a/WebCore/svg/SVGException.h
+++ b/WebCore/svg/SVGException.h
@@ -16,7 +16,6 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
#ifndef SVGException_h
diff --git a/WebCore/svg/SVGException.idl b/WebCore/svg/SVGException.idl
index db565ff..3f1f8ec 100644
--- a/WebCore/svg/SVGException.idl
+++ b/WebCore/svg/SVGException.idl
@@ -21,7 +21,8 @@
module svg {
interface [
- Conditional=SVG
+ Conditional=SVG,
+ DontCheckEnums
] SVGException {
readonly attribute unsigned short code;
diff --git a/WebCore/svg/SVGExternalResourcesRequired.cpp b/WebCore/svg/SVGExternalResourcesRequired.cpp
index 99bc5eb..981b056 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.cpp
+++ b/WebCore/svg/SVGExternalResourcesRequired.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,7 +24,6 @@
#include "SVGExternalResourcesRequired.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGElement.h"
#include "SVGNames.h"
@@ -38,7 +37,7 @@ SVGExternalResourcesRequired::~SVGExternalResourcesRequired()
{
}
-bool SVGExternalResourcesRequired::parseMappedAttribute(MappedAttribute* attr)
+bool SVGExternalResourcesRequired::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::externalResourcesRequiredAttr) {
setExternalResourcesRequiredBaseValue(attr->value() == "true");
diff --git a/WebCore/svg/SVGExternalResourcesRequired.h b/WebCore/svg/SVGExternalResourcesRequired.h
index b2a741d..44b6ae7 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.h
+++ b/WebCore/svg/SVGExternalResourcesRequired.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGExternalResourcesRequired_h
#define SVGExternalResourcesRequired_h
@@ -27,7 +27,7 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
// Notes on a SVG 1.1 spec discrepancy:
// The SVG DOM defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the
@@ -39,7 +39,7 @@ namespace WebCore {
SVGExternalResourcesRequired();
virtual ~SVGExternalResourcesRequired();
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
protected:
diff --git a/WebCore/svg/SVGExternalResourcesRequired.idl b/WebCore/svg/SVGExternalResourcesRequired.idl
index c1a0352..62e2c5d 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.idl
+++ b/WebCore/svg/SVGExternalResourcesRequired.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp
index 46c412c..e944d61 100644
--- a/WebCore/svg/SVGFEBlendElement.cpp
+++ b/WebCore/svg/SVGFEBlendElement.cpp
@@ -1,30 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEBlendElement.h"
-#include "MappedAttribute.h"
-#include "SVGResourceFilter.h"
+#include "Attribute.h"
namespace WebCore {
@@ -38,7 +37,7 @@ SVGFEBlendElement::~SVGFEBlendElement()
{
}
-void SVGFEBlendElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEBlendElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::modeAttr) {
@@ -79,18 +78,15 @@ void SVGFEBlendElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeIn2();
}
-bool SVGFEBlendElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
+ FilterEffect* input2 = filterBuilder->getEffectById(in2());
if (!input1 || !input2)
- return false;
-
- RefPtr<FilterEffect> effect = FEBlend::create(input1, input2, static_cast<BlendModeType>(mode()));
- filterResource->addFilterEffect(this, effect.release());
+ return 0;
- return true;
+ return FEBlend::create(input1, input2, static_cast<BlendModeType>(mode()));
}
}
diff --git a/WebCore/svg/SVGFEBlendElement.h b/WebCore/svg/SVGFEBlendElement.h
index 7e32244..2ffa93e 100644
--- a/WebCore/svg/SVGFEBlendElement.h
+++ b/WebCore/svg/SVGFEBlendElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEBlendElement_h
#define SVGFEBlendElement_h
@@ -26,20 +26,20 @@
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
- class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEBlendElement(const QualifiedName&, Document*);
- virtual ~SVGFEBlendElement();
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::in2Attr, String, In2, in2)
- DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::modeAttr, int, Mode, mode)
- };
+class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEBlendElement(const QualifiedName&, Document*);
+ virtual ~SVGFEBlendElement();
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::in2Attr, String, In2, in2)
+ DECLARE_ANIMATED_PROPERTY(SVGFEBlendElement, SVGNames::modeAttr, int, Mode, mode)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEBlendElement.idl b/WebCore/svg/SVGFEBlendElement.idl
index bb6d86d..03a5543 100644
--- a/WebCore/svg/SVGFEBlendElement.idl
+++ b/WebCore/svg/SVGFEBlendElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFEBlendElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFEBlendElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Blend Mode Types
const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0;
const unsigned short SVG_FEBLEND_MODE_NORMAL = 1;
diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp
index e27ad86..d7c10d1 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -1,32 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEColorMatrixElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -41,7 +40,7 @@ SVGFEColorMatrixElement::~SVGFEColorMatrixElement()
{
}
-void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEColorMatrixElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
@@ -81,25 +80,49 @@ void SVGFEColorMatrixElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeValues();
}
-bool SVGFEColorMatrixElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
- Vector<float> _values;
+ Vector<float> filterValues;
SVGNumberList* numbers = values();
+ const ColorMatrixType filterType(static_cast<ColorMatrixType>(type()));
+
+ // Use defaults if values is empty (SVG 1.1 15.10).
+ if (!hasAttribute(SVGNames::valuesAttr)) {
+ switch (filterType) {
+ case FECOLORMATRIX_TYPE_MATRIX:
+ for (size_t i = 0; i < 20; i++)
+ filterValues.append((i % 6) ? 0.0f : 1.0f);
+ break;
+ case FECOLORMATRIX_TYPE_HUEROTATE:
+ filterValues.append(0.0f);
+ break;
+ case FECOLORMATRIX_TYPE_SATURATE:
+ filterValues.append(1.0f);
+ break;
+ default:
+ break;
+ }
+ } else {
+ size_t size = numbers->numberOfItems();
+ for (size_t i = 0; i < size; i++) {
+ ExceptionCode ec = 0;
+ filterValues.append(numbers->getItem(i, ec));
+ }
+ size = filterValues.size();
+
+ if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
+ || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1)
+ || (filterType == FECOLORMATRIX_TYPE_SATURATE && (size != 1
+ || filterValues[0] < 0.0f || filterValues[0] > 1.0f)))
+ return 0;
+ }
- ExceptionCode ec = 0;
- unsigned int nr = numbers->numberOfItems();
- for (unsigned int i = 0;i < nr;i++)
- _values.append(numbers->getItem(i, ec));
-
- RefPtr<FilterEffect> effect = FEColorMatrix::create(input1, static_cast<ColorMatrixType>(type()), _values);
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEColorMatrix::create(input1, filterType, filterValues);
}
} //namespace WebCore
diff --git a/WebCore/svg/SVGFEColorMatrixElement.h b/WebCore/svg/SVGFEColorMatrixElement.h
index 811494d..6701eea 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.h
+++ b/WebCore/svg/SVGFEColorMatrixElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEColorMatrixElement_h
#define SVGFEColorMatrixElement_h
@@ -28,20 +28,20 @@
namespace WebCore {
- class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEColorMatrixElement(const QualifiedName&, Document*);
- virtual ~SVGFEColorMatrixElement();
+class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEColorMatrixElement(const QualifiedName&, Document*);
+ virtual ~SVGFEColorMatrixElement();
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::typeAttr, int, Type, type)
- DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::valuesAttr, SVGNumberList*, Values, values)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::typeAttr, int, Type, type)
+ DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::valuesAttr, SVGNumberList*, Values, values)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEColorMatrixElement.idl b/WebCore/svg/SVGFEColorMatrixElement.idl
index d704906..01f57fd 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.idl
+++ b/WebCore/svg/SVGFEColorMatrixElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFEColorMatrixElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFEColorMatrixElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Color Matrix Types
const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0;
const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1;
diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp
index 4cda9c9..9f85a0b 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,14 +24,12 @@
#include "SVGFEComponentTransferElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGFEFuncAElement.h"
#include "SVGFEFuncBElement.h"
#include "SVGFEFuncGElement.h"
#include "SVGFEFuncRElement.h"
#include "SVGNames.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -44,7 +42,7 @@ SVGFEComponentTransferElement::~SVGFEComponentTransferElement()
{
}
-void SVGFEComponentTransferElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEComponentTransferElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
@@ -61,12 +59,12 @@ void SVGFEComponentTransferElement::synchronizeProperty(const QualifiedName& att
synchronizeIn1();
}
-bool SVGFEComponentTransferElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
ComponentTransferFunction red;
ComponentTransferFunction green;
@@ -84,14 +82,9 @@ bool SVGFEComponentTransferElement::build(SVGResourceFilter* filterResource)
alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction();
}
- RefPtr<FilterEffect> effect = FEComponentTransfer::create(input1, red, green, blue, alpha);
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEComponentTransfer::create(input1, red, green, blue, alpha);
}
}
-#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
+#endif
diff --git a/WebCore/svg/SVGFEComponentTransferElement.h b/WebCore/svg/SVGFEComponentTransferElement.h
index b1d9373..785dc68 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.h
+++ b/WebCore/svg/SVGFEComponentTransferElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEComponentTransferElement_h
#define SVGFEComponentTransferElement_h
@@ -27,18 +27,18 @@
namespace WebCore {
- class SVGFEComponentTransferElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEComponentTransferElement(const QualifiedName&, Document*);
- virtual ~SVGFEComponentTransferElement();
+class SVGFEComponentTransferElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEComponentTransferElement(const QualifiedName&, Document*);
+ virtual ~SVGFEComponentTransferElement();
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEComponentTransferElement, SVGNames::inAttr, String, In1, in1)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEComponentTransferElement, SVGNames::inAttr, String, In1, in1)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEComponentTransferElement.idl b/WebCore/svg/SVGFEComponentTransferElement.idl
index 7ec0741..af340c9 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.idl
+++ b/WebCore/svg/SVGFEComponentTransferElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp
index 734c2fe..dfa335d 100644
--- a/WebCore/svg/SVGFECompositeElement.cpp
+++ b/WebCore/svg/SVGFECompositeElement.cpp
@@ -1,31 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFECompositeElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -39,7 +38,7 @@ SVGFECompositeElement::~SVGFECompositeElement()
{
}
-void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGFECompositeElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::operatorAttr) {
@@ -102,19 +101,16 @@ void SVGFECompositeElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeK4();
}
-bool SVGFECompositeElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
+ FilterEffect* input2 = filterBuilder->getEffectById(in2());
if (!input1 || !input2)
- return false;
+ return 0;
- RefPtr<FilterEffect> effect = FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
+ return FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
k1(), k2(), k3(), k4());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
}
}
diff --git a/WebCore/svg/SVGFECompositeElement.h b/WebCore/svg/SVGFECompositeElement.h
index c9fecc8..b229cc5 100644
--- a/WebCore/svg/SVGFECompositeElement.h
+++ b/WebCore/svg/SVGFECompositeElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFECompositeElement_h
#define SVGFECompositeElement_h
@@ -27,24 +27,24 @@
namespace WebCore {
- class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFECompositeElement(const QualifiedName&, Document*);
- virtual ~SVGFECompositeElement();
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::in2Attr, String, In2, in2)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::operatorAttr, int, _operator, _operator)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k1Attr, float, K1, k1)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k2Attr, float, K2, k2)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k3Attr, float, K3, k3)
- DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k4Attr, float, K4, k4)
- };
+class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFECompositeElement(const QualifiedName&, Document*);
+ virtual ~SVGFECompositeElement();
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::in2Attr, String, In2, in2)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::operatorAttr, int, _operator, _operator)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k1Attr, float, K1, k1)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k2Attr, float, K2, k2)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k3Attr, float, K3, k3)
+ DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k4Attr, float, K4, k4)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFECompositeElement.idl b/WebCore/svg/SVGFECompositeElement.idl
index d3adb25..dc7fd8d 100644
--- a/WebCore/svg/SVGFECompositeElement.idl
+++ b/WebCore/svg/SVGFECompositeElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFECompositeElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFECompositeElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Composite Operators
const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0;
const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1;
diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
new file mode 100644
index 0000000..ed6910e
--- /dev/null
+++ b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "SVGFEConvolveMatrixElement.h"
+
+#include "Attr.h"
+#include "FloatPoint.h"
+#include "FloatSize.h"
+#include "IntPoint.h"
+#include "IntSize.h"
+#include "SVGNames.h"
+#include "SVGNumberList.h"
+#include "SVGParserUtilities.h"
+
+#include <math.h>
+
+namespace WebCore {
+
+char SVGKernelUnitLengthXAttrIdentifier[] = "SVGKernelUnitLengthXAttr";
+char SVGKernelUnitLengthYAttrIdentifier[] = "SVGKernelUnitLengthYAttr";
+
+SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document* doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_kernelMatrix(SVGNumberList::create(SVGNames::kernelMatrixAttr))
+ , m_edgeMode(EDGEMODE_DUPLICATE)
+{
+}
+
+SVGFEConvolveMatrixElement::~SVGFEConvolveMatrixElement()
+{
+}
+
+void SVGFEConvolveMatrixElement::parseMappedAttribute(Attribute* attr)
+{
+ const String& value = attr->value();
+ if (attr->name() == SVGNames::inAttr)
+ setIn1BaseValue(value);
+ else if (attr->name() == SVGNames::orderAttr) {
+ float x, y;
+ if (parseNumberOptionalNumber(value, x, y)) {
+ setOrderXBaseValue(x);
+ setOrderYBaseValue(y);
+ }
+ } else if (attr->name() == SVGNames::edgeModeAttr) {
+ if (value == "duplicate")
+ setEdgeModeBaseValue(EDGEMODE_DUPLICATE);
+ else if (value == "wrap")
+ setEdgeModeBaseValue(EDGEMODE_WRAP);
+ else if (value == "none")
+ setEdgeModeBaseValue(EDGEMODE_NONE);
+ } else if (attr->name() == SVGNames::kernelMatrixAttr)
+ kernelMatrixBaseValue()->parse(value);
+ else if (attr->name() == SVGNames::divisorAttr)
+ setDivisorBaseValue(value.toFloat());
+ else if (attr->name() == SVGNames::biasAttr)
+ setBiasBaseValue(value.toFloat());
+ else if (attr->name() == SVGNames::targetXAttr)
+ setTargetXBaseValue(value.toUIntStrict());
+ else if (attr->name() == SVGNames::targetYAttr)
+ setTargetYBaseValue(value.toUIntStrict());
+ else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
+ float x, y;
+ if (parseNumberOptionalNumber(value, x, y)) {
+ setKernelUnitLengthXBaseValue(x);
+ setKernelUnitLengthYBaseValue(y);
+ }
+ } else if (attr->name() == SVGNames::preserveAlphaAttr) {
+ if (value == "true")
+ setPreserveAlphaBaseValue(true);
+ else if (value == "false")
+ setPreserveAlphaBaseValue(false);
+ } else
+ SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
+}
+
+void SVGFEConvolveMatrixElement::setOrder(float, float)
+{
+ // FIXME: Needs an implementation.
+}
+
+void SVGFEConvolveMatrixElement::setKernelUnitLength(float, float)
+{
+ // FIXME: Needs an implementation.
+}
+
+PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* filterBuilder)
+{
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
+
+ if (!input1)
+ return 0;
+
+ Vector<float> kernelMatrixValues;
+ SVGNumberList* numbers = kernelMatrix();
+
+ ExceptionCode ec = 0;
+ int numberOfItems = numbers->numberOfItems();
+ for (int i = 0; i < numberOfItems; ++i)
+ kernelMatrixValues.append(numbers->getItem(i, ec));
+
+ int orderXValue = orderX();
+ int orderYValue = orderY();
+ if (!hasAttribute(SVGNames::orderAttr)) {
+ orderXValue = 3;
+ orderYValue = 3;
+ }
+ // The spec says this is a requirement, and should bail out if fails
+ if (orderXValue * orderYValue != numberOfItems)
+ return 0;
+
+ int targetXValue = targetX();
+ int targetYValue = targetY();
+ if (hasAttribute(SVGNames::targetXAttr) && (targetXValue < 0 || targetXValue >= orderXValue))
+ return 0;
+ // The spec says the default value is: targetX = floor ( orderX / 2 ))
+ if (!hasAttribute(SVGNames::targetXAttr))
+ targetXValue = static_cast<int>(floorf(orderXValue / 2));
+ if (hasAttribute(SVGNames::targetYAttr) && (targetYValue < 0 || targetYValue >= orderYValue))
+ return 0;
+ // The spec says the default value is: targetY = floor ( orderY / 2 ))
+ if (!hasAttribute(SVGNames::targetYAttr))
+ targetYValue = static_cast<int>(floorf(orderYValue / 2));
+
+ float divisorValue = divisor();
+ if (hasAttribute(SVGNames::divisorAttr) && !divisorValue)
+ return 0;
+ if (!hasAttribute(SVGNames::divisorAttr)) {
+ for (int i = 0; i < numberOfItems; ++i)
+ divisorValue += kernelMatrixValues[i];
+ if (!divisorValue)
+ divisorValue = 1;
+ }
+
+ return FEConvolveMatrix::create(
+ input1, IntSize(orderXValue, orderYValue), divisorValue,
+ bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
+ FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.h b/WebCore/svg/SVGFEConvolveMatrixElement.h
new file mode 100644
index 0000000..5f505d7
--- /dev/null
+++ b/WebCore/svg/SVGFEConvolveMatrixElement.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGFEConvolveMatrixElement_h
+#define SVGFEConvolveMatrixElement_h
+
+#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "SVGFEConvolveMatrix.h"
+#include "SVGFilterPrimitiveStandardAttributes.h"
+#include "SVGNumberList.h"
+
+namespace WebCore {
+
+class SVGFEConvolveMatrixElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEConvolveMatrixElement(const QualifiedName&, Document*);
+ virtual ~SVGFEConvolveMatrixElement();
+
+ void setOrder(float orderX, float orderY);
+ void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY);
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::orderXAttr, long, OrderX, orderX)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::orderYAttr, long, OrderY, orderY)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, SVGNumberList*, KernelMatrix, kernelMatrix)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, float, Divisor, divisor)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::biasAttr, float, Bias, bias)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, long, TargetX, targetX)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, long, TargetY, targetY)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::operatorAttr, int, EdgeMode, edgeMode)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
+ DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, bool, PreserveAlpha, preserveAlpha)
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif
diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.idl b/WebCore/svg/SVGFEConvolveMatrixElement.idl
new file mode 100644
index 0000000..5fdc55c
--- /dev/null
+++ b/WebCore/svg/SVGFEConvolveMatrixElement.idl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module svg {
+
+ interface [
+ Conditional=SVG&FILTERS,
+ GenerateConstructor,
+ DontCheckEnums
+ ] SVGFEConvolveMatrixElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
+ // Edge Mode Values
+ const unsigned short SVG_EDGEMODE_UNKNOWN = 0;
+ const unsigned short SVG_EDGEMODE_DUPLICATE = 1;
+ const unsigned short SVG_EDGEMODE_WRAP = 2;
+ const unsigned short SVG_EDGEMODE_NONE = 3;
+
+ readonly attribute SVGAnimatedString in1;
+ readonly attribute SVGAnimatedInteger orderX;
+ readonly attribute SVGAnimatedInteger orderY;
+ readonly attribute SVGAnimatedNumberList kernelMatrix;
+ readonly attribute SVGAnimatedNumber divisor;
+ readonly attribute SVGAnimatedNumber bias;
+ readonly attribute SVGAnimatedInteger targetX;
+ readonly attribute SVGAnimatedInteger targetY;
+ readonly attribute SVGAnimatedEnumeration edgeMode;
+ readonly attribute SVGAnimatedNumber kernelUnitLengthX;
+ readonly attribute SVGAnimatedNumber kernelUnitLengthY;
+ readonly attribute SVGAnimatedBoolean preserveAlpha;
+ };
+
+}
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index a3db66d..81144c6 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -23,15 +23,12 @@
#include "SVGFEDiffuseLightingElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
-#include "RenderObject.h"
#include "SVGColor.h"
#include "SVGFEDiffuseLighting.h"
#include "SVGFELightElement.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -49,7 +46,7 @@ SVGFEDiffuseLightingElement::~SVGFEDiffuseLightingElement()
{
}
-void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
@@ -57,7 +54,7 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
else if (attr->name() == SVGNames::surfaceScaleAttr)
setSurfaceScaleBaseValue(value.toFloat());
else if (attr->name() == SVGNames::diffuseConstantAttr)
- setDiffuseConstantBaseValue(value.toInt());
+ setDiffuseConstantBaseValue(value.toFloat());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
float x, y;
if (parseNumberOptionalNumber(value, x, y)) {
@@ -68,6 +65,18 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
+void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::inAttr
+ || attrName == SVGNames::surfaceScaleAttr
+ || attrName == SVGNames::diffuseConstantAttr
+ || attrName == SVGNames::kernelUnitLengthAttr
+ || attrName == SVGNames::lighting_colorAttr)
+ SVGFilterElement::invalidateFilter(this);
+}
+
void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
@@ -93,21 +102,18 @@ void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrN
}
}
-bool SVGFEDiffuseLightingElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->lightingColor();
- RefPtr<FilterEffect> effect = FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(),
+ return FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(),
kernelUnitLengthX(), kernelUnitLengthY(), findLights());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
}
PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.h b/WebCore/svg/SVGFEDiffuseLightingElement.h
index 2e1b8cf..c5bedf1 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.h
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEDiffuseLightingElement_h
@@ -28,30 +28,31 @@
namespace WebCore {
- extern char SVGKernelUnitLengthXIdentifier[];
- extern char SVGKernelUnitLengthYIdentifier[];
+extern char SVGKernelUnitLengthXIdentifier[];
+extern char SVGKernelUnitLengthYIdentifier[];
- class FEDiffuseLighting;
- class SVGColor;
+class FEDiffuseLighting;
+class SVGColor;
- class SVGFEDiffuseLightingElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEDiffuseLightingElement(const QualifiedName&, Document*);
- virtual ~SVGFEDiffuseLightingElement();
+class SVGFEDiffuseLightingElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEDiffuseLightingElement(const QualifiedName&, Document*);
+ virtual ~SVGFEDiffuseLightingElement();
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, float, DiffuseConstant, diffuseConstant)
- DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, float, DiffuseConstant, diffuseConstant)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
- PassRefPtr<LightSource> findLights() const;
- };
+ PassRefPtr<LightSource> findLights() const;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.idl b/WebCore/svg/SVGFEDiffuseLightingElement.idl
index c48a4f1..bbab929 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.idl
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp
index b4fcb92..2706c78 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -22,8 +22,7 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEDisplacementMapElement.h"
-#include "MappedAttribute.h"
-#include "SVGResourceFilter.h"
+#include "Attribute.h"
namespace WebCore {
@@ -52,7 +51,7 @@ ChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& k
return CHANNEL_UNKNOWN;
}
-void SVGFEDisplacementMapElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEDisplacementMapElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::xChannelSelectorAttr)
@@ -94,20 +93,17 @@ void SVGFEDisplacementMapElement::synchronizeProperty(const QualifiedName& attrN
synchronizeScale();
}
-bool SVGFEDisplacementMapElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
- FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
+ FilterEffect* input2 = filterBuilder->getEffectById(in2());
if (!input1 || !input2)
- return false;
+ return 0;
- RefPtr<FilterEffect> effect = FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType>(xChannelSelector()),
- static_cast<ChannelSelectorType>(yChannelSelector()), scale());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType>(xChannelSelector()),
+ static_cast<ChannelSelectorType>(yChannelSelector()), scale());
}
}
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.h b/WebCore/svg/SVGFEDisplacementMapElement.h
index 95c6672..445c631 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.h
+++ b/WebCore/svg/SVGFEDisplacementMapElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEDisplacementMapElement_h
@@ -26,24 +26,24 @@
namespace WebCore {
- class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*);
- virtual ~SVGFEDisplacementMapElement();
-
- static ChannelSelectorType stringToChannel(const String&);
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::in2Attr, String, In2, in2)
- DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, int, XChannelSelector, xChannelSelector)
- DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, int, YChannelSelector, yChannelSelector)
- DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::scaleAttr, float, Scale, scale)
- };
+class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*);
+ virtual ~SVGFEDisplacementMapElement();
+
+ static ChannelSelectorType stringToChannel(const String&);
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::in2Attr, String, In2, in2)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, int, XChannelSelector, xChannelSelector)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, int, YChannelSelector, yChannelSelector)
+ DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::scaleAttr, float, Scale, scale)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.idl b/WebCore/svg/SVGFEDisplacementMapElement.idl
index b003e8f..0fb4e63 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.idl
+++ b/WebCore/svg/SVGFEDisplacementMapElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFEDisplacementMapElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFEDisplacementMapElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Channel Selectors
const unsigned short SVG_CHANNEL_UNKNOWN = 0;
const unsigned short SVG_CHANNEL_R = 1;
diff --git a/WebCore/svg/SVGFEDistantLightElement.cpp b/WebCore/svg/SVGFEDistantLightElement.cpp
index 8322a3a..3a056af 100644
--- a/WebCore/svg/SVGFEDistantLightElement.cpp
+++ b/WebCore/svg/SVGFEDistantLightElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGFEDistantLightElement.h b/WebCore/svg/SVGFEDistantLightElement.h
index 3d0c039..a625c04 100644
--- a/WebCore/svg/SVGFEDistantLightElement.h
+++ b/WebCore/svg/SVGFEDistantLightElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEDistantLightElement_h
diff --git a/WebCore/svg/SVGFEDistantLightElement.idl b/WebCore/svg/SVGFEDistantLightElement.idl
index 16e7467..d9d1be9 100644
--- a/WebCore/svg/SVGFEDistantLightElement.idl
+++ b/WebCore/svg/SVGFEDistantLightElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEFloodElement.cpp b/WebCore/svg/SVGFEFloodElement.cpp
index d69c240..050f2d4 100644
--- a/WebCore/svg/SVGFEFloodElement.cpp
+++ b/WebCore/svg/SVGFEFloodElement.cpp
@@ -1,32 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEFloodElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderStyle.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -39,17 +38,14 @@ SVGFEFloodElement::~SVGFEFloodElement()
{
}
-bool SVGFEFloodElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEFloodElement::build(SVGFilterBuilder*)
{
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->floodColor();
float opacity = filterStyle->svgStyle()->floodOpacity();
- RefPtr<FilterEffect> effect = FEFlood::create(color, opacity);
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEFlood::create(color, opacity);
}
}
diff --git a/WebCore/svg/SVGFEFloodElement.h b/WebCore/svg/SVGFEFloodElement.h
index b8b49e7..73aa0ee 100644
--- a/WebCore/svg/SVGFEFloodElement.h
+++ b/WebCore/svg/SVGFEFloodElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFloodElement_h
#define SVGFEFloodElement_h
@@ -26,13 +26,13 @@
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
- class SVGFEFloodElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEFloodElement(const QualifiedName&, Document*);
- virtual ~SVGFEFloodElement();
+class SVGFEFloodElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEFloodElement(const QualifiedName&, Document*);
+ virtual ~SVGFEFloodElement();
- virtual bool build(SVGResourceFilter*);
- };
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEFloodElement.idl b/WebCore/svg/SVGFEFloodElement.idl
index 59b9751..6adbefb 100644
--- a/WebCore/svg/SVGFEFloodElement.idl
+++ b/WebCore/svg/SVGFEFloodElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEFuncAElement.cpp b/WebCore/svg/SVGFEFuncAElement.cpp
index a02b0e5..3722826 100644
--- a/WebCore/svg/SVGFEFuncAElement.cpp
+++ b/WebCore/svg/SVGFEFuncAElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGFEFuncAElement.h b/WebCore/svg/SVGFEFuncAElement.h
index 55a3c9d..500d630 100644
--- a/WebCore/svg/SVGFEFuncAElement.h
+++ b/WebCore/svg/SVGFEFuncAElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFuncAElement_h
#define SVGFEFuncAElement_h
diff --git a/WebCore/svg/SVGFEFuncAElement.idl b/WebCore/svg/SVGFEFuncAElement.idl
index 8901551..8bde3a7 100644
--- a/WebCore/svg/SVGFEFuncAElement.idl
+++ b/WebCore/svg/SVGFEFuncAElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEFuncBElement.cpp b/WebCore/svg/SVGFEFuncBElement.cpp
index 2bf939b..3ea448f 100644
--- a/WebCore/svg/SVGFEFuncBElement.cpp
+++ b/WebCore/svg/SVGFEFuncBElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGFEFuncBElement.h b/WebCore/svg/SVGFEFuncBElement.h
index 177ed26..85f9500 100644
--- a/WebCore/svg/SVGFEFuncBElement.h
+++ b/WebCore/svg/SVGFEFuncBElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFuncBElement_h
#define SVGFEFuncBElement_h
diff --git a/WebCore/svg/SVGFEFuncBElement.idl b/WebCore/svg/SVGFEFuncBElement.idl
index fada028..2575ab5 100644
--- a/WebCore/svg/SVGFEFuncBElement.idl
+++ b/WebCore/svg/SVGFEFuncBElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEFuncGElement.cpp b/WebCore/svg/SVGFEFuncGElement.cpp
index e0d60f4..c74a9ce 100644
--- a/WebCore/svg/SVGFEFuncGElement.cpp
+++ b/WebCore/svg/SVGFEFuncGElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGFEFuncGElement.h b/WebCore/svg/SVGFEFuncGElement.h
index 4eeafa0..9950a53 100644
--- a/WebCore/svg/SVGFEFuncGElement.h
+++ b/WebCore/svg/SVGFEFuncGElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFuncGElement_h
#define SVGFEFuncGElement_h
diff --git a/WebCore/svg/SVGFEFuncGElement.idl b/WebCore/svg/SVGFEFuncGElement.idl
index 33fc9a0..16f7811 100644
--- a/WebCore/svg/SVGFEFuncGElement.idl
+++ b/WebCore/svg/SVGFEFuncGElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEFuncRElement.cpp b/WebCore/svg/SVGFEFuncRElement.cpp
index e8e6b99..ce3355d 100644
--- a/WebCore/svg/SVGFEFuncRElement.cpp
+++ b/WebCore/svg/SVGFEFuncRElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGFEFuncRElement.h b/WebCore/svg/SVGFEFuncRElement.h
index 196cfa3..8e78091 100644
--- a/WebCore/svg/SVGFEFuncRElement.h
+++ b/WebCore/svg/SVGFEFuncRElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFuncRElement_h
#define SVGFEFuncRElement_h
diff --git a/WebCore/svg/SVGFEFuncRElement.idl b/WebCore/svg/SVGFEFuncRElement.idl
index e9b8e26..c3c742a 100644
--- a/WebCore/svg/SVGFEFuncRElement.idl
+++ b/WebCore/svg/SVGFEFuncRElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp
index fd49fe7..2e5578a 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -1,32 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEGaussianBlurElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -47,7 +46,7 @@ void SVGFEGaussianBlurElement::setStdDeviation(float, float)
// FIXME: Needs an implementation.
}
-void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEGaussianBlurElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::stdDeviationAttr) {
@@ -80,17 +79,14 @@ void SVGFEGaussianBlurElement::synchronizeProperty(const QualifiedName& attrName
synchronizeIn1();
}
-bool SVGFEGaussianBlurElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
-
- RefPtr<FilterEffect> effect = FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
- filterResource->addFilterEffect(this, effect.release());
+ return 0;
- return true;
+ return FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
}
}
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.h b/WebCore/svg/SVGFEGaussianBlurElement.h
index a03b9df..10c0f5a 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.h
+++ b/WebCore/svg/SVGFEGaussianBlurElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEGaussianBlurElement_h
#define SVGFEGaussianBlurElement_h
@@ -27,25 +27,25 @@
namespace WebCore {
- extern char SVGStdDeviationXAttrIdentifier[];
- extern char SVGStdDeviationYAttrIdentifier[];
+extern char SVGStdDeviationXAttrIdentifier[];
+extern char SVGStdDeviationYAttrIdentifier[];
- class SVGFEGaussianBlurElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEGaussianBlurElement(const QualifiedName&, Document*);
- virtual ~SVGFEGaussianBlurElement();
+class SVGFEGaussianBlurElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEGaussianBlurElement(const QualifiedName&, Document*);
+ virtual ~SVGFEGaussianBlurElement();
- void setStdDeviation(float stdDeviationX, float stdDeviationY);
+ void setStdDeviation(float stdDeviationX, float stdDeviationY);
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEGaussianBlurElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, SVGStdDeviationXAttrIdentifier, float, StdDeviationX, stdDeviationX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, SVGStdDeviationYAttrIdentifier, float, StdDeviationY, stdDeviationY)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEGaussianBlurElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, SVGStdDeviationXAttrIdentifier, float, StdDeviationX, stdDeviationX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, SVGStdDeviationYAttrIdentifier, float, StdDeviationY, stdDeviationY)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.idl b/WebCore/svg/SVGFEGaussianBlurElement.idl
index efa09b8..52478d8 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.idl
+++ b/WebCore/svg/SVGFEGaussianBlurElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp
index 7be972c..eb024f6 100644
--- a/WebCore/svg/SVGFEImageElement.cpp
+++ b/WebCore/svg/SVGFEImageElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2010 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -28,12 +28,12 @@
#include "CachedImage.h"
#include "DocLoader.h"
#include "Document.h"
-#include "MappedAttribute.h"
+#include "RenderObject.h"
+#include "RenderSVGResource.h"
+#include "SVGImageBufferTools.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGPreserveAspectRatio.h"
-#include "SVGRenderSupport.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -68,7 +68,7 @@ void SVGFEImageElement::requestImageResource()
m_cachedImage->addClient(this);
}
-void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEImageElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::preserveAspectRatioAttr)
@@ -108,30 +108,37 @@ void SVGFEImageElement::synchronizeProperty(const QualifiedName& attrName)
void SVGFEImageElement::notifyFinished(CachedResource*)
{
- SVGStyledElement::invalidateResourcesInAncestorChain();
+ if (!inDocument())
+ return;
+
+ Element* parent = parentElement();
+ ASSERT(parent);
+
+ if (!parent->hasTagName(SVGNames::filterTag) || !parent->renderer())
+ return;
+
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(parent->renderer());
}
-bool SVGFEImageElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*)
{
if (!m_cachedImage && !m_targetImage) {
Element* hrefElement = document()->getElementById(SVGURIReference::getTarget(href()));
if (!hrefElement || !hrefElement->isSVGElement())
- return false;
+ return 0;
RenderObject* renderer = hrefElement->renderer();
if (!renderer)
- return false;
+ return 0;
IntRect targetRect = enclosingIntRect(renderer->objectBoundingBox());
m_targetImage = ImageBuffer::create(targetRect.size(), LinearRGB);
- renderSubtreeToImage(m_targetImage.get(), renderer);
+ AffineTransform contentTransformation;
+ SVGImageBufferTools::renderSubtreeToImageBuffer(m_targetImage.get(), renderer, contentTransformation);
}
- RefPtr<FilterEffect> effect = FEImage::create(m_targetImage ? m_targetImage->image() : m_cachedImage->image(), preserveAspectRatio());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEImage::create(m_targetImage ? m_targetImage->copyImage() : m_cachedImage->image(), preserveAspectRatio());
}
void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
diff --git a/WebCore/svg/SVGFEImageElement.h b/WebCore/svg/SVGFEImageElement.h
index 72cd949..2128c6d 100644
--- a/WebCore/svg/SVGFEImageElement.h
+++ b/WebCore/svg/SVGFEImageElement.h
@@ -1,27 +1,28 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEImageElement_h
#define SVGFEImageElement_h
#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
#include "ImageBuffer.h"
#include "SVGExternalResourcesRequired.h"
@@ -33,36 +34,36 @@
namespace WebCore {
- class SVGFEImageElement : public SVGFilterPrimitiveStandardAttributes,
- public SVGURIReference,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public CachedResourceClient {
- public:
- SVGFEImageElement(const QualifiedName&, Document*);
- virtual ~SVGFEImageElement();
+class SVGFEImageElement : public SVGFilterPrimitiveStandardAttributes,
+ public SVGURIReference,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public CachedResourceClient {
+public:
+ SVGFEImageElement(const QualifiedName&, Document*);
+ virtual ~SVGFEImageElement();
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual void notifyFinished(CachedResource*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void notifyFinished(CachedResource*);
- virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
- virtual bool build(SVGResourceFilter*);
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- void requestImageResource();
+private:
+ void requestImageResource();
- DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
+ DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
- // SVGURIReference
- DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, XLinkNames::hrefAttr, String, Href, href)
+ // SVGURIReference
+ DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, XLinkNames::hrefAttr, String, Href, href)
- // SVGExternalResourcesRequired
- DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+ // SVGExternalResourcesRequired
+ DECLARE_ANIMATED_PROPERTY(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
- CachedResourceHandle<CachedImage> m_cachedImage;
- OwnPtr<ImageBuffer> m_targetImage;
- };
+ CachedResourceHandle<CachedImage> m_cachedImage;
+ OwnPtr<ImageBuffer> m_targetImage;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEImageElement.idl b/WebCore/svg/SVGFEImageElement.idl
index 0ebe53e..6c7363c 100644
--- a/WebCore/svg/SVGFEImageElement.idl
+++ b/WebCore/svg/SVGFEImageElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFELightElement.cpp b/WebCore/svg/SVGFELightElement.cpp
index dc711cf..5975033 100644
--- a/WebCore/svg/SVGFELightElement.cpp
+++ b/WebCore/svg/SVGFELightElement.cpp
@@ -1,30 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- 2005 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFELightElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
+#include "SVGFilterElement.h"
#include "SVGNames.h"
namespace WebCore {
@@ -39,7 +40,7 @@ SVGFELightElement::~SVGFELightElement()
{
}
-void SVGFELightElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFELightElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::azimuthAttr)
@@ -66,6 +67,23 @@ void SVGFELightElement::parseMappedAttribute(MappedAttribute* attr)
SVGElement::parseMappedAttribute(attr);
}
+void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGElement::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::azimuthAttr
+ || attrName == SVGNames::elevationAttr
+ || attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::zAttr
+ || attrName == SVGNames::pointsAtXAttr
+ || attrName == SVGNames::pointsAtYAttr
+ || attrName == SVGNames::pointsAtZAttr
+ || attrName == SVGNames::specularExponentAttr
+ || attrName == SVGNames::limitingConeAngleAttr)
+ SVGFilterElement::invalidateFilter(this);
+}
+
void SVGFELightElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGElement::synchronizeProperty(attrName);
@@ -106,6 +124,14 @@ void SVGFELightElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeLimitingConeAngle();
}
+void SVGFELightElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+ if (!changedByParser)
+ SVGFilterElement::invalidateFilter(this);
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGFELightElement.h b/WebCore/svg/SVGFELightElement.h
index 4e9c389..d0874cb 100644
--- a/WebCore/svg/SVGFELightElement.h
+++ b/WebCore/svg/SVGFELightElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- 2005 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFELightElement_h
@@ -29,27 +29,29 @@
namespace WebCore {
- class SVGFELightElement : public SVGElement {
- public:
- SVGFELightElement(const QualifiedName&, Document*);
- virtual ~SVGFELightElement();
+class SVGFELightElement : public SVGElement {
+public:
+ SVGFELightElement(const QualifiedName&, Document*);
+ virtual ~SVGFELightElement();
- virtual PassRefPtr<LightSource> lightSource() const = 0;
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::azimuthAttr, float, Azimuth, azimuth)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::elevationAttr, float, Elevation, elevation)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::xAttr, float, X, x)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::yAttr, float, Y, y)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::zAttr, float, Z, z)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtXAttr, float, PointsAtX, pointsAtX)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtYAttr, float, PointsAtY, pointsAtY)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtZAttr, float, PointsAtZ, pointsAtZ)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
- DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::limitingConeAngleAttr, float, LimitingConeAngle, limitingConeAngle)
- };
+ virtual PassRefPtr<LightSource> lightSource() const = 0;
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::azimuthAttr, float, Azimuth, azimuth)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::elevationAttr, float, Elevation, elevation)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::xAttr, float, X, x)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::yAttr, float, Y, y)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::zAttr, float, Z, z)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtXAttr, float, PointsAtX, pointsAtX)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtYAttr, float, PointsAtY, pointsAtY)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtZAttr, float, PointsAtZ, pointsAtZ)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
+ DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::limitingConeAngleAttr, float, LimitingConeAngle, limitingConeAngle)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEMergeElement.cpp b/WebCore/svg/SVGFEMergeElement.cpp
index 078de22..bbdfd52 100644
--- a/WebCore/svg/SVGFEMergeElement.cpp
+++ b/WebCore/svg/SVGFEMergeElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,7 +24,6 @@
#include "SVGFEMergeElement.h"
#include "SVGFEMergeNodeElement.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -37,25 +36,22 @@ SVGFEMergeElement::~SVGFEMergeElement()
{
}
-bool SVGFEMergeElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder)
{
Vector<RefPtr<FilterEffect> > mergeInputs;
for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feMergeNodeTag)) {
- FilterEffect* mergeEffect = filterResource->builder()->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1());
+ FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1());
if (!mergeEffect)
- return false;
+ return 0;
mergeInputs.append(mergeEffect);
}
}
if (mergeInputs.isEmpty())
- return false;
-
- RefPtr<FilterEffect> effect = FEMerge::create(mergeInputs);
- filterResource->addFilterEffect(this, effect.release());
+ return 0;
- return true;
+ return FEMerge::create(mergeInputs);
}
}
diff --git a/WebCore/svg/SVGFEMergeElement.h b/WebCore/svg/SVGFEMergeElement.h
index f84ddce..1ae6eb4 100644
--- a/WebCore/svg/SVGFEMergeElement.h
+++ b/WebCore/svg/SVGFEMergeElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEMergeElement_h
#define SVGFEMergeElement_h
@@ -27,13 +27,13 @@
namespace WebCore {
- class SVGFEMergeElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEMergeElement(const QualifiedName&, Document*);
- virtual ~SVGFEMergeElement();
+class SVGFEMergeElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEMergeElement(const QualifiedName&, Document*);
+ virtual ~SVGFEMergeElement();
- virtual bool build(SVGResourceFilter*);
- };
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEMergeElement.idl b/WebCore/svg/SVGFEMergeElement.idl
index 0b03845..a648598 100644
--- a/WebCore/svg/SVGFEMergeElement.idl
+++ b/WebCore/svg/SVGFEMergeElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEMergeNodeElement.cpp b/WebCore/svg/SVGFEMergeNodeElement.cpp
index 9551d29..65f7a1d 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.cpp
+++ b/WebCore/svg/SVGFEMergeNodeElement.cpp
@@ -1,29 +1,29 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEMergeNodeElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -36,7 +36,7 @@ SVGFEMergeNodeElement::~SVGFEMergeNodeElement()
{
}
-void SVGFEMergeNodeElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEMergeNodeElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
diff --git a/WebCore/svg/SVGFEMergeNodeElement.h b/WebCore/svg/SVGFEMergeNodeElement.h
index 5ccfe94..944081f 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.h
+++ b/WebCore/svg/SVGFEMergeNodeElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEMergeNodeElement_h
#define SVGFEMergeNodeElement_h
@@ -32,7 +32,7 @@ namespace WebCore {
SVGFEMergeNodeElement(const QualifiedName&, Document*);
virtual ~SVGFEMergeNodeElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGFEMergeNodeElement.idl b/WebCore/svg/SVGFEMergeNodeElement.idl
index 4bddcb2..7463461 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.idl
+++ b/WebCore/svg/SVGFEMergeNodeElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp
index 1f37c08..739517f 100644
--- a/WebCore/svg/SVGFEMorphologyElement.cpp
+++ b/WebCore/svg/SVGFEMorphologyElement.cpp
@@ -1,31 +1,30 @@
/*
- Copyright (C) 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEMorphologyElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -47,7 +46,7 @@ void SVGFEMorphologyElement::setRadius(float, float)
// FIXME: Needs an implementation.
}
-void SVGFEMorphologyElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEMorphologyElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::operatorAttr) {
@@ -89,17 +88,19 @@ void SVGFEMorphologyElement::synchronizeProperty(const QualifiedName& attrName)
}
}
-bool SVGFEMorphologyElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
+ float xRadius = radiusX();
+ float yRadius = radiusY();
if (!input1)
- return false;
+ return 0;
+
+ if (xRadius < 0 || yRadius < 0)
+ return 0;
- RefPtr<FilterEffect> effect = FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), radiusX(), radiusY());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
}
} //namespace WebCore
diff --git a/WebCore/svg/SVGFEMorphologyElement.h b/WebCore/svg/SVGFEMorphologyElement.h
index c7e3f6f..d976b92 100644
--- a/WebCore/svg/SVGFEMorphologyElement.h
+++ b/WebCore/svg/SVGFEMorphologyElement.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEMorphologyElement_h
#define SVGFEMorphologyElement_h
@@ -26,26 +26,26 @@
namespace WebCore {
- extern char SVGRadiusXAttrIdentifier[];
- extern char SVGRadiusYAttrIdentifier[];
+extern char SVGRadiusXAttrIdentifier[];
+extern char SVGRadiusYAttrIdentifier[];
- class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEMorphologyElement(const QualifiedName&, Document*);
- virtual ~SVGFEMorphologyElement();
+class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEMorphologyElement(const QualifiedName&, Document*);
+ virtual ~SVGFEMorphologyElement();
- void setRadius(float radiusX, float radiusY);
+ void setRadius(float radiusX, float radiusY);
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEMorphologyElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEMorphologyElement, SVGNames::operatorAttr, int, _operator, _operator)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusXAttrIdentifier, float, RadiusX, radiusX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusYAttrIdentifier, float, RadiusY, radiusY)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEMorphologyElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEMorphologyElement, SVGNames::operatorAttr, int, _operator, _operator)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusXAttrIdentifier, float, RadiusX, radiusX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusYAttrIdentifier, float, RadiusY, radiusY)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEMorphologyElement.idl b/WebCore/svg/SVGFEMorphologyElement.idl
index ffd2289..36746c1 100644
--- a/WebCore/svg/SVGFEMorphologyElement.idl
+++ b/WebCore/svg/SVGFEMorphologyElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFEMorphologyElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFEMorphologyElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Morphology Operators
const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0;
const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1;
diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp
index 28955c0..006bb3b 100644
--- a/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/WebCore/svg/SVGFEOffsetElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,8 +24,6 @@
#include "SVGFEOffsetElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -38,7 +36,7 @@ SVGFEOffsetElement::~SVGFEOffsetElement()
{
}
-void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFEOffsetElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::dxAttr)
@@ -51,6 +49,16 @@ void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
+void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::inAttr
+ || attrName == SVGNames::dxAttr
+ || attrName == SVGNames::dyAttr)
+ SVGFilterElement::invalidateFilter(this);
+}
+
void SVGFEOffsetElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
@@ -70,17 +78,14 @@ void SVGFEOffsetElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeIn1();
}
-bool SVGFEOffsetElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
-
- RefPtr<FilterEffect> effect = FEOffset::create(input1, dx(), dy());
- filterResource->addFilterEffect(this, effect.release());
+ return 0;
- return true;
+ return FEOffset::create(input1, dx(), dy());
}
}
diff --git a/WebCore/svg/SVGFEOffsetElement.h b/WebCore/svg/SVGFEOffsetElement.h
index df61a9c..8f93526 100644
--- a/WebCore/svg/SVGFEOffsetElement.h
+++ b/WebCore/svg/SVGFEOffsetElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEOffsetElement_h
#define SVGFEOffsetElement_h
@@ -27,20 +27,21 @@
namespace WebCore {
- class SVGFEOffsetElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFEOffsetElement(const QualifiedName&, Document*);
- virtual ~SVGFEOffsetElement();
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dxAttr, float, Dx, dx)
- DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dyAttr, float, Dy, dy)
- };
+class SVGFEOffsetElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFEOffsetElement(const QualifiedName&, Document*);
+ virtual ~SVGFEOffsetElement();
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dxAttr, float, Dx, dx)
+ DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dyAttr, float, Dy, dy)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEOffsetElement.idl b/WebCore/svg/SVGFEOffsetElement.idl
index ba3ee4e..9308573 100644
--- a/WebCore/svg/SVGFEOffsetElement.idl
+++ b/WebCore/svg/SVGFEOffsetElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFEPointLightElement.cpp b/WebCore/svg/SVGFEPointLightElement.cpp
index 36ed2e9..46568ff 100644
--- a/WebCore/svg/SVGFEPointLightElement.cpp
+++ b/WebCore/svg/SVGFEPointLightElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGFEPointLightElement.h b/WebCore/svg/SVGFEPointLightElement.h
index 9b1f997..d734f9e 100644
--- a/WebCore/svg/SVGFEPointLightElement.h
+++ b/WebCore/svg/SVGFEPointLightElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFEPointLightElement_h
diff --git a/WebCore/svg/SVGFEPointLightElement.idl b/WebCore/svg/SVGFEPointLightElement.idl
index f5ad94c..09e0b56 100644
--- a/WebCore/svg/SVGFEPointLightElement.idl
+++ b/WebCore/svg/SVGFEPointLightElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp
index 0602103..afbdefe 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -1,36 +1,34 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- 2005 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFESpecularLightingElement.h"
-#include "MappedAttribute.h"
-#include "RenderObject.h"
+#include "Attribute.h"
#include "SVGColor.h"
#include "SVGFELightElement.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -46,7 +44,7 @@ SVGFESpecularLightingElement::~SVGFESpecularLightingElement()
{
}
-void SVGFESpecularLightingElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFESpecularLightingElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
@@ -109,22 +107,19 @@ PassRefPtr<LightSource> SVGFESpecularLightingElement::findLights() const
return 0;
}
-bool SVGFESpecularLightingElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->lightingColor();
- RefPtr<FilterEffect> effect = FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(),
- specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(),
+ specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
}
}
diff --git a/WebCore/svg/SVGFESpecularLightingElement.h b/WebCore/svg/SVGFESpecularLightingElement.h
index fe56980..a506cf7 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.h
+++ b/WebCore/svg/SVGFESpecularLightingElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- 2005 Oliver Hunt <oliver@nerget.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFESpecularLightingElement_h
@@ -28,28 +28,28 @@
namespace WebCore {
- extern char SVGKernelUnitLengthXIdentifier[];
- extern char SVGKernelUnitLengthYIdentifier[];
-
- class SVGFESpecularLightingElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFESpecularLightingElement(const QualifiedName&, Document*);
- virtual ~SVGFESpecularLightingElement();
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::inAttr, String, In1, in1)
- DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, float, SpecularConstant, specularConstant)
- DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
- DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
-
- PassRefPtr<LightSource> findLights() const;
- };
+extern char SVGKernelUnitLengthXIdentifier[];
+extern char SVGKernelUnitLengthYIdentifier[];
+
+class SVGFESpecularLightingElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFESpecularLightingElement(const QualifiedName&, Document*);
+ virtual ~SVGFESpecularLightingElement();
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::inAttr, String, In1, in1)
+ DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, float, SpecularConstant, specularConstant)
+ DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
+ DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
+
+ PassRefPtr<LightSource> findLights() const;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFESpecularLightingElement.idl b/WebCore/svg/SVGFESpecularLightingElement.idl
index 5fce7fa..fa7da96 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.idl
+++ b/WebCore/svg/SVGFESpecularLightingElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFESpotLightElement.cpp b/WebCore/svg/SVGFESpotLightElement.cpp
index 01fe54e..26d0e16 100644
--- a/WebCore/svg/SVGFESpotLightElement.cpp
+++ b/WebCore/svg/SVGFESpotLightElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -37,13 +37,8 @@ SVGFESpotLightElement::~SVGFESpotLightElement()
PassRefPtr<LightSource> SVGFESpotLightElement::lightSource() const
{
FloatPoint3D pos(x(), y(), z());
+ FloatPoint3D direction(pointsAtX(), pointsAtY(), pointsAtZ());
- // convert lookAt to a direction
- FloatPoint3D direction(pointsAtX() - pos.x(),
- pointsAtY() - pos.y(),
- pointsAtZ() - pos.z());
-
- direction.normalize();
return SpotLightSource::create(pos, direction, specularExponent(), limitingConeAngle());
}
diff --git a/WebCore/svg/SVGFESpotLightElement.h b/WebCore/svg/SVGFESpotLightElement.h
index d54e232..6903c0b 100644
--- a/WebCore/svg/SVGFESpotLightElement.h
+++ b/WebCore/svg/SVGFESpotLightElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFESpotLightElement_h
diff --git a/WebCore/svg/SVGFESpotLightElement.idl b/WebCore/svg/SVGFESpotLightElement.idl
index 5a41202..1c553a7 100644
--- a/WebCore/svg/SVGFESpotLightElement.idl
+++ b/WebCore/svg/SVGFESpotLightElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp
index 94c8e74..f3f5eaf 100644
--- a/WebCore/svg/SVGFETileElement.cpp
+++ b/WebCore/svg/SVGFETileElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,9 +24,7 @@
#include "SVGFETileElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -39,7 +37,7 @@ SVGFETileElement::~SVGFETileElement()
{
}
-void SVGFETileElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFETileElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
@@ -56,17 +54,14 @@ void SVGFETileElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeIn1();
}
-bool SVGFETileElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
- RefPtr<FilterEffect> effect = FETile::create(input1);
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
+ return FETile::create(input1);
}
}
diff --git a/WebCore/svg/SVGFETileElement.h b/WebCore/svg/SVGFETileElement.h
index 2c86abd..41355e2 100644
--- a/WebCore/svg/SVGFETileElement.h
+++ b/WebCore/svg/SVGFETileElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFETileElement_h
#define SVGFETileElement_h
@@ -27,18 +27,18 @@
namespace WebCore {
- class SVGFETileElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFETileElement(const QualifiedName&, Document*);
- virtual ~SVGFETileElement();
+class SVGFETileElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFETileElement(const QualifiedName&, Document*);
+ virtual ~SVGFETileElement();
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFETileElement, SVGNames::inAttr, String, In1, in1)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFETileElement, SVGNames::inAttr, String, In1, in1)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFETileElement.idl b/WebCore/svg/SVGFETileElement.idl
index 4a59a05..8d54991 100644
--- a/WebCore/svg/SVGFETileElement.idl
+++ b/WebCore/svg/SVGFETileElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp
index 622971c..0415e89 100644
--- a/WebCore/svg/SVGFETurbulenceElement.cpp
+++ b/WebCore/svg/SVGFETurbulenceElement.cpp
@@ -1,31 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFETurbulenceElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGParserUtilities.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -44,7 +43,7 @@ SVGFETurbulenceElement::~SVGFETurbulenceElement()
{
}
-void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::typeAttr) {
@@ -98,13 +97,13 @@ void SVGFETurbulenceElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeNumOctaves();
}
-bool SVGFETurbulenceElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*)
{
- RefPtr<FilterEffect> effect = FETurbulence::create(static_cast<TurbulanceType>(type()), baseFrequencyX(),
- baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH);
- filterResource->addFilterEffect(this, effect.release());
+ if (baseFrequencyX() < 0 || baseFrequencyY() < 0)
+ return 0;
- return true;
+ return FETurbulence::create(static_cast<TurbulanceType>(type()), baseFrequencyX(),
+ baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH);
}
}
diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h
index 464ce25..c5820c8 100644
--- a/WebCore/svg/SVGFETurbulenceElement.h
+++ b/WebCore/svg/SVGFETurbulenceElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFETurbulenceElement_h
#define SVGFETurbulenceElement_h
@@ -27,32 +27,32 @@
namespace WebCore {
- extern char SVGBaseFrequencyXIdentifier[];
- extern char SVGBaseFrequencyYIdentifier[];
-
- enum SVGStitchOptions {
- SVG_STITCHTYPE_UNKNOWN = 0,
- SVG_STITCHTYPE_STITCH = 1,
- SVG_STITCHTYPE_NOSTITCH = 2
- };
-
- class SVGFETurbulenceElement : public SVGFilterPrimitiveStandardAttributes {
- public:
- SVGFETurbulenceElement(const QualifiedName&, Document*);
- virtual ~SVGFETurbulenceElement();
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*);
-
- private:
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, SVGBaseFrequencyXIdentifier, float, BaseFrequencyX, baseFrequencyX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, SVGBaseFrequencyYIdentifier, float, BaseFrequencyY, baseFrequencyY)
- DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::numOctavesAttr, long, NumOctaves, numOctaves)
- DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::seedAttr, float, Seed, seed)
- DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, int, StitchTiles, stitchTiles)
- DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::typeAttr, int, Type, type)
- };
+extern char SVGBaseFrequencyXIdentifier[];
+extern char SVGBaseFrequencyYIdentifier[];
+
+enum SVGStitchOptions {
+ SVG_STITCHTYPE_UNKNOWN = 0,
+ SVG_STITCHTYPE_STITCH = 1,
+ SVG_STITCHTYPE_NOSTITCH = 2
+};
+
+class SVGFETurbulenceElement : public SVGFilterPrimitiveStandardAttributes {
+public:
+ SVGFETurbulenceElement(const QualifiedName&, Document*);
+ virtual ~SVGFETurbulenceElement();
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
+
+private:
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, SVGBaseFrequencyXIdentifier, float, BaseFrequencyX, baseFrequencyX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, SVGBaseFrequencyYIdentifier, float, BaseFrequencyY, baseFrequencyY)
+ DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::numOctavesAttr, long, NumOctaves, numOctaves)
+ DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::seedAttr, float, Seed, seed)
+ DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, int, StitchTiles, stitchTiles)
+ DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::typeAttr, int, Type, type)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFETurbulenceElement.idl b/WebCore/svg/SVGFETurbulenceElement.idl
index 934eddf..bd538bd 100644
--- a/WebCore/svg/SVGFETurbulenceElement.idl
+++ b/WebCore/svg/SVGFETurbulenceElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,8 +25,11 @@
module svg {
- interface [Conditional=SVG&FILTERS] SVGFETurbulenceElement : SVGElement,
- SVGFilterPrimitiveStandardAttributes {
+ interface [
+ Conditional=SVG&FILTERS,
+ DontCheckEnums
+ ] SVGFETurbulenceElement : SVGElement,
+ SVGFilterPrimitiveStandardAttributes {
// Turbulence Types
const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0;
const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp
index 60375fb..eb633c0 100644
--- a/WebCore/svg/SVGFilterElement.cpp
+++ b/WebCore/svg/SVGFilterElement.cpp
@@ -1,24 +1,25 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -27,14 +28,13 @@
#include "Attr.h"
#include "FloatSize.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
+#include "RenderSVGResourceFilter.h"
#include "SVGFilterBuilder.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
-#include "SVGResourceFilter.h"
#include "SVGUnitTypes.h"
namespace WebCore {
@@ -62,11 +62,16 @@ SVGFilterElement::~SVGFilterElement()
{
}
-void SVGFilterElement::setFilterRes(unsigned long, unsigned long) const
+void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filterResY)
{
+ setFilterResXBaseValue(filterResX);
+ setFilterResYBaseValue(filterResY);
+
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
-void SVGFilterElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFilterElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::filterUnitsAttr) {
@@ -105,6 +110,34 @@ void SVGFilterElement::parseMappedAttribute(MappedAttribute* attr)
}
}
+void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ bool invalidateClients = false;
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr) {
+ invalidateClients = true;
+ updateRelativeLengthsInformation();
+ }
+
+ RenderObject* object = renderer();
+ if (!object)
+ return;
+
+ if (invalidateClients
+ || attrName == SVGNames::filterUnitsAttr
+ || attrName == SVGNames::primitiveUnitsAttr
+ || attrName == SVGNames::filterResAttr
+ || SVGStyledElement::isKnownAttribute(attrName)
+ || SVGURIReference::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ object->setNeedsLayout(true);
+}
+
void SVGFilterElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledElement::synchronizeProperty(attrName);
@@ -144,6 +177,17 @@ void SVGFilterElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeHref();
}
+void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+ if (changedByParser)
+ return;
+
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
+}
+
FloatRect SVGFilterElement::filterBoundingBox(const FloatRect& objectBoundingBox) const
{
FloatRect filterBBox;
@@ -161,67 +205,19 @@ FloatRect SVGFilterElement::filterBoundingBox(const FloatRect& objectBoundingBox
return filterBBox;
}
-void SVGFilterElement::buildFilter(const FloatRect& targetRect) const
+RenderObject* SVGFilterElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- bool filterBBoxMode = filterUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
- bool primitiveBBoxMode = primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
-
- FloatRect filterBBox;
- if (filterBBoxMode)
- filterBBox = FloatRect(x().valueAsPercentage(),
- y().valueAsPercentage(),
- width().valueAsPercentage(),
- height().valueAsPercentage());
- else
- filterBBox = FloatRect(x().value(this),
- y().value(this),
- width().value(this),
- height().value(this));
-
- FloatRect filterRect = filterBBox;
- if (filterBBoxMode)
- filterRect = FloatRect(targetRect.x() + filterRect.x() * targetRect.width(),
- targetRect.y() + filterRect.y() * targetRect.height(),
- filterRect.width() * targetRect.width(),
- filterRect.height() * targetRect.height());
-
- m_filter->setFilterBoundingBox(filterRect);
- m_filter->setFilterRect(filterBBox);
- m_filter->setEffectBoundingBoxMode(primitiveBBoxMode);
- m_filter->setFilterBoundingBoxMode(filterBBoxMode);
-
- if (hasAttribute(SVGNames::filterResAttr)) {
- m_filter->setHasFilterResolution(true);
- m_filter->setFilterResolution(FloatSize(filterResX(), filterResY()));
- }
-
- // Add effects to the filter
- m_filter->builder()->clearEffects();
- for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
- SVGElement* element = 0;
- if (n->isSVGElement()) {
- element = static_cast<SVGElement*>(n);
- if (element->isFilterEffect()) {
- SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
- if (!effectElement->build(m_filter.get())) {
- m_filter->builder()->clearEffects();
- break;
- }
- }
- }
- }
+ return new (arena) RenderSVGResourceFilter(this);
}
-SVGResource* SVGFilterElement::canvasResource(const RenderObject*)
+bool SVGFilterElement::selfHasRelativeLengths() const
{
- if (!attached())
- return 0;
-
- if (!m_filter)
- m_filter = SVGResourceFilter::create(this);
- return m_filter.get();
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative();
}
}
-#endif // ENABLE(SVG) && ENABLE(FILTERS)
+#endif
diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h
index c89352b..ddcd953 100644
--- a/WebCore/svg/SVGFilterElement.h
+++ b/WebCore/svg/SVGFilterElement.h
@@ -1,30 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFilterElement_h
#define SVGFilterElement_h
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "RenderObject.h"
-#include "SVGResourceFilter.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledElement.h"
@@ -32,52 +32,65 @@
namespace WebCore {
- extern char SVGFilterResXIdentifier[];
- extern char SVGFilterResYIdentifier[];
+extern char SVGFilterResXIdentifier[];
+extern char SVGFilterResYIdentifier[];
- class SVGResourceFilter;
+class SVGFilterElement : public SVGStyledElement,
+ public SVGURIReference,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired {
+public:
+ SVGFilterElement(const QualifiedName&, Document*);
+ virtual ~SVGFilterElement();
- class SVGFilterElement : public SVGStyledElement,
- public SVGURIReference,
- public SVGLangSpace,
- public SVGExternalResourcesRequired {
- public:
- SVGFilterElement(const QualifiedName&, Document*);
- virtual ~SVGFilterElement();
+ virtual bool needsPendingResourceHandling() const { return false; }
- virtual SVGResource* canvasResource(const RenderObject*);
+ void setFilterRes(unsigned long filterResX, unsigned long filterResY);
+ FloatRect filterBoundingBox(const FloatRect&) const;
- void setFilterRes(unsigned long filterResX, unsigned long filterResY) const;
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::filterUnitsAttr, int, FilterUnits, filterUnits)
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::primitiveUnitsAttr, int, PrimitiveUnits, primitiveUnits)
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::xAttr, SVGLength, X, x)
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::yAttr, SVGLength, Y, y)
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::widthAttr, SVGLength, Width, width)
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::heightAttr, SVGLength, Height, height)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, SVGFilterResXIdentifier, long, FilterResX, filterResX)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, SVGFilterResYIdentifier, long, FilterResY, filterResY)
+ static void invalidateFilter(SVGElement* element)
+ {
+ ASSERT(element);
+ if (!element->inDocument())
+ return;
+ Node* parent = element->parentNode();
+ while (parent && !parent->hasTagName(SVGNames::filterTag))
+ parent = parent->parentNode();
- // SVGURIReference
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, XLinkNames::hrefAttr, String, Href, href)
+ if (!parent)
+ return;
- // SVGExternalResourcesRequired
- DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+ if (RenderObject* object = parent->renderer())
+ object->setNeedsLayout(true);
+ }
- mutable RefPtr<SVGResourceFilter> m_filter;
+private:
+ virtual bool selfHasRelativeLengths() const;
- private:
- friend class SVGResourceFilter;
- FloatRect filterBoundingBox(const FloatRect&) const;
- void buildFilter(const FloatRect& targetRect) const;
- };
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::filterUnitsAttr, int, FilterUnits, filterUnits)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::primitiveUnitsAttr, int, PrimitiveUnits, primitiveUnits)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::xAttr, SVGLength, X, x)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::yAttr, SVGLength, Y, y)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::widthAttr, SVGLength, Width, width)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::heightAttr, SVGLength, Height, height)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, SVGFilterResXIdentifier, long, FilterResX, filterResX)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, SVGFilterResYIdentifier, long, FilterResY, filterResY)
-} // namespace WebCore
+ // SVGURIReference
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, XLinkNames::hrefAttr, String, Href, href)
-#endif // ENABLE(SVG)
+ // SVGExternalResourcesRequired
+ DECLARE_ANIMATED_PROPERTY(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+};
+
+}
+
+#endif
#endif
diff --git a/WebCore/svg/SVGFilterElement.idl b/WebCore/svg/SVGFilterElement.idl
index 10b4f5e..1a74b7e 100644
--- a/WebCore/svg/SVGFilterElement.idl
+++ b/WebCore/svg/SVGFilterElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 0a95522..e91c0a1 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -1,31 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFilterPrimitiveStandardAttributes.h"
+#include "Attribute.h"
#include "FilterEffect.h"
-#include "MappedAttribute.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGStyledElement.h"
@@ -48,7 +48,7 @@ SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes()
{
}
-void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute* attr)
+void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
@@ -65,6 +65,18 @@ void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute*
return SVGStyledElement::parseMappedAttribute(attr);
}
+void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr
+ || attrName == SVGNames::resultAttr)
+ SVGFilterElement::invalidateFilter(this);
+}
+
void SVGFilterPrimitiveStandardAttributes::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledElement::synchronizeProperty(attrName);
@@ -90,14 +102,20 @@ void SVGFilterPrimitiveStandardAttributes::synchronizeProperty(const QualifiedNa
synchronizeResult();
}
-void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilter* resourceFilter, FilterEffect* filterEffect) const
+void SVGFilterPrimitiveStandardAttributes::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+ if (!changedByParser)
+ SVGFilterElement::invalidateFilter(this);
+}
+
+void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(bool primitiveBoundingBoxMode, FilterEffect* filterEffect) const
{
ASSERT(filterEffect);
if (!filterEffect)
return;
- ASSERT(resourceFilter);
-
if (this->hasAttribute(SVGNames::xAttr))
filterEffect->setHasX(true);
if (this->hasAttribute(SVGNames::yAttr))
@@ -108,7 +126,7 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilt
filterEffect->setHasHeight(true);
FloatRect effectBBox;
- if (resourceFilter->effectBoundingBoxMode())
+ if (primitiveBoundingBoxMode)
effectBBox = FloatRect(x().valueAsPercentage(),
y().valueAsPercentage(),
width().valueAsPercentage(),
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
index fb8e5f2..8754c6a 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
@@ -1,60 +1,62 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFilterPrimitiveStandardAttributes_h
#define SVGFilterPrimitiveStandardAttributes_h
#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "FilterEffect.h"
#include "SVGFilterBuilder.h"
+#include "SVGFilterElement.h"
#include "SVGNames.h"
-#include "SVGResourceFilter.h"
#include "SVGStyledElement.h"
-namespace WebCore {
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
- class SVGResourceFilter;
+namespace WebCore {
- class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement {
- public:
- SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document*);
- virtual ~SVGFilterPrimitiveStandardAttributes();
-
- virtual bool isFilterEffect() const { return true; }
+class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement {
+public:
+ SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document*);
+ virtual ~SVGFilterPrimitiveStandardAttributes();
+
+ virtual bool isFilterEffect() const { return true; }
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool build(SVGResourceFilter*) = 0;
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*) = 0;
- virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
- protected:
- friend class SVGResourceFilter;
- void setStandardAttributes(SVGResourceFilter*, FilterEffect*) const;
+ void setStandardAttributes(bool, FilterEffect*) const;
- private:
- DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, SVGLength, X, x)
- DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, SVGLength, Y, y)
- DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, SVGLength, Width, width)
- DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, SVGLength, Height, height)
- DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, String, Result, result)
- };
+private:
+ DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, SVGLength, X, x)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, SVGLength, Y, y)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, SVGLength, Width, width)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, SVGLength, Height, height)
+ DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, String, Result, result)
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl
index 194147c..8e43f90 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp
index 64c978f..c78a619 100644
--- a/WebCore/svg/SVGFitToViewBox.cpp
+++ b/WebCore/svg/SVGFitToViewBox.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -27,11 +27,10 @@
#include "Attr.h"
#include "Document.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGPreserveAspectRatio.h"
-#include "StringImpl.h"
+#include <wtf/text/StringImpl.h>
namespace WebCore {
@@ -43,35 +42,49 @@ SVGFitToViewBox::~SVGFitToViewBox()
{
}
-bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate)
+bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox)
+{
+ const UChar* c = s.characters();
+ const UChar* end = c + s.length();
+ return parseViewBox(doc, c, end, viewBox, true);
+}
+
+bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate)
{
String str(c, end - c);
skipOptionalSpaces(c, end);
+ float x = 0.0f;
+ float y = 0.0f;
+ float width = 0.0f;
+ float height = 0.0f;
bool valid = (parseNumber(c, end, x) && parseNumber(c, end, y) &&
- parseNumber(c, end, w) && parseNumber(c, end, h, false));
- if (!validate)
+ parseNumber(c, end, width) && parseNumber(c, end, height, false));
+ if (!validate) {
+ viewBox = FloatRect(x, y, width, height);
return true;
+ }
if (!valid) {
doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\"");
return false;
}
- if (w < 0.0) { // check that width is positive
+ if (width < 0.0) { // check that width is positive
doc->accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed");
return false;
- } else if (h < 0.0) { // check that height is positive
+ }
+ if (height < 0.0) { // check that height is positive
doc->accessSVGExtensions()->reportError("A negative value for ViewBox height is not allowed");
return false;
- } else {
- skipOptionalSpaces(c, end);
- if (c < end) { // nothing should come after the last, fourth number
- doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\"");
- return false;
- }
+ }
+ skipOptionalSpaces(c, end);
+ if (c < end) { // nothing should come after the last, fourth number
+ doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\"");
+ return false;
}
+ viewBox = FloatRect(x, y, width, height);
return true;
}
@@ -83,15 +96,15 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox
return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 0, 0, viewWidth, viewHeight);
}
-bool SVGFitToViewBox::parseMappedAttribute(Document* document, MappedAttribute* attr)
+bool SVGFitToViewBox::parseMappedAttribute(Document* document, Attribute* attr)
{
if (attr->name() == SVGNames::viewBoxAttr) {
- float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f;
- const UChar* c = attr->value().characters();
- const UChar* end = c + attr->value().length();
- if (parseViewBox(document, c, end, x, y, w, h))
- setViewBoxBaseValue(FloatRect(x, y, w, h));
- return true;
+ FloatRect viewBox;
+ if (!attr->value().isNull()) {
+ if (!parseViewBox(document, attr->value(), viewBox))
+ return true;
+ }
+ setViewBoxBaseValue(viewBox);
} else if (attr->name() == SVGNames::preserveAspectRatioAttr) {
SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value());
return true;
diff --git a/WebCore/svg/SVGFitToViewBox.h b/WebCore/svg/SVGFitToViewBox.h
index ef7e54b..ca0fec8 100644
--- a/WebCore/svg/SVGFitToViewBox.h
+++ b/WebCore/svg/SVGFitToViewBox.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFitToViewBox_h
#define SVGFitToViewBox_h
@@ -34,14 +34,17 @@ public:
SVGFitToViewBox();
virtual ~SVGFitToViewBox();
- bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true);
+ bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true);
static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight);
- bool parseMappedAttribute(Document*, MappedAttribute*);
+ bool parseMappedAttribute(Document*, Attribute*);
bool isKnownAttribute(const QualifiedName&);
virtual void setViewBoxBaseValue(SVGAnimatedPropertyTraits<FloatRect>::PassType) = 0;
virtual void setPreserveAspectRatioBaseValue(SVGAnimatedPropertyTraits<SVGPreserveAspectRatio>::PassType) = 0;
+
+private:
+ bool parseViewBox(Document*, const String&, FloatRect&);
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFitToViewBox.idl b/WebCore/svg/SVGFitToViewBox.idl
index d456cf8..af6efda 100644
--- a/WebCore/svg/SVGFitToViewBox.idl
+++ b/WebCore/svg/SVGFitToViewBox.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp
index b7ca5f2..898c259 100644
--- a/WebCore/svg/SVGFont.cpp
+++ b/WebCore/svg/SVGFont.cpp
@@ -1,5 +1,6 @@
-/**
+/*
* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -15,7 +16,6 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
#include "config.h"
@@ -26,6 +26,7 @@
#include "CSSFontSelector.h"
#include "GraphicsContext.h"
#include "RenderObject.h"
+#include "RenderSVGResourceSolidColor.h"
#include "SimpleFontData.h"
#include "SVGAltGlyphElement.h"
#include "SVGFontData.h"
@@ -34,8 +35,6 @@
#include "SVGFontElement.h"
#include "SVGFontFaceElement.h"
#include "SVGMissingGlyphElement.h"
-#include "SVGPaintServer.h"
-#include "SVGPaintServerSolid.h"
#include "XMLNames.h"
using namespace WTF::Unicode;
@@ -183,8 +182,8 @@ static inline bool isCompatibleGlyph(const SVGGlyphIdentifier& identifier, bool
// Split subcode from language, if existant.
String languagePrefix;
- int subCodeSeparator = language.find('-');
- if (subCodeSeparator != -1)
+ size_t subCodeSeparator = language.find('-');
+ if (subCodeSeparator != notFound)
languagePrefix = language.left(subCodeSeparator);
Vector<String>::const_iterator it = identifier.languages.begin();
@@ -413,7 +412,7 @@ static float floatWidthOfSubStringUsingSVGFont(const Font* font, const TextRun&
}
SVGTextRunWalker<SVGTextRunWalkerMeasuredLengthData> runWalker(fontData, fontElement, data, floatWidthUsingSVGFontCallback, floatWidthMissingGlyphCallback);
- runWalker.walk(run, isVerticalText, language, 0, run.length());
+ runWalker.walk(run, isVerticalText, language, from, to);
charsConsumed = data.charsConsumed;
glyphName = data.glyphName;
return data.length;
@@ -470,20 +469,20 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
FloatPoint currentPoint = point;
float scale = convertEmUnitToPixel(size(), fontFaceElement->unitsPerEm(), 1.0f);
- SVGPaintServer* activePaintServer = run.activePaintServer();
+ RenderSVGResource* activePaintingResource = run.activePaintingResource();
// If renderObject is not set, we're dealing for HTML text rendered using SVG Fonts.
if (!run.referencingRenderObject()) {
- ASSERT(!activePaintServer);
+ ASSERT(!activePaintingResource);
// TODO: We're only supporting simple filled HTML text so far.
- SVGPaintServerSolid* solidPaintServer = SVGPaintServer::sharedSolidPaintServer();
- solidPaintServer->setColor(context->fillColor());
+ RenderSVGResourceSolidColor* solidPaintingResource = RenderSVGResource::sharedSolidPaintingResource();
+ solidPaintingResource->setColor(context->fillColor());
- activePaintServer = solidPaintServer;
+ activePaintingResource = solidPaintingResource;
}
- ASSERT(activePaintServer);
+ ASSERT(activePaintingResource);
int charsConsumed;
String glyphName;
@@ -512,7 +511,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
SVGTextRunWalker<SVGTextRunWalkerDrawTextData> runWalker(fontData, fontElement, data, drawTextUsingSVGFontCallback, drawTextMissingGlyphCallback);
runWalker.walk(run, isVerticalText, language, from, to);
- SVGPaintTargetType targetType = context->textDrawingMode() == cTextStroke ? ApplyToStrokeTargetType : ApplyToFillTargetType;
+ RenderSVGResourceMode resourceMode = context->textDrawingMode() == cTextStroke ? ApplyToStrokeMode : ApplyToFillMode;
unsigned numGlyphs = data.glyphIdentifiers.size();
unsigned fallbackCharacterIndex = 0;
@@ -528,25 +527,19 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
glyphOrigin.setY(identifier.verticalOriginY * scale);
}
- context->translate(xStartOffset + currentPoint.x() + glyphOrigin.x(), currentPoint.y() + glyphOrigin.y());
- context->scale(FloatSize(scale, -scale));
+ AffineTransform glyphPathTransform;
+ glyphPathTransform.translate(xStartOffset + currentPoint.x() + glyphOrigin.x(), currentPoint.y() + glyphOrigin.y());
+ glyphPathTransform.scale(scale, -scale);
+
+ Path glyphPath = identifier.pathData;
+ glyphPath.transform(glyphPathTransform);
context->beginPath();
- context->addPath(identifier.pathData);
-
- // FIXME: setup() tries to get objectBoundingBox() from run.referencingRenderObject()
- // which is wrong. We need to change setup() to take a bounding box instead, or pass
- // a RenderObject which would return the bounding box for identifier.pathData
- if (activePaintServer->setup(context, run.referencingRenderObject(), targetType)) {
- // Spec: Any properties specified on a text elements which represents a length, such as the
- // 'stroke-width' property, might produce surprising results since the length value will be
- // processed in the coordinate system of the glyph. (TODO: What other lengths? miter-limit? dash-offset?)
- if (targetType == ApplyToStrokeTargetType && scale != 0.0f)
- context->setStrokeThickness(context->strokeThickness() / scale);
-
- activePaintServer->renderPath(context, run.referencingRenderObject(), targetType);
- activePaintServer->teardown(context, run.referencingRenderObject(), targetType);
- }
+ context->addPath(glyphPath);
+
+ RenderStyle* style = run.referencingRenderObject() ? run.referencingRenderObject()->style() : 0;
+ if (activePaintingResource->applyResource(run.referencingRenderObject(), style, context, resourceMode))
+ activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode);
context->restore();
}
@@ -577,7 +570,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
}
}
-FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const IntPoint& point, int height, int from, int to) const
+FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const FloatPoint& point, int height, int from, int to) const
{
int charsConsumed;
String glyphName;
@@ -586,7 +579,7 @@ FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const IntPo
point.y(), floatWidthOfSubStringUsingSVGFont(this, run, 0, from, to, charsConsumed, glyphName), height);
}
-int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, int, bool) const
+int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, float, bool) const
{
// TODO: Fix text selection when HTML text is drawn using a SVG Font
// We need to integrate the SVG text selection code in the offsetForPosition() framework.
diff --git a/WebCore/svg/SVGFontData.cpp b/WebCore/svg/SVGFontData.cpp
index dc8ae4e..a88de66 100644
--- a/WebCore/svg/SVGFontData.cpp
+++ b/WebCore/svg/SVGFontData.cpp
@@ -15,7 +15,6 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
#include "config.h"
@@ -34,6 +33,7 @@ SVGFontData::SVGFontData(SVGFontFaceElement* fontFaceElement)
, m_verticalOriginY(fontFaceElement->verticalOriginY())
, m_verticalAdvanceY(fontFaceElement->verticalAdvanceY())
{
+ ASSERT_ARG(fontFaceElement, fontFaceElement);
}
SVGFontData::~SVGFontData()
diff --git a/WebCore/svg/SVGFontData.h b/WebCore/svg/SVGFontData.h
index 3f17e3e..c66aa23 100644
--- a/WebCore/svg/SVGFontData.h
+++ b/WebCore/svg/SVGFontData.h
@@ -15,7 +15,6 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
#ifndef SVGFontData_h
diff --git a/WebCore/svg/SVGFontElement.cpp b/WebCore/svg/SVGFontElement.cpp
index 91d222c..2d29042 100644
--- a/WebCore/svg/SVGFontElement.cpp
+++ b/WebCore/svg/SVGFontElement.cpp
@@ -1,22 +1,23 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -27,9 +28,10 @@
#include "Font.h"
#include "GlyphPageTreeNode.h"
#include "SVGGlyphElement.h"
+#include "SVGHKernElement.h"
#include "SVGMissingGlyphElement.h"
#include "SVGNames.h"
-#include "SVGParserUtilities.h"
+#include "SVGVKernElement.h"
#include <wtf/ASCIICType.h>
using namespace WTF;
@@ -60,7 +62,8 @@ void SVGFontElement::invalidateGlyphCache()
{
if (m_isGlyphCacheValid) {
m_glyphMap.clear();
- m_kerningPairs.clear();
+ m_horizontalKerningPairs.clear();
+ m_verticalKerningPairs.clear();
}
m_isGlyphCacheValid = false;
}
@@ -88,156 +91,86 @@ void SVGFontElement::ensureGlyphCache() const
m_glyphMap.add(unicode, glyph->buildGlyphIdentifier());
} else if (child->hasTagName(hkernTag)) {
SVGHKernElement* hkern = static_cast<SVGHKernElement*>(child);
- SVGHorizontalKerningPair kerningPair = hkern->buildHorizontalKerningPair();
- m_kerningPairs.append(kerningPair);
+ hkern->buildHorizontalKerningPair(m_horizontalKerningPairs);
+ } else if (child->hasTagName(vkernTag)) {
+ SVGVKernElement* vkern = static_cast<SVGVKernElement*>(child);
+ vkern->buildVerticalKerningPair(m_verticalKerningPairs);
}
}
m_isGlyphCacheValid = true;
}
-
-// Returns the number of characters consumed or 0 if no range was found.
-static unsigned parseUnicodeRange(const UChar* characters, unsigned length, pair<unsigned, unsigned>& range)
+
+static bool stringMatchesUnicodeRange(const String& unicodeString, const UnicodeRanges& ranges, const HashSet<String>& unicodeValues)
{
- if (length < 2)
- return 0;
- if (characters[0] != 'U')
- return 0;
- if (characters[1] != '+')
- return 0;
-
- // Parse the starting hex number (or its prefix).
- unsigned start = 0;
- unsigned startLength = 0;
- for (unsigned i = 2; i < length; ++i) {
- if (!isASCIIHexDigit(characters[i]))
- break;
- if (++startLength > 6)
- return 0;
- start = (start << 4) | toASCIIHexValue(characters[i]);
- }
-
- // Handle the case of ranges separated by "-" sign.
- if (2 + startLength < length && characters[2 + startLength] == '-') {
- if (!startLength)
- return 0;
-
- // Parse the ending hex number (or its prefix).
- unsigned end = 0;
- unsigned endLength = 0;
- for (unsigned i = 2 + startLength + 1; i < length; ++i) {
- if (!isASCIIHexDigit(characters[i]))
- break;
- if (++endLength > 6)
- return 0;
- end = (end << 4) | toASCIIHexValue(characters[i]);
+ if (unicodeString.isEmpty())
+ return false;
+
+ if (!ranges.isEmpty()) {
+ UChar firstChar = unicodeString[0];
+ const UnicodeRanges::const_iterator end = ranges.end();
+ for (UnicodeRanges::const_iterator it = ranges.begin(); it != end; ++it) {
+ if (firstChar >= it->first && firstChar <= it->second)
+ return true;
}
-
- if (!endLength)
- return 0;
-
- range.first = start;
- range.second = end;
- return 2 + startLength + 1 + endLength;
}
+
+ if (!unicodeValues.isEmpty())
+ return unicodeValues.contains(unicodeString);
- // Handle the case of a number with some optional trailing question marks.
- unsigned end = start;
- for (unsigned i = 2 + startLength; i < length; ++i) {
- if (characters[i] != '?')
- break;
- if (++startLength > 6)
- return 0;
- start <<= 4;
- end = (end << 4) | 0xF;
- }
-
- if (!startLength)
- return 0;
-
- range.first = start;
- range.second = end;
- return 2 + startLength;
-}
-
-static bool parseUnicodeRangeList(const UChar* characters, unsigned length, Vector<pair<unsigned, unsigned> >& ranges)
-{
- ranges.clear();
- if (!length)
- return true;
-
- const UChar* remainingCharacters = characters;
- unsigned remainingLength = length;
-
- while (1) {
- pair<unsigned, unsigned> range;
- unsigned charactersConsumed = parseUnicodeRange(remainingCharacters, remainingLength, range);
- if (charactersConsumed) {
- ranges.append(range);
- remainingCharacters += charactersConsumed;
- remainingLength -= charactersConsumed;
- } else {
- if (!remainingLength)
- return false;
- UChar character = remainingCharacters[0];
- if (character == ',')
- return false;
- ranges.append(make_pair(character, character));
- ++remainingCharacters;
- --remainingLength;
- }
- if (!remainingLength)
- return true;
- if (remainingCharacters[0] != ',')
- return false;
- ++remainingCharacters;
- --remainingLength;
- }
+ return false;
}
-static bool stringMatchesUnicodeRange(const String& unicodeString, const String& unicodeRangeSpec)
+static bool stringMatchesGlyphName(const String& glyphName, const HashSet<String>& glyphValues)
{
- Vector<pair<unsigned, unsigned> > ranges;
- if (!parseUnicodeRangeList(unicodeRangeSpec.characters(), unicodeRangeSpec.length(), ranges))
+ if (glyphName.isEmpty())
return false;
+
+ if (!glyphValues.isEmpty())
+ return glyphValues.contains(glyphName);
- if (unicodeString.length() != ranges.size())
- return false;
-
- for (size_t i = 0; i < unicodeString.length(); ++i) {
- UChar c = unicodeString[i];
- if (c < ranges[i].first || c > ranges[i].second)
- return false;
- }
-
- return true;
+ return false;
}
-static bool matches(const String& u1, const String& g1, const String& u2, const String& g2, const SVGHorizontalKerningPair& kerningPair)
+static bool matches(const String& u1, const String& g1, const String& u2, const String& g2, const SVGKerningPair& kerningPair)
{
- if (kerningPair.unicode1.length() && !stringMatchesUnicodeRange(u1, kerningPair.unicode1))
- return false;
- if (kerningPair.glyphName1.length() && kerningPair.glyphName1 != g1)
- return false;
-
- if (kerningPair.unicode2.length() && !stringMatchesUnicodeRange(u2, kerningPair.unicode2))
+ if (!stringMatchesUnicodeRange(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1)
+ && !stringMatchesGlyphName(g1, kerningPair.glyphName1))
return false;
- if (kerningPair.glyphName2.length() && kerningPair.glyphName2 != g2)
+
+ if (!stringMatchesUnicodeRange(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2)
+ && !stringMatchesGlyphName(g2, kerningPair.glyphName2))
return false;
-
+
return true;
}
-
-bool SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const
+
+static float kerningForPairOfStringsAndGlyphs(KerningPairVector& kerningPairs, const String& u1, const String& g1, const String& u2, const String& g2)
{
- for (size_t i = 0; i < m_kerningPairs.size(); ++i) {
- if (matches(u1, g1, u2, g2, m_kerningPairs[i])) {
- kerningPair = m_kerningPairs[i];
- return true;
- }
+ KerningPairVector::const_iterator it = kerningPairs.end() - 1;
+ const KerningPairVector::const_iterator begin = kerningPairs.begin() - 1;
+ for (; it != begin; --it) {
+ if (matches(u1, g1, u2, g2, *it))
+ return it->kerning;
}
+
+ return 0.0f;
+}
- return false;
+float SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const
+{
+ if (m_horizontalKerningPairs.isEmpty())
+ return 0.0f;
+
+ return kerningForPairOfStringsAndGlyphs(m_horizontalKerningPairs, u1, g1, u2, g2);
+}
+
+float SVGFontElement::verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const
+{
+ if (m_verticalKerningPairs.isEmpty())
+ return 0.0f;
+
+ return kerningForPairOfStringsAndGlyphs(m_verticalKerningPairs, u1, g1, u2, g2);
}
void SVGFontElement::getGlyphIdentifiersForString(const String& string, Vector<SVGGlyphIdentifier>& glyphs) const
diff --git a/WebCore/svg/SVGFontElement.h b/WebCore/svg/SVGFontElement.h
index 90641a8..24c2fc5 100644
--- a/WebCore/svg/SVGFontElement.h
+++ b/WebCore/svg/SVGFontElement.h
@@ -1,21 +1,22 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFontElement_h
@@ -25,41 +26,59 @@
#include "SVGExternalResourcesRequired.h"
#include "SVGGlyphElement.h"
#include "SVGGlyphMap.h"
-#include "SVGHKernElement.h"
+#include "SVGParserUtilities.h"
#include "SVGStyledElement.h"
namespace WebCore {
- class SVGMissingGlyphElement;
- class SVGFontElement : public SVGStyledElement
- , public SVGExternalResourcesRequired {
- public:
- SVGFontElement(const QualifiedName&, Document*);
- virtual ~SVGFontElement();
-
- virtual void synchronizeProperty(const QualifiedName&);
- virtual bool rendererIsNeeded(RenderStyle*) { return false; }
-
- void invalidateGlyphCache();
-
- void getGlyphIdentifiersForString(const String&, Vector<SVGGlyphIdentifier>&) const;
-
- bool getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const;
-
- SVGMissingGlyphElement* firstMissingGlyphElement() const;
-
- private:
- // SVGExternalResourcesRequired
- DECLARE_ANIMATED_PROPERTY(SVGFontElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
-
- void ensureGlyphCache() const;
-
- typedef Vector<SVGHorizontalKerningPair> KerningPairVector;
-
- mutable KerningPairVector m_kerningPairs;
- mutable SVGGlyphMap m_glyphMap;
- mutable bool m_isGlyphCacheValid;
- };
+// Describe an SVG <hkern>/<vkern> element
+struct SVGKerningPair {
+ float kerning;
+ UnicodeRanges unicodeRange1;
+ UnicodeRanges unicodeRange2;
+ HashSet<String> unicodeName1;
+ HashSet<String> unicodeName2;
+ HashSet<String> glyphName1;
+ HashSet<String> glyphName2;
+
+ SVGKerningPair()
+ : kerning(0.0f)
+ {
+ }
+};
+
+typedef Vector<SVGKerningPair> KerningPairVector;
+
+class SVGMissingGlyphElement;
+class SVGFontElement : public SVGStyledElement
+ , public SVGExternalResourcesRequired {
+public:
+ SVGFontElement(const QualifiedName&, Document*);
+ virtual ~SVGFontElement();
+
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+
+ void invalidateGlyphCache();
+
+ void getGlyphIdentifiersForString(const String&, Vector<SVGGlyphIdentifier>&) const;
+
+ float horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const;
+ float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const;
+
+ SVGMissingGlyphElement* firstMissingGlyphElement() const;
+
+private:
+ // SVGExternalResourcesRequired
+ DECLARE_ANIMATED_PROPERTY(SVGFontElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+
+ void ensureGlyphCache() const;
+
+ mutable KerningPairVector m_horizontalKerningPairs;
+ mutable KerningPairVector m_verticalKerningPairs;
+ mutable SVGGlyphMap m_glyphMap;
+ mutable bool m_isGlyphCacheValid;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFontElement.idl b/WebCore/svg/SVGFontElement.idl
index 92bd512..71967bf 100644
--- a/WebCore/svg/SVGFontElement.idl
+++ b/WebCore/svg/SVGFontElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFontFaceElement.cpp b/WebCore/svg/SVGFontFaceElement.cpp
index 25b3aea..42c1c75 100644
--- a/WebCore/svg/SVGFontFaceElement.cpp
+++ b/WebCore/svg/SVGFontFaceElement.cpp
@@ -1,30 +1,30 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG_FONTS)
#include "SVGFontFaceElement.h"
-#include "CString.h"
+#include "Attribute.h"
#include "CSSFontFaceRule.h"
#include "CSSFontFaceSrcValue.h"
#include "CSSParser.h"
@@ -36,7 +36,6 @@
#include "CSSValueList.h"
#include "Document.h"
#include "Font.h"
-#include "MappedAttribute.h"
#include "SVGFontElement.h"
#include "SVGFontFaceSrcElement.h"
#include "SVGGlyphElement.h"
@@ -59,7 +58,6 @@ SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document* d
SVGFontFaceElement::~SVGFontFaceElement()
{
- removeFromMappedElementSheet();
}
static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
@@ -110,7 +108,7 @@ static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
return propertyNameToIdMap->get(attrName.localName().impl());
}
-void SVGFontFaceElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFontFaceElement::parseMappedAttribute(Attribute* attr)
{
int propId = cssPropertyIdForSVGAttributeName(attr->name());
if (propId > 0) {
diff --git a/WebCore/svg/SVGFontFaceElement.h b/WebCore/svg/SVGFontFaceElement.h
index 3c28a89..7d1f457 100644
--- a/WebCore/svg/SVGFontFaceElement.h
+++ b/WebCore/svg/SVGFontFaceElement.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFontFaceElement_h
#define SVGFontFaceElement_h
@@ -36,7 +36,7 @@ namespace WebCore {
SVGFontFaceElement(const QualifiedName&, Document*);
virtual ~SVGFontFaceElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void insertedIntoDocument();
diff --git a/WebCore/svg/SVGFontFaceElement.idl b/WebCore/svg/SVGFontFaceElement.idl
index 0097f49..e7e6980 100644
--- a/WebCore/svg/SVGFontFaceElement.idl
+++ b/WebCore/svg/SVGFontFaceElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFontFaceFormatElement.cpp b/WebCore/svg/SVGFontFaceFormatElement.cpp
index e6dd94b..d6e3a3d 100644
--- a/WebCore/svg/SVGFontFaceFormatElement.cpp
+++ b/WebCore/svg/SVGFontFaceFormatElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGFontFaceFormatElement.h b/WebCore/svg/SVGFontFaceFormatElement.h
index 97828cb..eae22bf 100644
--- a/WebCore/svg/SVGFontFaceFormatElement.h
+++ b/WebCore/svg/SVGFontFaceFormatElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFontFaceFormatElement_h
diff --git a/WebCore/svg/SVGFontFaceFormatElement.idl b/WebCore/svg/SVGFontFaceFormatElement.idl
index cac29d7..6053c98 100644
--- a/WebCore/svg/SVGFontFaceFormatElement.idl
+++ b/WebCore/svg/SVGFontFaceFormatElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFontFaceNameElement.cpp b/WebCore/svg/SVGFontFaceNameElement.cpp
index 91002e1..b9657b3 100644
--- a/WebCore/svg/SVGFontFaceNameElement.cpp
+++ b/WebCore/svg/SVGFontFaceNameElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGFontFaceNameElement.h b/WebCore/svg/SVGFontFaceNameElement.h
index 1e07b13..ab71b7d 100644
--- a/WebCore/svg/SVGFontFaceNameElement.h
+++ b/WebCore/svg/SVGFontFaceNameElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFontFaceNameElement_h
diff --git a/WebCore/svg/SVGFontFaceNameElement.idl b/WebCore/svg/SVGFontFaceNameElement.idl
index 0dd0c90..4292a28 100644
--- a/WebCore/svg/SVGFontFaceNameElement.idl
+++ b/WebCore/svg/SVGFontFaceNameElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFontFaceSrcElement.cpp b/WebCore/svg/SVGFontFaceSrcElement.cpp
index 0d72c74..77b2e5e 100644
--- a/WebCore/svg/SVGFontFaceSrcElement.cpp
+++ b/WebCore/svg/SVGFontFaceSrcElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGFontFaceSrcElement.h b/WebCore/svg/SVGFontFaceSrcElement.h
index b86f689..0277e9a 100644
--- a/WebCore/svg/SVGFontFaceSrcElement.h
+++ b/WebCore/svg/SVGFontFaceSrcElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFontFaceSrcElement_h
diff --git a/WebCore/svg/SVGFontFaceSrcElement.idl b/WebCore/svg/SVGFontFaceSrcElement.idl
index 4887bb8..addfc0e 100644
--- a/WebCore/svg/SVGFontFaceSrcElement.idl
+++ b/WebCore/svg/SVGFontFaceSrcElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGFontFaceUriElement.cpp b/WebCore/svg/SVGFontFaceUriElement.cpp
index bfcda70..a7ad370 100644
--- a/WebCore/svg/SVGFontFaceUriElement.cpp
+++ b/WebCore/svg/SVGFontFaceUriElement.cpp
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2009 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -23,11 +23,11 @@
#if ENABLE(SVG_FONTS)
#include "SVGFontFaceUriElement.h"
+#include "Attribute.h"
#include "CSSFontFaceSrcValue.h"
#include "CachedFont.h"
#include "DocLoader.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "SVGFontFaceElement.h"
#include "SVGNames.h"
#include "XLinkNames.h"
@@ -55,7 +55,7 @@ PassRefPtr<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const
return src.release();
}
-void SVGFontFaceUriElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGFontFaceUriElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == XLinkNames::hrefAttr)
diff --git a/WebCore/svg/SVGFontFaceUriElement.h b/WebCore/svg/SVGFontFaceUriElement.h
index 1d880e5..b026160 100644
--- a/WebCore/svg/SVGFontFaceUriElement.h
+++ b/WebCore/svg/SVGFontFaceUriElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFontFaceUriElement_h
@@ -37,10 +37,26 @@ namespace WebCore {
PassRefPtr<CSSFontFaceSrcValue> srcValue() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void insertedIntoDocument();
+#ifdef ANDROID_INSTRUMENT
+ void* operator new(size_t size) {
+ return SVGElement::operator new(size);
+ }
+ void* operator new[](size_t size) {
+ return SVGElement::operator new[](size);
+ }
+
+ void operator delete(void* p, size_t size) {
+ SVGElement::operator delete(p, size);
+ }
+ void operator delete[](void* p, size_t size) {
+ SVGElement::operator delete[](p, size);
+ }
+#endif
+
private:
void loadFont();
diff --git a/WebCore/svg/SVGFontFaceUriElement.idl b/WebCore/svg/SVGFontFaceUriElement.idl
index 6c194ba..ae34a91 100644
--- a/WebCore/svg/SVGFontFaceUriElement.idl
+++ b/WebCore/svg/SVGFontFaceUriElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp
index e9118ef..3e9e90e 100644
--- a/WebCore/svg/SVGForeignObjectElement.cpp
+++ b/WebCore/svg/SVGForeignObjectElement.cpp
@@ -1,33 +1,32 @@
/*
- Copyright (C) 2006 Apple Computer, Inc.
- (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
#include "SVGForeignObjectElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
-#include "MappedAttribute.h"
#include "RenderForeignObject.h"
+#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include <wtf/Assertions.h>
@@ -50,7 +49,7 @@ SVGForeignObjectElement::~SVGForeignObjectElement()
{
}
-void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGForeignObjectElement::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
@@ -72,83 +71,33 @@ void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute* attr)
}
}
-// TODO: Move this function in some SVG*Element base class, as SVGSVGElement / SVGImageElement will need the same logic!
-
-// This function mimics addCSSProperty and StyledElement::attributeChanged.
-// In HTML code, you'd always call addCSSProperty from your derived parseMappedAttribute()
-// function - though in SVG code we need to move this logic into svgAttributeChanged, in
-// order to support SVG DOM changes (which don't use the parseMappedAttribute/attributeChanged).
-// If we'd ignore SVG DOM, we could use _exactly_ the same logic as HTML.
-static inline void addCSSPropertyAndNotifyAttributeMap(StyledElement* element, const QualifiedName& name, int cssProperty, const String& value)
+void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
{
- ASSERT(element);
-
- if (!element)
- return;
-
- NamedMappedAttrMap* attrs = element->mappedAttributes();
- ASSERT(attrs);
-
- if (!attrs)
- return;
-
- Attribute* attr = attrs->getAttributeItem(name);
- if (!attr || !attr->isMappedAttribute())
- return;
-
- MappedAttribute* mappedAttr = static_cast<MappedAttribute*>(attr);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
- // This logic is only meant to be used for entries that have to be parsed and are mapped to eNone. Assert that.
- MappedAttributeEntry entry;
- bool needToParse = element->mapToEntry(mappedAttr->name(), entry);
+ bool isLengthAttribute = attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr;
- ASSERT(needToParse);
- ASSERT(entry == eNone);
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
- if (!needToParse || entry != eNone)
+ RenderObject* renderer = this->renderer();
+ if (!renderer)
return;
- if (mappedAttr->decl()) {
- mappedAttr->setDecl(0);
- attrs->declRemoved();
- }
-
- element->setNeedsStyleRecalc();
- element->addCSSProperty(mappedAttr, cssProperty, value);
-
- if (CSSMappedAttributeDeclaration* decl = mappedAttr->decl()) {
- // Add the decl to the table in the appropriate spot.
- element->setMappedAttributeDecl(entry, mappedAttr, decl);
-
- decl->setMappedState(entry, mappedAttr->name(), mappedAttr->value());
- decl->setParent(0);
- decl->setNode(0);
-
- attrs->declAdded();
- }
-}
-
-void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
-{
- SVGStyledTransformableElement::svgAttributeChanged(attrName);
-
- if (attrName == SVGNames::widthAttr) {
- addCSSPropertyAndNotifyAttributeMap(this, attrName, CSSPropertyWidth, width().valueAsString());
- return;
- } else if (attrName == SVGNames::heightAttr) {
- addCSSPropertyAndNotifyAttributeMap(this, attrName, CSSPropertyHeight, height().valueAsString());
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
}
- if (!renderer())
- return;
-
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (isLengthAttribute
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGForeignObjectElement::synchronizeProperty(const QualifiedName& attrName)
@@ -175,8 +124,6 @@ void SVGForeignObjectElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeHeight();
else if (SVGExternalResourcesRequired::isKnownAttribute(attrName))
synchronizeExternalResourcesRequired();
- else if (SVGURIReference::isKnownAttribute(attrName))
- synchronizeHref();
}
RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, RenderStyle*)
@@ -186,10 +133,22 @@ RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, Render
bool SVGForeignObjectElement::childShouldCreateRenderer(Node* child) const
{
+ // Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subdocuments.
+ if (child->isSVGElement())
+ return child->hasTagName(SVGNames::svgTag);
+
// Skip over SVG rules which disallow non-SVG kids
return StyledElement::childShouldCreateRenderer(child);
}
-} // namespace WebCore
+bool SVGForeignObjectElement::selfHasRelativeLengths() const
+{
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative();
+}
+
+}
-#endif // ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
+#endif
diff --git a/WebCore/svg/SVGForeignObjectElement.h b/WebCore/svg/SVGForeignObjectElement.h
index fe36a20..5ce16fd 100644
--- a/WebCore/svg/SVGForeignObjectElement.h
+++ b/WebCore/svg/SVGForeignObjectElement.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2006 Apple Computer, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGForeignObjectElement_h
#define SVGForeignObjectElement_h
@@ -33,14 +33,13 @@ namespace WebCore {
class SVGForeignObjectElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGURIReference {
+ public SVGExternalResourcesRequired {
public:
SVGForeignObjectElement(const QualifiedName&, Document*);
virtual ~SVGForeignObjectElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
@@ -48,6 +47,8 @@ namespace WebCore {
virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style);
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGForeignObjectElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGForeignObjectElement, SVGNames::yAttr, SVGLength, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGForeignObjectElement, SVGNames::widthAttr, SVGLength, Width, width)
diff --git a/WebCore/svg/SVGForeignObjectElement.idl b/WebCore/svg/SVGForeignObjectElement.idl
index f5226e3..0d3fc25 100644
--- a/WebCore/svg/SVGForeignObjectElement.idl
+++ b/WebCore/svg/SVGForeignObjectElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp
index 0fd329f..0c85a03 100644
--- a/WebCore/svg/SVGGElement.cpp
+++ b/WebCore/svg/SVGGElement.cpp
@@ -1,28 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGGElement.h"
+#include "RenderSVGHiddenContainer.h"
+#include "RenderSVGResource.h"
#include "RenderSVGTransformableContainer.h"
namespace WebCore {
@@ -39,7 +41,7 @@ SVGGElement::~SVGGElement()
{
}
-void SVGGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTests::parseMappedAttribute(attr))
return;
@@ -55,14 +57,20 @@ void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ RenderObject* renderer = this->renderer();
+ if (!renderer)
+ return;
+
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
+ }
- if (SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGGElement::synchronizeProperty(const QualifiedName& attrName)
@@ -73,16 +81,15 @@ void SVGGElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeExternalResourcesRequired();
}
-void SVGGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
- SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
- if (renderer())
- renderer()->setNeedsLayout(true);
-}
+ // SVG 1.1 testsuite explicitely uses constructs like <g display="none"><linearGradient>
+ // We still have to create renderers for the <g> & <linearGradient> element, though the
+ // subtree may be hidden - we only want the resource renderers to exist so they can be
+ // referenced from somewhere else.
+ if (style->display() == NONE)
+ return new (arena) RenderSVGHiddenContainer(this);
-RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
return new (arena) RenderSVGTransformableContainer(this);
}
diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h
index 3e0dd8e..107fa3c 100644
--- a/WebCore/svg/SVGGElement.h
+++ b/WebCore/svg/SVGGElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGGElement_h
#define SVGGElement_h
@@ -40,11 +40,11 @@ namespace WebCore {
virtual bool isShadowTreeContainerElement() const { return false; }
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual bool rendererIsNeeded(RenderStyle*) { return true; }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
private:
diff --git a/WebCore/svg/SVGGElement.idl b/WebCore/svg/SVGGElement.idl
index d03466d..5c539f7 100644
--- a/WebCore/svg/SVGGElement.idl
+++ b/WebCore/svg/SVGGElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGGlyphElement.cpp b/WebCore/svg/SVGGlyphElement.cpp
index 2d15569..2c84841 100644
--- a/WebCore/svg/SVGGlyphElement.cpp
+++ b/WebCore/svg/SVGGlyphElement.cpp
@@ -1,35 +1,35 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG_FONTS)
#include "SVGGlyphElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGFontData.h"
#include "SVGFontElement.h"
#include "SVGFontFaceElement.h"
#include "SVGNames.h"
-#include "SVGParserUtilities.h"
+#include "SVGPathParserFactory.h"
#include "SimpleFontData.h"
#include "XMLNames.h"
@@ -55,7 +55,7 @@ void SVGGlyphElement::invalidateGlyphCache()
}
}
-void SVGGlyphElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGlyphElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::dAttr)
invalidateGlyphCache();
@@ -102,8 +102,8 @@ static inline SVGGlyphIdentifier::Orientation parseOrientation(const AtomicStrin
static inline Path parsePathData(const AtomicString& value)
{
Path result;
- pathFromSVGData(result, value);
-
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ factory->buildPathFromString(value, result);
return result;
}
diff --git a/WebCore/svg/SVGGlyphElement.h b/WebCore/svg/SVGGlyphElement.h
index 0662097..5b5408d 100644
--- a/WebCore/svg/SVGGlyphElement.h
+++ b/WebCore/svg/SVGGlyphElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGGlyphElement_h
@@ -24,13 +24,13 @@
#if ENABLE(SVG_FONTS)
#include "SVGStyledElement.h"
+#include <wtf/Forward.h>
#include <limits>
#include "Path.h"
namespace WebCore {
- class AtomicString;
class SVGFontData;
// Describe a SVG <glyph> element
@@ -106,7 +106,7 @@ namespace WebCore {
SVGGlyphElement(const QualifiedName&, Document*);
virtual ~SVGGlyphElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/svg/SVGGlyphElement.idl b/WebCore/svg/SVGGlyphElement.idl
index 2d77fcd..2d68698 100644
--- a/WebCore/svg/SVGGlyphElement.idl
+++ b/WebCore/svg/SVGGlyphElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGGlyphMap.h b/WebCore/svg/SVGGlyphMap.h
index b58b155..aba0c86 100644
--- a/WebCore/svg/SVGGlyphMap.h
+++ b/WebCore/svg/SVGGlyphMap.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2008 Apple, Inc
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGGlyphMap_h
diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp
index f573265..f2d9712 100644
--- a/WebCore/svg/SVGGradientElement.cpp
+++ b/WebCore/svg/SVGGradientElement.cpp
@@ -1,35 +1,36 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGGradientElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "RenderSVGHiddenContainer.h"
+#include "RenderSVGResourceLinearGradient.h"
+#include "RenderSVGResourceRadialGradient.h"
#include "SVGNames.h"
-#include "SVGPaintServerLinearGradient.h"
-#include "SVGPaintServerRadialGradient.h"
#include "SVGStopElement.h"
#include "SVGTransformList.h"
#include "SVGTransformable.h"
@@ -50,7 +51,7 @@ SVGGradientElement::~SVGGradientElement()
{
}
-void SVGGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::gradientUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
@@ -84,16 +85,17 @@ void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledElement::svgAttributeChanged(attrName);
- if (!m_resource)
+ RenderObject* object = renderer();
+ if (!object)
return;
- if (attrName == SVGNames::gradientUnitsAttr ||
- attrName == SVGNames::gradientTransformAttr ||
- attrName == SVGNames::spreadMethodAttr ||
- SVGURIReference::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledElement::isKnownAttribute(attrName))
- m_resource->invalidate();
+ if (attrName == SVGNames::gradientUnitsAttr
+ || attrName == SVGNames::gradientTransformAttr
+ || attrName == SVGNames::spreadMethodAttr
+ || SVGURIReference::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName)
+ || SVGStyledElement::isKnownAttribute(attrName))
+ object->setNeedsLayout(true);
}
void SVGGradientElement::synchronizeProperty(const QualifiedName& attrName)
@@ -125,61 +127,37 @@ void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang
{
SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- if (m_resource)
- m_resource->invalidate();
-}
-
-RenderObject* SVGGradientElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
- return new (arena) RenderSVGHiddenContainer(this);
-}
-
-SVGResource* SVGGradientElement::canvasResource(const RenderObject*)
-{
- if (!m_resource) {
- if (gradientType() == LinearGradientPaintServer)
- m_resource = SVGPaintServerLinearGradient::create(this);
- else
- m_resource = SVGPaintServerRadialGradient::create(this);
- }
+ if (changedByParser)
+ return;
- return m_resource.get();
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
-Vector<SVGGradientStop> SVGGradientElement::buildStops() const
+Vector<Gradient::ColorStop> SVGGradientElement::buildStops()
{
- Vector<SVGGradientStop> stops;
- RefPtr<RenderStyle> gradientStyle;
+ Vector<Gradient::ColorStop> stops;
+ float previousOffset = 0.0f;
for (Node* n = firstChild(); n; n = n->nextSibling()) {
SVGElement* element = n->isSVGElement() ? static_cast<SVGElement*>(n) : 0;
+ if (!element || !element->isGradientStop())
+ continue;
- if (element && element->isGradientStop()) {
- SVGStopElement* stop = static_cast<SVGStopElement*>(element);
- float stopOffset = stop->offset();
+ SVGStopElement* stop = static_cast<SVGStopElement*>(element);
+ Color color = stop->stopColorIncludingOpacity();
- Color color;
- float opacity;
+ // Figure out right monotonic offset
+ float offset = stop->offset();
+ offset = std::min(std::max(previousOffset, offset), 1.0f);
+ previousOffset = offset;
- if (stop->renderer()) {
- RenderStyle* stopStyle = stop->renderer()->style();
- color = stopStyle->svgStyle()->stopColor();
- opacity = stopStyle->svgStyle()->stopOpacity();
- } else {
- // If there is no renderer for this stop element, then a parent element
- // set display="none" - ie. <g display="none"><linearGradient><stop>..
- // Unfortunately we have to manually rebuild the stop style. See pservers-grad-19-b.svg
- if (!gradientStyle)
- gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer();
+ // Extract individual channel values
+ // FIXME: Why doesn't ColorStop take a Color and an offset??
+ float r, g, b, a;
+ color.getRGBA(r, g, b, a);
- RefPtr<RenderStyle> stopStyle = stop->resolveStyle(gradientStyle.get());
-
- color = stopStyle->svgStyle()->stopColor();
- opacity = stopStyle->svgStyle()->stopOpacity();
- }
-
- stops.append(makeGradientStop(stopOffset, makeRGBA(color.red(), color.green(), color.blue(), int(opacity * 255.))));
- }
+ stops.append(Gradient::ColorStop(offset, r, g, b, a));
}
return stops;
diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h
index 122e1d9..9976d7d 100644
--- a/WebCore/svg/SVGGradientElement.h
+++ b/WebCore/svg/SVGGradientElement.h
@@ -1,29 +1,28 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGGradientElement_h
#define SVGGradientElement_h
#if ENABLE(SVG)
-#include "RenderObject.h"
-#include "SVGPaintServerGradient.h"
+#include "Gradient.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGStyledElement.h"
#include "SVGTransformList.h"
@@ -38,25 +37,15 @@ namespace WebCore {
SVGGradientElement(const QualifiedName&, Document*);
virtual ~SVGGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual bool needsPendingResourceHandling() const { return false; }
+
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-
- virtual SVGResource* canvasResource(const RenderObject*);
-
- protected:
- friend class SVGPaintServerGradient;
- friend class SVGLinearGradientElement;
- friend class SVGRadialGradientElement;
-
- virtual void buildGradient() const = 0;
- virtual SVGPaintServerType gradientType() const = 0;
- Vector<SVGGradientStop> buildStops() const;
- mutable RefPtr<SVGPaintServerGradient> m_resource;
+ Vector<Gradient::ColorStop> buildStops();
protected:
DECLARE_ANIMATED_PROPERTY(SVGGradientElement, SVGNames::spreadMethodAttr, int, SpreadMethod, spreadMethod)
diff --git a/WebCore/svg/SVGGradientElement.idl b/WebCore/svg/SVGGradientElement.idl
index 7485780..853081f 100644
--- a/WebCore/svg/SVGGradientElement.idl
+++ b/WebCore/svg/SVGGradientElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,11 +25,14 @@
module svg {
- interface [Conditional=SVG] SVGGradientElement : SVGElement,
- SVGURIReference,
- SVGExternalResourcesRequired,
- SVGStylable
- /* SVGUnitTypes */ {
+ interface [
+ Conditional=SVG,
+ DontCheckEnums
+ ] SVGGradientElement : SVGElement,
+ SVGURIReference,
+ SVGExternalResourcesRequired,
+ SVGStylable
+ /* SVGUnitTypes */ {
// Spread Method Types
const unsigned short SVG_SPREADMETHOD_UNKNOWN = 0;
const unsigned short SVG_SPREADMETHOD_PAD = 1;
diff --git a/WebCore/svg/SVGHKernElement.cpp b/WebCore/svg/SVGHKernElement.cpp
index 0ee3e76..eb8a4b5 100644
--- a/WebCore/svg/SVGHKernElement.cpp
+++ b/WebCore/svg/SVGHKernElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -28,7 +28,6 @@
#include "SVGFontFaceElement.h"
#include "SVGFontData.h"
#include "SVGNames.h"
-#include "SVGParserUtilities.h"
#include "SimpleFontData.h"
#include "XMLNames.h"
@@ -63,17 +62,23 @@ void SVGHKernElement::removedFromDocument()
}
}
-SVGHorizontalKerningPair SVGHKernElement::buildHorizontalKerningPair() const
+void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs)
{
- SVGHorizontalKerningPair kerningPair;
-
- kerningPair.unicode1 = getAttribute(u1Attr);
- kerningPair.glyphName1 = getAttribute(g1Attr);
- kerningPair.unicode2 = getAttribute(u2Attr);
- kerningPair.glyphName2 = getAttribute(g2Attr);
- kerningPair.kerning = getAttribute(kAttr).string().toDouble();
-
- return kerningPair;
+ String u1 = getAttribute(u1Attr);
+ String g1 = getAttribute(g1Attr);
+ String u2 = getAttribute(u2Attr);
+ String g2 = getAttribute(g2Attr);
+ if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty()))
+ return;
+
+ SVGKerningPair kerningPair;
+ if (parseGlyphName(g1, kerningPair.glyphName1)
+ && parseGlyphName(g2, kerningPair.glyphName2)
+ && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1)
+ && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2)) {
+ kerningPair.kerning = getAttribute(kAttr).string().toFloat();
+ kerningPairs.append(kerningPair);
+ }
}
}
diff --git a/WebCore/svg/SVGHKernElement.h b/WebCore/svg/SVGHKernElement.h
index 32772bd..bd893d8 100644
--- a/WebCore/svg/SVGHKernElement.h
+++ b/WebCore/svg/SVGHKernElement.h
@@ -1,52 +1,39 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2008 Apple, Inc
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGHKernElement_h
#define SVGHKernElement_h
#if ENABLE(SVG_FONTS)
+#include "SVGFontElement.h"
+#include "SVGParserUtilities.h"
#include "SVGStyledElement.h"
+#include <wtf/Forward.h>
#include <limits>
-#include "Path.h"
namespace WebCore {
- class AtomicString;
class SVGFontData;
- // Describe an SVG <hkern> element
- struct SVGHorizontalKerningPair {
- String unicode1;
- String glyphName1;
- String unicode2;
- String glyphName2;
- double kerning;
-
- SVGHorizontalKerningPair()
- : kerning(0)
- {
- }
- };
-
class SVGHKernElement : public SVGElement {
public:
SVGHKernElement(const QualifiedName&, Document*);
@@ -57,7 +44,7 @@ namespace WebCore {
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
- SVGHorizontalKerningPair buildHorizontalKerningPair() const;
+ void buildHorizontalKerningPair(KerningPairVector&);
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGHKernElement.idl b/WebCore/svg/SVGHKernElement.idl
index 7706578..7e042ff 100644
--- a/WebCore/svg/SVGHKernElement.idl
+++ b/WebCore/svg/SVGHKernElement.idl
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp
index 4055533..c5e4802 100644
--- a/WebCore/svg/SVGImageElement.cpp
+++ b/WebCore/svg/SVGImageElement.cpp
@@ -1,32 +1,33 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
- 2006 Alexander Kellett <lypanov@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGImageElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
-#include "MappedAttribute.h"
#include "RenderSVGImage.h"
+#include "RenderSVGResource.h"
#include "SVGDocument.h"
#include "SVGLength.h"
#include "SVGPreserveAspectRatio.h"
@@ -53,7 +54,7 @@ SVGImageElement::~SVGImageElement()
{
}
-void SVGImageElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGImageElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -91,18 +92,30 @@ void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
if (SVGURIReference::isKnownAttribute(attrName))
m_imageLoader.updateFromElementIgnoringPreviousError();
- if (!renderer())
+ bool isLengthAttribute = attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr;
+
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderObject* renderer = this->renderer();
+ if (!renderer)
return;
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
- attrName == SVGNames::preserveAspectRatioAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName)) {
- renderer()->setNeedsLayout(true);
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
}
+
+ if (isLengthAttribute
+ || attrName == SVGNames::preserveAspectRatioAttr
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGImageElement::synchronizeProperty(const QualifiedName& attrName)
@@ -136,10 +149,12 @@ void SVGImageElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeHref();
}
-bool SVGImageElement::hasRelativeValues() const
+bool SVGImageElement::selfHasRelativeLengths() const
{
- return (x().isRelative() || width().isRelative() ||
- y().isRelative() || height().isRelative());
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative();
}
RenderObject* SVGImageElement::createRenderer(RenderArena* arena, RenderStyle*)
@@ -156,7 +171,7 @@ void SVGImageElement::attach()
{
SVGStyledTransformableElement::attach();
- if (RenderImage* imageObj = toRenderImage(renderer())) {
+ if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) {
if (imageObj->hasImage())
return;
@@ -185,6 +200,12 @@ void SVGImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
addSubresourceURL(urls, document()->completeURL(href()));
}
+void SVGImageElement::willMoveToNewOwnerDocument()
+{
+ m_imageLoader.elementWillMoveToNewOwnerDocument();
+ SVGStyledTransformableElement::willMoveToNewOwnerDocument();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGImageElement.h b/WebCore/svg/SVGImageElement.h
index 3fa0e3f..cf4cf88 100644
--- a/WebCore/svg/SVGImageElement.h
+++ b/WebCore/svg/SVGImageElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGImageElement_h
#define SVGImageElement_h
@@ -45,7 +45,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
@@ -59,9 +59,11 @@ namespace WebCore {
protected:
virtual bool haveLoadedRequiredResources();
- virtual bool hasRelativeValues() const;
private:
+ virtual bool selfHasRelativeLengths() const;
+ virtual void willMoveToNewOwnerDocument();
+
DECLARE_ANIMATED_PROPERTY(SVGImageElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGImageElement, SVGNames::yAttr, SVGLength, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGImageElement, SVGNames::widthAttr, SVGLength, Width, width)
diff --git a/WebCore/svg/SVGImageElement.idl b/WebCore/svg/SVGImageElement.idl
index 8e2e140..5ea8671 100644
--- a/WebCore/svg/SVGImageElement.idl
+++ b/WebCore/svg/SVGImageElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGImageLoader.cpp b/WebCore/svg/SVGImageLoader.cpp
index 5d5d3bc..3d04863 100644
--- a/WebCore/svg/SVGImageLoader.cpp
+++ b/WebCore/svg/SVGImageLoader.cpp
@@ -1,24 +1,22 @@
/*
- Copyright (C) 2005, 2005 Alexander Kellett <lypanov@kde.org>
- 2008 Rob Buis <buis@kde.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2005, 2005 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGImageLoader.h b/WebCore/svg/SVGImageLoader.h
index a838db8..807a9bc 100644
--- a/WebCore/svg/SVGImageLoader.h
+++ b/WebCore/svg/SVGImageLoader.h
@@ -1,23 +1,21 @@
/*
- Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGImageLoader_h
#define SVGImageLoader_h
diff --git a/WebCore/svg/SVGLangSpace.cpp b/WebCore/svg/SVGLangSpace.cpp
index f0d6997..4ac7c00 100644
--- a/WebCore/svg/SVGLangSpace.cpp
+++ b/WebCore/svg/SVGLangSpace.cpp
@@ -1,29 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGLangSpace.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGElement.h"
#include "XMLNames.h"
#include <wtf/StdLibExtras.h>
@@ -63,7 +63,7 @@ void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace)
m_space = xmlSpace;
}
-bool SVGLangSpace::parseMappedAttribute(MappedAttribute* attr)
+bool SVGLangSpace::parseMappedAttribute(Attribute* attr)
{
if (attr->name().matches(XMLNames::langAttr)) {
setXmllang(attr->value());
diff --git a/WebCore/svg/SVGLangSpace.h b/WebCore/svg/SVGLangSpace.h
index 1613998..64e435d 100644
--- a/WebCore/svg/SVGLangSpace.h
+++ b/WebCore/svg/SVGLangSpace.h
@@ -1,32 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLangSpace_h
#define SVGLangSpace_h
#if ENABLE(SVG)
-#include "AtomicString.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class QualifiedName;
class SVGLangSpace {
@@ -40,7 +40,7 @@ namespace WebCore {
const AtomicString& xmlspace() const;
void setXmlspace(const AtomicString& xmlSpace);
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGLangSpace.idl b/WebCore/svg/SVGLangSpace.idl
index 277e514..a62b49b 100644
--- a/WebCore/svg/SVGLangSpace.idl
+++ b/WebCore/svg/SVGLangSpace.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -27,9 +27,9 @@
module svg {
interface [Conditional=SVG, ObjCProtocol, OmitConstructor] SVGLangSpace {
- attribute core::DOMString xmllang
+ attribute DOMString xmllang
/*setter raises(DOMException)*/;
- attribute core::DOMString xmlspace
+ attribute DOMString xmlspace
/*setter raises(DOMException)*/;
};
diff --git a/WebCore/svg/SVGLength.cpp b/WebCore/svg/SVGLength.cpp
index 2884507..bdd5b27 100644
--- a/WebCore/svg/SVGLength.cpp
+++ b/WebCore/svg/SVGLength.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- 2007 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -27,6 +27,7 @@
#include "CSSHelper.h"
#include "FloatConversion.h"
#include "FrameView.h"
+#include "NotImplemented.h"
#include "RenderObject.h"
#include "RenderView.h"
#include "SVGParserUtilities.h"
@@ -118,6 +119,23 @@ SVGLength::SVGLength(SVGLengthMode mode, const String& valueAsString)
setValueAsString(valueAsString);
}
+SVGLength::SVGLength(const SVGLength& other)
+ : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits)
+ , m_unit(other.m_unit)
+{
+}
+
+bool SVGLength::operator==(const SVGLength& other) const
+{
+ return m_unit == other.m_unit
+ && m_valueInSpecifiedUnits == other.m_valueInSpecifiedUnits;
+}
+
+bool SVGLength::operator!=(const SVGLength& other) const
+{
+ return !operator==(other);
+}
+
SVGLengthType SVGLength::unitType() const
{
return extractType(m_unit);
@@ -186,7 +204,7 @@ void SVGLength::setValue(float value)
case LengthTypePercentage:
case LengthTypeEMS:
case LengthTypeEXS:
- ASSERT_NOT_REACHED();
+ notImplemented();
break;
case LengthTypePX:
m_valueInSpecifiedUnits = value;
@@ -258,7 +276,8 @@ String SVGLength::valueAsString() const
void SVGLength::newValueSpecifiedUnits(unsigned short type, float value)
{
- ASSERT(type <= LengthTypePC);
+ if (type == LengthTypeUnknown || type > LengthTypePC)
+ return;
m_unit = storeUnit(extractMode(m_unit), (SVGLengthType) type);
m_valueInSpecifiedUnits = value;
@@ -266,7 +285,8 @@ void SVGLength::newValueSpecifiedUnits(unsigned short type, float value)
void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGElement* context)
{
- ASSERT(type <= LengthTypePC);
+ if (type == LengthTypeUnknown || type > LengthTypePC)
+ return;
float valueInUserUnits = value(context);
m_unit = storeUnit(extractMode(m_unit), (SVGLengthType) type);
@@ -280,15 +300,16 @@ float SVGLength::PercentageOfViewport(float value, const SVGElement* context, SV
float width = 0.0f, height = 0.0f;
SVGElement* viewportElement = context->viewportElement();
+ // PercentageOfViewport() is used to resolve all relative-positioned values within a SVG document (fragment)
Document* doc = context->document();
if (doc->documentElement() == context) {
- // We have to ask the canvas for the full "canvas size"...
- RenderView* view = toRenderView(doc->renderer());
- if (view && view->frameView()) {
- width = view->frameView()->visibleWidth(); // TODO: recheck!
- height = view->frameView()->visibleHeight(); // TODO: recheck!
+ // Resolve value against outermost <svg> element
+ if (RenderView* view = toRenderView(doc->renderer())) {
+ width = view->viewWidth();
+ height = view->viewHeight();
}
} else if (viewportElement && viewportElement->isSVG()) {
+ // Resolve value against nearest viewport element (common case: inner <svg> elements)
const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement);
if (svg->hasAttribute(SVGNames::viewBoxAttr)) {
width = svg->viewBox().width();
@@ -298,6 +319,7 @@ float SVGLength::PercentageOfViewport(float value, const SVGElement* context, SV
height = svg->height().value(svg);
}
} else if (context->parent() && !context->parent()->isSVGElement()) {
+ // Resolve value against enclosing non-SVG RenderBox
if (RenderObject* renderer = context->renderer()) {
if (renderer->isBox()) {
RenderBox* box = toRenderBox(renderer);
@@ -317,8 +339,99 @@ float SVGLength::PercentageOfViewport(float value, const SVGElement* context, SV
return 0.0f;
}
+SVGLength SVGLength::fromCSSPrimitiveValue(CSSPrimitiveValue* value)
+{
+ ASSERT(value);
+
+ SVGLengthType svgType;
+ switch (value->primitiveType()) {
+ case CSSPrimitiveValue::CSS_NUMBER:
+ svgType = LengthTypeNumber;
+ break;
+ case CSSPrimitiveValue::CSS_PERCENTAGE:
+ svgType = LengthTypePercentage;
+ break;
+ case CSSPrimitiveValue::CSS_EMS:
+ svgType = LengthTypeEMS;
+ break;
+ case CSSPrimitiveValue::CSS_EXS:
+ svgType = LengthTypeEXS;
+ break;
+ case CSSPrimitiveValue::CSS_PX:
+ svgType = LengthTypePX;
+ break;
+ case CSSPrimitiveValue::CSS_CM:
+ svgType = LengthTypeCM;
+ break;
+ case CSSPrimitiveValue::CSS_MM:
+ svgType = LengthTypeMM;
+ break;
+ case CSSPrimitiveValue::CSS_IN:
+ svgType = LengthTypeIN;
+ break;
+ case CSSPrimitiveValue::CSS_PT:
+ svgType = LengthTypePT;
+ break;
+ case CSSPrimitiveValue::CSS_PC:
+ svgType = LengthTypePC;
+ break;
+ case CSSPrimitiveValue::CSS_UNKNOWN:
+ default:
+ svgType = LengthTypeUnknown;
+ break;
+ };
+
+ if (svgType == LengthTypeUnknown)
+ return SVGLength();
+
+ SVGLength length;
+ length.newValueSpecifiedUnits(svgType, value->getFloatValue());
+ return length;
}
-#endif // ENABLE(SVG)
+PassRefPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
+{
+ CSSPrimitiveValue::UnitTypes cssType = CSSPrimitiveValue::CSS_UNKNOWN;
+ switch (length.unitType()) {
+ case LengthTypeUnknown:
+ break;
+ case LengthTypeNumber:
+ cssType = CSSPrimitiveValue::CSS_NUMBER;
+ break;
+ case LengthTypePercentage:
+ cssType = CSSPrimitiveValue::CSS_PERCENTAGE;
+ break;
+ case LengthTypeEMS:
+ cssType = CSSPrimitiveValue::CSS_EMS;
+ break;
+ case LengthTypeEXS:
+ cssType = CSSPrimitiveValue::CSS_EXS;
+ break;
+ case LengthTypePX:
+ cssType = CSSPrimitiveValue::CSS_PX;
+ break;
+ case LengthTypeCM:
+ cssType = CSSPrimitiveValue::CSS_CM;
+ break;
+ case LengthTypeMM:
+ cssType = CSSPrimitiveValue::CSS_MM;
+ break;
+ case LengthTypeIN:
+ cssType = CSSPrimitiveValue::CSS_IN;
+ break;
+ case LengthTypePT:
+ cssType = CSSPrimitiveValue::CSS_PT;
+ break;
+ case LengthTypePC:
+ cssType = CSSPrimitiveValue::CSS_PC;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ };
+
+ return CSSPrimitiveValue::create(length.valueInSpecifiedUnits(), cssType);
+}
+
+}
-// vim:ts=4:noet
+#endif
diff --git a/WebCore/svg/SVGLength.h b/WebCore/svg/SVGLength.h
index a14bc68..a0551f7 100644
--- a/WebCore/svg/SVGLength.h
+++ b/WebCore/svg/SVGLength.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLength_h
#define SVGLength_h
@@ -26,76 +26,85 @@
namespace WebCore {
- enum SVGLengthType {
- LengthTypeUnknown = 0,
- LengthTypeNumber = 1,
- LengthTypePercentage = 2,
- LengthTypeEMS = 3,
- LengthTypeEXS = 4,
- LengthTypePX = 5,
- LengthTypeCM = 6,
- LengthTypeMM = 7,
- LengthTypeIN = 8,
- LengthTypePT = 9,
- LengthTypePC = 10
+class CSSPrimitiveValue;
+
+enum SVGLengthType {
+ LengthTypeUnknown = 0,
+ LengthTypeNumber = 1,
+ LengthTypePercentage = 2,
+ LengthTypeEMS = 3,
+ LengthTypeEXS = 4,
+ LengthTypePX = 5,
+ LengthTypeCM = 6,
+ LengthTypeMM = 7,
+ LengthTypeIN = 8,
+ LengthTypePT = 9,
+ LengthTypePC = 10
+};
+
+enum SVGLengthMode {
+ LengthModeWidth = 0,
+ LengthModeHeight,
+ LengthModeOther
+};
+
+class SVGElement;
+
+class SVGLength {
+public:
+ // Forward declare these enums in the w3c naming scheme, for IDL generation
+ enum {
+ SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown,
+ SVG_LENGTHTYPE_NUMBER = LengthTypeNumber,
+ SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage,
+ SVG_LENGTHTYPE_EMS = LengthTypeEMS,
+ SVG_LENGTHTYPE_EXS = LengthTypeEXS,
+ SVG_LENGTHTYPE_PX = LengthTypePX,
+ SVG_LENGTHTYPE_CM = LengthTypeCM,
+ SVG_LENGTHTYPE_MM = LengthTypeMM,
+ SVG_LENGTHTYPE_IN = LengthTypeIN,
+ SVG_LENGTHTYPE_PT = LengthTypePT,
+ SVG_LENGTHTYPE_PC = LengthTypePC
};
- enum SVGLengthMode {
- LengthModeWidth = 0,
- LengthModeHeight,
- LengthModeOther
- };
+ SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String());
+ SVGLength(const SVGLength&);
- class SVGElement;
-
- class SVGLength {
- public:
- // Forward declare these enums in the w3c naming scheme, for IDL generation
- enum {
- SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown,
- SVG_LENGTHTYPE_NUMBER = LengthTypeNumber,
- SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage,
- SVG_LENGTHTYPE_EMS = LengthTypeEMS,
- SVG_LENGTHTYPE_EXS = LengthTypeEXS,
- SVG_LENGTHTYPE_PX = LengthTypePX,
- SVG_LENGTHTYPE_CM = LengthTypeCM,
- SVG_LENGTHTYPE_MM = LengthTypeMM,
- SVG_LENGTHTYPE_IN = LengthTypeIN,
- SVG_LENGTHTYPE_PT = LengthTypePT,
- SVG_LENGTHTYPE_PC = LengthTypePC
- };
-
- SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String());
-
- SVGLengthType unitType() const;
-
- float value(const SVGElement* context) const;
- void setValue(float);
-
- float valueInSpecifiedUnits() const;
- void setValueInSpecifiedUnits(float);
-
- float valueAsPercentage() const;
-
- String valueAsString() const;
- bool setValueAsString(const String&);
-
- void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
- void convertToSpecifiedUnits(unsigned short, const SVGElement* context);
-
- // Helper functions
- static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode);
-
- inline bool isRelative() const
- {
- SVGLengthType type = unitType();
- return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS);
- }
-
- private:
- float m_valueInSpecifiedUnits;
- unsigned int m_unit;
- };
+ SVGLengthType unitType() const;
+
+ bool operator==(const SVGLength&) const;
+ bool operator!=(const SVGLength&) const;
+
+ float value(const SVGElement* context) const;
+ void setValue(float);
+
+ float valueInSpecifiedUnits() const;
+ void setValueInSpecifiedUnits(float);
+
+ float valueAsPercentage() const;
+
+ String valueAsString() const;
+ bool setValueAsString(const String&);
+
+ void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
+ void convertToSpecifiedUnits(unsigned short, const SVGElement* context);
+
+ // Helper functions
+ static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode);
+
+ inline bool isRelative() const
+ {
+ SVGLengthType type = unitType();
+ return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS);
+ }
+
+ static SVGLength fromCSSPrimitiveValue(CSSPrimitiveValue*);
+ static PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&);
+
+private:
+ float m_valueInSpecifiedUnits;
+ unsigned int m_unit;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGLength.idl b/WebCore/svg/SVGLength.idl
index a349c47..d1cb572 100644
--- a/WebCore/svg/SVGLength.idl
+++ b/WebCore/svg/SVGLength.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGLengthList.cpp b/WebCore/svg/SVGLengthList.cpp
index 367befb..d144ca0 100644
--- a/WebCore/svg/SVGLengthList.cpp
+++ b/WebCore/svg/SVGLengthList.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGLengthList.h b/WebCore/svg/SVGLengthList.h
index 00fc3f8..bbabf62 100644
--- a/WebCore/svg/SVGLengthList.h
+++ b/WebCore/svg/SVGLengthList.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLengthList_h
#define SVGLengthList_h
diff --git a/WebCore/svg/SVGLengthList.idl b/WebCore/svg/SVGLengthList.idl
index b11811b..a5771d2 100644
--- a/WebCore/svg/SVGLengthList.idl
+++ b/WebCore/svg/SVGLengthList.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGLineElement.cpp b/WebCore/svg/SVGLineElement.cpp
index 6c8a16b..ebbcdf6 100644
--- a/WebCore/svg/SVGLineElement.cpp
+++ b/WebCore/svg/SVGLineElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGLineElement.h"
+#include "Attribute.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -47,7 +48,7 @@ SVGLineElement::~SVGLineElement()
{
}
-void SVGLineElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGLineElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::x1Attr)
setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -72,16 +73,34 @@ void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ bool isLengthAttribute = attrName == SVGNames::x1Attr
+ || attrName == SVGNames::y1Attr
+ || attrName == SVGNames::x2Attr
+ || attrName == SVGNames::y2Attr;
+
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
return;
- if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr ||
- attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (isLengthAttribute) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGLineElement::synchronizeProperty(const QualifiedName& attrName)
@@ -115,10 +134,12 @@ Path SVGLineElement::toPathData() const
FloatPoint(x2().value(this), y2().value(this)));
}
-bool SVGLineElement::hasRelativeValues() const
+bool SVGLineElement::selfHasRelativeLengths() const
{
- return (x1().isRelative() || y1().isRelative() ||
- x2().isRelative() || y2().isRelative());
+ return x1().isRelative()
+ || y1().isRelative()
+ || x2().isRelative()
+ || y2().isRelative();
}
}
diff --git a/WebCore/svg/SVGLineElement.h b/WebCore/svg/SVGLineElement.h
index c5ecafa..cdfa2aa 100644
--- a/WebCore/svg/SVGLineElement.h
+++ b/WebCore/svg/SVGLineElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLineElement_h
#define SVGLineElement_h
@@ -41,7 +41,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
@@ -49,10 +49,9 @@ namespace WebCore {
virtual bool supportsMarkers() const { return true; }
- protected:
- virtual bool hasRelativeValues() const;
-
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGLineElement, SVGNames::x1Attr, SVGLength, X1, x1)
DECLARE_ANIMATED_PROPERTY(SVGLineElement, SVGNames::y1Attr, SVGLength, Y1, y1)
DECLARE_ANIMATED_PROPERTY(SVGLineElement, SVGNames::x2Attr, SVGLength, X2, x2)
diff --git a/WebCore/svg/SVGLineElement.idl b/WebCore/svg/SVGLineElement.idl
index 28ed228..56270a1 100644
--- a/WebCore/svg/SVGLineElement.idl
+++ b/WebCore/svg/SVGLineElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp
index 665a1da..d3c81b0 100644
--- a/WebCore/svg/SVGLinearGradientElement.cpp
+++ b/WebCore/svg/SVGLinearGradientElement.cpp
@@ -1,37 +1,38 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- 2008 Eric Seidel <eric@webkit.org>
- 2008 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGLinearGradientElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatPoint.h"
#include "LinearGradientAttributes.h"
-#include "MappedAttribute.h"
+#include "RenderSVGResourceLinearGradient.h"
#include "SVGLength.h"
#include "SVGNames.h"
-#include "SVGPaintServerLinearGradient.h"
#include "SVGTransform.h"
#include "SVGTransformList.h"
#include "SVGUnitTypes.h"
@@ -52,7 +53,7 @@ SVGLinearGradientElement::~SVGLinearGradientElement()
{
}
-void SVGLinearGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGLinearGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::x1Attr)
setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -70,12 +71,18 @@ void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName
{
SVGGradientElement::svgAttributeChanged(attrName);
- if (!m_resource)
- return;
+ if (attrName == SVGNames::x1Attr
+ || attrName == SVGNames::y1Attr
+ || attrName == SVGNames::x2Attr
+ || attrName == SVGNames::y2Attr) {
+ updateRelativeLengthsInformation();
+
+ RenderObject* object = renderer();
+ if (!object)
+ return;
- if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr ||
- attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr)
- m_resource->invalidate();
+ object->setNeedsLayout(true);
+ }
}
void SVGLinearGradientElement::synchronizeProperty(const QualifiedName& attrName)
@@ -100,56 +107,18 @@ void SVGLinearGradientElement::synchronizeProperty(const QualifiedName& attrName
synchronizeY2();
}
-void SVGLinearGradientElement::buildGradient() const
+RenderObject* SVGLinearGradientElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- LinearGradientAttributes attributes = collectGradientProperties();
-
- RefPtr<SVGPaintServerLinearGradient> linearGradient = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(m_resource);
-
- FloatPoint startPoint;
- FloatPoint endPoint;
- if (attributes.boundingBoxMode()) {
- startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage());
- endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage());
- } else {
- startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this));
- endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this));
- }
-
- RefPtr<Gradient> gradient = Gradient::create(startPoint, endPoint);
- gradient->setSpreadMethod(attributes.spreadMethod());
-
- Vector<SVGGradientStop> m_stops = attributes.stops();
- float previousOffset = 0.0f;
- for (unsigned i = 0; i < m_stops.size(); ++i) {
- float offset = std::min(std::max(previousOffset, m_stops[i].first), 1.0f);
- previousOffset = offset;
- gradient->addColorStop(offset, m_stops[i].second);
- }
-
- linearGradient->setGradient(gradient);
-
- if (attributes.stops().isEmpty())
- return;
-
- // This code should go away. PaintServers should go away too.
- // Only this code should care about bounding boxes
- linearGradient->setBoundingBoxMode(attributes.boundingBoxMode());
- linearGradient->setGradientStops(attributes.stops());
-
- // These should possibly be supported on Gradient
- linearGradient->setGradientTransform(attributes.gradientTransform());
- linearGradient->setGradientStart(startPoint);
- linearGradient->setGradientEnd(endPoint);
+ return new (arena) RenderSVGResourceLinearGradient(this);
}
-LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() const
+LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties()
{
LinearGradientAttributes attributes;
- HashSet<const SVGGradientElement*> processedGradients;
+ HashSet<SVGGradientElement*> processedGradients;
bool isLinear = true;
- const SVGGradientElement* current = this;
+ SVGGradientElement* current = this;
while (current) {
if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr))
@@ -162,13 +131,13 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c
attributes.setGradientTransform(current->gradientTransform()->consolidate().matrix());
if (!attributes.hasStops()) {
- const Vector<SVGGradientStop>& stops(current->buildStops());
+ const Vector<Gradient::ColorStop>& stops(current->buildStops());
if (!stops.isEmpty())
attributes.setStops(stops);
}
if (isLinear) {
- const SVGLinearGradientElement* linear = static_cast<const SVGLinearGradientElement*>(current);
+ SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElement*>(current);
if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr))
attributes.setX1(linear->x1());
@@ -188,13 +157,15 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c
// Respect xlink:href, take attributes from referenced element
Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href()));
if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refNode->hasTagName(SVGNames::radialGradientTag))) {
- current = static_cast<const SVGGradientElement*>(const_cast<const Node*>(refNode));
+ current = static_cast<SVGGradientElement*>(refNode);
// Cycle detection
- if (processedGradients.contains(current))
- return LinearGradientAttributes();
+ if (processedGradients.contains(current)) {
+ current = 0;
+ break;
+ }
- isLinear = current->gradientType() == LinearGradientPaintServer;
+ isLinear = current->hasTagName(SVGNames::linearGradientTag);
} else
current = 0;
}
@@ -202,6 +173,26 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c
return attributes;
}
+void SVGLinearGradientElement::calculateStartEndPoints(const LinearGradientAttributes& attributes, FloatPoint& startPoint, FloatPoint& endPoint)
+{
+ // Determine gradient start/end points
+ if (attributes.boundingBoxMode()) {
+ startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage());
+ endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage());
+ } else {
+ startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this));
+ endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this));
+ }
+}
+
+bool SVGLinearGradientElement::selfHasRelativeLengths() const
+{
+ return x1().isRelative()
+ || y1().isRelative()
+ || x2().isRelative()
+ || y2().isRelative();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h
index 0308c0e..b329d8b 100644
--- a/WebCore/svg/SVGLinearGradientElement.h
+++ b/WebCore/svg/SVGLinearGradientElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLinearGradientElement_h
#define SVGLinearGradientElement_h
@@ -34,17 +34,18 @@ namespace WebCore {
SVGLinearGradientElement(const QualifiedName&, Document*);
virtual ~SVGLinearGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- protected:
- virtual void buildGradient() const;
- virtual SVGPaintServerType gradientType() const { return LinearGradientPaintServer; }
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- LinearGradientAttributes collectGradientProperties() const;
+ LinearGradientAttributes collectGradientProperties();
+ void calculateStartEndPoints(const LinearGradientAttributes&, FloatPoint& startPoint, FloatPoint& endPoint);
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGLinearGradientElement, SVGNames::x1Attr, SVGLength, X1, x1)
DECLARE_ANIMATED_PROPERTY(SVGLinearGradientElement, SVGNames::y1Attr, SVGLength, Y1, y1)
DECLARE_ANIMATED_PROPERTY(SVGLinearGradientElement, SVGNames::x2Attr, SVGLength, X2, x2)
diff --git a/WebCore/svg/SVGLinearGradientElement.idl b/WebCore/svg/SVGLinearGradientElement.idl
index eb3eac1..0ef8197 100644
--- a/WebCore/svg/SVGLinearGradientElement.idl
+++ b/WebCore/svg/SVGLinearGradientElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGList.h b/WebCore/svg/SVGList.h
index e1249e2..6ae5191 100644
--- a/WebCore/svg/SVGList.h
+++ b/WebCore/svg/SVGList.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGList_h
#define SVGList_h
diff --git a/WebCore/svg/SVGListTraits.h b/WebCore/svg/SVGListTraits.h
index f58b9b9..0f60c75 100644
--- a/WebCore/svg/SVGListTraits.h
+++ b/WebCore/svg/SVGListTraits.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
- 2006 Apple Computer Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGListTraits_h
#define SVGListTraits_h
diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp
index 39cf589..b7b4440 100644
--- a/WebCore/svg/SVGLocatable.cpp
+++ b/WebCore/svg/SVGLocatable.cpp
@@ -1,33 +1,33 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
- Copyright (C) 2009 Google, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2009 Google, Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGLocatable.h"
-#include "AffineTransform.h"
-#include "RenderPath.h"
+#include "RenderObject.h"
+#include "SVGStyledLocatableElement.h"
#include "SVGException.h"
-#include "SVGSVGElement.h"
namespace WebCore {
@@ -71,9 +71,11 @@ SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* element)
return farthest;
}
-FloatRect SVGLocatable::getBBox(const SVGElement* element)
+FloatRect SVGLocatable::getBBox(const SVGElement* element, StyleUpdateStrategy styleUpdateStrategy)
{
- element->document()->updateLayoutIgnorePendingStylesheets();
+ ASSERT(element);
+ if (styleUpdateStrategy == AllowStyleUpdate)
+ element->document()->updateLayoutIgnorePendingStylesheets();
// FIXME: Eventually we should support getBBox for detached elements.
if (!element->renderer())
@@ -82,46 +84,38 @@ FloatRect SVGLocatable::getBBox(const SVGElement* element)
return element->renderer()->objectBoundingBox();
}
-AffineTransform SVGLocatable::getCTM(const SVGElement* element)
+AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mode, StyleUpdateStrategy styleUpdateStrategy)
{
ASSERT(element);
+ if (styleUpdateStrategy == AllowStyleUpdate)
+ element->document()->updateLayoutIgnorePendingStylesheets();
+
AffineTransform ctm;
- Node* parent = element->parentNode();
- if (parent && parent->isSVGElement()) {
- SVGElement* parentElement = static_cast<SVGElement*>(parent);
- if (parentElement && parentElement->isStyledLocatable()) {
- AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getCTM();
- ctm = parentCTM * ctm;
- }
- }
+ SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportElement(element) : 0;
- return ctm;
-}
+ Node* current = const_cast<SVGElement*>(element);
+ while (current && current->isSVGElement()) {
+ SVGElement* currentElement = static_cast<SVGElement*>(current);
+ if (currentElement->isStyled())
+ ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm);
-AffineTransform SVGLocatable::getScreenCTM(const SVGElement* element)
-{
- ASSERT(element);
- AffineTransform ctm;
+ // For getCTM() computation, stop at the nearest viewport element
+ if (currentElement == stopAtElement)
+ break;
- Node* parent = element->parentNode();
- if (parent && parent->isSVGElement()) {
- SVGElement* parentElement = static_cast<SVGElement*>(parent);
- if (parentElement && parentElement->isStyledLocatable()) {
- AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getScreenCTM();
- ctm = parentCTM * ctm;
- }
+ current = current->isShadowNode() ? current->shadowParentNode() : current->parentNode();
}
return ctm;
}
-AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const
+AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec, StyleUpdateStrategy styleUpdateStrategy) const
{
- AffineTransform ctm = getCTM();
+ AffineTransform ctm = getCTM(styleUpdateStrategy);
if (target && target->isStyledLocatable()) {
- AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM();
+ AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM(styleUpdateStrategy);
if (!targetCTM.isInvertible()) {
ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
return ctm;
@@ -135,5 +129,3 @@ AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, Exceptio
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLocatable.h b/WebCore/svg/SVGLocatable.h
index b7d8d30..2e51dc5 100644
--- a/WebCore/svg/SVGLocatable.h
+++ b/WebCore/svg/SVGLocatable.h
@@ -1,33 +1,33 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLocatable_h
#define SVGLocatable_h
#if ENABLE(SVG)
-
+#include "AffineTransform.h"
#include "ExceptionCode.h"
namespace WebCore {
-class AffineTransform;
class FloatRect;
class SVGElement;
@@ -40,23 +40,29 @@ public:
virtual SVGElement* nearestViewportElement() const = 0;
virtual SVGElement* farthestViewportElement() const = 0;
- virtual FloatRect getBBox() const = 0;
- virtual AffineTransform getCTM() const = 0;
- virtual AffineTransform getScreenCTM() const = 0;
- AffineTransform getTransformToElement(SVGElement*, ExceptionCode&) const;
+ enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate };
+
+ virtual FloatRect getBBox(StyleUpdateStrategy) const = 0;
+ virtual AffineTransform getCTM(StyleUpdateStrategy) const = 0;
+ virtual AffineTransform getScreenCTM(StyleUpdateStrategy) const = 0;
+ AffineTransform getTransformToElement(SVGElement*, ExceptionCode&, StyleUpdateStrategy = AllowStyleUpdate) const;
static SVGElement* nearestViewportElement(const SVGElement*);
static SVGElement* farthestViewportElement(const SVGElement*);
+ enum CTMScope {
+ NearestViewportScope, // Used for getCTM()
+ ScreenScope // Used for getScreenCTM()
+ };
+
protected:
- static FloatRect getBBox(const SVGElement*);
- static AffineTransform getCTM(const SVGElement*);
- static AffineTransform getScreenCTM(const SVGElement*);
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return AffineTransform(); }
+
+ static FloatRect getBBox(const SVGElement*, StyleUpdateStrategy);
+ static AffineTransform computeCTM(const SVGElement*, CTMScope, StyleUpdateStrategy);
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGLocatable_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLocatable.idl b/WebCore/svg/SVGLocatable.idl
index 72db8f4..247f390 100644
--- a/WebCore/svg/SVGLocatable.idl
+++ b/WebCore/svg/SVGLocatable.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGMPathElement.cpp b/WebCore/svg/SVGMPathElement.cpp
index dfe7e99..7165c11 100644
--- a/WebCore/svg/SVGMPathElement.cpp
+++ b/WebCore/svg/SVGMPathElement.cpp
@@ -1,22 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -38,7 +36,7 @@ SVGMPathElement::~SVGMPathElement()
{
}
-void SVGMPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMPathElement::parseMappedAttribute(Attribute* attr)
{
if (SVGURIReference::parseMappedAttribute(attr))
return;
diff --git a/WebCore/svg/SVGMPathElement.h b/WebCore/svg/SVGMPathElement.h
index 50a7dd1..7543b6e 100644
--- a/WebCore/svg/SVGMPathElement.h
+++ b/WebCore/svg/SVGMPathElement.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGMPathElement_h
#define SVGMPathElement_h
@@ -35,7 +35,7 @@ namespace WebCore {
SVGMPathElement(const QualifiedName&, Document*);
virtual ~SVGMPathElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
SVGPathElement* pathElement();
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index 7716af7..8e6296d 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGMarkerElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "PlatformString.h"
-#include "RenderSVGViewportContainer.h"
+#include "RenderSVGResourceMarker.h"
#include "SVGFitToViewBox.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -61,7 +62,7 @@ AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float
return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
}
-void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMarkerElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::markerUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
@@ -103,21 +104,27 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledElement::svgAttributeChanged(attrName);
- if (!m_marker)
+ bool invalidateClients = false;
+ if (attrName == SVGNames::refXAttr
+ || attrName == SVGNames::refYAttr
+ || attrName == SVGNames::markerWidthAttr
+ || attrName == SVGNames::markerHeightAttr) {
+ invalidateClients = true;
+ updateRelativeLengthsInformation();
+ }
+
+ RenderObject* object = renderer();
+ if (!object)
return;
- if (attrName == SVGNames::markerUnitsAttr || attrName == SVGNames::refXAttr ||
- attrName == SVGNames::refYAttr || attrName == SVGNames::markerWidthAttr ||
- attrName == SVGNames::markerHeightAttr || attrName == SVGNames::orientAttr ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGFitToViewBox::isKnownAttribute(attrName) ||
- SVGStyledElement::isKnownAttribute(attrName)) {
- if (renderer())
- renderer()->setNeedsLayout(true);
-
- m_marker->invalidate();
- }
+ if (invalidateClients
+ || attrName == SVGNames::markerUnitsAttr
+ || attrName == SVGNames::orientAttr
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName)
+ || SVGFitToViewBox::isKnownAttribute(attrName)
+ || SVGStyledElement::isKnownAttribute(attrName))
+ object->setNeedsLayout(true);
}
void SVGMarkerElement::synchronizeProperty(const QualifiedName& attrName)
@@ -163,13 +170,11 @@ void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange,
{
SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- if (!m_marker)
+ if (changedByParser)
return;
- if (renderer())
- renderer()->setNeedsLayout(true);
-
- m_marker->invalidate();
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
void SVGMarkerElement::setOrientToAuto()
@@ -177,13 +182,8 @@ void SVGMarkerElement::setOrientToAuto()
setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO);
setOrientAngleBaseValue(SVGAngle());
- if (!m_marker)
- return;
-
- if (renderer())
- renderer()->setNeedsLayout(true);
-
- m_marker->invalidate();
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
@@ -191,41 +191,23 @@ void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE);
setOrientAngleBaseValue(angle);
- if (!m_marker)
- return;
-
- if (renderer())
- renderer()->setNeedsLayout(true);
-
- m_marker->invalidate();
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
-SVGResource* SVGMarkerElement::canvasResource(const RenderObject*)
+RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- if (!m_marker)
- m_marker = SVGResourceMarker::create();
-
- ASSERT(renderer());
- m_marker->setRenderer(toRenderSVGViewportContainer(renderer()));
-
- if (orientType() == SVG_MARKER_ORIENT_ANGLE)
- m_marker->setAngle(orientAngle().value());
- else
- m_marker->setAutoAngle();
-
- m_marker->setReferencePoint(FloatPoint(refX().value(this), refY().value(this)));
- m_marker->setUseStrokeWidth(markerUnits() == SVG_MARKERUNITS_STROKEWIDTH);
-
- return m_marker.get();
+ return new (arena) RenderSVGResourceMarker(this);
}
-RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle*)
+bool SVGMarkerElement::selfHasRelativeLengths() const
{
- RenderSVGViewportContainer* markerContainer = new (arena) RenderSVGViewportContainer(this);
- markerContainer->setDrawsContents(false); // Marker contents will be explicitly drawn.
- return markerContainer;
+ return refX().isRelative()
+ || refY().isRelative()
+ || markerWidth().isRelative()
+ || markerHeight().isRelative();
}
}
-#endif // ENABLE(SVG)
+#endif
diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h
index fd5a13b..436aaa7 100644
--- a/WebCore/svg/SVGMarkerElement.h
+++ b/WebCore/svg/SVGMarkerElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGMarkerElement_h
#define SVGMarkerElement_h
@@ -27,69 +27,69 @@
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGLangSpace.h"
-#include "SVGResourceMarker.h"
#include "SVGStyledElement.h"
namespace WebCore {
- class Document;
-
- extern char SVGOrientTypeAttrIdentifier[];
- extern char SVGOrientAngleAttrIdentifier[];
-
- class SVGMarkerElement : public SVGStyledElement,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGFitToViewBox {
- public:
- enum SVGMarkerUnitsType {
- SVG_MARKERUNITS_UNKNOWN = 0,
- SVG_MARKERUNITS_USERSPACEONUSE = 1,
- SVG_MARKERUNITS_STROKEWIDTH = 2
- };
-
- enum SVGMarkerOrientType {
- SVG_MARKER_ORIENT_UNKNOWN = 0,
- SVG_MARKER_ORIENT_AUTO = 1,
- SVG_MARKER_ORIENT_ANGLE = 2
- };
-
- SVGMarkerElement(const QualifiedName&, Document*);
- virtual ~SVGMarkerElement();
-
- AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
-
- void setOrientToAuto();
- void setOrientToAngle(const SVGAngle&);
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void svgAttributeChanged(const QualifiedName&);
- virtual void synchronizeProperty(const QualifiedName&);
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
-
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual SVGResource* canvasResource(const RenderObject*);
-
- private:
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::refXAttr, SVGLength, RefX, refX)
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::refYAttr, SVGLength, RefY, refY)
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerWidthAttr, SVGLength, MarkerWidth, markerWidth)
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerHeightAttr, SVGLength, MarkerHeight, markerHeight)
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerUnitsAttr, int, MarkerUnits, markerUnits)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, SVGOrientTypeAttrIdentifier, int, OrientType, orientType)
- DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, SVGOrientAngleAttrIdentifier, SVGAngle, OrientAngle, orientAngle)
-
- // SVGExternalResourcesRequired
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
-
- // SVGFitToViewBox
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
- DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
-
- RefPtr<SVGResourceMarker> m_marker;
+class Document;
+
+extern char SVGOrientTypeAttrIdentifier[];
+extern char SVGOrientAngleAttrIdentifier[];
+
+class SVGMarkerElement : public SVGStyledElement,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGFitToViewBox {
+public:
+ enum SVGMarkerUnitsType {
+ SVG_MARKERUNITS_UNKNOWN = 0,
+ SVG_MARKERUNITS_USERSPACEONUSE = 1,
+ SVG_MARKERUNITS_STROKEWIDTH = 2
};
-} // namespace WebCore
+ enum SVGMarkerOrientType {
+ SVG_MARKER_ORIENT_UNKNOWN = 0,
+ SVG_MARKER_ORIENT_AUTO = 1,
+ SVG_MARKER_ORIENT_ANGLE = 2
+ };
+
+ SVGMarkerElement(const QualifiedName&, Document*);
+ virtual ~SVGMarkerElement();
+
+ virtual bool needsPendingResourceHandling() const { return false; }
+
+ AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
-#endif // ENABLE(SVG)
+ void setOrientToAuto();
+ void setOrientToAngle(const SVGAngle&);
+
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void synchronizeProperty(const QualifiedName&);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+private:
+ virtual bool selfHasRelativeLengths() const;
+
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::refXAttr, SVGLength, RefX, refX)
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::refYAttr, SVGLength, RefY, refY)
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerWidthAttr, SVGLength, MarkerWidth, markerWidth)
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerHeightAttr, SVGLength, MarkerHeight, markerHeight)
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::markerUnitsAttr, int, MarkerUnits, markerUnits)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, SVGOrientTypeAttrIdentifier, int, OrientType, orientType)
+ DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, SVGOrientAngleAttrIdentifier, SVGAngle, OrientAngle, orientAngle)
+
+ // SVGExternalResourcesRequired
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+
+ // SVGFitToViewBox
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
+ DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
+};
+
+}
+
+#endif
#endif
diff --git a/WebCore/svg/SVGMarkerElement.idl b/WebCore/svg/SVGMarkerElement.idl
index c715d70..3870941 100644
--- a/WebCore/svg/SVGMarkerElement.idl
+++ b/WebCore/svg/SVGMarkerElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 86d1062..4f245ce 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -1,47 +1,38 @@
/*
- 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGMaskElement.h"
-#include "CanvasPixelArray.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
-#include "GraphicsContext.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "ImageData.h"
-#include "MappedAttribute.h"
-#include "RenderObject.h"
-#include "RenderSVGContainer.h"
+#include "RenderSVGResourceMasker.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGRenderSupport.h"
#include "SVGUnitTypes.h"
-#include <math.h>
-#include <wtf/MathExtras.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
using namespace std;
@@ -49,7 +40,6 @@ namespace WebCore {
SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* doc)
: SVGStyledLocatableElement(tagName, doc)
- , SVGURIReference()
, SVGTests()
, SVGLangSpace()
, SVGExternalResourcesRequired()
@@ -68,7 +58,7 @@ SVGMaskElement::~SVGMaskElement()
{
}
-void SVGMaskElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGMaskElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::maskUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
@@ -89,8 +79,6 @@ void SVGMaskElement::parseMappedAttribute(MappedAttribute* attr)
else if (attr->name() == SVGNames::heightAttr)
setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
else {
- if (SVGURIReference::parseMappedAttribute(attr))
- return;
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGLangSpace::parseMappedAttribute(attr))
@@ -105,15 +93,27 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledElement::svgAttributeChanged(attrName);
- if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
- attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
- SVGURIReference::isKnownAttribute(attrName) ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledElement::isKnownAttribute(attrName))
- invalidateCanvasResources();
+ bool invalidateClients = false;
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr) {
+ invalidateClients = true;
+ updateRelativeLengthsInformation();
+ }
+
+ RenderObject* object = renderer();
+ if (!object)
+ return;
+
+ if (invalidateClients
+ || attrName == SVGNames::maskUnitsAttr
+ || attrName == SVGNames::maskContentUnitsAttr
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName)
+ || SVGStyledElement::isKnownAttribute(attrName))
+ object->setNeedsLayout(true);
}
void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
@@ -126,7 +126,6 @@ void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeX();
synchronizeY();
synchronizeExternalResourcesRequired();
- synchronizeHref();
return;
}
@@ -140,14 +139,17 @@ void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeY();
else if (SVGExternalResourcesRequired::isKnownAttribute(attrName))
synchronizeExternalResourcesRequired();
- else if (SVGURIReference::isKnownAttribute(attrName))
- synchronizeHref();
}
void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- invalidateCanvasResources();
+
+ if (changedByParser)
+ return;
+
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const
@@ -167,122 +169,17 @@ FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) co
return maskBBox;
}
-PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const RenderObject* object, FloatRect& maskDestRect, bool& emptyMask) const
-{
- FloatRect objectBoundingBox = object->objectBoundingBox();
-
- // Mask rect clipped with clippingBoundingBox and filterBoundingBox as long as they are present.
- maskDestRect = object->repaintRectInLocalCoordinates();
- if (maskDestRect.isEmpty()) {
- emptyMask = true;
- return 0;
- }
-
- // Calculate the smallest rect for the mask ImageBuffer.
- FloatRect repaintRect;
- Vector<RenderObject*> rendererList;
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer())
- continue;
-
- rendererList.append(node->renderer());
- repaintRect.unite(node->renderer()->localToParentTransform().mapRect(node->renderer()->repaintRectInLocalCoordinates()));
- }
-
- AffineTransform contextTransform;
- // We need to scale repaintRect for objectBoundingBox to get the drawing area.
- if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
- contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
- FloatPoint contextAdjustment = repaintRect.location();
- repaintRect = contextTransform.mapRect(repaintRect);
- repaintRect.move(objectBoundingBox.x(), objectBoundingBox.y());
- contextTransform.translate(-contextAdjustment.x(), -contextAdjustment.y());
- }
- repaintRect.intersect(maskDestRect);
- maskDestRect = repaintRect;
- IntRect maskImageRect = enclosingIntRect(maskDestRect);
-
- maskImageRect.setLocation(IntPoint());
-
- // Don't create ImageBuffers with image size of 0
- if (!maskImageRect.width() || !maskImageRect.height()) {
- emptyMask = true;
- return 0;
- }
-
- // FIXME: This changes color space to linearRGB, the default color space
- // for masking operations in SVG. We need a switch for the other color-space
- // attribute values sRGB, inherit and auto.
- OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size(), LinearRGB);
- if (!maskImage)
- return 0;
-
- GraphicsContext* maskImageContext = maskImage->context();
- ASSERT(maskImageContext);
-
- maskImageContext->save();
-
- if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
- maskImageContext->translate(-maskDestRect.x(), -maskDestRect.y());
- maskImageContext->concatCTM(contextTransform);
-
- // draw the content into the ImageBuffer
- Vector<RenderObject*>::iterator end = rendererList.end();
- for (Vector<RenderObject*>::iterator it = rendererList.begin(); it != end; it++)
- renderSubtreeToImage(maskImage.get(), *it);
-
-
- maskImageContext->restore();
-
- // create the luminance mask
- RefPtr<ImageData> imageData(maskImage->getUnmultipliedImageData(maskImageRect));
- CanvasPixelArray* srcPixelArray(imageData->data());
-
- for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset += 4) {
- unsigned char a = srcPixelArray->get(pixelOffset + 3);
- if (!a)
- continue;
- unsigned char r = srcPixelArray->get(pixelOffset);
- unsigned char g = srcPixelArray->get(pixelOffset + 1);
- unsigned char b = srcPixelArray->get(pixelOffset + 2);
-
- double luma = (r * 0.2125 + g * 0.7154 + b * 0.0721) * ((double)a / 255.0);
- srcPixelArray->set(pixelOffset + 3, luma);
- }
-
- maskImage->putUnmultipliedImageData(imageData.get(), maskImageRect, IntPoint());
-
- return maskImage.release();
-}
-
RenderObject* SVGMaskElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- RenderSVGContainer* maskContainer = new (arena) RenderSVGContainer(this);
- maskContainer->setDrawsContents(false);
- return maskContainer;
-}
-
-SVGResource* SVGMaskElement::canvasResource(const RenderObject* object)
-{
- ASSERT(object);
-
- if (m_masker.contains(object))
- return m_masker.get(object).get();
-
- RefPtr<SVGResourceMasker> masker = SVGResourceMasker::create(this);
- SVGResourceMasker* maskerPtr = masker.get();
- m_masker.set(object, masker.release());
-
- return maskerPtr;
+ return new (arena) RenderSVGResourceMasker(this);
}
-void SVGMaskElement::invalidateCanvasResources()
+bool SVGMaskElement::selfHasRelativeLengths() const
{
- // Don't call through to the base class since the base class will just
- // invalidate one item in the HashMap.
- HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator end = m_masker.end();
- for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator it = m_masker.begin(); it != end; ++it)
- it->second->invalidate();
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative();
}
}
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 005fa4f..91d9bc9 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -1,63 +1,58 @@
/*
- Copyright (C) 2005 Alexander Kellett <lypanov@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGMaskElement_h
#define SVGMaskElement_h
#if ENABLE(SVG)
#include "RenderObject.h"
-#include "SVGResourceMasker.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledLocatableElement.h"
#include "SVGTests.h"
-#include "SVGURIReference.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
class SVGLength;
- class SVGResourceMasker;
class SVGMaskElement : public SVGStyledLocatableElement,
- public SVGURIReference,
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired {
public:
SVGMaskElement(const QualifiedName&, Document*);
virtual ~SVGMaskElement();
+
virtual bool isValid() const { return SVGTests::isValid(); }
+ virtual bool needsPendingResourceHandling() const { return false; }
FloatRect maskBoundingBox(const FloatRect&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual SVGResource* canvasResource(const RenderObject*);
-
- PassOwnPtr<ImageBuffer> drawMaskerContent(const RenderObject*, FloatRect& maskRect, bool& emptyMask) const;
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::maskUnitsAttr, int, MaskUnits, maskUnits)
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::maskContentUnitsAttr, int, MaskContentUnits, maskContentUnits)
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::xAttr, SVGLength, X, x)
@@ -65,18 +60,11 @@ namespace WebCore {
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::widthAttr, SVGLength, Width, width)
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::heightAttr, SVGLength, Height, height)
- // SVGURIReference
- DECLARE_ANIMATED_PROPERTY(SVGMaskElement, XLinkNames::hrefAttr, String, Href, href)
-
// SVGExternalResourcesRequired
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
-
- virtual void invalidateCanvasResources();
-
- HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
};
-} // namespace WebCore
+}
-#endif // ENABLE(SVG)
+#endif
#endif
diff --git a/WebCore/svg/SVGMaskElement.idl b/WebCore/svg/SVGMaskElement.idl
index 19bdc14..1bb9752 100644
--- a/WebCore/svg/SVGMaskElement.idl
+++ b/WebCore/svg/SVGMaskElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGMatrix.idl b/WebCore/svg/SVGMatrix.idl
index 1b91d53..c6e996d 100644
--- a/WebCore/svg/SVGMatrix.idl
+++ b/WebCore/svg/SVGMatrix.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGMetadataElement.cpp b/WebCore/svg/SVGMetadataElement.cpp
index 2cefc7d..28a34d6 100644
--- a/WebCore/svg/SVGMetadataElement.cpp
+++ b/WebCore/svg/SVGMetadataElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGMetadataElement.h b/WebCore/svg/SVGMetadataElement.h
index afa6a8e..6323f12 100644
--- a/WebCore/svg/SVGMetadataElement.h
+++ b/WebCore/svg/SVGMetadataElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGMetadataElement_h
#define SVGMetadataElement_h
diff --git a/WebCore/svg/SVGMetadataElement.idl b/WebCore/svg/SVGMetadataElement.idl
index 9434f4d..8714a15 100644
--- a/WebCore/svg/SVGMetadataElement.idl
+++ b/WebCore/svg/SVGMetadataElement.idl
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGMissingGlyphElement.cpp b/WebCore/svg/SVGMissingGlyphElement.cpp
index 5d31e82..3fe531c 100644
--- a/WebCore/svg/SVGMissingGlyphElement.cpp
+++ b/WebCore/svg/SVGMissingGlyphElement.cpp
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGMissingGlyphElement.h b/WebCore/svg/SVGMissingGlyphElement.h
index 468ad9d..9dde843 100644
--- a/WebCore/svg/SVGMissingGlyphElement.h
+++ b/WebCore/svg/SVGMissingGlyphElement.h
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGMissingGlyphElement_h
diff --git a/WebCore/svg/SVGMissingGlyphElement.idl b/WebCore/svg/SVGMissingGlyphElement.idl
index 232c6b9..23d7628 100644
--- a/WebCore/svg/SVGMissingGlyphElement.idl
+++ b/WebCore/svg/SVGMissingGlyphElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGNumber.idl b/WebCore/svg/SVGNumber.idl
index 7e1a117..f57ff40 100644
--- a/WebCore/svg/SVGNumber.idl
+++ b/WebCore/svg/SVGNumber.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGNumberList.cpp b/WebCore/svg/SVGNumberList.cpp
index 11aebde..0603af7 100644
--- a/WebCore/svg/SVGNumberList.cpp
+++ b/WebCore/svg/SVGNumberList.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGNumberList.h b/WebCore/svg/SVGNumberList.h
index 329968b..fa29356 100644
--- a/WebCore/svg/SVGNumberList.h
+++ b/WebCore/svg/SVGNumberList.h
@@ -1,34 +1,33 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGNumberList_h
#define SVGNumberList_h
#if ENABLE(SVG)
#include "SVGList.h"
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
- class String;
-
class SVGNumberList : public SVGPODList<float> {
public:
static PassRefPtr<SVGNumberList> create(const QualifiedName& attributeName) { return adoptRef(new SVGNumberList(attributeName)); }
diff --git a/WebCore/svg/SVGNumberList.idl b/WebCore/svg/SVGNumberList.idl
index 427a249..58bbcf4 100644
--- a/WebCore/svg/SVGNumberList.idl
+++ b/WebCore/svg/SVGNumberList.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPaint.cpp b/WebCore/svg/SVGPaint.cpp
index 3b39b91..a2100aa 100644
--- a/WebCore/svg/SVGPaint.cpp
+++ b/WebCore/svg/SVGPaint.cpp
@@ -1,26 +1,29 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGPaint.h"
+#include "SVGURIReference.h"
namespace WebCore {
@@ -66,14 +69,14 @@ SVGPaint::~SVGPaint()
SVGPaint* SVGPaint::defaultFill()
{
- static SVGPaint* _defaultFill = new SVGPaint(Color::black);
- return _defaultFill;
+ static SVGPaint* staticDefaultFill = create(Color::black).releaseRef();
+ return staticDefaultFill;
}
SVGPaint* SVGPaint::defaultStroke()
{
- static SVGPaint* _defaultStroke = new SVGPaint(SVG_PAINTTYPE_NONE);
- return _defaultStroke;
+ static SVGPaint* staticDefaultStroke = create(SVG_PAINTTYPE_NONE).releaseRef();
+ return staticDefaultStroke;
}
String SVGPaint::uri() const
@@ -108,8 +111,14 @@ String SVGPaint::cssText() const
return SVGColor::cssText();
}
+bool SVGPaint::matchesTargetURI(const String& referenceId)
+{
+ if (m_paintType != SVG_PAINTTYPE_URI && m_paintType != SVG_PAINTTYPE_URI_RGBCOLOR)
+ return false;
+
+ return referenceId == SVGURIReference::getTarget(m_uri);
}
-// vim:ts=4:noet
-#endif // ENABLE(SVG)
+}
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPaint.h b/WebCore/svg/SVGPaint.h
index 032f715..e86c315 100644
--- a/WebCore/svg/SVGPaint.h
+++ b/WebCore/svg/SVGPaint.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmial.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPaint_h
#define SVGPaint_h
@@ -78,6 +78,8 @@ namespace WebCore {
static SVGPaint* defaultFill();
static SVGPaint* defaultStroke();
+ bool matchesTargetURI(const String& referenceId);
+
private:
SVGPaint();
SVGPaint(const String& uri);
@@ -96,5 +98,3 @@ namespace WebCore {
#endif // ENABLE(SVG)
#endif // SVGPaint_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPaint.idl b/WebCore/svg/SVGPaint.idl
index 392ae33..426b762 100644
--- a/WebCore/svg/SVGPaint.idl
+++ b/WebCore/svg/SVGPaint.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp
index c05e0f8..5bf2fbc 100644
--- a/WebCore/svg/SVGParserUtilities.cpp
+++ b/WebCore/svg/SVGParserUtilities.cpp
@@ -1,50 +1,36 @@
/*
- Copyright (C) 2002, 2003 The Karbon Developers
- 2006 Alexander Kellett <lypanov@kde.org>
- 2006, 2007 Rob Buis <buis@kde.org>
- Copyrigth (C) 2007, 2009 Apple, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGParserUtilities.h"
+#include "Document.h"
#include "ExceptionCode.h"
-#include "FloatConversion.h"
#include "FloatPoint.h"
-#include "Path.h"
#include "PlatformString.h"
-#include "SVGPathSegList.h"
-#include "SVGPathSegArc.h"
-#include "SVGPathSegClosePath.h"
-#include "SVGPathSegCurvetoCubic.h"
-#include "SVGPathSegCurvetoCubicSmooth.h"
-#include "SVGPathSegCurvetoQuadratic.h"
-#include "SVGPathSegCurvetoQuadraticSmooth.h"
-#include "SVGPathSegLineto.h"
-#include "SVGPathSegLinetoHorizontal.h"
-#include "SVGPathSegLinetoVertical.h"
-#include "SVGPathSegList.h"
-#include "SVGPathSegMoveto.h"
#include "SVGPointList.h"
-#include "SVGPathElement.h"
-#include <math.h>
-#include <wtf/MathExtras.h>
+#include <wtf/ASCIICType.h>
namespace WebCore {
@@ -54,8 +40,8 @@ namespace WebCore {
*/
template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const UChar* end, FloatType& number, bool skip)
{
- int integer, exponent;
- FloatType decimal, frac;
+ int exponent;
+ FloatType integer, decimal, frac;
int sign, expsign;
const UChar* start = ptr;
@@ -78,9 +64,19 @@ template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const
// The first character of a number must be one of [0-9+-.]
return false;
- // read the integer part
+ // read the integer part, build right-to-left
+ const UChar* ptrStartIntPart = ptr;
while (ptr < end && *ptr >= '0' && *ptr <= '9')
- integer = (integer * 10) + *(ptr++) - '0';
+ ++ptr; // Advance to first non-digit.
+
+ if (ptr != ptrStartIntPart) {
+ const UChar* ptrScanIntPart = ptr - 1;
+ FloatType multiplier = 1;
+ while (ptrScanIntPart >= ptrStartIntPart) {
+ integer += multiplier * static_cast<FloatType>(*(ptrScanIntPart--) - '0');
+ multiplier *= 10;
+ }
+ }
if (ptr < end && *ptr == '.') { // read the decimals
ptr++;
@@ -134,10 +130,21 @@ bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip)
return _parseNumber(ptr, end, number, skip);
}
-// Only used for parsing Paths
-static bool parseNumber(const UChar*& ptr, const UChar* end, double& number, bool skip = true)
+// only used to parse largeArcFlag and sweepFlag which must be a "0" or "1"
+// and might not have any whitespace/comma after it
+bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag)
{
- return _parseNumber(ptr, end, number, skip);
+ const UChar flagChar = *ptr++;
+ if (flagChar == '0')
+ flag = false;
+ else if (flagChar == '1')
+ flag = true;
+ else
+ return false;
+
+ skipOptionalSpacesOrDelimiter(ptr, end);
+
+ return true;
}
bool parseNumberOptionalNumber(const String& s, float& x, float& y)
@@ -192,640 +199,129 @@ bool pointsListFromSVGData(SVGPointList* pointsList, const String& points)
return cur == end && !delimParsed;
}
- /**
- * Parser for svg path data, contained in the d attribute.
- *
- * The parser delivers encountered commands and parameters by calling
- * methods that correspond to those commands. Clients have to derive
- * from this class and implement the abstract command methods.
- *
- * There are two operating modes. By default the parser just delivers unaltered
- * svg path data commands and parameters. In the second mode, it will convert all
- * relative coordinates to absolute ones, and convert all curves to cubic beziers.
- */
- class SVGPathParser {
- public:
- virtual ~SVGPathParser() { }
- bool parseSVG(const String& d, bool process = false);
-
- protected:
- virtual void svgMoveTo(double x1, double y1, bool closed, bool abs = true) = 0;
- virtual void svgLineTo(double x1, double y1, bool abs = true) = 0;
- virtual void svgLineToHorizontal(double, bool /*abs*/ = true) { }
- virtual void svgLineToVertical(double /*y*/, bool /*abs*/ = true) { }
- virtual void svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs = true) = 0;
- virtual void svgCurveToCubicSmooth(double /*x*/, double /*y*/, double /*x2*/, double /*y2*/, bool /*abs*/ = true) { }
- virtual void svgCurveToQuadratic(double /*x*/, double /*y*/, double /*x1*/, double /*y1*/, bool /*abs*/ = true) { }
- virtual void svgCurveToQuadraticSmooth(double /*x*/, double /*y*/, bool /*abs*/ = true) { }
- virtual void svgArcTo(double /*x*/, double /*y*/, double /*r1*/, double /*r2*/, double /*angle*/, bool /*largeArcFlag*/, bool /*sweepFlag*/, bool /*abs*/ = true) { }
- virtual void svgClosePath() = 0;
-
- private:
- void calculateArc(bool relative, double& curx, double& cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag);
- };
-
-bool SVGPathParser::parseSVG(const String& s, bool process)
+bool parseGlyphName(const String& input, HashSet<String>& values)
{
- const UChar* ptr = s.characters();
- const UChar* end = ptr + s.length();
+ // FIXME: Parsing error detection is missing.
+ values.clear();
- double contrlx, contrly, curx, cury, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc;
- double px1, py1, px2, py2, px3, py3;
- bool closed = true;
-
- if (!skipOptionalSpaces(ptr, end)) // skip any leading spaces
- return false;
-
- char command = *(ptr++), lastCommand = ' ';
- if (command != 'm' && command != 'M') // path must start with moveto
- return false;
+ const UChar* ptr = input.characters();
+ const UChar* end = ptr + input.length();
+ skipOptionalSpaces(ptr, end);
- subpathx = subpathy = curx = cury = contrlx = contrly = 0.0;
- while (1) {
- skipOptionalSpaces(ptr, end); // skip spaces between command and first coord
-
- bool relative = false;
-
- switch (command)
- {
- case 'm':
- relative = true;
- case 'M':
- {
- if (!parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- if (process) {
- subpathx = curx = relative ? curx + tox : tox;
- subpathy = cury = relative ? cury + toy : toy;
-
- svgMoveTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury), closed);
- } else
- svgMoveTo(narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), closed, !relative);
- closed = false;
- break;
- }
- case 'l':
- relative = true;
- case 'L':
- {
- if (!parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- if (process) {
- curx = relative ? curx + tox : tox;
- cury = relative ? cury + toy : toy;
-
- svgLineTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury));
- }
- else
- svgLineTo(narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), !relative);
- break;
- }
- case 'h':
- {
- if (!parseNumber(ptr, end, tox))
- return false;
- if (process) {
- curx = curx + tox;
- svgLineTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury));
- }
- else
- svgLineToHorizontal(narrowPrecisionToFloat(tox), false);
- break;
- }
- case 'H':
- {
- if (!parseNumber(ptr, end, tox))
- return false;
- if (process) {
- curx = tox;
- svgLineTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury));
- }
- else
- svgLineToHorizontal(narrowPrecisionToFloat(tox));
- break;
- }
- case 'v':
- {
- if (!parseNumber(ptr, end, toy))
- return false;
- if (process) {
- cury = cury + toy;
- svgLineTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury));
- }
- else
- svgLineToVertical(narrowPrecisionToFloat(toy), false);
- break;
- }
- case 'V':
- {
- if (!parseNumber(ptr, end, toy))
- return false;
- if (process) {
- cury = toy;
- svgLineTo(narrowPrecisionToFloat(curx), narrowPrecisionToFloat(cury));
- }
- else
- svgLineToVertical(narrowPrecisionToFloat(toy));
- break;
- }
- case 'z':
- case 'Z':
- {
- // reset curx, cury for next path
- if (process) {
- curx = subpathx;
- cury = subpathy;
- }
- closed = true;
- svgClosePath();
- break;
- }
- case 'c':
- relative = true;
- case 'C':
- {
- if (!parseNumber(ptr, end, x1) || !parseNumber(ptr, end, y1) ||
- !parseNumber(ptr, end, x2) || !parseNumber(ptr, end, y2) ||
- !parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- if (process) {
- px1 = relative ? curx + x1 : x1;
- py1 = relative ? cury + y1 : y1;
- px2 = relative ? curx + x2 : x2;
- py2 = relative ? cury + y2 : y2;
- px3 = relative ? curx + tox : tox;
- py3 = relative ? cury + toy : toy;
-
- svgCurveToCubic(narrowPrecisionToFloat(px1), narrowPrecisionToFloat(py1), narrowPrecisionToFloat(px2),
- narrowPrecisionToFloat(py2), narrowPrecisionToFloat(px3), narrowPrecisionToFloat(py3));
-
- contrlx = relative ? curx + x2 : x2;
- contrly = relative ? cury + y2 : y2;
- curx = relative ? curx + tox : tox;
- cury = relative ? cury + toy : toy;
- }
- else
- svgCurveToCubic(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1), narrowPrecisionToFloat(x2),
- narrowPrecisionToFloat(y2), narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), !relative);
+ while (ptr < end) {
+ // Leading and trailing white space, and white space before and after separators, will be ignored.
+ const UChar* inputStart = ptr;
+ while (ptr < end && *ptr != ',')
+ ++ptr;
- break;
- }
- case 's':
- relative = true;
- case 'S':
- {
- if (!parseNumber(ptr, end, x2) || !parseNumber(ptr, end, y2) ||
- !parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- if (!(lastCommand == 'c' || lastCommand == 'C' ||
- lastCommand == 's' || lastCommand == 'S')) {
- contrlx = curx;
- contrly = cury;
- }
-
- if (process) {
- px1 = 2 * curx - contrlx;
- py1 = 2 * cury - contrly;
- px2 = relative ? curx + x2 : x2;
- py2 = relative ? cury + y2 : y2;
- px3 = relative ? curx + tox : tox;
- py3 = relative ? cury + toy : toy;
-
- svgCurveToCubic(narrowPrecisionToFloat(px1), narrowPrecisionToFloat(py1), narrowPrecisionToFloat(px2),
- narrowPrecisionToFloat(py2), narrowPrecisionToFloat(px3), narrowPrecisionToFloat(py3));
-
- contrlx = relative ? curx + x2 : x2;
- contrly = relative ? cury + y2 : y2;
- curx = relative ? curx + tox : tox;
- cury = relative ? cury + toy : toy;
- }
- else
- svgCurveToCubicSmooth(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2),
- narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), !relative);
- break;
- }
- case 'q':
- relative = true;
- case 'Q':
- {
- if (!parseNumber(ptr, end, x1) || !parseNumber(ptr, end, y1) ||
- !parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- if (process) {
- px1 = relative ? (curx + 2 * (x1 + curx)) * (1.0 / 3.0) : (curx + 2 * x1) * (1.0 / 3.0);
- py1 = relative ? (cury + 2 * (y1 + cury)) * (1.0 / 3.0) : (cury + 2 * y1) * (1.0 / 3.0);
- px2 = relative ? ((curx + tox) + 2 * (x1 + curx)) * (1.0 / 3.0) : (tox + 2 * x1) * (1.0 / 3.0);
- py2 = relative ? ((cury + toy) + 2 * (y1 + cury)) * (1.0 / 3.0) : (toy + 2 * y1) * (1.0 / 3.0);
- px3 = relative ? curx + tox : tox;
- py3 = relative ? cury + toy : toy;
-
- svgCurveToCubic(narrowPrecisionToFloat(px1), narrowPrecisionToFloat(py1), narrowPrecisionToFloat(px2),
- narrowPrecisionToFloat(py2), narrowPrecisionToFloat(px3), narrowPrecisionToFloat(py3));
-
- contrlx = relative ? curx + x1 : x1;
- contrly = relative ? cury + y1 : y1;
- curx = relative ? curx + tox : tox;
- cury = relative ? cury + toy : toy;
- }
- else
- svgCurveToQuadratic(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1),
- narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), !relative);
- break;
- }
- case 't':
- relative = true;
- case 'T':
- {
- if (!parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
- if (!(lastCommand == 'q' || lastCommand == 'Q' ||
- lastCommand == 't' || lastCommand == 'T')) {
- contrlx = curx;
- contrly = cury;
- }
-
- if (process) {
- xc = 2 * curx - contrlx;
- yc = 2 * cury - contrly;
-
- px1 = relative ? (curx + 2 * xc) * (1.0 / 3.0) : (curx + 2 * xc) * (1.0 / 3.0);
- py1 = relative ? (cury + 2 * yc) * (1.0 / 3.0) : (cury + 2 * yc) * (1.0 / 3.0);
- px2 = relative ? ((curx + tox) + 2 * xc) * (1.0 / 3.0) : (tox + 2 * xc) * (1.0 / 3.0);
- py2 = relative ? ((cury + toy) + 2 * yc) * (1.0 / 3.0) : (toy + 2 * yc) * (1.0 / 3.0);
- px3 = relative ? curx + tox : tox;
- py3 = relative ? cury + toy : toy;
-
- svgCurveToCubic(narrowPrecisionToFloat(px1), narrowPrecisionToFloat(py1), narrowPrecisionToFloat(px2),
- narrowPrecisionToFloat(py2), narrowPrecisionToFloat(px3), narrowPrecisionToFloat(py3));
-
- contrlx = xc;
- contrly = yc;
- curx = relative ? curx + tox : tox;
- cury = relative ? cury + toy : toy;
- }
- else
- svgCurveToQuadraticSmooth(narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), !relative);
- break;
- }
- case 'a':
- relative = true;
- case 'A':
- {
- bool largeArc, sweep;
- double angle, rx, ry;
- if (!parseNumber(ptr, end, rx) || !parseNumber(ptr, end, ry) ||
- !parseNumber(ptr, end, angle) || !parseNumber(ptr, end, tox))
- return false;
- largeArc = tox == 1;
- if (!parseNumber(ptr, end, tox))
- return false;
- sweep = tox == 1;
- if (!parseNumber(ptr, end, tox) || !parseNumber(ptr, end, toy))
- return false;
-
- // Spec: radii are nonnegative numbers
- rx = fabs(rx);
- ry = fabs(ry);
-
- if (process)
- calculateArc(relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep);
- else
- svgArcTo(narrowPrecisionToFloat(tox), narrowPrecisionToFloat(toy), narrowPrecisionToFloat(rx), narrowPrecisionToFloat(ry),
- narrowPrecisionToFloat(angle), largeArc, sweep, !relative);
- break;
- }
- default:
- // FIXME: An error should go to the JavaScript console, or the like.
- return false;
- }
- lastCommand = command;
-
- if (ptr >= end)
- return true;
-
- // Check for remaining coordinates in the current command.
- if ((*ptr == '+' || *ptr == '-' || *ptr == '.' || (*ptr >= '0' && *ptr <= '9'))
- && (command != 'z' && command != 'Z')) {
- if (command == 'M')
- command = 'L';
- else if (command == 'm')
- command = 'l';
- } else
- command = *(ptr++);
-
- if (lastCommand != 'C' && lastCommand != 'c' &&
- lastCommand != 'S' && lastCommand != 's' &&
- lastCommand != 'Q' && lastCommand != 'q' &&
- lastCommand != 'T' && lastCommand != 't') {
- contrlx = curx;
- contrly = cury;
- }
+ if (ptr == inputStart)
+ break;
+
+ // walk backwards from the ; to ignore any whitespace
+ const UChar* inputEnd = ptr - 1;
+ while (inputStart < inputEnd && isWhitespace(*inputEnd))
+ --inputEnd;
+
+ values.add(String(inputStart, inputEnd - inputStart + 1));
+ skipOptionalSpacesOrDelimiter(ptr, end, ',');
}
- return false;
+ return true;
}
-// This works by converting the SVG arc to "simple" beziers.
-// For each bezier found a svgToCurve call is done.
-// Adapted from Niko's code in kdelibs/kdecore/svgicons.
-// Maybe this can serve in some shared lib? (Rob)
-void SVGPathParser::calculateArc(bool relative, double& curx, double& cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag)
+static bool parseUnicodeRange(const UChar* characters, unsigned length, UnicodeRange& range)
{
- double sin_th, cos_th;
- double a00, a01, a10, a11;
- double x0, y0, x1, y1, xc, yc;
- double d, sfactor, sfactor_sq;
- double th0, th1, th_arc;
- int i, n_segs;
-
- sin_th = sin(angle * (piDouble / 180.0));
- cos_th = cos(angle * (piDouble / 180.0));
-
- double dx;
-
- if (!relative)
- dx = (curx - x) / 2.0;
- else
- dx = -x / 2.0;
+ if (length < 2 || characters[0] != 'U' || characters[1] != '+')
+ return false;
+
+ // Parse the starting hex number (or its prefix).
+ unsigned startRange = 0;
+ unsigned startLength = 0;
- double dy;
-
- if (!relative)
- dy = (cury - y) / 2.0;
- else
- dy = -y / 2.0;
-
- double _x1 = cos_th * dx + sin_th * dy;
- double _y1 = -sin_th * dx + cos_th * dy;
- double Pr1 = r1 * r1;
- double Pr2 = r2 * r2;
- double Px = _x1 * _x1;
- double Py = _y1 * _y1;
-
- // Spec : check if radii are large enough
- double check = Px / Pr1 + Py / Pr2;
- if (check > 1) {
- r1 = r1 * sqrt(check);
- r2 = r2 * sqrt(check);
+ const UChar* ptr = characters + 2;
+ const UChar* end = characters + length;
+ while (ptr < end) {
+ if (!isASCIIHexDigit(*ptr))
+ break;
+ ++startLength;
+ if (startLength > 6)
+ return false;
+ startRange = (startRange << 4) | toASCIIHexValue(*ptr);
+ ++ptr;
}
-
- a00 = cos_th / r1;
- a01 = sin_th / r1;
- a10 = -sin_th / r2;
- a11 = cos_th / r2;
-
- x0 = a00 * curx + a01 * cury;
- y0 = a10 * curx + a11 * cury;
-
- if (!relative)
- x1 = a00 * x + a01 * y;
- else
- x1 = a00 * (curx + x) + a01 * (cury + y);
+
+ // Handle the case of ranges separated by "-" sign.
+ if (2 + startLength < length && *ptr == '-') {
+ if (!startLength)
+ return false;
- if (!relative)
- y1 = a10 * x + a11 * y;
- else
- y1 = a10 * (curx + x) + a11 * (cury + y);
-
- /* (x0, y0) is current point in transformed coordinate space.
- (x1, y1) is new point in transformed coordinate space.
-
- The arc fits a unit-radius circle in this space.
- */
-
- d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
-
- sfactor_sq = 1.0 / d - 0.25;
-
- if (sfactor_sq < 0)
- sfactor_sq = 0;
-
- sfactor = sqrt(sfactor_sq);
-
- if (sweepFlag == largeArcFlag)
- sfactor = -sfactor;
-
- xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
- yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
-
- /* (xc, yc) is center of the circle. */
- th0 = atan2(y0 - yc, x0 - xc);
- th1 = atan2(y1 - yc, x1 - xc);
-
- th_arc = th1 - th0;
- if (th_arc < 0 && sweepFlag)
- th_arc += 2 * piDouble;
- else if (th_arc > 0 && !sweepFlag)
- th_arc -= 2 * piDouble;
-
- n_segs = (int) (int) ceil(fabs(th_arc / (piDouble * 0.5 + 0.001)));
-
- for (i = 0; i < n_segs; i++) {
- double sin_th, cos_th;
- double a00, a01, a10, a11;
- double x1, y1, x2, y2, x3, y3;
- double t;
- double th_half;
-
- double _th0 = th0 + i * th_arc / n_segs;
- double _th1 = th0 + (i + 1) * th_arc / n_segs;
-
- sin_th = sin(angle * (piDouble / 180.0));
- cos_th = cos(angle * (piDouble / 180.0));
-
- /* inverse transform compared with rsvg_path_arc */
- a00 = cos_th * r1;
- a01 = -sin_th * r2;
- a10 = sin_th * r1;
- a11 = cos_th * r2;
-
- th_half = 0.5 * (_th1 - _th0);
- t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half);
- x1 = xc + cos(_th0) - t * sin(_th0);
- y1 = yc + sin(_th0) + t * cos(_th0);
- x3 = xc + cos(_th1);
- y3 = yc + sin(_th1);
- x2 = x3 + t * sin(_th1);
- y2 = y3 - t * cos(_th1);
-
- svgCurveToCubic(narrowPrecisionToFloat(a00 * x1 + a01 * y1), narrowPrecisionToFloat(a10 * x1 + a11 * y1),
- narrowPrecisionToFloat(a00 * x2 + a01 * y2), narrowPrecisionToFloat(a10 * x2 + a11 * y2),
- narrowPrecisionToFloat(a00 * x3 + a01 * y3), narrowPrecisionToFloat(a10 * x3 + a11 * y3));
- }
-
- if (!relative)
- curx = x;
- else
- curx += x;
-
- if (!relative)
- cury = y;
- else
- cury += y;
-}
-
-class PathBuilder : private SVGPathParser {
-public:
- bool build(Path* path, const String& d)
- {
- Path temporaryPath;
- m_path = &temporaryPath;
- if (!parseSVG(d, true))
+ // Parse the ending hex number (or its prefix).
+ unsigned endRange = 0;
+ unsigned endLength = 0;
+ ++ptr;
+ while (ptr < end) {
+ if (!isASCIIHexDigit(*ptr))
+ break;
+ ++endLength;
+ if (endLength > 6)
+ return false;
+ endRange = (endRange << 4) | toASCIIHexValue(*ptr);
+ ++ptr;
+ }
+
+ if (!endLength)
return false;
- temporaryPath.swap(*path);
+
+ range.first = startRange;
+ range.second = endRange;
return true;
}
-
-private:
- virtual void svgMoveTo(double x1, double y1, bool closed, bool abs = true)
- {
- current.setX(narrowPrecisionToFloat(abs ? x1 : current.x() + x1));
- current.setY(narrowPrecisionToFloat(abs ? y1 : current.y() + y1));
- if (closed)
- m_path->closeSubpath();
- m_path->moveTo(current);
- }
- virtual void svgLineTo(double x1, double y1, bool abs = true)
- {
- current.setX(narrowPrecisionToFloat(abs ? x1 : current.x() + x1));
- current.setY(narrowPrecisionToFloat(abs ? y1 : current.y() + y1));
- m_path->addLineTo(current);
- }
- virtual void svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs = true)
- {
- if (!abs) {
- x1 += current.x();
- y1 += current.y();
- x2 += current.x();
- y2 += current.y();
- }
- current.setX(narrowPrecisionToFloat(abs ? x : current.x() + x));
- current.setY(narrowPrecisionToFloat(abs ? y : current.y() + y));
- m_path->addBezierCurveTo(FloatPoint::narrowPrecision(x1, y1), FloatPoint::narrowPrecision(x2, y2), current);
- }
- virtual void svgClosePath()
- {
- m_path->closeSubpath();
+
+ // Handle the case of a number with some optional trailing question marks.
+ unsigned endRange = startRange;
+ while (ptr < end) {
+ if (*ptr != '?')
+ break;
+ ++startLength;
+ if (startLength > 6)
+ return false;
+ startRange <<= 4;
+ endRange = (endRange << 4) | 0xF;
+ ++ptr;
}
+
+ if (!startLength)
+ return false;
+
+ range.first = startRange;
+ range.second = endRange;
+ return true;
+}
- Path* m_path;
- FloatPoint current;
-};
-
-bool pathFromSVGData(Path& path, const String& d)
+bool parseKerningUnicodeString(const String& input, UnicodeRanges& rangeList, HashSet<String>& stringList)
{
- PathBuilder builder;
- return builder.build(&path, d);
-}
+ // FIXME: Parsing error detection is missing.
+ const UChar* ptr = input.characters();
+ const UChar* end = ptr + input.length();
-class SVGPathSegListBuilder : private SVGPathParser {
-public:
- bool build(SVGPathSegList* segList, const String& d, bool process)
- {
- if (!parseSVG(d, process))
- return false;
- size_t size = m_vector.size();
- for (size_t i = 0; i < size; ++i) {
- ExceptionCode ec;
- segList->appendItem(m_vector[i].release(), ec);
- }
- m_vector.clear();
- return true;
- }
+ while (ptr < end) {
+ const UChar* inputStart = ptr;
+ while (ptr < end && *ptr != ',')
+ ++ptr;
-private:
- virtual void svgMoveTo(double x1, double y1, bool, bool abs = true)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegMovetoAbs(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegMovetoRel(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1)));
- }
- virtual void svgLineTo(double x1, double y1, bool abs = true)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegLinetoAbs(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegLinetoRel(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1)));
- }
- virtual void svgLineToHorizontal(double x, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegLinetoHorizontalAbs(narrowPrecisionToFloat(x)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegLinetoHorizontalRel(narrowPrecisionToFloat(x)));
- }
- virtual void svgLineToVertical(double y, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegLinetoVerticalAbs(narrowPrecisionToFloat(y)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegLinetoVerticalRel(narrowPrecisionToFloat(y)));
- }
- virtual void svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs = true)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoCubicAbs(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y),
- narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1),
- narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoCubicRel(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y),
- narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1),
- narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2)));
- }
- virtual void svgCurveToCubicSmooth(double x, double y, double x2, double y2, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2),
- narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2),
- narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- }
- virtual void svgCurveToQuadratic(double x, double y, double x1, double y1, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1),
- narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoQuadraticRel(narrowPrecisionToFloat(x1), narrowPrecisionToFloat(y1),
- narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- }
- virtual void svgCurveToQuadraticSmooth(double x, double y, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- else
- m_vector.append(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y)));
- }
- virtual void svgArcTo(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, bool abs)
- {
- if (abs)
- m_vector.append(SVGPathElement::createSVGPathSegArcAbs(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y),
- narrowPrecisionToFloat(r1), narrowPrecisionToFloat(r2),
- narrowPrecisionToFloat(angle), largeArcFlag, sweepFlag));
+ if (ptr == inputStart)
+ break;
+
+ // Try to parse unicode range first
+ UnicodeRange range;
+ if (parseUnicodeRange(inputStart, ptr - inputStart, range))
+ rangeList.append(range);
else
- m_vector.append(SVGPathElement::createSVGPathSegArcRel(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y),
- narrowPrecisionToFloat(r1), narrowPrecisionToFloat(r2),
- narrowPrecisionToFloat(angle), largeArcFlag, sweepFlag));
+ stringList.add(String(inputStart, ptr - inputStart));
+ ++ptr;
}
- virtual void svgClosePath()
- {
- m_vector.append(SVGPathElement::createSVGPathSegClosePath());
- }
-
- Vector<RefPtr<SVGPathSeg> > m_vector;
-};
-bool pathSegListFromSVGData(SVGPathSegList* path, const String& d, bool process)
-{
- SVGPathSegListBuilder builder;
- return builder.build(path, d, process);
+ return true;
}
Vector<String> parseDelimitedString(const String& input, const char seperator)
diff --git a/WebCore/svg/SVGParserUtilities.h b/WebCore/svg/SVGParserUtilities.h
index 8d3c9b2..4e9362d 100644
--- a/WebCore/svg/SVGParserUtilities.h
+++ b/WebCore/svg/SVGParserUtilities.h
@@ -1,37 +1,40 @@
/*
- Copyright (C) 2002, 2003 The Karbon Developers
- 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGParserUtilities_h
#define SVGParserUtilities_h
#if ENABLE(SVG)
#include "ParserUtilities.h"
+#include <wtf/HashSet.h>
+
+typedef pair<unsigned, unsigned> UnicodeRange;
+typedef Vector<UnicodeRange> UnicodeRanges;
namespace WebCore {
- class Path;
class SVGPointList;
- class SVGPathSegList;
bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true);
bool parseNumberOptionalNumber(const String& s, float& h, float& v);
+ bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
// SVG allows several different whitespace characters:
// http://www.w3.org/TR/SVG/paths.html#PathDataBNF
@@ -61,9 +64,9 @@ namespace WebCore {
}
bool pointsListFromSVGData(SVGPointList* pointsList, const String& points);
- bool pathFromSVGData(Path& path, const String& d);
- bool pathSegListFromSVGData(SVGPathSegList* pathSegList, const String& d, bool process = false);
Vector<String> parseDelimitedString(const String& input, const char seperator);
+ bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList);
+ bool parseGlyphName(const String& input, HashSet<String>& values);
} // namespace WebCore
diff --git a/WebCore/svg/SVGPathBlender.cpp b/WebCore/svg/SVGPathBlender.cpp
new file mode 100644
index 0000000..8320890
--- /dev/null
+++ b/WebCore/svg/SVGPathBlender.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathBlender.h"
+
+#include "SVGPathSeg.h"
+
+namespace WebCore {
+
+SVGPathBlender::SVGPathBlender()
+ : m_fromSource(0)
+ , m_toSource(0)
+ , m_consumer(0)
+ , m_progress(0)
+{
+}
+
+SVGPathBlender::~SVGPathBlender()
+{
+}
+
+float SVGPathBlender::blendAnimatedFloat(float from, float to)
+{
+ return (to - from) * m_progress + from;
+}
+
+FloatPoint SVGPathBlender::blendAnimatedFloatPoint(FloatPoint& from, FloatPoint& to)
+{
+ return FloatPoint((to.x() - from.x()) * m_progress + from.x(), (to.y() - from.y()) * m_progress + from.y());
+}
+
+bool SVGPathBlender::blendMoveToSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint toTargetPoint;
+ if (!m_fromSource->parseMoveToSegment(fromTargetPoint)
+ || !m_toSource->parseMoveToSegment(toTargetPoint))
+ return false;
+
+ m_consumer->moveTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), false, m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendLineToSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint toTargetPoint;
+ if (!m_fromSource->parseLineToSegment(fromTargetPoint)
+ || !m_toSource->parseLineToSegment(toTargetPoint))
+ return false;
+
+ m_consumer->lineTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendLineToHorizontalSegment()
+{
+ float fromX;
+ float toX;
+ if (!m_fromSource->parseLineToHorizontalSegment(fromX)
+ || !m_toSource->parseLineToHorizontalSegment(toX))
+ return false;
+
+ m_consumer->lineToHorizontal(blendAnimatedFloat(fromX, toX), m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendLineToVerticalSegment()
+{
+ float fromY;
+ float toY;
+ if (!m_fromSource->parseLineToVerticalSegment(fromY)
+ || !m_toSource->parseLineToVerticalSegment(toY))
+ return false;
+
+ m_consumer->lineToVertical(blendAnimatedFloat(fromY, toY), m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendCurveToCubicSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint fromPoint1;
+ FloatPoint fromPoint2;
+ FloatPoint toTargetPoint;
+ FloatPoint toPoint1;
+ FloatPoint toPoint2;
+ if (!m_fromSource->parseCurveToCubicSegment(fromPoint1, fromPoint2, fromTargetPoint)
+ || !m_toSource->parseCurveToCubicSegment(toPoint1, toPoint2, toTargetPoint))
+ return false;
+
+ m_consumer->curveToCubic(blendAnimatedFloatPoint(fromPoint1, toPoint1),
+ blendAnimatedFloatPoint(fromPoint2, toPoint2),
+ blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
+ m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendCurveToCubicSmoothSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint fromPoint2;
+ FloatPoint toTargetPoint;
+ FloatPoint toPoint2;
+ if (!m_fromSource->parseCurveToCubicSmoothSegment(fromPoint2, fromTargetPoint)
+ || !m_toSource->parseCurveToCubicSmoothSegment(toPoint2, toTargetPoint))
+ return false;
+
+ m_consumer->curveToCubicSmooth(blendAnimatedFloatPoint(fromPoint2, toPoint2),
+ blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
+ m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendCurveToQuadraticSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint fromPoint1;
+ FloatPoint toTargetPoint;
+ FloatPoint toPoint1;
+ if (!m_fromSource->parseCurveToQuadraticSegment(fromPoint1, fromTargetPoint)
+ || !m_toSource->parseCurveToQuadraticSegment(toPoint1, toTargetPoint))
+ return false;
+
+ m_consumer->curveToQuadratic(blendAnimatedFloatPoint(fromPoint1, toPoint1),
+ blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
+ m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendCurveToQuadraticSmoothSegment()
+{
+ FloatPoint fromTargetPoint;
+ FloatPoint toTargetPoint;
+ if (!m_fromSource->parseCurveToQuadraticSmoothSegment(fromTargetPoint)
+ || !m_toSource->parseCurveToQuadraticSmoothSegment(toTargetPoint))
+ return false;
+
+ m_consumer->curveToQuadraticSmooth(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendArcToSegment()
+{
+ float fromRx;
+ float fromRy;
+ float fromAngle;
+ bool fromLargeArc;
+ bool fromSweep;
+ FloatPoint fromTargetPoint;
+ float toRx;
+ float toRy;
+ float toAngle;
+ bool toLargeArc;
+ bool toSweep;
+ FloatPoint toTargetPoint;
+ if (!m_fromSource->parseArcToSegment(fromRx, fromRy, fromAngle, fromLargeArc, fromSweep, fromTargetPoint)
+ || !m_toSource->parseArcToSegment(toRx, toRy, toAngle, toLargeArc, toSweep, toTargetPoint))
+ return false;
+
+ m_consumer->arcTo(blendAnimatedFloat(fromRx, toRx),
+ blendAnimatedFloat(fromRy, toRy),
+ blendAnimatedFloat(fromAngle, toAngle),
+ m_progress < 0.5 ? fromLargeArc : toLargeArc,
+ m_progress < 0.5 ? fromSweep : toSweep,
+ blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
+ m_mode);
+ return true;
+}
+
+bool SVGPathBlender::blendAnimatedPath(float progress, SVGPathSource* fromSource, SVGPathSource* toSource, SVGPathConsumer* consumer)
+{
+ ASSERT(fromSource);
+ ASSERT(toSource);
+ ASSERT(consumer);
+ m_fromSource = fromSource;
+ m_toSource = toSource;
+ m_consumer = consumer;
+
+ m_progress = progress;
+ while (true) {
+ SVGPathSegType fromCommand;
+ SVGPathSegType toCommand;
+ if (!m_fromSource->parseSVGSegmentType(fromCommand) || !m_toSource->parseSVGSegmentType(toCommand))
+ return false;
+ if (fromCommand != toCommand)
+ return false;
+
+ m_mode = AbsoluteCoordinates;
+ switch (fromCommand) {
+ case PathSegMoveToRel:
+ m_mode = RelativeCoordinates;
+ case PathSegMoveToAbs:
+ if (!blendMoveToSegment())
+ return false;
+ break;
+ case PathSegLineToRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToAbs:
+ if (!blendLineToSegment())
+ return false;
+ break;
+ case PathSegLineToHorizontalRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToHorizontalAbs:
+ if (!blendLineToHorizontalSegment())
+ return false;
+ break;
+ case PathSegLineToVerticalRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToVerticalAbs:
+ if (!blendLineToVerticalSegment())
+ return false;
+ break;
+ case PathSegClosePath:
+ m_consumer->closePath();
+ break;
+ case PathSegCurveToCubicRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToCubicAbs:
+ if (!blendCurveToCubicSegment())
+ return false;
+ break;
+ case PathSegCurveToCubicSmoothRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToCubicSmoothAbs:
+ if (!blendCurveToCubicSmoothSegment())
+ return false;
+ break;
+ case PathSegCurveToQuadraticRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToQuadraticAbs:
+ if (!blendCurveToQuadraticSegment())
+ return false;
+ break;
+ case PathSegCurveToQuadraticSmoothRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToQuadraticSmoothAbs:
+ if (!blendCurveToQuadraticSmoothSegment())
+ return false;
+ break;
+ case PathSegArcRel:
+ m_mode = RelativeCoordinates;
+ case PathSegArcAbs:
+ if (!blendArcToSegment())
+ return false;
+ break;
+ default:
+ return false;
+ }
+ if (m_fromSource->hasMoreData() != m_toSource->hasMoreData())
+ return false;
+ if (!m_fromSource->hasMoreData() || !m_toSource->hasMoreData())
+ break;
+ }
+ return true;
+}
+
+void SVGPathBlender::cleanup()
+{
+ ASSERT(m_toSource);
+ ASSERT(m_fromSource);
+ ASSERT(m_consumer);
+
+ m_consumer->cleanup();
+ m_toSource = 0;
+ m_fromSource = 0;
+ m_consumer = 0;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathBlender.h b/WebCore/svg/SVGPathBlender.h
new file mode 100644
index 0000000..a15c0ad
--- /dev/null
+++ b/WebCore/svg/SVGPathBlender.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathBlender_h
+#define SVGPathBlender_h
+
+#if ENABLE(SVG)
+#include "SVGPathConsumer.h"
+#include "SVGPathSource.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class SVGPathBlender : public Noncopyable {
+public:
+ SVGPathBlender();
+ ~SVGPathBlender();
+
+ bool blendAnimatedPath(float, SVGPathSource*, SVGPathSource*, SVGPathConsumer*);
+ void cleanup();
+
+private:
+ bool blendMoveToSegment();
+ bool blendLineToSegment();
+ bool blendLineToHorizontalSegment();
+ bool blendLineToVerticalSegment();
+ bool blendCurveToCubicSegment();
+ bool blendCurveToCubicSmoothSegment();
+ bool blendCurveToQuadraticSegment();
+ bool blendCurveToQuadraticSmoothSegment();
+ bool blendArcToSegment();
+
+ float blendAnimatedFloat(float, float);
+ FloatPoint blendAnimatedFloatPoint(FloatPoint&, FloatPoint&);
+
+ SVGPathSource* m_fromSource;
+ SVGPathSource* m_toSource;
+ SVGPathConsumer* m_consumer;
+ PathCoordinateMode m_mode;
+ float m_progress;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathBlender_h
diff --git a/WebCore/svg/SVGPathBuilder.cpp b/WebCore/svg/SVGPathBuilder.cpp
new file mode 100644
index 0000000..6687edf
--- /dev/null
+++ b/WebCore/svg/SVGPathBuilder.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathBuilder.h"
+
+namespace WebCore {
+
+SVGPathBuilder::SVGPathBuilder()
+ : m_path(0)
+{
+}
+
+void SVGPathBuilder::moveTo(const FloatPoint& targetPoint, bool closed, PathCoordinateMode mode)
+{
+ ASSERT(m_path);
+ m_current = mode == AbsoluteCoordinates ? targetPoint : m_current + targetPoint;
+ if (closed && !m_path->isEmpty())
+ m_path->closeSubpath();
+ m_path->moveTo(m_current);
+}
+
+void SVGPathBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_path);
+ m_current = mode == AbsoluteCoordinates ? targetPoint : m_current + targetPoint;
+ m_path->addLineTo(m_current);
+}
+
+void SVGPathBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_path);
+ if (mode == RelativeCoordinates) {
+ m_path->addBezierCurveTo(m_current + point1, m_current + point2, m_current + targetPoint);
+ m_current += targetPoint;
+ } else {
+ m_current = targetPoint;
+ m_path->addBezierCurveTo(point1, point2, m_current);
+ }
+}
+
+void SVGPathBuilder::closePath()
+{
+ ASSERT(m_path);
+ m_path->closeSubpath();
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathBuilder.h b/WebCore/svg/SVGPathBuilder.h
new file mode 100644
index 0000000..38eabd4
--- /dev/null
+++ b/WebCore/svg/SVGPathBuilder.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathBuilder_h
+#define SVGPathBuilder_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "Path.h"
+#include "SVGPathConsumer.h"
+
+namespace WebCore {
+
+class SVGPathBuilder : public SVGPathConsumer {
+public:
+ SVGPathBuilder();
+
+ void setCurrentPath(Path* path) { m_path = path; }
+ virtual void incrementPathSegmentCount() { }
+ virtual bool continueConsuming() { return true; }
+ virtual void cleanup() { m_path = 0; }
+
+private:
+ // Used in UnalteredParisng/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode);
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void closePath();
+
+private:
+ // Only used in UnalteredParsing mode.
+ virtual void lineToHorizontal(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void lineToVertical(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+
+ Path* m_path;
+ FloatPoint m_current;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathBuilder_h
diff --git a/WebCore/svg/SVGPathByteStream.h b/WebCore/svg/SVGPathByteStream.h
new file mode 100644
index 0000000..b8882b6
--- /dev/null
+++ b/WebCore/svg/SVGPathByteStream.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathByteStream_h
+#define SVGPathByteStream_h
+
+#if ENABLE(SVG)
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// Type definitions for the byte stream data
+typedef union {
+ bool value;
+ unsigned char bytes[sizeof(bool)];
+} BoolByte;
+
+typedef union {
+ float value;
+ unsigned char bytes[sizeof(float)];
+} FloatByte;
+
+typedef union {
+ unsigned short value;
+ unsigned char bytes[sizeof(unsigned short)];
+} UnsignedShortByte;
+
+class SVGPathByteStream : public Noncopyable {
+public:
+ static PassOwnPtr<SVGPathByteStream> create()
+ {
+ return adoptPtr(new SVGPathByteStream);
+ }
+
+ typedef Vector<unsigned char> Data;
+ typedef Data::const_iterator DataIterator;
+
+ DataIterator begin() { return m_data.begin(); }
+ DataIterator end() { return m_data.end(); }
+ void append(unsigned char byte) { m_data.append(byte); }
+ void clear() { m_data.clear(); }
+ bool isEmpty() const { return !m_data.size(); }
+
+private:
+ SVGPathByteStream() { }
+ Data m_data;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathByteStream_h
diff --git a/WebCore/svg/SVGPathByteStreamBuilder.cpp b/WebCore/svg/SVGPathByteStreamBuilder.cpp
new file mode 100644
index 0000000..cf939f0
--- /dev/null
+++ b/WebCore/svg/SVGPathByteStreamBuilder.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathByteStreamBuilder.h"
+
+#include "SVGPathParser.h"
+#include "SVGPathSeg.h"
+#include "SVGPathStringSource.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+SVGPathByteStreamBuilder::SVGPathByteStreamBuilder()
+ : m_byteStream(0)
+{
+}
+
+void SVGPathByteStreamBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegMoveToRel : PathSegMoveToAbs);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegLineToRel : PathSegLineToAbs);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegLineToHorizontalRel : PathSegLineToHorizontalAbs);
+ writeFloat(x);
+}
+
+void SVGPathByteStreamBuilder::lineToVertical(float y, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegLineToVerticalRel : PathSegLineToVerticalAbs);
+ writeFloat(y);
+}
+
+void SVGPathByteStreamBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegCurveToCubicRel : PathSegCurveToCubicAbs);
+ writeFloatPoint(point1);
+ writeFloatPoint(point2);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegCurveToCubicSmoothRel : PathSegCurveToCubicSmoothAbs);
+ writeFloatPoint(point2);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegCurveToQuadraticRel : PathSegCurveToQuadraticAbs);
+ writeFloatPoint(point1);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegCurveToQuadraticSmoothRel : PathSegCurveToQuadraticSmoothAbs);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(mode == RelativeCoordinates ? PathSegArcRel : PathSegArcAbs);
+ writeFloat(r1);
+ writeFloat(r2);
+ writeFloat(angle);
+ writeFlag(largeArcFlag);
+ writeFlag(sweepFlag);
+ writeFloatPoint(targetPoint);
+}
+
+void SVGPathByteStreamBuilder::closePath()
+{
+ ASSERT(m_byteStream);
+ writeSegmentType(PathSegClosePath);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathByteStreamBuilder.h b/WebCore/svg/SVGPathByteStreamBuilder.h
new file mode 100644
index 0000000..c89856f
--- /dev/null
+++ b/WebCore/svg/SVGPathByteStreamBuilder.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathByteStreamBuilder_h
+#define SVGPathByteStreamBuilder_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "PlatformString.h"
+#include "SVGPathByteStream.h"
+#include "SVGPathConsumer.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathByteStreamBuilder : public SVGPathConsumer {
+public:
+ SVGPathByteStreamBuilder();
+
+ void setCurrentByteStream(SVGPathByteStream* byteStream) { m_byteStream = byteStream; }
+ virtual void incrementPathSegmentCount() { }
+ virtual bool continueConsuming() { return true; }
+ virtual void cleanup() { m_byteStream = 0; }
+
+private:
+ // Used in UnalteredParsing/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode);
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void closePath();
+
+private:
+ // Only used in UnalteredParsing mode.
+ virtual void lineToHorizontal(float, PathCoordinateMode);
+ virtual void lineToVertical(float, PathCoordinateMode);
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode);
+ virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode);
+
+private:
+ template<typename ByteType>
+ void writeType(const ByteType& type)
+ {
+ size_t typeSize = sizeof(ByteType);
+ for (size_t i = 0; i < typeSize; ++i)
+ m_byteStream->append(type.bytes[i]);
+ }
+
+ void writeFlag(bool value)
+ {
+ BoolByte data;
+ data.value = value;
+ writeType(data);
+ }
+
+ void writeFloat(float value)
+ {
+ FloatByte data;
+ data.value = value;
+ writeType(data);
+ }
+
+ void writeFloatPoint(const FloatPoint& point)
+ {
+ writeFloat(point.x());
+ writeFloat(point.y());
+ }
+
+ void writeSegmentType(unsigned short value)
+ {
+ UnsignedShortByte data;
+ data.value = value;
+ writeType(data);
+ }
+
+ SVGPathByteStream* m_byteStream;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathByteStreamBuilder_h
diff --git a/WebCore/svg/SVGPathByteStreamSource.cpp b/WebCore/svg/SVGPathByteStreamSource.cpp
new file mode 100644
index 0000000..e6a60e3
--- /dev/null
+++ b/WebCore/svg/SVGPathByteStreamSource.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathByteStreamSource.h"
+
+namespace WebCore {
+
+SVGPathByteStreamSource::SVGPathByteStreamSource(SVGPathByteStream* stream)
+ : m_stream(stream)
+{
+ ASSERT(stream);
+ m_streamCurrent = stream->begin();
+ m_streamEnd = stream->end();
+}
+
+SVGPathByteStreamSource::~SVGPathByteStreamSource()
+{
+}
+
+bool SVGPathByteStreamSource::hasMoreData() const
+{
+ return m_streamCurrent < m_streamEnd;
+}
+
+bool SVGPathByteStreamSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+{
+ pathSegType = static_cast<SVGPathSegType>(readSVGSegmentType());
+ return true;
+}
+
+SVGPathSegType SVGPathByteStreamSource::nextCommand(SVGPathSegType)
+{
+ return static_cast<SVGPathSegType>(readSVGSegmentType());
+}
+
+bool SVGPathByteStreamSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseLineToSegment(FloatPoint& targetPoint)
+{
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseLineToHorizontalSegment(float& x)
+{
+ x = readFloat();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseLineToVerticalSegment(float& y)
+{
+ y = readFloat();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ point1 = readFloatPoint();
+ point2 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ point2 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ point1 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ rx = readFloat();
+ ry = readFloat();
+ angle = readFloat();
+ largeArc = readFlag();
+ sweep = readFlag();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathByteStreamSource.h b/WebCore/svg/SVGPathByteStreamSource.h
new file mode 100644
index 0000000..2537ad2
--- /dev/null
+++ b/WebCore/svg/SVGPathByteStreamSource.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathByteStreamSource_h
+#define SVGPathByteStreamSource_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "SVGPathByteStream.h"
+#include "SVGPathSource.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathByteStreamSource : public SVGPathSource {
+public:
+ static PassOwnPtr<SVGPathByteStreamSource> create(SVGPathByteStream* stream)
+ {
+ return adoptPtr(new SVGPathByteStreamSource(stream));
+ }
+
+ virtual ~SVGPathByteStreamSource();
+
+ virtual bool hasMoreData() const;
+ virtual bool moveToNextToken() { return true; }
+ virtual bool parseSVGSegmentType(SVGPathSegType&);
+ virtual SVGPathSegType nextCommand(SVGPathSegType);
+
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
+private:
+ SVGPathByteStreamSource(SVGPathByteStream*);
+
+#if COMPILER(MSVC)
+#pragma warning(disable: 4701)
+#endif
+ template<typename DataType, typename ByteType>
+ DataType readType()
+ {
+ ByteType data;
+ size_t typeSize = sizeof(ByteType);
+
+ for (size_t i = 0; i < typeSize; ++i) {
+ ASSERT(m_streamCurrent < m_streamEnd);
+ data.bytes[i] = *m_streamCurrent;
+ ++m_streamCurrent;
+ }
+
+ return data.value;
+ }
+
+ bool readFlag()
+ {
+ return readType<bool, BoolByte>();
+ }
+
+ float readFloat()
+ {
+ return readType<float, FloatByte>();
+ }
+
+ unsigned short readSVGSegmentType()
+ {
+ return readType<unsigned short, UnsignedShortByte>();
+ }
+
+ FloatPoint readFloatPoint()
+ {
+ float x = readType<float, FloatByte>();
+ float y = readType<float, FloatByte>();
+ return FloatPoint(x, y);
+ }
+
+ SVGPathByteStream* m_stream;
+ SVGPathByteStream::DataIterator m_streamCurrent;
+ SVGPathByteStream::DataIterator m_streamEnd;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathByteStreamSource_h
diff --git a/WebCore/svg/SVGPathConsumer.h b/WebCore/svg/SVGPathConsumer.h
new file mode 100644
index 0000000..629c1bf
--- /dev/null
+++ b/WebCore/svg/SVGPathConsumer.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathConsumer_h
+#define SVGPathConsumer_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+enum PathCoordinateMode {
+ AbsoluteCoordinates,
+ RelativeCoordinates
+};
+
+enum PathParsingMode {
+ NormalizedParsing,
+ UnalteredParsing
+};
+
+class SVGPathConsumer : public Noncopyable {
+public:
+ virtual void incrementPathSegmentCount() = 0;
+ virtual bool continueConsuming() = 0;
+ virtual void cleanup() = 0;
+
+public:
+ // Used in UnalteredParisng/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) = 0;
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode) = 0;
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) = 0;
+ virtual void closePath() = 0;
+
+public:
+ // Only used in UnalteredParsing mode.
+ virtual void lineToHorizontal(float, PathCoordinateMode) = 0;
+ virtual void lineToVertical(float, PathCoordinateMode) = 0;
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) = 0;
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) = 0;
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) = 0;
+ virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) = 0;
+
+protected:
+ SVGPathConsumer() { }
+ virtual ~SVGPathConsumer() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathConsumer_h
diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp
index f6e7867..6d801fb 100644
--- a/WebCore/svg/SVGPathElement.cpp
+++ b/WebCore/svg/SVGPathElement.cpp
@@ -1,32 +1,33 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGPathElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGNames.h"
-#include "SVGParserUtilities.h"
+#include "SVGPathParserFactory.h"
#include "SVGPathSegArc.h"
#include "SVGPathSegClosePath.h"
#include "SVGPathSegCurvetoCubic.h"
@@ -37,6 +38,7 @@
#include "SVGPathSegLinetoHorizontal.h"
#include "SVGPathSegLinetoVertical.h"
#include "SVGPathSegList.h"
+#include "SVGPathSegListBuilder.h"
#include "SVGPathSegMoveto.h"
#include "SVGSVGElement.h"
@@ -67,9 +69,12 @@ FloatPoint SVGPathElement::getPointAtLength(float length)
return toPathData().pointAtLength(length, ok);
}
-unsigned long SVGPathElement::getPathSegAtLength(float length, ExceptionCode& ec)
+unsigned long SVGPathElement::getPathSegAtLength(float length)
{
- return pathSegList()->getPathSegAtLength(length, ec);
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ unsigned long pathSeg = 0;
+ factory->getSVGPathSegAtLengthFromSVGPathSegList(pathSegList(), length, pathSeg);
+ return pathSeg;
}
PassRefPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClosePath()
@@ -167,12 +172,13 @@ PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
return SVGPathSegCurvetoQuadraticSmoothRel::create(x, y);
}
-void SVGPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPathElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::dAttr) {
ExceptionCode ec;
pathSegList()->clear(ec);
- if (!pathSegListFromSVGData(pathSegList(), attr->value(), true))
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ if (!factory->buildSVGPathSegListFromString(attr->value(), pathSegList(), NormalizedParsing))
document()->accessSVGExtensions()->reportError("Problem parsing d=\"" + attr->value() + "\"");
} else if (attr->name() == SVGNames::pathLengthAttr) {
setPathLengthBaseValue(attr->value().toFloat());
@@ -193,15 +199,27 @@ void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
+ return;
+
+ if (attrName == SVGNames::dAttr) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
+ }
+
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
- if (attrName == SVGNames::dAttr || attrName == SVGNames::pathLengthAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (attrName == SVGNames::pathLengthAttr
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGPathElement::synchronizeProperty(const QualifiedName& attrName)
@@ -248,7 +266,10 @@ SVGPathSegList* SVGPathElement::animatedNormalizedPathSegList() const
Path SVGPathElement::toPathData() const
{
- return pathSegList()->toPathData();
+ Path result;
+ SVGPathParserFactory* factory = SVGPathParserFactory::self();
+ factory->buildPathFromSVGPathSegList(pathSegList(), result);
+ return result;
}
}
diff --git a/WebCore/svg/SVGPathElement.h b/WebCore/svg/SVGPathElement.h
index e46ed92..07612c6 100644
--- a/WebCore/svg/SVGPathElement.h
+++ b/WebCore/svg/SVGPathElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathElement_h
#define SVGPathElement_h
@@ -62,7 +62,7 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
float getTotalLength();
FloatPoint getPointAtLength(float distance);
- unsigned long getPathSegAtLength(float distance, ExceptionCode&);
+ unsigned long getPathSegAtLength(float distance);
static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath();
static PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y);
@@ -90,7 +90,7 @@ namespace WebCore {
virtual SVGPathSegList* animatedPathSegList() const;
virtual SVGPathSegList* animatedNormalizedPathSegList() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGPathElement.idl b/WebCore/svg/SVGPathElement.idl
index 9a389c8..1c1dca7 100644
--- a/WebCore/svg/SVGPathElement.idl
+++ b/WebCore/svg/SVGPathElement.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -37,8 +37,7 @@ module svg {
float getTotalLength();
SVGPoint getPointAtLength(in float distance);
- unsigned long getPathSegAtLength(in float distance)
- raises(DOMException, SVGException);
+ unsigned long getPathSegAtLength(in float distance);
SVGPathSegClosePath createSVGPathSegClosePath();
diff --git a/WebCore/svg/SVGPathParser.cpp b/WebCore/svg/SVGPathParser.cpp
new file mode 100644
index 0000000..66bd00f
--- /dev/null
+++ b/WebCore/svg/SVGPathParser.cpp
@@ -0,0 +1,492 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathParser.h"
+
+#include "AffineTransform.h"
+#include <wtf/MathExtras.h>
+
+static const float gOneOverThree = 1 / 3.f;
+
+namespace WebCore {
+
+SVGPathParser::SVGPathParser()
+ : m_consumer(0)
+{
+}
+
+SVGPathParser::~SVGPathParser()
+{
+}
+
+void SVGPathParser::parseClosePathSegment()
+{
+ // Reset m_currentPoint for the next path.
+ if (m_pathParsingMode == NormalizedParsing)
+ m_currentPoint = m_subPathPoint;
+ m_closePath = true;
+ m_consumer->closePath();
+}
+
+bool SVGPathParser::parseMoveToSegment()
+{
+ FloatPoint targetPoint;
+ if (!m_source->parseMoveToSegment(targetPoint))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ m_currentPoint += targetPoint;
+ else
+ m_currentPoint = targetPoint;
+ m_subPathPoint = m_currentPoint;
+ m_consumer->moveTo(m_currentPoint, m_closePath, AbsoluteCoordinates);
+ } else
+ m_consumer->moveTo(targetPoint, m_closePath, m_mode);
+ m_closePath = false;
+ return true;
+}
+
+bool SVGPathParser::parseLineToSegment()
+{
+ FloatPoint targetPoint;
+ if (!m_source->parseLineToSegment(targetPoint))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ m_currentPoint += targetPoint;
+ else
+ m_currentPoint = targetPoint;
+ m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
+ } else
+ m_consumer->lineTo(targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseLineToHorizontalSegment()
+{
+ float toX;
+ if (!m_source->parseLineToHorizontalSegment(toX))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ m_currentPoint.move(toX, 0);
+ else
+ m_currentPoint.setX(toX);
+ m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
+ } else
+ m_consumer->lineToHorizontal(toX, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseLineToVerticalSegment()
+{
+ float toY;
+ if (!m_source->parseLineToVerticalSegment(toY))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ m_currentPoint.move(0, toY);
+ else
+ m_currentPoint.setY(toY);
+ m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
+ } else
+ m_consumer->lineToVertical(toY, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseCurveToCubicSegment()
+{
+ FloatPoint point1;
+ FloatPoint point2;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToCubicSegment(point1, point2, targetPoint))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates) {
+ point1 += m_currentPoint;
+ point2 += m_currentPoint;
+ targetPoint += m_currentPoint;
+ }
+ m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
+
+ m_controlPoint = point2;
+ m_currentPoint = targetPoint;
+ } else
+ m_consumer->curveToCubic(point1, point2, targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseCurveToCubicSmoothSegment()
+{
+ FloatPoint point2;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToCubicSmoothSegment(point2, targetPoint))
+ return false;
+
+ if (m_lastCommand != PathSegCurveToCubicAbs
+ && m_lastCommand != PathSegCurveToCubicRel
+ && m_lastCommand != PathSegCurveToCubicSmoothAbs
+ && m_lastCommand != PathSegCurveToCubicSmoothRel)
+ m_controlPoint = m_currentPoint;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ FloatPoint point1 = m_currentPoint;
+ point1.scale(2, 2);
+ point1.move(-m_controlPoint.x(), -m_controlPoint.y());
+ if (m_mode == RelativeCoordinates) {
+ point2 += m_currentPoint;
+ targetPoint += m_currentPoint;
+ }
+
+ m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
+
+ m_controlPoint = point2;
+ m_currentPoint = targetPoint;
+ } else
+ m_consumer->curveToCubicSmooth(point2, targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseCurveToQuadraticSegment()
+{
+ FloatPoint point1;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToQuadraticSegment(point1, targetPoint))
+ return false;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ m_controlPoint = point1;
+ FloatPoint point1 = m_currentPoint;
+ point1.move(2 * m_controlPoint.x(), 2 * m_controlPoint.y());
+ FloatPoint point2(targetPoint.x() + 2 * m_controlPoint.x(), targetPoint.y() + 2 * m_controlPoint.y());
+ if (m_mode == RelativeCoordinates) {
+ point1.move(2 * m_currentPoint.x(), 2 * m_currentPoint.y());
+ point2.move(3 * m_currentPoint.x(), 3 * m_currentPoint.y());
+ targetPoint += m_currentPoint;
+ }
+ point1.scale(gOneOverThree, gOneOverThree);
+ point2.scale(gOneOverThree, gOneOverThree);
+
+ m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
+
+ if (m_mode == RelativeCoordinates)
+ m_controlPoint += m_currentPoint;
+ m_currentPoint = targetPoint;
+ } else
+ m_consumer->curveToQuadratic(point1, targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
+{
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToQuadraticSmoothSegment(targetPoint))
+ return false;
+
+ if (m_lastCommand != PathSegCurveToQuadraticAbs
+ && m_lastCommand != PathSegCurveToQuadraticRel
+ && m_lastCommand != PathSegCurveToQuadraticSmoothAbs
+ && m_lastCommand != PathSegCurveToQuadraticSmoothRel)
+ m_controlPoint = m_currentPoint;
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ FloatPoint cubicPoint = m_currentPoint;
+ cubicPoint.scale(2, 2);
+ cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y());
+ FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y() + 2 * cubicPoint.y());
+ FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2 * cubicPoint.y());
+ if (m_mode == RelativeCoordinates) {
+ point2 += m_currentPoint;
+ targetPoint += m_currentPoint;
+ }
+ point1.scale(gOneOverThree, gOneOverThree);
+ point2.scale(gOneOverThree, gOneOverThree);
+
+ m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
+
+ m_controlPoint = cubicPoint;
+ m_currentPoint = targetPoint;
+ } else
+ m_consumer->curveToQuadraticSmooth(targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parseArcToSegment()
+{
+ float rx;
+ float ry;
+ float angle;
+ bool largeArc;
+ bool sweep;
+ FloatPoint targetPoint;
+ if (!m_source->parseArcToSegment(rx, ry, angle, largeArc, sweep, targetPoint))
+ return false;
+
+ // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a "lineto") joining the endpoints.
+ // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters
+ rx = fabsf(rx);
+ ry = fabsf(ry);
+ if (!rx || !ry) {
+ if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ m_currentPoint += targetPoint;
+ else
+ m_currentPoint = targetPoint;
+ m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
+ } else
+ m_consumer->lineTo(targetPoint, m_mode);
+ return true;
+ }
+
+ if (m_pathParsingMode == NormalizedParsing) {
+ FloatPoint point1 = m_currentPoint;
+ if (m_mode == RelativeCoordinates)
+ targetPoint += m_currentPoint;
+ m_currentPoint = targetPoint;
+ return decomposeArcToCubic(angle, rx, ry, point1, targetPoint, largeArc, sweep);
+ }
+ m_consumer->arcTo(rx, ry, angle, largeArc, sweep, targetPoint, m_mode);
+ return true;
+}
+
+bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode)
+{
+ ASSERT(m_source);
+ ASSERT(m_consumer);
+
+ m_pathParsingMode = pathParsingMode;
+
+ m_controlPoint = FloatPoint();
+ m_currentPoint = FloatPoint();
+ m_subPathPoint = FloatPoint();
+ m_closePath = true;
+
+ // Skip any leading spaces.
+ if (!m_source->moveToNextToken())
+ return false;
+
+ SVGPathSegType command;
+ m_source->parseSVGSegmentType(command);
+ m_lastCommand = PathSegUnknown;
+
+ // Path must start with moveto.
+ if (command != PathSegMoveToAbs && command != PathSegMoveToRel)
+ return false;
+
+ while (true) {
+ // Skip spaces between command and first coordinate.
+ m_source->moveToNextToken();
+ m_mode = AbsoluteCoordinates;
+ switch (command) {
+ case PathSegMoveToRel:
+ m_mode = RelativeCoordinates;
+ case PathSegMoveToAbs:
+ if (!parseMoveToSegment())
+ return false;
+ break;
+ case PathSegLineToRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToAbs:
+ if (!parseLineToSegment())
+ return false;
+ break;
+ case PathSegLineToHorizontalRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToHorizontalAbs:
+ if (!parseLineToHorizontalSegment())
+ return false;
+ break;
+ case PathSegLineToVerticalRel:
+ m_mode = RelativeCoordinates;
+ case PathSegLineToVerticalAbs:
+ if (!parseLineToVerticalSegment())
+ return false;
+ break;
+ case PathSegClosePath:
+ parseClosePathSegment();
+ break;
+ case PathSegCurveToCubicRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToCubicAbs:
+ if (!parseCurveToCubicSegment())
+ return false;
+ break;
+ case PathSegCurveToCubicSmoothRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToCubicSmoothAbs:
+ if (!parseCurveToCubicSmoothSegment())
+ return false;
+ break;
+ case PathSegCurveToQuadraticRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToQuadraticAbs:
+ if (!parseCurveToQuadraticSegment())
+ return false;
+ break;
+ case PathSegCurveToQuadraticSmoothRel:
+ m_mode = RelativeCoordinates;
+ case PathSegCurveToQuadraticSmoothAbs:
+ if (!parseCurveToQuadraticSmoothSegment())
+ return false;
+ break;
+ case PathSegArcRel:
+ m_mode = RelativeCoordinates;
+ case PathSegArcAbs:
+ if (!parseArcToSegment())
+ return false;
+ break;
+ default:
+ return false;
+ }
+ if (!m_consumer->continueConsuming())
+ return true;
+
+ m_lastCommand = command;
+
+ if (!m_source->hasMoreData())
+ return true;
+
+ command = m_source->nextCommand(command);
+
+ if (m_lastCommand != PathSegCurveToCubicAbs
+ && m_lastCommand != PathSegCurveToCubicRel
+ && m_lastCommand != PathSegCurveToCubicSmoothAbs
+ && m_lastCommand != PathSegCurveToCubicSmoothRel
+ && m_lastCommand != PathSegCurveToQuadraticAbs
+ && m_lastCommand != PathSegCurveToQuadraticRel
+ && m_lastCommand != PathSegCurveToQuadraticSmoothAbs
+ && m_lastCommand != PathSegCurveToQuadraticSmoothRel)
+ m_controlPoint = m_currentPoint;
+
+ m_consumer->incrementPathSegmentCount();
+ }
+
+ return false;
+}
+
+void SVGPathParser::cleanup()
+{
+ ASSERT(m_source);
+ ASSERT(m_consumer);
+
+ m_consumer->cleanup();
+ m_source = 0;
+ m_consumer = 0;
+}
+
+// This works by converting the SVG arc to "simple" beziers.
+// Partly adapted from Niko's code in kdelibs/kdecore/svgicons.
+// See also SVG implementation notes: http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
+bool SVGPathParser::decomposeArcToCubic(float angle, float rx, float ry, FloatPoint& point1, FloatPoint& point2, bool largeArcFlag, bool sweepFlag)
+{
+ FloatSize midPointDistance = point1 - point2;
+ midPointDistance.scale(0.5f);
+
+ AffineTransform pointTransform;
+ pointTransform.rotate(-angle);
+
+ FloatPoint transformedMidPoint = pointTransform.mapPoint(FloatPoint(midPointDistance.width(), midPointDistance.height()));
+ float squareRx = rx * rx;
+ float squareRy = ry * ry;
+ float squareX = transformedMidPoint.x() * transformedMidPoint.x();
+ float squareY = transformedMidPoint.y() * transformedMidPoint.y();
+
+ // Check if the radii are big enough to draw the arc, scale radii if not.
+ // http://www.w3.org/TR/SVG/implnote.html#ArcCorrectionOutOfRangeRadii
+ float radiiScale = squareX / squareRx + squareY / squareRy;
+ if (radiiScale > 1) {
+ rx *= sqrtf(radiiScale);
+ ry *= sqrtf(radiiScale);
+ }
+
+ pointTransform.makeIdentity();
+ pointTransform.scale(1 / rx, 1 / ry);
+ pointTransform.rotate(-angle);
+
+ point1 = pointTransform.mapPoint(point1);
+ point2 = pointTransform.mapPoint(point2);
+ FloatSize delta = point2 - point1;
+
+ float d = delta.width() * delta.width() + delta.height() * delta.height();
+ float scaleFactorSquared = std::max(1 / d - 0.25f, 0.f);
+
+ float scaleFactor = sqrtf(scaleFactorSquared);
+ if (sweepFlag == largeArcFlag)
+ scaleFactor = -scaleFactor;
+
+ delta.scale(scaleFactor);
+ FloatPoint centerPoint = FloatPoint(0.5f * (point1.x() + point2.x()) - delta.height(),
+ 0.5f * (point1.y() + point2.y()) + delta.width());
+
+ float theta1 = atan2f(point1.y() - centerPoint.y(), point1.x() - centerPoint.x());
+ float theta2 = atan2f(point2.y() - centerPoint.y(), point2.x() - centerPoint.x());
+
+ float thetaArc = theta2 - theta1;
+ if (thetaArc < 0 && sweepFlag)
+ thetaArc += 2 * piFloat;
+ else if (thetaArc > 0 && !sweepFlag)
+ thetaArc -= 2 * piFloat;
+
+ pointTransform.makeIdentity();
+ pointTransform.rotate(angle);
+ pointTransform.scale(rx, ry);
+
+ // Some results of atan2 on some platform implementations are not exact enough. So that we get more
+ // cubic curves than expected here. Adding 0.001f reduces the count of sgements to the correct count.
+ int segments = ceilf(fabsf(thetaArc / (piOverTwoFloat + 0.001f)));
+ for (int i = 0; i < segments; ++i) {
+ float startTheta = theta1 + i * thetaArc / segments;
+ float endTheta = theta1 + (i + 1) * thetaArc / segments;
+
+ float t = (8 / 6.f) * tanf(0.25f * (endTheta - startTheta));
+ if (!isfinite(t))
+ return false;
+ float sinStartTheta = sinf(startTheta);
+ float cosStartTheta = cosf(startTheta);
+ float sinEndTheta = sinf(endTheta);
+ float cosEndTheta = cosf(endTheta);
+
+ point1 = FloatPoint(cosStartTheta - t * sinStartTheta, sinStartTheta + t * cosStartTheta);
+ point1.move(centerPoint.x(), centerPoint.y());
+ FloatPoint targetPoint = FloatPoint(cosEndTheta, sinEndTheta);
+ targetPoint.move(centerPoint.x(), centerPoint.y());
+ point2 = targetPoint;
+ point2.move(t * sinEndTheta, -t * cosEndTheta);
+
+ m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform.mapPoint(point2),
+ pointTransform.mapPoint(targetPoint), AbsoluteCoordinates);
+ }
+ return true;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathParser.h b/WebCore/svg/SVGPathParser.h
new file mode 100644
index 0000000..5393fc2
--- /dev/null
+++ b/WebCore/svg/SVGPathParser.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathParser_h
+#define SVGPathParser_h
+
+#if ENABLE(SVG)
+#include "PlatformString.h"
+#include "SVGPathConsumer.h"
+#include "SVGPathSeg.h"
+#include "SVGPathSource.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathParser : public Noncopyable {
+public:
+ SVGPathParser();
+ ~SVGPathParser();
+
+ bool parsePathDataFromSource(PathParsingMode pathParsingMode);
+ void setCurrentConsumer(SVGPathConsumer* consumer) { m_consumer = consumer; }
+ void setCurrentSource(SVGPathSource* source) { m_source = source; }
+ void cleanup();
+
+private:
+ bool decomposeArcToCubic(float, float, float, FloatPoint&, FloatPoint&, bool largeArcFlag, bool sweepFlag);
+ void parseClosePathSegment();
+ bool parseMoveToSegment();
+ bool parseLineToSegment();
+ bool parseLineToHorizontalSegment();
+ bool parseLineToVerticalSegment();
+ bool parseCurveToCubicSegment();
+ bool parseCurveToCubicSmoothSegment();
+ bool parseCurveToQuadraticSegment();
+ bool parseCurveToQuadraticSmoothSegment();
+ bool parseArcToSegment();
+
+ SVGPathSource* m_source;
+ SVGPathConsumer* m_consumer;
+ PathCoordinateMode m_mode;
+ PathParsingMode m_pathParsingMode;
+ SVGPathSegType m_lastCommand;
+ bool m_closePath;
+ FloatPoint m_controlPoint;
+ FloatPoint m_currentPoint;
+ FloatPoint m_subPathPoint;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathParser_h
diff --git a/WebCore/svg/SVGPathParserFactory.cpp b/WebCore/svg/SVGPathParserFactory.cpp
new file mode 100644
index 0000000..b251ec4
--- /dev/null
+++ b/WebCore/svg/SVGPathParserFactory.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathParserFactory.h"
+
+#include "PathTraversalState.h"
+#include "SVGPathBlender.h"
+#include "SVGPathBuilder.h"
+#include "SVGPathByteStreamBuilder.h"
+#include "SVGPathByteStreamSource.h"
+#include "SVGPathParser.h"
+#include "SVGPathSegListBuilder.h"
+#include "SVGPathSegListSource.h"
+#include "SVGPathStringBuilder.h"
+#include "SVGPathStringSource.h"
+#include "SVGPathTraversalStateBuilder.h"
+#include "StringBuilder.h"
+
+namespace WebCore {
+
+static SVGPathBuilder* globalSVGPathBuilder(Path& result)
+{
+ static SVGPathBuilder* s_builder = 0;
+ if (!s_builder)
+ s_builder = new SVGPathBuilder;
+
+ s_builder->setCurrentPath(&result);
+ return s_builder;
+}
+
+static SVGPathSegListBuilder* globalSVGPathSegListBuilder(SVGPathSegList* result)
+{
+ static SVGPathSegListBuilder* s_builder = 0;
+ if (!s_builder)
+ s_builder = new SVGPathSegListBuilder;
+
+ s_builder->setCurrentSVGPathSegList(result);
+ return s_builder;
+}
+
+static SVGPathByteStreamBuilder* globalSVGPathByteStreamBuilder(SVGPathByteStream* result)
+{
+ static SVGPathByteStreamBuilder* s_builder = 0;
+ if (!s_builder)
+ s_builder = new SVGPathByteStreamBuilder;
+
+ s_builder->setCurrentByteStream(result);
+ return s_builder;
+}
+
+static SVGPathStringBuilder* globalSVGPathStringBuilder()
+{
+ static SVGPathStringBuilder* s_builder = 0;
+ if (!s_builder)
+ s_builder = new SVGPathStringBuilder;
+
+ return s_builder;
+}
+
+static SVGPathTraversalStateBuilder* globalSVGPathTraversalStateBuilder(PathTraversalState& traversalState, float length)
+{
+ static SVGPathTraversalStateBuilder* s_builder = 0;
+ if (!s_builder)
+ s_builder = new SVGPathTraversalStateBuilder;
+
+ s_builder->setCurrentTraversalState(&traversalState);
+ s_builder->setDesiredLength(length);
+ return s_builder;
+}
+
+static SVGPathParser* globalSVGPathParser(SVGPathSource* source, SVGPathConsumer* consumer)
+{
+ static SVGPathParser* s_parser = 0;
+ if (!s_parser)
+ s_parser = new SVGPathParser;
+
+ s_parser->setCurrentSource(source);
+ s_parser->setCurrentConsumer(consumer);
+ return s_parser;
+}
+
+static SVGPathBlender* globalSVGPathBlender()
+{
+ static SVGPathBlender* s_blender = 0;
+ if (!s_blender)
+ s_blender = new SVGPathBlender;
+
+ return s_blender;
+}
+
+SVGPathParserFactory* SVGPathParserFactory::self()
+{
+ static SVGPathParserFactory* s_instance = 0;
+ if (!s_instance)
+ s_instance = new SVGPathParserFactory;
+
+ return s_instance;
+}
+
+SVGPathParserFactory::SVGPathParserFactory()
+{
+}
+
+SVGPathParserFactory::~SVGPathParserFactory()
+{
+}
+
+bool SVGPathParserFactory::buildPathFromString(const String& d, Path& result)
+{
+ if (d.isEmpty())
+ return false;
+
+ SVGPathBuilder* builder = globalSVGPathBuilder(result);
+
+ OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(NormalizedParsing);
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildPathFromByteStream(SVGPathByteStream* stream, Path& result)
+{
+ ASSERT(stream);
+ if (stream->isEmpty())
+ return false;
+
+ SVGPathBuilder* builder = globalSVGPathBuilder(result);
+
+ OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(NormalizedParsing);
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildPathFromSVGPathSegList(SVGPathSegList* pathSegList, Path& result)
+{
+ ASSERT(pathSegList);
+ if (!pathSegList->numberOfItems())
+ return false;
+
+ SVGPathBuilder* builder = globalSVGPathBuilder(result);
+
+ OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(pathSegList);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(NormalizedParsing);
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildSVGPathSegListFromString(const String& d, SVGPathSegList* result, PathParsingMode parsingMode)
+{
+ ASSERT(result);
+ if (d.isEmpty())
+ return false;
+
+ SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(result);
+
+ OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(parsingMode);
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathSegList* result, PathParsingMode parsingMode)
+{
+ ASSERT(stream);
+ ASSERT(result);
+ if (stream->isEmpty())
+ return false;
+
+ SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(result);
+
+ OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(parsingMode);
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildStringFromByteStream(SVGPathByteStream* stream, String& result, PathParsingMode parsingMode)
+{
+ ASSERT(stream);
+ if (stream->isEmpty())
+ return false;
+
+ SVGPathStringBuilder* builder = globalSVGPathStringBuilder();
+
+ OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(parsingMode);
+ result = builder->result();
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildStringFromSVGPathSegList(SVGPathSegList* pathSegList, String& result, PathParsingMode parsingMode)
+{
+ ASSERT(pathSegList);
+ if (!pathSegList->numberOfItems())
+ return false;
+
+ SVGPathStringBuilder* builder = globalSVGPathStringBuilder();
+
+ OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(pathSegList);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(parsingMode);
+ result = builder->result();
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildSVGPathByteStreamFromString(const String& d, OwnPtr<SVGPathByteStream>& result, PathParsingMode parsingMode)
+{
+ if (d.isEmpty())
+ return false;
+
+ OwnPtr<SVGPathByteStream> stream = SVGPathByteStream::create();
+ SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(stream.get());
+
+ OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(parsingMode);
+ result = stream.release();
+ parser->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::buildAnimatedSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* toStream, OwnPtr<SVGPathByteStream>& result, float progress)
+{
+ ASSERT(fromStream);
+ ASSERT(toStream);
+ if (fromStream->isEmpty() || toStream->isEmpty())
+ return false;
+
+ OwnPtr<SVGPathByteStream> stream = SVGPathByteStream::create();
+ SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(stream.get());
+
+ OwnPtr<SVGPathByteStreamSource> fromSource = SVGPathByteStreamSource::create(fromStream);
+ OwnPtr<SVGPathByteStreamSource> toSource = SVGPathByteStreamSource::create(toStream);
+ SVGPathBlender* blender = globalSVGPathBlender();
+ bool ok = blender->blendAnimatedPath(progress, fromSource.get(), toSource.get(), builder);
+ result = stream.release();
+ blender->cleanup();
+ return ok;
+}
+
+bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathSegList(SVGPathSegList* pathSegList, float length, unsigned long& pathSeg)
+{
+ ASSERT(pathSegList);
+ if (!pathSegList->numberOfItems())
+ return false;
+
+ PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength);
+ SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length);
+
+ OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(pathSegList);
+ SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
+ bool ok = parser->parsePathDataFromSource(NormalizedParsing);
+ pathSeg = builder->pathSegmentIndex();
+ parser->cleanup();
+ return ok;
+}
+
+}
+
+#endif
diff --git a/WebCore/svg/SVGPathParserFactory.h b/WebCore/svg/SVGPathParserFactory.h
new file mode 100644
index 0000000..b8a2dd5
--- /dev/null
+++ b/WebCore/svg/SVGPathParserFactory.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathParserFactory_h
+#define SVGPathParserFactory_h
+
+#if ENABLE(SVG)
+#include "Path.h"
+#include "PlatformString.h"
+#include "SVGPathConsumer.h"
+#include "SVGPathSegList.h"
+#include "SVGPathByteStream.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathParserFactory {
+public:
+ static SVGPathParserFactory* self();
+
+ bool buildPathFromString(const String&, Path&);
+ bool buildPathFromByteStream(SVGPathByteStream*, Path&);
+ bool buildPathFromSVGPathSegList(SVGPathSegList*, Path&);
+
+ bool buildSVGPathSegListFromString(const String&, SVGPathSegList*, PathParsingMode);
+ bool buildSVGPathSegListFromByteStream(SVGPathByteStream*, SVGPathSegList*, PathParsingMode);
+
+ bool buildStringFromByteStream(SVGPathByteStream*, String&, PathParsingMode);
+ bool buildStringFromSVGPathSegList(SVGPathSegList*, String&, PathParsingMode);
+
+ bool buildSVGPathByteStreamFromString(const String&, OwnPtr<SVGPathByteStream>&, PathParsingMode);
+
+ bool buildAnimatedSVGPathByteStream(SVGPathByteStream*, SVGPathByteStream*, OwnPtr<SVGPathByteStream>&, float);
+
+ bool getSVGPathSegAtLengthFromSVGPathSegList(SVGPathSegList*, float, unsigned long&);
+
+private:
+ SVGPathParserFactory();
+ ~SVGPathParserFactory();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathParserFactory_h
diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.h b/WebCore/svg/SVGPathSeg.cpp
index 680b0fe..56ee56c 100644
--- a/WebCore/svg/graphics/SVGPaintServerSolid.h
+++ b/WebCore/svg/SVGPathSeg.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,51 +10,45 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SVGPaintServerSolid_h
-#define SVGPaintServerSolid_h
-
+#include "config.h"
#if ENABLE(SVG)
+#include "SVGPathSeg.h"
-#include "Color.h"
-#include "SVGPaintServer.h"
+#include "SVGNames.h"
namespace WebCore {
- class SVGPaintServerSolid : public SVGPaintServer {
- public:
- static PassRefPtr<SVGPaintServerSolid> create() { return adoptRef(new SVGPaintServerSolid); }
- virtual ~SVGPaintServerSolid();
-
- virtual SVGPaintServerType type() const { return SolidPaintServer; }
-
- Color color() const;
- void setColor(const Color&);
+SVGPathSeg::~SVGPathSeg()
+{
+}
- virtual TextStream& externalRepresentation(TextStream&) const;
+unsigned short SVGPathSeg::pathSegType() const
+{
+ return PATHSEG_UNKNOWN;
+}
- virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
+String SVGPathSeg::pathSegTypeAsLetter() const
+{
+ return "";
+}
- private:
- SVGPaintServerSolid();
-
- Color m_color;
- };
+const QualifiedName& SVGPathSeg::associatedAttributeName() const
+{
+ return SVGNames::dAttr;
+}
} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServerSolid_h
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSeg.h b/WebCore/svg/SVGPathSeg.h
index b88806c..6c4db89 100644
--- a/WebCore/svg/SVGPathSeg.h
+++ b/WebCore/svg/SVGPathSeg.h
@@ -1,91 +1,115 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSeg_h
#define SVGPathSeg_h
#if ENABLE(SVG)
-#include "PlatformString.h"
-#include "SVGNames.h"
-
+#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
- class SVGPathElement;
- class SVGStyledElement;
-
- class SVGPathSeg : public RefCounted<SVGPathSeg> {
- public:
- virtual ~SVGPathSeg() { }
-
- enum SVGPathSegType {
- PATHSEG_UNKNOWN = 0,
- PATHSEG_CLOSEPATH = 1,
- PATHSEG_MOVETO_ABS = 2,
- PATHSEG_MOVETO_REL = 3,
- PATHSEG_LINETO_ABS = 4,
- PATHSEG_LINETO_REL = 5,
- PATHSEG_CURVETO_CUBIC_ABS = 6,
- PATHSEG_CURVETO_CUBIC_REL = 7,
- PATHSEG_CURVETO_QUADRATIC_ABS = 8,
- PATHSEG_CURVETO_QUADRATIC_REL = 9,
- PATHSEG_ARC_ABS = 10,
- PATHSEG_ARC_REL = 11,
- PATHSEG_LINETO_HORIZONTAL_ABS = 12,
- PATHSEG_LINETO_HORIZONTAL_REL = 13,
- PATHSEG_LINETO_VERTICAL_ABS = 14,
- PATHSEG_LINETO_VERTICAL_REL = 15,
- PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16,
- PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17,
- PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18,
- PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19
- };
-
- virtual unsigned short pathSegType() const { return PATHSEG_UNKNOWN; }
- virtual String pathSegTypeAsLetter() const { return ""; }
- virtual String toString() const { return ""; }
-
- const QualifiedName& associatedAttributeName() const { return SVGNames::dAttr; }
-
- protected:
- SVGPathSeg() { }
+
+enum SVGPathSegType {
+ PathSegUnknown = 0,
+ PathSegClosePath = 1,
+ PathSegMoveToAbs = 2,
+ PathSegMoveToRel = 3,
+ PathSegLineToAbs = 4,
+ PathSegLineToRel = 5,
+ PathSegCurveToCubicAbs = 6,
+ PathSegCurveToCubicRel = 7,
+ PathSegCurveToQuadraticAbs = 8,
+ PathSegCurveToQuadraticRel = 9,
+ PathSegArcAbs = 10,
+ PathSegArcRel = 11,
+ PathSegLineToHorizontalAbs = 12,
+ PathSegLineToHorizontalRel = 13,
+ PathSegLineToVerticalAbs = 14,
+ PathSegLineToVerticalRel = 15,
+ PathSegCurveToCubicSmoothAbs = 16,
+ PathSegCurveToCubicSmoothRel = 17,
+ PathSegCurveToQuadraticSmoothAbs = 18,
+ PathSegCurveToQuadraticSmoothRel = 19
+};
+
+class SVGPathElement;
+class SVGStyledElement;
+class QualifiedName;
+
+class SVGPathSeg : public RefCounted<SVGPathSeg> {
+public:
+ virtual ~SVGPathSeg();
+
+ // Forward declare these enums in the w3c naming scheme, for IDL generation
+ enum {
+ PATHSEG_UNKNOWN = PathSegUnknown,
+ PATHSEG_CLOSEPATH = PathSegClosePath,
+ PATHSEG_MOVETO_ABS = PathSegMoveToAbs,
+ PATHSEG_MOVETO_REL = PathSegMoveToRel,
+ PATHSEG_LINETO_ABS = PathSegLineToAbs,
+ PATHSEG_LINETO_REL = PathSegLineToRel,
+ PATHSEG_CURVETO_CUBIC_ABS = PathSegCurveToCubicAbs,
+ PATHSEG_CURVETO_CUBIC_REL = PathSegCurveToCubicRel,
+ PATHSEG_CURVETO_QUADRATIC_ABS = PathSegCurveToQuadraticAbs,
+ PATHSEG_CURVETO_QUADRATIC_REL = PathSegCurveToQuadraticRel,
+ PATHSEG_ARC_ABS = PathSegArcAbs,
+ PATHSEG_ARC_REL = PathSegArcRel,
+ PATHSEG_LINETO_HORIZONTAL_ABS = PathSegLineToHorizontalAbs,
+ PATHSEG_LINETO_HORIZONTAL_REL = PathSegLineToHorizontalRel,
+ PATHSEG_LINETO_VERTICAL_ABS = PathSegLineToVerticalAbs,
+ PATHSEG_LINETO_VERTICAL_REL = PathSegLineToVerticalRel,
+ PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = PathSegCurveToCubicSmoothAbs,
+ PATHSEG_CURVETO_CUBIC_SMOOTH_REL = PathSegCurveToCubicSmoothRel,
+ PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = PathSegCurveToQuadraticSmoothAbs,
+ PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = PathSegCurveToQuadraticSmoothRel
};
- class SVGPathSegSingleCoord : public SVGPathSeg {
- public:
- SVGPathSegSingleCoord(float x, float y)
- : SVGPathSeg() , m_x(x) , m_y(y) {}
- void setX(float x) { m_x = x; }
- float x() const { return m_x; }
+ virtual unsigned short pathSegType() const;
+ virtual String pathSegTypeAsLetter() const;
- void setY(float y) { m_y = y; }
- float y() const { return m_y; }
+ const QualifiedName& associatedAttributeName() const;
+
+protected:
+ SVGPathSeg() { }
+};
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg", m_x, m_y); }
+class SVGPathSegSingleCoord : public SVGPathSeg {
+public:
+ SVGPathSegSingleCoord(float x, float y)
+ : m_x(x)
+ , m_y(y)
+ {
+ }
- private:
- float m_x;
- float m_y;
- };
+ void setX(float x) { m_x = x; }
+ float x() const { return m_x; }
+
+ void setY(float y) { m_y = y; }
+ float y() const { return m_y; }
+private:
+ float m_x;
+ float m_y;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGPathSeg.idl b/WebCore/svg/SVGPathSeg.idl
index afabb41..8641a48 100644
--- a/WebCore/svg/SVGPathSeg.idl
+++ b/WebCore/svg/SVGPathSeg.idl
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegArc.cpp b/WebCore/svg/SVGPathSegArc.cpp
index 5fb0243..f606905 100644
--- a/WebCore/svg/SVGPathSegArc.cpp
+++ b/WebCore/svg/SVGPathSegArc.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegArc.h b/WebCore/svg/SVGPathSegArc.h
index e1cbeb1..c7bbbb0 100644
--- a/WebCore/svg/SVGPathSegArc.h
+++ b/WebCore/svg/SVGPathSegArc.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegArc_h
#define SVGPathSegArc_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -30,9 +31,15 @@ namespace WebCore {
class SVGPathSegArc : public SVGPathSeg {
public:
SVGPathSegArc(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
- : m_x(x), m_y(y), m_r1(r1), m_r2(r2), m_angle(angle), m_largeArcFlag(largeArcFlag), m_sweepFlag(sweepFlag) {}
-
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", m_r1, m_r2, m_angle, m_largeArcFlag, m_sweepFlag, m_x, m_y); }
+ : m_x(x)
+ , m_y(y)
+ , m_r1(r1)
+ , m_r2(r2)
+ , m_angle(angle)
+ , m_largeArcFlag(largeArcFlag)
+ , m_sweepFlag(sweepFlag)
+ {
+ }
void setX(float x) { m_x = x; }
float x() const { return m_x; }
diff --git a/WebCore/svg/SVGPathSegArcAbs.idl b/WebCore/svg/SVGPathSegArcAbs.idl
index 5d9cf7c..bdc45a7 100644
--- a/WebCore/svg/SVGPathSegArcAbs.idl
+++ b/WebCore/svg/SVGPathSegArcAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegArcRel.idl b/WebCore/svg/SVGPathSegArcRel.idl
index b4b66ab..8b08d68 100644
--- a/WebCore/svg/SVGPathSegArcRel.idl
+++ b/WebCore/svg/SVGPathSegArcRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegClosePath.cpp b/WebCore/svg/SVGPathSegClosePath.cpp
index 1f58096..d3c8c3b 100644
--- a/WebCore/svg/SVGPathSegClosePath.cpp
+++ b/WebCore/svg/SVGPathSegClosePath.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegClosePath.h b/WebCore/svg/SVGPathSegClosePath.h
index 0e29bb3..635c970 100644
--- a/WebCore/svg/SVGPathSegClosePath.h
+++ b/WebCore/svg/SVGPathSegClosePath.h
@@ -1,47 +1,46 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegClosePath_h
#define SVGPathSegClosePath_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
- class SVGPathSegClosePath : public SVGPathSeg {
- public:
- static PassRefPtr<SVGPathSegClosePath> create() { return adoptRef(new SVGPathSegClosePath); }
- virtual ~SVGPathSegClosePath();
-
- virtual unsigned short pathSegType() const { return PATHSEG_CLOSEPATH; }
- virtual String pathSegTypeAsLetter() const { return "Z"; }
- virtual String toString() const { return "Z"; }
-
- private:
- SVGPathSegClosePath();
- };
+
+class SVGPathSegClosePath : public SVGPathSeg {
+public:
+ static PassRefPtr<SVGPathSegClosePath> create() { return adoptRef(new SVGPathSegClosePath); }
+ virtual ~SVGPathSegClosePath();
+
+ virtual unsigned short pathSegType() const { return PATHSEG_CLOSEPATH; }
+ virtual String pathSegTypeAsLetter() const { return "Z"; }
+
+private:
+ SVGPathSegClosePath();
+};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathSegClosePath.idl b/WebCore/svg/SVGPathSegClosePath.idl
index 4061a13..2bd6c61 100644
--- a/WebCore/svg/SVGPathSegClosePath.idl
+++ b/WebCore/svg/SVGPathSegClosePath.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoCubic.cpp b/WebCore/svg/SVGPathSegCurvetoCubic.cpp
index 6b87f55..33f2d96 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubic.cpp
+++ b/WebCore/svg/SVGPathSegCurvetoCubic.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegCurvetoCubic.h b/WebCore/svg/SVGPathSegCurvetoCubic.h
index 125b3a3..7e2735e 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubic.h
+++ b/WebCore/svg/SVGPathSegCurvetoCubic.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegCurvetoCubic_h
#define SVGPathSegCurvetoCubic_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -31,8 +32,6 @@ namespace WebCore {
public:
SVGPathSegCurvetoCubic(float x, float y, float x1, float y1, float x2, float y2) : SVGPathSeg() , m_x(x) , m_y(y) , m_x1(x1) , m_y1(y1) , m_x2(x2) , m_y2(y2) {}
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x2, m_y2, m_x, m_y); }
-
void setX(float x) { m_x = x; }
float x() const { return m_x; }
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl b/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl
index 79188ff..6b16809 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl
+++ b/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicRel.idl b/WebCore/svg/SVGPathSegCurvetoCubicRel.idl
index 89677db..be6606d 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicRel.idl
+++ b/WebCore/svg/SVGPathSegCurvetoCubicRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp b/WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp
index 97b256b..a7625e3 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp
+++ b/WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h b/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h
index db71dac..bc8895c 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h
+++ b/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegCurvetoCubicSmooth_h
#define SVGPathSegCurvetoCubicSmooth_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -32,8 +33,6 @@ namespace WebCore {
SVGPathSegCurvetoCubicSmooth(float x, float y, float x2, float y2)
: m_x(x), m_y(y), m_x2(x2), m_y2(y2) { }
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x2, m_y2, m_x, m_y); }
-
void setX(float x) { m_x = x; }
float x() const { return m_x; }
@@ -79,5 +78,3 @@ namespace WebCore {
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl b/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl
index 4768271..d31582e 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl
+++ b/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl b/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl
index c807621..2dd71f0 100644
--- a/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl
+++ b/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadratic.cpp b/WebCore/svg/SVGPathSegCurvetoQuadratic.cpp
index f3de513..bf2bb4d 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadratic.cpp
+++ b/WebCore/svg/SVGPathSegCurvetoQuadratic.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadratic.h b/WebCore/svg/SVGPathSegCurvetoQuadratic.h
index eb8b0d5..967442f 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadratic.h
+++ b/WebCore/svg/SVGPathSegCurvetoQuadratic.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegCurvetoQuadratic_h
#define SVGPathSegCurvetoQuadratic_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -32,8 +33,6 @@ namespace WebCore {
SVGPathSegCurvetoQuadratic(float x, float y, float x1, float y1)
: SVGPathSeg(), m_x(x), m_y(y), m_x1(x1), m_y1(y1) {}
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg %.6lg %.6lg %.6lg", m_x1, m_y1, m_x, m_y); }
-
void setX(float x) { m_x = x; }
float x() const { return m_x; }
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl b/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl
index b6da170..9b09222 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl b/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl
index 2404b67..01e1e6d 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp b/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp
index a64cbb6..6a7e9f7 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h b/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h
index 00eeec7..fb3d51f 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegCurvetoQuadraticSmooth_h
#define SVGPathSegCurvetoQuadraticSmooth_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl b/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl
index c47450b..4568538 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl b/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl
index 0cdff0e..5ffde79 100644
--- a/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl
+++ b/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLineto.cpp b/WebCore/svg/SVGPathSegLineto.cpp
index 9ad300e..746f2c1 100644
--- a/WebCore/svg/SVGPathSegLineto.cpp
+++ b/WebCore/svg/SVGPathSegLineto.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegLineto.h b/WebCore/svg/SVGPathSegLineto.h
index 500d5e4..9b69bf0 100644
--- a/WebCore/svg/SVGPathSegLineto.h
+++ b/WebCore/svg/SVGPathSegLineto.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegLineto_h
#define SVGPathSegLineto_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGPathSegLinetoAbs.idl b/WebCore/svg/SVGPathSegLinetoAbs.idl
index 3cb4e35..85dfca5 100644
--- a/WebCore/svg/SVGPathSegLinetoAbs.idl
+++ b/WebCore/svg/SVGPathSegLinetoAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLinetoHorizontal.cpp b/WebCore/svg/SVGPathSegLinetoHorizontal.cpp
index f217919..85f2896 100644
--- a/WebCore/svg/SVGPathSegLinetoHorizontal.cpp
+++ b/WebCore/svg/SVGPathSegLinetoHorizontal.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegLinetoHorizontal.h b/WebCore/svg/SVGPathSegLinetoHorizontal.h
index 87d6475..3a16ad1 100644
--- a/WebCore/svg/SVGPathSegLinetoHorizontal.h
+++ b/WebCore/svg/SVGPathSegLinetoHorizontal.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegLinetoHorizontal_h
#define SVGPathSegLinetoHorizontal_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -31,8 +32,6 @@ namespace WebCore {
public:
SVGPathSegLinetoHorizontal(float x) : SVGPathSeg(), m_x(x) {}
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg", m_x); }
-
void setX(float x) { m_x = x; }
float x() const { return m_x; }
diff --git a/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl b/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl
index 2a0aff5..eadb612 100644
--- a/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl
+++ b/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl b/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl
index 4fa03b4..91f537c 100644
--- a/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl
+++ b/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLinetoRel.idl b/WebCore/svg/SVGPathSegLinetoRel.idl
index 94f129d..51a8b5d 100644
--- a/WebCore/svg/SVGPathSegLinetoRel.idl
+++ b/WebCore/svg/SVGPathSegLinetoRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLinetoVertical.cpp b/WebCore/svg/SVGPathSegLinetoVertical.cpp
index 341ab02..ba02c9e 100644
--- a/WebCore/svg/SVGPathSegLinetoVertical.cpp
+++ b/WebCore/svg/SVGPathSegLinetoVertical.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegLinetoVertical.h b/WebCore/svg/SVGPathSegLinetoVertical.h
index 844f2f2..d4d9f85 100644
--- a/WebCore/svg/SVGPathSegLinetoVertical.h
+++ b/WebCore/svg/SVGPathSegLinetoVertical.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegLinetoVertical_h
#define SVGPathSegLinetoVertical_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
@@ -31,8 +32,6 @@ namespace WebCore {
public:
SVGPathSegLinetoVertical(float y) : SVGPathSeg(), m_y(y) {}
- virtual String toString() const { return pathSegTypeAsLetter() + String::format(" %.6lg", m_y); }
-
void setY(float y) { m_y = y; }
float y() const { return m_y; }
diff --git a/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl b/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl
index c2c59a5..b6ba7f1 100644
--- a/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl
+++ b/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegLinetoVerticalRel.idl b/WebCore/svg/SVGPathSegLinetoVerticalRel.idl
index bb8c3af..7246c7d 100644
--- a/WebCore/svg/SVGPathSegLinetoVerticalRel.idl
+++ b/WebCore/svg/SVGPathSegLinetoVerticalRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegList.cpp b/WebCore/svg/SVGPathSegList.cpp
index 11cad14..3b86f55 100644
--- a/WebCore/svg/SVGPathSegList.cpp
+++ b/WebCore/svg/SVGPathSegList.cpp
@@ -1,45 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGPathSegList.h"
-#include "FloatPoint.h"
-#include "Path.h"
-#include "PathTraversalState.h"
-#include "SVGPathSegArc.h"
-#include "SVGPathSegClosePath.h"
-#include "SVGPathSegMoveto.h"
-#include "SVGPathSegLineto.h"
-#include "SVGPathSegLinetoHorizontal.h"
-#include "SVGPathSegLinetoVertical.h"
-#include "SVGPathSegCurvetoCubic.h"
-#include "SVGPathSegCurvetoCubicSmooth.h"
-#include "SVGPathSegCurvetoQuadratic.h"
-#include "SVGPathSegCurvetoQuadraticSmooth.h"
-
namespace WebCore {
SVGPathSegList::SVGPathSegList(const QualifiedName& attributeName)
@@ -51,219 +36,6 @@ SVGPathSegList::~SVGPathSegList()
{
}
-unsigned SVGPathSegList::getPathSegAtLength(double, ExceptionCode& ec)
-{
- // FIXME : to be useful this will need to support non-normalized SVGPathSegLists
- int len = numberOfItems();
- // FIXME: Eventually this will likely move to a "path applier"-like model, until then PathTraversalState is less useful as we could just use locals
- PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength);
- for (int i = 0; i < len; ++i) {
- SVGPathSeg* segment = getItem(i, ec).get();
- if (ec)
- return 0;
- float segmentLength = 0;
- switch (segment->pathSegType()) {
- case SVGPathSeg::PATHSEG_MOVETO_ABS:
- {
- SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment);
- segmentLength = traversalState.moveTo(FloatPoint(moveTo->x(), moveTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_LINETO_ABS:
- {
- SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment);
- segmentLength = traversalState.lineTo(FloatPoint(lineTo->x(), lineTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
- {
- SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment);
- segmentLength = traversalState.cubicBezierTo(FloatPoint(curveTo->x1(), curveTo->y1()),
- FloatPoint(curveTo->x2(), curveTo->y2()),
- FloatPoint(curveTo->x(), curveTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_CLOSEPATH:
- segmentLength = traversalState.closeSubpath();
- break;
- default:
- ASSERT(false); // FIXME: This only works with normalized/processed path data.
- break;
- }
- traversalState.m_totalLength += segmentLength;
- if ((traversalState.m_action == PathTraversalState::TraversalSegmentAtLength)
- && (traversalState.m_totalLength > traversalState.m_desiredLength)) {
- return traversalState.m_segmentIndex;
- }
- traversalState.m_segmentIndex++;
- }
-
- return 0; // The SVG spec is unclear as to what to return when the distance is not on the path
-}
-
-Path SVGPathSegList::toPathData()
-{
- // FIXME : This should also support non-normalized PathSegLists
- Path pathData;
- int len = numberOfItems();
- ExceptionCode ec = 0;
- for (int i = 0; i < len; ++i) {
- SVGPathSeg* segment = getItem(i, ec).get();
- if (ec)
- return Path();
- switch (segment->pathSegType()) {
- case SVGPathSeg::PATHSEG_MOVETO_ABS:
- {
- SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment);
- pathData.moveTo(FloatPoint(moveTo->x(), moveTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_LINETO_ABS:
- {
- SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment);
- pathData.addLineTo(FloatPoint(lineTo->x(), lineTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
- {
- SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment);
- pathData.addBezierCurveTo(FloatPoint(curveTo->x1(), curveTo->y1()),
- FloatPoint(curveTo->x2(), curveTo->y2()),
- FloatPoint(curveTo->x(), curveTo->y()));
- break;
- }
- case SVGPathSeg::PATHSEG_CLOSEPATH:
- pathData.closeSubpath();
- break;
- default:
- ASSERT(false); // FIXME: This only works with normalized/processed path data.
- break;
- }
- }
-
- return pathData;
-}
-
-static inline float blendFunc(float from, float to, float progress)
-{
- return (to - from) * progress + from;
-}
-
-#define BLENDPATHSEG1(class, attr1) \
- class::create(blendFunc(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress))
-
-#define BLENDPATHSEG2(class, attr1, attr2) \
- class::create(blendFunc(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \
- blendFunc(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress))
-
-#define BLENDPATHSEG4(class, attr1, attr2, attr3, attr4) \
- class::create(blendFunc(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \
- blendFunc(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \
- blendFunc(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \
- blendFunc(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress))
-
-#define BLENDPATHSEG6(class, attr1, attr2, attr3, attr4, attr5, attr6) \
- class::create(blendFunc(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \
- blendFunc(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \
- blendFunc(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \
- blendFunc(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress), \
- blendFunc(static_cast<class*>(from)->attr5(), static_cast<class*>(to)->attr5(), progress), \
- blendFunc(static_cast<class*>(from)->attr6(), static_cast<class*>(to)->attr6(), progress))
-
-#define BLENDPATHSEG7(class, attr1, attr2, attr3, attr4, attr5, bool1, bool2) \
- class::create(blendFunc(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \
- blendFunc(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \
- blendFunc(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \
- blendFunc(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress), \
- blendFunc(static_cast<class*>(from)->attr5(), static_cast<class*>(to)->attr5(), progress), \
- static_cast<bool>(blendFunc(static_cast<class*>(from)->bool1(), static_cast<class*>(to)->bool1(), progress)), \
- static_cast<bool>(blendFunc(static_cast<class*>(from)->bool2(), static_cast<class*>(to)->bool2(), progress)))
-
-PassRefPtr<SVGPathSegList> SVGPathSegList::createAnimated(const SVGPathSegList* fromList, const SVGPathSegList* toList, float progress)
-{
- unsigned itemCount = fromList->numberOfItems();
- if (!itemCount || itemCount != toList->numberOfItems())
- return 0;
- RefPtr<SVGPathSegList> result = create(fromList->associatedAttributeName());
- ExceptionCode ec = 0;
- for (unsigned n = 0; n < itemCount; ++n) {
- SVGPathSeg* from = fromList->getItem(n, ec).get();
- if (ec)
- return 0;
- SVGPathSeg* to = toList->getItem(n, ec).get();
- if (ec)
- return 0;
- if (from->pathSegType() == SVGPathSeg::PATHSEG_UNKNOWN || from->pathSegType() != to->pathSegType())
- return 0;
- RefPtr<SVGPathSeg> segment = 0;
- switch (static_cast<SVGPathSeg::SVGPathSegType>(from->pathSegType())) {
- case SVGPathSeg::PATHSEG_CLOSEPATH:
- segment = SVGPathSegClosePath::create();
- break;
- case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
- segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalAbs, x);
- break;
- case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
- segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalRel, x);
- break;
- case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
- segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalAbs, y);
- break;
- case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
- segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalRel, y);
- break;
- case SVGPathSeg::PATHSEG_MOVETO_ABS:
- segment = BLENDPATHSEG2(SVGPathSegMovetoAbs, x, y);
- break;
- case SVGPathSeg::PATHSEG_MOVETO_REL:
- segment = BLENDPATHSEG2(SVGPathSegMovetoRel, x, y);
- break;
- case SVGPathSeg::PATHSEG_LINETO_ABS:
- segment = BLENDPATHSEG2(SVGPathSegLinetoAbs, x, y);
- break;
- case SVGPathSeg::PATHSEG_LINETO_REL:
- segment = BLENDPATHSEG2(SVGPathSegLinetoRel, x, y);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
- segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicAbs, x, y, x1, y1, x2, y2);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
- segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicRel, x, y, x1, y1, x2, y2);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
- segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothAbs, x, y, x2, y2);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
- segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothRel, x, y, x2, y2);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
- segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticAbs, x, y, x1, y1);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
- segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticRel, x, y, x1, y1);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
- segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothAbs, x, y);
- break;
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
- segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothRel, x, y);
- break;
- case SVGPathSeg::PATHSEG_ARC_ABS:
- segment = BLENDPATHSEG7(SVGPathSegArcAbs, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
- break;
- case SVGPathSeg::PATHSEG_ARC_REL:
- segment = BLENDPATHSEG7(SVGPathSegArcRel, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
- break;
- case SVGPathSeg::PATHSEG_UNKNOWN:
- ASSERT_NOT_REACHED();
- }
- result->appendItem(segment, ec);
- if (ec)
- return 0;
- }
- return result.release();
-}
-
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSegList.h b/WebCore/svg/SVGPathSegList.h
index d2999f0..f27c653 100644
--- a/WebCore/svg/SVGPathSegList.h
+++ b/WebCore/svg/SVGPathSegList.h
@@ -1,23 +1,21 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegList_h
#define SVGPathSegList_h
@@ -28,22 +26,16 @@
namespace WebCore {
- class Path;
- class SVGElement;
-
- class SVGPathSegList : public SVGList<RefPtr<SVGPathSeg> > {
- public:
- static PassRefPtr<SVGPathSegList> create(const QualifiedName& attributeName) { return adoptRef(new SVGPathSegList(attributeName)); }
- virtual ~SVGPathSegList();
-
- unsigned getPathSegAtLength(double, ExceptionCode&);
- Path toPathData();
-
- static PassRefPtr<SVGPathSegList> createAnimated(const SVGPathSegList* fromList, const SVGPathSegList* toList, float progress);
-
- private:
- SVGPathSegList(const QualifiedName&);
- };
+class SVGElement;
+
+class SVGPathSegList : public SVGList<RefPtr<SVGPathSeg> > {
+public:
+ static PassRefPtr<SVGPathSegList> create(const QualifiedName& attributeName) { return adoptRef(new SVGPathSegList(attributeName)); }
+ virtual ~SVGPathSegList();
+
+private:
+ SVGPathSegList(const QualifiedName&);
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGPathSegList.idl b/WebCore/svg/SVGPathSegList.idl
index 8c67bd3..1407b33 100644
--- a/WebCore/svg/SVGPathSegList.idl
+++ b/WebCore/svg/SVGPathSegList.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegListBuilder.cpp b/WebCore/svg/SVGPathSegListBuilder.cpp
new file mode 100644
index 0000000..342de88
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListBuilder.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathSegListBuilder.h"
+
+#include "ExceptionCode.h"
+#include "SVGPathElement.h"
+#include "SVGPathSegArc.h"
+#include "SVGPathSegClosePath.h"
+#include "SVGPathSegCurvetoCubic.h"
+#include "SVGPathSegCurvetoCubicSmooth.h"
+#include "SVGPathSegCurvetoQuadratic.h"
+#include "SVGPathSegCurvetoQuadraticSmooth.h"
+#include "SVGPathSegLineto.h"
+#include "SVGPathSegLinetoHorizontal.h"
+#include "SVGPathSegLinetoVertical.h"
+#include "SVGPathSegList.h"
+#include "SVGPathSegMoveto.h"
+
+namespace WebCore {
+
+SVGPathSegListBuilder::SVGPathSegListBuilder()
+ : m_pathSegList(0)
+{
+}
+
+void SVGPathSegListBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoAbs(targetPoint.x(), targetPoint.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoRel(targetPoint.x(), targetPoint.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoAbs(targetPoint.x(), targetPoint.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoRel(targetPoint.x(), targetPoint.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoHorizontalAbs(x), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoHorizontalRel(x), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoVerticalAbs(y), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoVerticalRel(y), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(targetPoint.x(), targetPoint.y(), point2.x(), point2.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(targetPoint.x(), targetPoint.y(), point2.x(), point2.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(targetPoint.x(), targetPoint.y()), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(targetPoint.x(), targetPoint.y()), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ if (mode == AbsoluteCoordinates)
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcAbs(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
+ else
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcRel(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
+ ASSERT(!ec);
+}
+
+void SVGPathSegListBuilder::closePath()
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ m_pathSegList->appendItem(SVGPathElement::createSVGPathSegClosePath(), ec);
+ ASSERT(!ec);
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSegListBuilder.h b/WebCore/svg/SVGPathSegListBuilder.h
new file mode 100644
index 0000000..2fd2667
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListBuilder.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathSegListBuilder_h
+#define SVGPathSegListBuilder_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "SVGPathConsumer.h"
+#include "SVGPathSegList.h"
+
+namespace WebCore {
+
+class SVGPathSegListBuilder : public SVGPathConsumer {
+public:
+ SVGPathSegListBuilder();
+
+ void setCurrentSVGPathSegList(SVGPathSegList* pathSegList) { m_pathSegList = pathSegList; }
+ virtual void incrementPathSegmentCount() { }
+ virtual bool continueConsuming() { return true; }
+ virtual void cleanup() { m_pathSegList = 0; }
+
+private:
+ // Used in UnalteredParisng/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode);
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void closePath();
+
+private:
+ // Only used in UnalteredParsing mode.
+ virtual void lineToHorizontal(float, PathCoordinateMode);
+ virtual void lineToVertical(float, PathCoordinateMode);
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode);
+ virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode);
+
+ SVGPathSegList* m_pathSegList;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathSegListBuilder_h
diff --git a/WebCore/svg/SVGPathSegListSource.cpp b/WebCore/svg/SVGPathSegListSource.cpp
new file mode 100644
index 0000000..48fa094
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListSource.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathSegListSource.h"
+
+#include "SVGPathSegArc.h"
+#include "SVGPathSegCurvetoCubic.h"
+#include "SVGPathSegCurvetoCubicSmooth.h"
+#include "SVGPathSegCurvetoQuadratic.h"
+#include "SVGPathSegLinetoHorizontal.h"
+#include "SVGPathSegLinetoVertical.h"
+
+namespace WebCore {
+
+SVGPathSegListSource::SVGPathSegListSource(SVGPathSegList* pathSegList)
+ : m_pathSegList(pathSegList)
+{
+ ASSERT(m_pathSegList);
+ m_itemCurrent = 0;
+ m_itemEnd = m_pathSegList->numberOfItems();
+}
+
+SVGPathSegListSource::~SVGPathSegListSource()
+{
+}
+
+bool SVGPathSegListSource::hasMoreData() const
+{
+ return m_itemCurrent < m_itemEnd;
+}
+
+bool SVGPathSegListSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ m_segment = m_pathSegList->getItem(m_itemCurrent, ec);
+ if (ec)
+ return false;
+ pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
+ ++m_itemCurrent;
+ return true;
+}
+
+SVGPathSegType SVGPathSegListSource::nextCommand(SVGPathSegType)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ m_segment = m_pathSegList->getItem(m_itemCurrent, ec);
+ if (ec)
+ return PathSegUnknown;
+ SVGPathSegType pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
+ ++m_itemCurrent;
+ return pathSegType;
+}
+
+bool SVGPathSegListSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegMoveToAbs || m_segment->pathSegType() == PathSegMoveToRel);
+ SVGPathSegSingleCoord* moveTo = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(moveTo->x(), moveTo->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToAbs || m_segment->pathSegType() == PathSegLineToRel);
+ SVGPathSegSingleCoord* lineTo = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(lineTo->x(), lineTo->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToHorizontalSegment(float& x)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToHorizontalAbs || m_segment->pathSegType() == PathSegLineToHorizontalRel);
+ SVGPathSegLinetoHorizontal* horizontal = static_cast<SVGPathSegLinetoHorizontal*>(m_segment.get());
+ x = horizontal->x();
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToVerticalSegment(float& y)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToVerticalAbs || m_segment->pathSegType() == PathSegLineToVerticalRel);
+ SVGPathSegLinetoVertical* vertical = static_cast<SVGPathSegLinetoVertical*>(m_segment.get());
+ y = vertical->y();
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToCubicAbs || m_segment->pathSegType() == PathSegCurveToCubicRel);
+ SVGPathSegCurvetoCubic* cubic = static_cast<SVGPathSegCurvetoCubic*>(m_segment.get());
+ point1 = FloatPoint(cubic->x1(), cubic->y1());
+ point2 = FloatPoint(cubic->x2(), cubic->y2());
+ targetPoint = FloatPoint(cubic->x(), cubic->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToCubicSmoothAbs || m_segment->pathSegType() == PathSegCurveToCubicSmoothRel);
+ SVGPathSegCurvetoCubicSmooth* cubicSmooth = static_cast<SVGPathSegCurvetoCubicSmooth*>(m_segment.get());
+ point2 = FloatPoint(cubicSmooth->x2(), cubicSmooth->y2());
+ targetPoint = FloatPoint(cubicSmooth->x(), cubicSmooth->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToQuadraticAbs || m_segment->pathSegType() == PathSegCurveToQuadraticRel);
+ SVGPathSegCurvetoQuadratic* quadratic = static_cast<SVGPathSegCurvetoQuadratic*>(m_segment.get());
+ point1 = FloatPoint(quadratic->x1(), quadratic->y1());
+ targetPoint = FloatPoint(quadratic->x(), quadratic->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToQuadraticSmoothAbs || m_segment->pathSegType() == PathSegCurveToQuadraticSmoothRel);
+ SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(quadraticSmooth->x(), quadraticSmooth->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegArcAbs || m_segment->pathSegType() == PathSegArcRel);
+ SVGPathSegArc* arcTo = static_cast<SVGPathSegArc*>(m_segment.get());
+ rx = arcTo->r1();
+ ry = arcTo->r2();
+ angle = arcTo->angle();
+ largeArc = arcTo->largeArcFlag();
+ sweep = arcTo->sweepFlag();
+ targetPoint = FloatPoint(arcTo->x(), arcTo->y());
+ return true;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSegListSource.h b/WebCore/svg/SVGPathSegListSource.h
new file mode 100644
index 0000000..fd89e3e
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListSource.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathSegListSource_h
+#define SVGPathSegListSource_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "SVGPathSeg.h"
+#include "SVGPathSegList.h"
+#include "SVGPathSource.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SVGPathSegListSource : public SVGPathSource {
+public:
+ static PassOwnPtr<SVGPathSegListSource> create(SVGPathSegList* pathSegList)
+ {
+ return adoptPtr(new SVGPathSegListSource(pathSegList));
+ }
+
+ virtual ~SVGPathSegListSource();
+
+ virtual bool hasMoreData() const;
+ virtual bool moveToNextToken() { return true; }
+ virtual bool parseSVGSegmentType(SVGPathSegType&);
+ virtual SVGPathSegType nextCommand(SVGPathSegType);
+
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
+private:
+ SVGPathSegListSource(SVGPathSegList*);
+
+ SVGPathSegList* m_pathSegList;
+ RefPtr<SVGPathSeg> m_segment;
+ int m_itemCurrent;
+ int m_itemEnd;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathSegListSource_h
diff --git a/WebCore/svg/SVGPathSegMoveto.cpp b/WebCore/svg/SVGPathSegMoveto.cpp
index 1144779..f87077f 100644
--- a/WebCore/svg/SVGPathSegMoveto.cpp
+++ b/WebCore/svg/SVGPathSegMoveto.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPathSegMoveto.h b/WebCore/svg/SVGPathSegMoveto.h
index 5d30633..194b1a6 100644
--- a/WebCore/svg/SVGPathSegMoveto.h
+++ b/WebCore/svg/SVGPathSegMoveto.h
@@ -1,28 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPathSegMoveto_h
#define SVGPathSegMoveto_h
#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGPathSeg.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGPathSegMovetoAbs.idl b/WebCore/svg/SVGPathSegMovetoAbs.idl
index 13ffde4..e10163e 100644
--- a/WebCore/svg/SVGPathSegMovetoAbs.idl
+++ b/WebCore/svg/SVGPathSegMovetoAbs.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSegMovetoRel.idl b/WebCore/svg/SVGPathSegMovetoRel.idl
index 3393d9e..78ba078 100644
--- a/WebCore/svg/SVGPathSegMovetoRel.idl
+++ b/WebCore/svg/SVGPathSegMovetoRel.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPathSource.h b/WebCore/svg/SVGPathSource.h
new file mode 100644
index 0000000..6d7ec5f
--- /dev/null
+++ b/WebCore/svg/SVGPathSource.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathSource_h
+#define SVGPathSource_h
+
+#if ENABLE(SVG)
+#include "SVGPathSeg.h"
+
+namespace WebCore {
+
+class SVGPathSource : public Noncopyable {
+public:
+ virtual ~SVGPathSource() { }
+
+ virtual bool hasMoreData() const = 0;
+ virtual bool moveToNextToken() = 0;
+ virtual bool parseSVGSegmentType(SVGPathSegType&) = 0;
+ virtual SVGPathSegType nextCommand(SVGPathSegType previousCommand) = 0;
+
+ virtual bool parseMoveToSegment(FloatPoint&) = 0;
+ virtual bool parseLineToSegment(FloatPoint&) = 0;
+ virtual bool parseLineToHorizontalSegment(float&) = 0;
+ virtual bool parseLineToVerticalSegment(float&) = 0;
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&) = 0;
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&) = 0;
+
+public:
+ SVGPathSource() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathSource_h
diff --git a/WebCore/svg/SVGPathStringBuilder.cpp b/WebCore/svg/SVGPathStringBuilder.cpp
new file mode 100644
index 0000000..0a166ad
--- /dev/null
+++ b/WebCore/svg/SVGPathStringBuilder.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathStringBuilder.h"
+
+namespace WebCore {
+
+SVGPathStringBuilder::SVGPathStringBuilder()
+{
+}
+
+void SVGPathStringBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("M %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("m %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("L %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("l %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("H %.6lg", x));
+ else
+ m_stringBuilder.append(String::format("h %.6lg", x));
+}
+
+void SVGPathStringBuilder::lineToVertical(float y, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("V %.6lg", y));
+ else
+ m_stringBuilder.append(String::format("v %.6lg", y));
+}
+
+void SVGPathStringBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("S %.6lg %.6lg %.6lg %.6lg", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("s %.6lg %.6lg %.6lg %.6lg", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("Q %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("q %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("T %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("t %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
+{
+ if (mode == AbsoluteCoordinates)
+ m_stringBuilder.append(String::format("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
+ else
+ m_stringBuilder.append(String::format("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
+}
+
+void SVGPathStringBuilder::closePath()
+{
+ m_stringBuilder.append("Z");
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathStringBuilder.h b/WebCore/svg/SVGPathStringBuilder.h
new file mode 100644
index 0000000..ebb8596
--- /dev/null
+++ b/WebCore/svg/SVGPathStringBuilder.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathStringBuilder_h
+#define SVGPathStringBuilder_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "SVGPathConsumer.h"
+#include "StringBuilder.h"
+
+namespace WebCore {
+
+class SVGPathStringBuilder : public SVGPathConsumer {
+public:
+ SVGPathStringBuilder();
+
+ virtual void cleanup() { m_stringBuilder.clear(); }
+ virtual void incrementPathSegmentCount() { }
+ virtual bool continueConsuming() { return true; }
+ String result() { return m_stringBuilder.toString(ConcatAddingSpacesBetweenIndividualStrings); }
+
+private:
+ // Used in UnalteredParsing/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode);
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void closePath();
+
+private:
+ // Only used in UnalteredParsing mode.
+ virtual void lineToHorizontal(float, PathCoordinateMode);
+ virtual void lineToVertical(float, PathCoordinateMode);
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode);
+ virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode);
+
+ StringBuilder m_stringBuilder;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathStringBuilder_h
diff --git a/WebCore/svg/SVGPathStringSource.cpp b/WebCore/svg/SVGPathStringSource.cpp
new file mode 100644
index 0000000..0efbfd0
--- /dev/null
+++ b/WebCore/svg/SVGPathStringSource.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathStringSource.h"
+
+#include "SVGParserUtilities.h"
+
+namespace WebCore {
+
+SVGPathStringSource::SVGPathStringSource(const String& string)
+ : m_string(string)
+ , m_current(string.characters())
+ , m_end(m_current + string.length())
+{
+ ASSERT(!string.isEmpty());
+}
+
+SVGPathStringSource::~SVGPathStringSource()
+{
+}
+
+bool SVGPathStringSource::hasMoreData() const
+{
+ return m_current < m_end;
+}
+
+bool SVGPathStringSource::moveToNextToken()
+{
+ return skipOptionalSpaces(m_current, m_end);
+}
+
+bool SVGPathStringSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+{
+ switch (*(m_current++)) {
+ case 'Z':
+ case 'z':
+ pathSegType = PathSegClosePath;
+ break;
+ case 'M':
+ pathSegType = PathSegMoveToAbs;
+ break;
+ case 'm':
+ pathSegType = PathSegMoveToRel;
+ break;
+ case 'L':
+ pathSegType = PathSegLineToAbs;
+ break;
+ case 'l':
+ pathSegType = PathSegLineToRel;
+ break;
+ case 'C':
+ pathSegType = PathSegCurveToCubicAbs;
+ break;
+ case 'c':
+ pathSegType = PathSegCurveToCubicRel;
+ break;
+ case 'Q':
+ pathSegType = PathSegCurveToQuadraticAbs;
+ break;
+ case 'q':
+ pathSegType = PathSegCurveToQuadraticRel;
+ break;
+ case 'A':
+ pathSegType = PathSegArcAbs;
+ break;
+ case 'a':
+ pathSegType = PathSegArcRel;
+ break;
+ case 'H':
+ pathSegType = PathSegLineToHorizontalAbs;
+ break;
+ case 'h':
+ pathSegType = PathSegLineToHorizontalRel;
+ break;
+ case 'V':
+ pathSegType = PathSegLineToVerticalAbs;
+ break;
+ case 'v':
+ pathSegType = PathSegLineToVerticalRel;
+ break;
+ case 'S':
+ pathSegType = PathSegCurveToCubicSmoothAbs;
+ break;
+ case 's':
+ pathSegType = PathSegCurveToCubicSmoothRel;
+ break;
+ case 'T':
+ pathSegType = PathSegCurveToQuadraticSmoothAbs;
+ break;
+ case 't':
+ pathSegType = PathSegCurveToQuadraticSmoothRel;
+ break;
+ default:
+ pathSegType = PathSegUnknown;
+ }
+ return true;
+}
+
+SVGPathSegType SVGPathStringSource::nextCommand(SVGPathSegType previousCommand)
+{
+ // Check for remaining coordinates in the current command.
+ if ((*m_current == '+' || *m_current == '-' || *m_current == '.' || (*m_current >= '0' && *m_current <= '9'))
+ && previousCommand != PathSegClosePath) {
+ if (previousCommand == PathSegMoveToAbs)
+ return PathSegLineToAbs;
+ if (previousCommand == PathSegMoveToRel)
+ return PathSegLineToRel;
+ return previousCommand;
+ }
+ SVGPathSegType nextCommand;
+ parseSVGSegmentType(nextCommand);
+ return nextCommand;
+}
+
+bool SVGPathStringSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX) || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseLineToSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX) || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseLineToHorizontalSegment(float& x)
+{
+ return parseNumber(m_current, m_end, x);
+}
+
+bool SVGPathStringSource::parseLineToVerticalSegment(float& y)
+{
+ return parseNumber(m_current, m_end, y);
+}
+
+bool SVGPathStringSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ float x1;
+ float y1;
+ float x2;
+ float y2;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x1)
+ || !parseNumber(m_current, m_end, y1)
+ || !parseNumber(m_current, m_end, x2)
+ || !parseNumber(m_current, m_end, y2)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point1 = FloatPoint(x1, y1);
+ point2 = FloatPoint(x2, y2);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToCubicSmoothSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ float x1;
+ float y1;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x1)
+ || !parseNumber(m_current, m_end, y1)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point1 = FloatPoint(x1, y1);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToQuadraticSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ float x2;
+ float y2;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x2)
+ || !parseNumber(m_current, m_end, y2)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point2 = FloatPoint(x2, y2);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, rx)
+ || !parseNumber(m_current, m_end, ry)
+ || !parseNumber(m_current, m_end, angle)
+ || !parseArcFlag(m_current, m_end, largeArc)
+ || !parseArcFlag(m_current, m_end, sweep)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathStringSource.h b/WebCore/svg/SVGPathStringSource.h
new file mode 100644
index 0000000..d0266f4
--- /dev/null
+++ b/WebCore/svg/SVGPathStringSource.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathStringSource_h
+#define SVGPathStringSource_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "PlatformString.h"
+#include "SVGPathSource.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathStringSource : public SVGPathSource {
+public:
+ static PassOwnPtr<SVGPathStringSource> create(const String& string)
+ {
+ return adoptPtr(new SVGPathStringSource(string));
+ }
+
+ virtual ~SVGPathStringSource();
+
+ virtual bool hasMoreData() const;
+ virtual bool moveToNextToken();
+ virtual bool parseSVGSegmentType(SVGPathSegType&);
+ virtual SVGPathSegType nextCommand(SVGPathSegType previousCommand);
+
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
+private:
+ SVGPathStringSource(const String&);
+ String m_string;
+
+ const UChar* m_current;
+ const UChar* m_end;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathStringSource_h
diff --git a/WebCore/svg/SVGPathTraversalStateBuilder.cpp b/WebCore/svg/SVGPathTraversalStateBuilder.cpp
new file mode 100644
index 0000000..a4ef2fb
--- /dev/null
+++ b/WebCore/svg/SVGPathTraversalStateBuilder.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathTraversalStateBuilder.h"
+
+namespace WebCore {
+
+SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder()
+ : m_traversalState(0)
+ , m_desiredLength(0)
+{
+}
+
+void SVGPathTraversalStateBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode)
+{
+ ASSERT(m_traversalState);
+ m_traversalState->m_totalLength += m_traversalState->moveTo(targetPoint);
+}
+
+void SVGPathTraversalStateBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode)
+{
+ ASSERT(m_traversalState);
+ m_traversalState->m_totalLength += m_traversalState->lineTo(targetPoint);
+}
+
+void SVGPathTraversalStateBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode)
+{
+ ASSERT(m_traversalState);
+ m_traversalState->m_totalLength += m_traversalState->cubicBezierTo(point1, point2, targetPoint);
+}
+
+void SVGPathTraversalStateBuilder::closePath()
+{
+ ASSERT(m_traversalState);
+ m_traversalState->m_totalLength += m_traversalState->closeSubpath();
+}
+
+void SVGPathTraversalStateBuilder::setDesiredLength(float desiredLength)
+{
+ ASSERT(m_traversalState);
+ m_traversalState->m_desiredLength = desiredLength;
+}
+
+bool SVGPathTraversalStateBuilder::continueConsuming()
+{
+ ASSERT(m_traversalState);
+ ASSERT(m_traversalState->m_action == PathTraversalState::TraversalSegmentAtLength);
+ return m_traversalState->m_totalLength < m_traversalState->m_desiredLength;
+}
+
+void SVGPathTraversalStateBuilder::incrementPathSegmentCount()
+{
+ ASSERT(m_traversalState);
+ ++m_traversalState->m_segmentIndex;
+}
+
+unsigned long SVGPathTraversalStateBuilder::pathSegmentIndex()
+{
+ ASSERT(m_traversalState);
+ return m_traversalState->m_segmentIndex;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathTraversalStateBuilder.h b/WebCore/svg/SVGPathTraversalStateBuilder.h
new file mode 100644
index 0000000..a5f3f79
--- /dev/null
+++ b/WebCore/svg/SVGPathTraversalStateBuilder.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathTraversalStateBuilder_h
+#define SVGPathTraversalStateBuilder_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "PathTraversalState.h"
+#include "SVGPathConsumer.h"
+
+namespace WebCore {
+
+class SVGPathTraversalStateBuilder : public SVGPathConsumer {
+public:
+ SVGPathTraversalStateBuilder();
+
+ unsigned long pathSegmentIndex();
+ void setCurrentTraversalState(PathTraversalState* traversalState) { m_traversalState = traversalState; }
+ void setDesiredLength(float);
+ virtual void incrementPathSegmentCount();
+ virtual bool continueConsuming();
+ virtual void cleanup() { m_traversalState = 0; }
+
+private:
+ // Used in UnalteredParisng/NormalizedParsing modes.
+ virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode);
+ virtual void lineTo(const FloatPoint&, PathCoordinateMode);
+ virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode);
+ virtual void closePath();
+
+private:
+ // Not used for PathTraversalState.
+ virtual void lineToHorizontal(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void lineToVertical(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+ virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+
+ PathTraversalState* m_traversalState;
+ float m_desiredLength;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathTraversalStateBuilder_h
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index 7659afa..94d3572 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -1,22 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,16 +25,16 @@
#include "SVGPatternElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatConversion.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
-#include "MappedAttribute.h"
#include "PatternAttributes.h"
#include "RenderSVGContainer.h"
+#include "RenderSVGResourcePattern.h"
#include "SVGLength.h"
#include "SVGNames.h"
-#include "SVGPaintServerPattern.h"
#include "SVGRenderSupport.h"
#include "SVGSVGElement.h"
#include "SVGStyledTransformableElement.h"
@@ -69,7 +70,7 @@ SVGPatternElement::~SVGPatternElement()
{
}
-void SVGPatternElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPatternElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::patternUnitsAttr) {
if (attr->value() == "userSpaceOnUse")
@@ -119,19 +120,30 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledElement::svgAttributeChanged(attrName);
- if (!m_resource)
+ bool invalidateClients = false;
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr) {
+ invalidateClients = true;
+ updateRelativeLengthsInformation();
+ }
+
+ RenderObject* object = renderer();
+ if (!object)
return;
- if (attrName == SVGNames::patternUnitsAttr || attrName == SVGNames::patternContentUnitsAttr ||
- attrName == SVGNames::patternTransformAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
- SVGURIReference::isKnownAttribute(attrName) ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGFitToViewBox::isKnownAttribute(attrName) ||
- SVGStyledElement::isKnownAttribute(attrName))
- m_resource->invalidate();
+ if (invalidateClients
+ || attrName == SVGNames::patternUnitsAttr
+ || attrName == SVGNames::patternContentUnitsAttr
+ || attrName == SVGNames::patternTransformAttr
+ || SVGURIReference::isKnownAttribute(attrName)
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName)
+ || SVGFitToViewBox::isKnownAttribute(attrName)
+ || SVGStyledElement::isKnownAttribute(attrName))
+ object->setNeedsLayout(true);
}
void SVGPatternElement::synchronizeProperty(const QualifiedName& attrName)
@@ -180,126 +192,16 @@ void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange
{
SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- if (!m_resource)
+ if (changedByParser)
return;
- m_resource->invalidate();
-}
-
-void SVGPatternElement::buildPattern(const FloatRect& targetRect) const
-{
- PatternAttributes attributes = collectPatternProperties();
-
- // If we didn't find any pattern content, ignore the request.
- if (!attributes.patternContentElement() || !renderer() || !renderer()->style())
- return;
-
- FloatRect patternBoundaries;
- FloatRect patternContentBoundaries;
-
- // Determine specified pattern size
- if (attributes.boundingBoxMode())
- patternBoundaries = FloatRect(attributes.x().valueAsPercentage() * targetRect.width(),
- attributes.y().valueAsPercentage() * targetRect.height(),
- attributes.width().valueAsPercentage() * targetRect.width(),
- attributes.height().valueAsPercentage() * targetRect.height());
- else
- patternBoundaries = FloatRect(attributes.x().value(this),
- attributes.y().value(this),
- attributes.width().value(this),
- attributes.height().value(this));
-
- IntSize patternSize(patternBoundaries.width(), patternBoundaries.height());
- clampImageBufferSizeToViewport(document()->view(), patternSize);
-
- if (patternSize.width() < static_cast<int>(patternBoundaries.width()))
- patternBoundaries.setWidth(patternSize.width());
-
- if (patternSize.height() < static_cast<int>(patternBoundaries.height()))
- patternBoundaries.setHeight(patternSize.height());
-
- // Eventually calculate the pattern content boundaries (only needed with overflow="visible").
- RenderStyle* style = renderer()->style();
- if (style->overflowX() == OVISIBLE && style->overflowY() == OVISIBLE) {
- for (Node* n = attributes.patternContentElement()->firstChild(); n; n = n->nextSibling()) {
- if (!n->isSVGElement() || !static_cast<SVGElement*>(n)->isStyledTransformable() || !n->renderer())
- continue;
- patternContentBoundaries.unite(n->renderer()->repaintRectInLocalCoordinates());
- }
- }
-
- AffineTransform viewBoxCTM = viewBoxToViewTransform(viewBox(), preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
- FloatRect patternBoundariesIncludingOverflow = patternBoundaries;
-
- // Apply objectBoundingBoxMode fixup for patternContentUnits, if viewBox is not set.
- if (!patternContentBoundaries.isEmpty()) {
- if (!viewBoxCTM.isIdentity())
- patternContentBoundaries = viewBoxCTM.mapRect(patternContentBoundaries);
- else if (attributes.boundingBoxModeContent())
- patternContentBoundaries = FloatRect(patternContentBoundaries.x() * targetRect.width(),
- patternContentBoundaries.y() * targetRect.height(),
- patternContentBoundaries.width() * targetRect.width(),
- patternContentBoundaries.height() * targetRect.height());
-
- patternBoundariesIncludingOverflow.unite(patternContentBoundaries);
- }
-
- IntSize imageSize(lroundf(patternBoundariesIncludingOverflow.width()), lroundf(patternBoundariesIncludingOverflow.height()));
- clampImageBufferSizeToViewport(document()->view(), imageSize);
-
- OwnPtr<ImageBuffer> patternImage = ImageBuffer::create(imageSize);
-
- if (!patternImage)
- return;
-
- GraphicsContext* context = patternImage->context();
- ASSERT(context);
-
- context->save();
-
- // Move to pattern start origin
- if (patternBoundariesIncludingOverflow.location() != patternBoundaries.location()) {
- context->translate(patternBoundaries.x() - patternBoundariesIncludingOverflow.x(),
- patternBoundaries.y() - patternBoundariesIncludingOverflow.y());
-
- patternBoundaries.setLocation(patternBoundariesIncludingOverflow.location());
- }
-
- // Process viewBox or boundingBoxModeContent correction
- if (!viewBoxCTM.isIdentity())
- context->concatCTM(viewBoxCTM);
- else if (attributes.boundingBoxModeContent()) {
- context->translate(targetRect.x(), targetRect.y());
- context->scale(FloatSize(targetRect.width(), targetRect.height()));
- }
-
- // Render subtree into ImageBuffer
- for (Node* n = attributes.patternContentElement()->firstChild(); n; n = n->nextSibling()) {
- if (!n->isSVGElement() || !static_cast<SVGElement*>(n)->isStyled() || !n->renderer())
- continue;
- renderSubtreeToImage(patternImage.get(), n->renderer());
- }
-
- context->restore();
-
- m_resource->setPatternTransform(attributes.patternTransform());
- m_resource->setPatternBoundaries(patternBoundaries);
- m_resource->setTile(patternImage.release());
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
}
RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- RenderSVGContainer* patternContainer = new (arena) RenderSVGContainer(this);
- patternContainer->setDrawsContents(false);
- return patternContainer;
-}
-
-SVGResource* SVGPatternElement::canvasResource(const RenderObject*)
-{
- if (!m_resource)
- m_resource = SVGPaintServerPattern::create(this);
-
- return m_resource.get();
+ return new (arena) RenderSVGResourcePattern(this);
}
PatternAttributes SVGPatternElement::collectPatternProperties() const
@@ -341,8 +243,10 @@ PatternAttributes SVGPatternElement::collectPatternProperties() const
current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode));
// Cycle detection
- if (processedPatterns.contains(current))
- return PatternAttributes();
+ if (processedPatterns.contains(current)) {
+ current = 0;
+ break;
+ }
} else
current = 0;
}
@@ -350,6 +254,14 @@ PatternAttributes SVGPatternElement::collectPatternProperties() const
return attributes;
}
+bool SVGPatternElement::selfHasRelativeLengths() const
+{
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h
index fffbbca..32ec808 100644
--- a/WebCore/svg/SVGPatternElement.h
+++ b/WebCore/svg/SVGPatternElement.h
@@ -1,32 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPatternElement_h
#define SVGPatternElement_h
#if ENABLE(SVG)
-#include "RenderObject.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGLangSpace.h"
-#include "SVGPaintServerPattern.h"
#include "SVGStyledElement.h"
#include "SVGTests.h"
#include "SVGTransformList.h"
@@ -49,16 +47,20 @@ namespace WebCore {
virtual ~SVGPatternElement();
virtual bool isValid() const { return SVGTests::isValid(); }
+ virtual bool needsPendingResourceHandling() const { return false; }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual SVGResource* canvasResource(const RenderObject*);
+
+ PatternAttributes collectPatternProperties() const;
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::yAttr, SVGLength, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::widthAttr, SVGLength, Width, width)
@@ -75,15 +77,7 @@ namespace WebCore {
// SVGPatternElement
DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
- DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
-
- mutable RefPtr<SVGPaintServerPattern> m_resource;
-
- private:
- friend class SVGPaintServerPattern;
- void buildPattern(const FloatRect& targetRect) const;
-
- PatternAttributes collectPatternProperties() const;
+ DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGPatternElement.idl b/WebCore/svg/SVGPatternElement.idl
index 8b380fb..59d6f8c 100644
--- a/WebCore/svg/SVGPatternElement.idl
+++ b/WebCore/svg/SVGPatternElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPoint.idl b/WebCore/svg/SVGPoint.idl
index 1bf96f8..e93baf1 100644
--- a/WebCore/svg/SVGPoint.idl
+++ b/WebCore/svg/SVGPoint.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGPointList.cpp b/WebCore/svg/SVGPointList.cpp
index 02a67ed..8a3d870 100644
--- a/WebCore/svg/SVGPointList.cpp
+++ b/WebCore/svg/SVGPointList.cpp
@@ -1,27 +1,28 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGPointList.h"
+#include "SVGPathSegList.h"
#include "PlatformString.h"
namespace WebCore {
@@ -53,6 +54,34 @@ String SVGPointList::valueAsString() const
return result;
}
+float inline adjustAnimatedValue(float from, float to, float progress)
+{
+ return (to - from) * progress + from;
+}
+
+PassRefPtr<SVGPointList> SVGPointList::createAnimated(const SVGPointList* fromList, const SVGPointList* toList, float progress)
+{
+ unsigned itemCount = fromList->numberOfItems();
+ if (!itemCount || itemCount != toList->numberOfItems())
+ return 0;
+ RefPtr<SVGPointList> result = create(fromList->associatedAttributeName());
+ ExceptionCode ec = 0;
+ for (unsigned n = 0; n < itemCount; ++n) {
+ FloatPoint from = fromList->getItem(n, ec);
+ if (ec)
+ return 0;
+ FloatPoint to = toList->getItem(n, ec);
+ if (ec)
+ return 0;
+ FloatPoint segment = FloatPoint(adjustAnimatedValue(from.x(), to.x(), progress),
+ adjustAnimatedValue(from.y(), to.y(), progress));
+ result->appendItem(segment, ec);
+ if (ec)
+ return 0;
+ }
+ return result.release();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPointList.h b/WebCore/svg/SVGPointList.h
index cc12366..853c7b1 100644
--- a/WebCore/svg/SVGPointList.h
+++ b/WebCore/svg/SVGPointList.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPointList_h
#define SVGPointList_h
@@ -24,12 +24,11 @@
#if ENABLE(SVG)
#include "SVGList.h"
#include "FloatPoint.h"
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
- class String;
-
class SVGPointList : public SVGPODList<FloatPoint> {
public:
static PassRefPtr<SVGPointList> create(const QualifiedName& attributeName) { return adoptRef(new SVGPointList(attributeName)); }
@@ -37,6 +36,8 @@ namespace WebCore {
String valueAsString() const;
+ static PassRefPtr<SVGPointList> createAnimated(const SVGPointList* fromList, const SVGPointList* toList, float progress);
+
private:
SVGPointList(const QualifiedName&);
};
diff --git a/WebCore/svg/SVGPointList.idl b/WebCore/svg/SVGPointList.idl
index 24b1042..647ae69 100644
--- a/WebCore/svg/SVGPointList.idl
+++ b/WebCore/svg/SVGPointList.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp
index 800bdfa..8475309 100644
--- a/WebCore/svg/SVGPolyElement.cpp
+++ b/WebCore/svg/SVGPolyElement.cpp
@@ -1,32 +1,33 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGPolyElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGPointList.h"
@@ -60,17 +61,15 @@ SVGPointList* SVGPolyElement::animatedPoints() const
return 0;
}
-void SVGPolyElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGPolyElement::parseMappedAttribute(Attribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::pointsAttr) {
ExceptionCode ec = 0;
points()->clear(ec);
- if (!pointsListFromSVGData(points(), value)) {
- points()->clear(ec);
+ if (!pointsListFromSVGData(points(), value))
document()->accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\"");
- }
} else {
if (SVGTests::parseMappedAttribute(attr))
return;
@@ -88,17 +87,28 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
// The points property is not a regular SVGAnimatedProperty, still we use the same SVG<->XML DOM synchronization framework.
if (attrName == SVGNames::pointsAttr)
- setSynchronizedSVGAttributes(false);
+ invalidateSVGAttributes();
+
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
+ return;
- if (!renderer())
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
+ }
+
+ if (attrName == SVGNames::pointsAttr) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
- if (attrName == SVGNames::pointsAttr
- || SVGTests::isKnownAttribute(attrName)
+ if (SVGTests::isKnownAttribute(attrName)
|| SVGLangSpace::isKnownAttribute(attrName)
- || SVGExternalResourcesRequired::isKnownAttribute(attrName)
- || SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGPolyElement::synchronizeProperty(const QualifiedName& attrName)
diff --git a/WebCore/svg/SVGPolyElement.h b/WebCore/svg/SVGPolyElement.h
index b881ca2..bbcdb67 100644
--- a/WebCore/svg/SVGPolyElement.h
+++ b/WebCore/svg/SVGPolyElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPolyElement_h
#define SVGPolyElement_h
@@ -44,11 +44,10 @@ namespace WebCore {
virtual SVGPointList* points() const;
virtual SVGPointList* animatedPoints() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual bool supportsMarkers() const { return true; }
private:
diff --git a/WebCore/svg/SVGPolygonElement.cpp b/WebCore/svg/SVGPolygonElement.cpp
index a4a62af..c7ab09b 100644
--- a/WebCore/svg/SVGPolygonElement.cpp
+++ b/WebCore/svg/SVGPolygonElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPolygonElement.h b/WebCore/svg/SVGPolygonElement.h
index fa6eef6..76b11a2 100644
--- a/WebCore/svg/SVGPolygonElement.h
+++ b/WebCore/svg/SVGPolygonElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPolygonElement_h
#define SVGPolygonElement_h
diff --git a/WebCore/svg/SVGPolygonElement.idl b/WebCore/svg/SVGPolygonElement.idl
index 1bb7806..e58ec38 100644
--- a/WebCore/svg/SVGPolygonElement.idl
+++ b/WebCore/svg/SVGPolygonElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPolylineElement.cpp b/WebCore/svg/SVGPolylineElement.cpp
index 899c072..a1dfcd6 100644
--- a/WebCore/svg/SVGPolylineElement.cpp
+++ b/WebCore/svg/SVGPolylineElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPolylineElement.h b/WebCore/svg/SVGPolylineElement.h
index e070c9f..fbdaa81 100644
--- a/WebCore/svg/SVGPolylineElement.h
+++ b/WebCore/svg/SVGPolylineElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPolylineElement_h
#define SVGPolylineElement_h
diff --git a/WebCore/svg/SVGPolylineElement.idl b/WebCore/svg/SVGPolylineElement.idl
index a77ef6d..e3f1cd7 100644
--- a/WebCore/svg/SVGPolylineElement.idl
+++ b/WebCore/svg/SVGPolylineElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGPreserveAspectRatio.cpp b/WebCore/svg/SVGPreserveAspectRatio.cpp
index 6853a14..00a7a65 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.cpp
+++ b/WebCore/svg/SVGPreserveAspectRatio.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- 2010 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h
index 8ee8d07..9ed27fe 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.h
+++ b/WebCore/svg/SVGPreserveAspectRatio.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPreserveAspectRatio_h
#define SVGPreserveAspectRatio_h
@@ -25,10 +25,10 @@
#include "FloatRect.h"
#include "PlatformString.h"
#include "SVGNames.h"
+#include <wtf/Forward.h>
namespace WebCore {
- class String;
class AffineTransform;
class SVGPreserveAspectRatio {
diff --git a/WebCore/svg/SVGPreserveAspectRatio.idl b/WebCore/svg/SVGPreserveAspectRatio.idl
index b21daba..7537e9b 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.idl
+++ b/WebCore/svg/SVGPreserveAspectRatio.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp
index b153c0f..4448c67 100644
--- a/WebCore/svg/SVGRadialGradientElement.cpp
+++ b/WebCore/svg/SVGRadialGradientElement.cpp
@@ -1,38 +1,38 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- 2008 Eric Seidel <eric@webkit.org>
- 2008 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGRadialGradientElement.h"
+#include "Attribute.h"
#include "FloatConversion.h"
#include "FloatPoint.h"
-#include "MappedAttribute.h"
#include "RadialGradientAttributes.h"
-#include "RenderObject.h"
+#include "RenderSVGResourceRadialGradient.h"
#include "SVGLength.h"
#include "SVGNames.h"
-#include "SVGPaintServerRadialGradient.h"
#include "SVGStopElement.h"
#include "SVGTransform.h"
#include "SVGTransformList.h"
@@ -55,7 +55,7 @@ SVGRadialGradientElement::~SVGRadialGradientElement()
{
}
-void SVGRadialGradientElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGRadialGradientElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::cxAttr)
setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -77,13 +77,19 @@ void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName
{
SVGGradientElement::svgAttributeChanged(attrName);
- if (!m_resource)
- return;
-
- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr ||
- attrName == SVGNames::fxAttr || attrName == SVGNames::fyAttr ||
- attrName == SVGNames::rAttr)
- m_resource->invalidate();
+ if (attrName == SVGNames::cxAttr
+ || attrName == SVGNames::cyAttr
+ || attrName == SVGNames::fxAttr
+ || attrName == SVGNames::fyAttr
+ || attrName == SVGNames::rAttr) {
+ updateRelativeLengthsInformation();
+
+ RenderObject* object = renderer();
+ if (!object)
+ return;
+
+ object->setNeedsLayout(true);
+ }
}
void SVGRadialGradientElement::synchronizeProperty(const QualifiedName& attrName)
@@ -111,77 +117,18 @@ void SVGRadialGradientElement::synchronizeProperty(const QualifiedName& attrName
synchronizeR();
}
-void SVGRadialGradientElement::buildGradient() const
+RenderObject* SVGRadialGradientElement::createRenderer(RenderArena* arena, RenderStyle*)
{
- RadialGradientAttributes attributes = collectGradientProperties();
-
- RefPtr<SVGPaintServerRadialGradient> radialGradient = WTF::static_pointer_cast<SVGPaintServerRadialGradient>(m_resource);
-
- FloatPoint focalPoint;
- FloatPoint centerPoint;
- float radius;
- if (attributes.boundingBoxMode()) {
- focalPoint = FloatPoint(attributes.fx().valueAsPercentage(), attributes.fy().valueAsPercentage());
- centerPoint = FloatPoint(attributes.cx().valueAsPercentage(), attributes.cy().valueAsPercentage());
- radius = attributes.r().valueAsPercentage();
- } else {
- focalPoint = FloatPoint(attributes.fx().value(this), attributes.fy().value(this));
- centerPoint = FloatPoint(attributes.cx().value(this), attributes.cy().value(this));
- radius = attributes.r().value(this);
- }
-
- FloatPoint adjustedFocalPoint = focalPoint;
- float dfx = focalPoint.x() - centerPoint.x();
- float dfy = focalPoint.y() - centerPoint.y();
- float rMax = 0.99f * radius;
-
- // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and
- // r, set (fx, fy) to the point of intersection of the line through
- // (fx, fy) and the circle.
- // We scale the radius by 0.99 to match the behavior of FireFox.
- if (sqrt(dfx * dfx + dfy * dfy) > rMax) {
- float angle = atan2f(dfy, dfx);
-
- dfx = cosf(angle) * rMax;
- dfy = sinf(angle) * rMax;
- adjustedFocalPoint = FloatPoint(dfx + centerPoint.x(), dfy + centerPoint.y());
- }
-
- RefPtr<Gradient> gradient = Gradient::create(
- adjustedFocalPoint,
- 0.f, // SVG does not support a "focus radius"
- centerPoint,
- radius);
- gradient->setSpreadMethod(attributes.spreadMethod());
-
- Vector<SVGGradientStop> stops = attributes.stops();
- float previousOffset = 0.0f;
- for (unsigned i = 0; i < stops.size(); ++i) {
- float offset = std::min(std::max(previousOffset, stops[i].first), 1.0f);
- previousOffset = offset;
- gradient->addColorStop(offset, stops[i].second);
- }
-
- radialGradient->setGradient(gradient);
-
- if (attributes.stops().isEmpty())
- return;
-
- radialGradient->setBoundingBoxMode(attributes.boundingBoxMode());
- radialGradient->setGradientTransform(attributes.gradientTransform());
- radialGradient->setGradientCenter(centerPoint);
- radialGradient->setGradientFocal(focalPoint);
- radialGradient->setGradientRadius(radius);
- radialGradient->setGradientStops(attributes.stops());
+ return new (arena) RenderSVGResourceRadialGradient(this);
}
-RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() const
+RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties()
{
RadialGradientAttributes attributes;
- HashSet<const SVGGradientElement*> processedGradients;
+ HashSet<SVGGradientElement*> processedGradients;
bool isRadial = true;
- const SVGGradientElement* current = this;
+ SVGGradientElement* current = this;
while (current) {
if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr))
@@ -194,13 +141,13 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c
attributes.setGradientTransform(current->gradientTransform()->consolidate().matrix());
if (!attributes.hasStops()) {
- const Vector<SVGGradientStop>& stops(current->buildStops());
+ const Vector<Gradient::ColorStop>& stops(current->buildStops());
if (!stops.isEmpty())
attributes.setStops(stops);
}
if (isRadial) {
- const SVGRadialGradientElement* radial = static_cast<const SVGRadialGradientElement*>(current);
+ SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElement*>(current);
if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr))
attributes.setCx(radial->cx());
@@ -223,13 +170,15 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c
// Respect xlink:href, take attributes from referenced element
Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href()));
if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refNode->hasTagName(SVGNames::linearGradientTag))) {
- current = static_cast<const SVGGradientElement*>(const_cast<const Node*>(refNode));
+ current = static_cast<SVGGradientElement*>(refNode);
// Cycle detection
- if (processedGradients.contains(current))
- return RadialGradientAttributes();
+ if (processedGradients.contains(current)) {
+ current = 0;
+ break;
+ }
- isRadial = current->gradientType() == RadialGradientPaintServer;
+ isRadial = current->hasTagName(SVGNames::radialGradientTag);
} else
current = 0;
}
@@ -243,6 +192,46 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c
return attributes;
}
+
+void SVGRadialGradientElement::calculateFocalCenterPointsAndRadius(const RadialGradientAttributes& attributes, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius)
+{
+ // Determine gradient focal/center points and radius
+ if (attributes.boundingBoxMode()) {
+ focalPoint = FloatPoint(attributes.fx().valueAsPercentage(), attributes.fy().valueAsPercentage());
+ centerPoint = FloatPoint(attributes.cx().valueAsPercentage(), attributes.cy().valueAsPercentage());
+ radius = attributes.r().valueAsPercentage();
+ } else {
+ focalPoint = FloatPoint(attributes.fx().value(this), attributes.fy().value(this));
+ centerPoint = FloatPoint(attributes.cx().value(this), attributes.cy().value(this));
+ radius = attributes.r().value(this);
+ }
+
+ // Eventually adjust focal points, as described below
+ float deltaX = focalPoint.x() - centerPoint.x();
+ float deltaY = focalPoint.y() - centerPoint.y();
+ float radiusMax = 0.99f * radius;
+
+ // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set
+ // (fx, fy) to the point of intersection of the line through (fx, fy) and the circle.
+ // We scale the radius by 0.99 to match the behavior of FireFox.
+ if (sqrt(deltaX * deltaX + deltaY * deltaY) > radiusMax) {
+ float angle = atan2f(deltaY, deltaX);
+
+ deltaX = cosf(angle) * radiusMax;
+ deltaY = sinf(angle) * radiusMax;
+ focalPoint = FloatPoint(deltaX + centerPoint.x(), deltaY + centerPoint.y());
+ }
+}
+
+bool SVGRadialGradientElement::selfHasRelativeLengths() const
+{
+ return cy().isRelative()
+ || cy().isRelative()
+ || r().isRelative()
+ || fx().isRelative()
+ || fy().isRelative();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h
index 180948f..2c3db56 100644
--- a/WebCore/svg/SVGRadialGradientElement.h
+++ b/WebCore/svg/SVGRadialGradientElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGRadialGradientElement_h
#define SVGRadialGradientElement_h
@@ -34,17 +34,18 @@ namespace WebCore {
SVGRadialGradientElement(const QualifiedName&, Document*);
virtual ~SVGRadialGradientElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- protected:
- virtual void buildGradient() const;
- virtual SVGPaintServerType gradientType() const { return RadialGradientPaintServer; }
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- RadialGradientAttributes collectGradientProperties() const;
+ RadialGradientAttributes collectGradientProperties();
+ void calculateFocalCenterPointsAndRadius(const RadialGradientAttributes&, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius);
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGRadialGradientElement, SVGNames::cxAttr, SVGLength, Cx, cx)
DECLARE_ANIMATED_PROPERTY(SVGRadialGradientElement, SVGNames::cyAttr, SVGLength, Cy, cy)
DECLARE_ANIMATED_PROPERTY(SVGRadialGradientElement, SVGNames::rAttr, SVGLength, R, r)
diff --git a/WebCore/svg/SVGRadialGradientElement.idl b/WebCore/svg/SVGRadialGradientElement.idl
index 032dda5..a10aa57 100644
--- a/WebCore/svg/SVGRadialGradientElement.idl
+++ b/WebCore/svg/SVGRadialGradientElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGRect.idl b/WebCore/svg/SVGRect.idl
index 0278030..2f8799c 100644
--- a/WebCore/svg/SVGRect.idl
+++ b/WebCore/svg/SVGRect.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp
index 014c42f..d5451e2 100644
--- a/WebCore/svg/SVGRectElement.cpp
+++ b/WebCore/svg/SVGRectElement.cpp
@@ -1,30 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGRectElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderPath.h"
+#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -48,7 +49,7 @@ SVGRectElement::~SVGRectElement()
{
}
-void SVGRectElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGRectElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -85,17 +86,36 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ bool isLengthAttribute = attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr
+ || attrName == SVGNames::heightAttr
+ || attrName == SVGNames::rxAttr
+ || attrName == SVGNames::ryAttr;
+
+ if (isLengthAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ if (!renderer)
return;
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
- attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGStyledTransformableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (isLengthAttribute) {
+ renderer->setNeedsPathUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
+
+ if (SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGRectElement::synchronizeProperty(const QualifiedName& attrName)
@@ -144,11 +164,14 @@ Path SVGRectElement::toPathData() const
return Path::createRectangle(rect);
}
-bool SVGRectElement::hasRelativeValues() const
+bool SVGRectElement::selfHasRelativeLengths() const
{
- return (x().isRelative() || width().isRelative() ||
- y().isRelative() || height().isRelative() ||
- rx().isRelative() || ry().isRelative());
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative()
+ || rx().isRelative()
+ || ry().isRelative();
}
}
diff --git a/WebCore/svg/SVGRectElement.h b/WebCore/svg/SVGRectElement.h
index df382f9..bc90919 100644
--- a/WebCore/svg/SVGRectElement.h
+++ b/WebCore/svg/SVGRectElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGRectElement_h
#define SVGRectElement_h
@@ -39,16 +39,15 @@ namespace WebCore {
virtual bool isValid() const { return SVGTests::isValid(); }
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual Path toPathData() const;
- protected:
- virtual bool hasRelativeValues() const;
-
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGRectElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGRectElement, SVGNames::yAttr, SVGLength, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGRectElement, SVGNames::widthAttr, SVGLength, Width, width)
diff --git a/WebCore/svg/SVGRectElement.idl b/WebCore/svg/SVGRectElement.idl
index 540ceb3..c7f8c7c 100644
--- a/WebCore/svg/SVGRectElement.idl
+++ b/WebCore/svg/SVGRectElement.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGRenderingIntent.h b/WebCore/svg/SVGRenderingIntent.h
index f4bfa6a..230258a 100644
--- a/WebCore/svg/SVGRenderingIntent.h
+++ b/WebCore/svg/SVGRenderingIntent.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGRenderingIntent_h
#define SVGRenderingIntent_h
diff --git a/WebCore/svg/SVGRenderingIntent.idl b/WebCore/svg/SVGRenderingIntent.idl
index ff2f6ce..47eaccc 100644
--- a/WebCore/svg/SVGRenderingIntent.idl
+++ b/WebCore/svg/SVGRenderingIntent.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp
index cfe1615..b7f9717 100644
--- a/WebCore/svg/SVGSVGElement.cpp
+++ b/WebCore/svg/SVGSVGElement.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
- 2007 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -25,6 +25,7 @@
#include "SVGSVGElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Document.h"
@@ -32,9 +33,9 @@
#include "EventNames.h"
#include "FloatConversion.h"
#include "FloatRect.h"
-#include "Frame.h"
+#include "FrameView.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
+#include "RenderSVGResource.h"
#include "RenderSVGRoot.h"
#include "RenderSVGViewportContainer.h"
#include "SMILTimeContainer.h"
@@ -187,22 +188,25 @@ SVGViewSpec* SVGSVGElement::currentView() const
float SVGSVGElement::currentScale() const
{
- if (document() && parentNode() == document())
- return document()->frame() ? document()->frame()->zoomFactor() : 1;
+ // Only the page zoom factor is relevant for SVG
+ if (FrameView* view = document()->view())
+ return view->pageZoomFactor();
return m_scale;
}
void SVGSVGElement::setCurrentScale(float scale)
{
- if (document() && parentNode() == document()) {
- if (document()->frame())
- document()->frame()->setZoomFactor(scale, true);
+ if (FrameView* view = document()->view()) {
+ // Calling setCurrentScale() on the outermost <svg> element in a standalone SVG document
+ // is allowed to change the page zoom factor, influencing the document size, scrollbars etc.
+ if (parentNode() == document())
+ view->setZoomFactor(scale, ZoomPage);
return;
}
m_scale = scale;
- if (renderer())
- renderer()->setNeedsLayout(true);
+ if (RenderObject* object = renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
}
FloatPoint SVGSVGElement::currentTranslate() const
@@ -213,11 +217,14 @@ FloatPoint SVGSVGElement::currentTranslate() const
void SVGSVGElement::setCurrentTranslate(const FloatPoint &translation)
{
m_translation = translation;
+ if (RenderObject* object = renderer())
+ object->setNeedsLayout(true);
+
if (parentNode() == document() && document()->renderer())
document()->renderer()->repaint();
}
-void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSVGElement::parseMappedAttribute(Attribute* attr)
{
if (!nearestViewportElement()) {
bool setListener = true;
@@ -279,7 +286,7 @@ static void updateCSSForAttribute(SVGSVGElement* element, const QualifiedName& a
Attribute* attribute = element->attributes(false)->getAttributeItem(attrName);
if (!attribute || !attribute->isMappedAttribute())
return;
- element->addCSSProperty(static_cast<MappedAttribute*>(attribute), property, value.valueAsString());
+ element->addCSSProperty(attribute, property, value.valueAsString());
}
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -291,22 +298,33 @@ void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
// Thus the CSS length value for width is not updated, and width() calcWidth()
// calculations on RenderSVGRoot will be wrong.
// https://bugs.webkit.org/show_bug.cgi?id=25387
- if (attrName == SVGNames::widthAttr)
+ bool updateRelativeLengths = false;
+ if (attrName == SVGNames::widthAttr) {
updateCSSForAttribute(this, attrName, CSSPropertyWidth, widthBaseValue());
- else if (attrName == SVGNames::heightAttr)
+ updateRelativeLengths = true;
+ } else if (attrName == SVGNames::heightAttr) {
updateCSSForAttribute(this, attrName, CSSPropertyHeight, heightBaseValue());
+ updateRelativeLengths = true;
+ }
+
+ if (updateRelativeLengths
+ || attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || SVGFitToViewBox::isKnownAttribute(attrName)) {
+ updateRelativeLengths = true;
+ updateRelativeLengthsInformation();
+ }
if (!renderer())
return;
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGLangSpace::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGFitToViewBox::isKnownAttribute(attrName) ||
- SVGZoomAndPan::isKnownAttribute(attrName) ||
- SVGStyledLocatableElement::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (updateRelativeLengths
+ || SVGTests::isKnownAttribute(attrName)
+ || SVGLangSpace::isKnownAttribute(attrName)
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName)
+ || SVGZoomAndPan::isKnownAttribute(attrName)
+ || SVGStyledLocatableElement::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
}
void SVGSVGElement::synchronizeProperty(const QualifiedName& attrName)
@@ -391,7 +409,8 @@ bool SVGSVGElement::checkEnclosure(SVGElement*, const FloatRect& rect)
void SVGSVGElement::deselectAll()
{
- document()->frame()->selection()->clear();
+ if (Frame* frame = document()->frame())
+ frame->selection()->clear();
}
float SVGSVGElement::createSVGNumber()
@@ -426,7 +445,7 @@ FloatRect SVGSVGElement::createSVGRect()
SVGTransform SVGSVGElement::createSVGTransform()
{
- return SVGTransform();
+ return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX);
}
SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const AffineTransform& matrix)
@@ -434,53 +453,37 @@ SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const AffineTransform&
return SVGTransform(matrix);
}
-AffineTransform SVGSVGElement::getCTM() const
-{
- AffineTransform mat;
- if (!isOutermostSVG())
- mat.translate(x().value(this), y().value(this));
-
- if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) {
- AffineTransform viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
- mat = viewBox * mat;
- }
-
- return mat;
-}
-
-AffineTransform SVGSVGElement::getScreenCTM() const
+AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const
{
- document()->updateLayoutIgnorePendingStylesheets();
- FloatPoint rootLocation;
+ AffineTransform viewBoxTransform;
+ if (attributes()->getAttributeItem(SVGNames::viewBoxAttr))
+ viewBoxTransform = viewBoxToViewTransform(width().value(this), height().value(this));
- if (RenderObject* renderer = this->renderer()) {
- if (isOutermostSVG()) {
+ AffineTransform transform;
+ if (!isOutermostSVG())
+ transform.translate(x().value(this), y().value(this));
+ else if (mode == SVGLocatable::ScreenScope) {
+ if (RenderObject* renderer = this->renderer()) {
+ // Translate in our CSS parent coordinate space
// FIXME: This doesn't work correctly with CSS transforms.
- FloatPoint point;
- if (renderer->parent())
- point = renderer->localToAbsolute(point, false, true);
- rootLocation.move(point.x(), point.y());
- } else
- rootLocation.move(x().value(this), y().value(this));
- }
-
- AffineTransform mat = SVGStyledLocatableElement::getScreenCTM();
- mat.translate(rootLocation.x(), rootLocation.y());
+ FloatPoint location = renderer->localToAbsolute(FloatPoint(), false, true);
- if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) {
- AffineTransform viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
- mat = viewBox * mat;
+ // Be careful here! localToAbsolute() includes the x/y offset coming from the viewBoxToViewTransform(), because
+ // RenderSVGRoot::localToBorderBoxTransform() (called through mapLocalToContainer(), called from localToAbsolute())
+ // also takes the viewBoxToViewTransform() into account, so we have to subtract it here (original cause of bug #27183)
+ transform.translate(location.x() - viewBoxTransform.e(), location.y() - viewBoxTransform.f());
+ }
}
- return mat;
+ return transform.multLeft(viewBoxTransform);
}
RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*)
{
if (isOutermostSVG())
return new (arena) RenderSVGRoot(this);
- else
- return new (arena) RenderSVGViewportContainer(this);
+
+ return new (arena) RenderSVGViewportContainer(this);
}
void SVGSVGElement::insertedIntoDocument()
@@ -522,10 +525,13 @@ void SVGSVGElement::setCurrentTime(float /* seconds */)
// FIXME: Implement me, bug 12073
}
-bool SVGSVGElement::hasRelativeValues() const
+bool SVGSVGElement::selfHasRelativeLengths() const
{
- return (x().isRelative() || width().isRelative() ||
- y().isRelative() || height().isRelative());
+ return x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative()
+ || hasAttribute(SVGNames::viewBoxAttr);
}
bool SVGSVGElement::isOutermostSVG() const
@@ -534,6 +540,12 @@ bool SVGSVGElement::isOutermostSVG() const
if (!parentNode())
return true;
+#if ENABLE(SVG_FOREIGN_OBJECT)
+ // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element.
+ if (parentNode()->hasTagName(SVGNames::foreignObjectTag))
+ return true;
+#endif
+
// This is true whenever this is the outermost SVG, even if there are HTML elements outside it
return !parentNode()->isSVGElement();
}
@@ -571,7 +583,9 @@ void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement)
if (viewElement->hasAttribute(SVGNames::zoomAndPanAttr))
currentView()->setZoomAndPan(viewElement->zoomAndPan());
- renderer()->setNeedsLayout(true);
+
+ if (RenderObject* object = renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
}
void SVGSVGElement::documentWillBecomeInactive()
@@ -584,8 +598,27 @@ void SVGSVGElement::documentDidBecomeActive()
unpauseAnimations();
}
+// getElementById on SVGSVGElement is restricted to only the child subtree defined by the <svg> element.
+// See http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement
+Element* SVGSVGElement::getElementById(const AtomicString& id) const
+{
+ Element* element = document()->getElementById(id);
+ if (element && element->isDescendantOf(this))
+ return element;
+
+ // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will
+ // be returned.
+ for (Node* node = traverseNextNode(this); node; node = node->traverseNextNode(this)) {
+ if (!node->isElementNode())
+ continue;
+
+ Element* element = static_cast<Element*>(node);
+ if (element->hasID() && element->getIdAttribute() == id)
+ return element;
+ }
+ return 0;
+}
+
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h
index dde6534..b7c9b16 100644
--- a/WebCore/svg/SVGSVGElement.h
+++ b/WebCore/svg/SVGSVGElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGSVGElement_h
#define SVGSVGElement_h
@@ -112,11 +112,7 @@ namespace WebCore {
static SVGTransform createSVGTransform();
static SVGTransform createSVGTransformFromMatrix(const AffineTransform&);
- virtual void parseMappedAttribute(MappedAttribute*);
-
- // 'virtual SVGLocatable' functions
- virtual AffineTransform getCTM() const;
- virtual AffineTransform getScreenCTM() const;
+ virtual void parseMappedAttribute(Attribute*);
virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
@@ -132,9 +128,12 @@ namespace WebCore {
void inheritViewAttributes(SVGViewElement*);
bool isOutermostSVG() const;
- virtual bool hasRelativeValues() const;
+
+ Element* getElementById(const AtomicString&) const;
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGSVGElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGSVGElement, SVGNames::yAttr, SVGLength, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGSVGElement, SVGNames::widthAttr, SVGLength, Width, width)
@@ -150,6 +149,8 @@ namespace WebCore {
virtual void documentWillBecomeInactive();
virtual void documentDidBecomeActive();
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
+
bool m_useCurrentView;
RefPtr<SMILTimeContainer> m_timeContainer;
FloatPoint m_translation;
diff --git a/WebCore/svg/SVGSVGElement.idl b/WebCore/svg/SVGSVGElement.idl
index 46a17b0..bcf9236 100644
--- a/WebCore/svg/SVGSVGElement.idl
+++ b/WebCore/svg/SVGSVGElement.idl
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2010 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
@@ -37,9 +37,9 @@ module svg {
readonly attribute SVGAnimatedLength y;
readonly attribute SVGAnimatedLength width;
readonly attribute SVGAnimatedLength height;
- attribute core::DOMString contentScriptType
+ attribute DOMString contentScriptType
/*setter raises(DOMException)*/;
- attribute core::DOMString contentStyleType
+ attribute DOMString contentStyleType
/*setter raises(DOMException)*/;
readonly attribute [Immutable] SVGRect viewport;
readonly attribute float pixelUnitToMillimeterX;
@@ -62,9 +62,9 @@ module svg {
boolean animationsPaused();
float getCurrentTime();
void setCurrentTime(in float seconds);
- core::NodeList getIntersectionList(in SVGRect rect,
+ NodeList getIntersectionList(in SVGRect rect,
in SVGElement referenceElement);
- core::NodeList getEnclosureList(in SVGRect rect,
+ NodeList getEnclosureList(in SVGRect rect,
in SVGElement referenceElement);
boolean checkIntersection(in SVGElement element,
in SVGRect rect);
@@ -80,6 +80,7 @@ module svg {
SVGRect createSVGRect();
SVGTransform createSVGTransform();
SVGTransform createSVGTransformFromMatrix(in SVGMatrix matrix);
+ Element getElementById(in DOMString elementId);
};
}
diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp
index 299ab8d..4109aad 100644
--- a/WebCore/svg/SVGScriptElement.cpp
+++ b/WebCore/svg/SVGScriptElement.cpp
@@ -1,32 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGScriptElement.h"
+#include "Attribute.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
namespace WebCore {
@@ -49,7 +49,7 @@ String SVGScriptElement::scriptContent() const
return m_data.scriptContent();
}
-void SVGScriptElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGScriptElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
@@ -194,6 +194,21 @@ String SVGScriptElement::forAttributeValue() const
return String();
}
+String SVGScriptElement::eventAttributeValue() const
+{
+ return String();
+}
+
+bool SVGScriptElement::asyncAttributeValue() const
+{
+ return false;
+}
+
+bool SVGScriptElement::deferAttributeValue() const
+{
+ return false;
+}
+
void SVGScriptElement::dispatchLoadEvent()
{
bool externalResourcesRequired = externalResourcesRequiredBaseValue();
@@ -227,6 +242,11 @@ void SVGScriptElement::dispatchErrorEvent()
dispatchEvent(Event::create(eventNames().errorEvent, true, false));
}
+bool SVGScriptElement::shouldExecuteAsJavaScript() const
+{
+ return m_data.shouldExecuteAsJavaScript();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h
index 396907c..8f2a393 100644
--- a/WebCore/svg/SVGScriptElement.h
+++ b/WebCore/svg/SVGScriptElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGScriptElement_h
#define SVGScriptElement_h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual String scriptContent() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
@@ -56,7 +56,7 @@ namespace WebCore {
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
- virtual bool shouldExecuteAsJavaScript() const { return false; }
+ virtual bool shouldExecuteAsJavaScript() const;
protected:
virtual bool haveLoadedRequiredResources();
@@ -66,6 +66,9 @@ namespace WebCore {
virtual String typeAttributeValue() const;
virtual String languageAttributeValue() const;
virtual String forAttributeValue() const;
+ virtual String eventAttributeValue() const;
+ virtual bool asyncAttributeValue() const;
+ virtual bool deferAttributeValue() const;
virtual void dispatchLoadEvent();
virtual void dispatchErrorEvent();
diff --git a/WebCore/svg/SVGScriptElement.idl b/WebCore/svg/SVGScriptElement.idl
index da2e034..2513238 100644
--- a/WebCore/svg/SVGScriptElement.idl
+++ b/WebCore/svg/SVGScriptElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGSetElement.cpp b/WebCore/svg/SVGSetElement.cpp
index a6e81b3..eceed12 100644
--- a/WebCore/svg/SVGSetElement.cpp
+++ b/WebCore/svg/SVGSetElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG_ANIMATION)
diff --git a/WebCore/svg/SVGSetElement.h b/WebCore/svg/SVGSetElement.h
index 7d0eced..975ad27 100644
--- a/WebCore/svg/SVGSetElement.h
+++ b/WebCore/svg/SVGSetElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGSetElement_h
#define SVGSetElement_h
diff --git a/WebCore/svg/SVGSetElement.idl b/WebCore/svg/SVGSetElement.idl
index 2ee36f1..6e806e7 100644
--- a/WebCore/svg/SVGSetElement.idl
+++ b/WebCore/svg/SVGSetElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp
index 3c97827..317774a 100644
--- a/WebCore/svg/SVGStopElement.cpp
+++ b/WebCore/svg/SVGStopElement.cpp
@@ -1,31 +1,32 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGStopElement.h"
+#include "Attribute.h"
#include "Document.h"
-#include "MappedAttribute.h"
#include "RenderSVGGradientStop.h"
+#include "RenderSVGResource.h"
#include "SVGGradientElement.h"
#include "SVGNames.h"
@@ -33,7 +34,7 @@ namespace WebCore {
SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document* doc)
: SVGStyledElement(tagName, doc)
- , m_offset(0.0f)
+ , m_offset(0)
{
}
@@ -41,7 +42,7 @@ SVGStopElement::~SVGStopElement()
{
}
-void SVGStopElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStopElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::offsetAttr) {
const String& value = attr->value();
@@ -49,12 +50,21 @@ void SVGStopElement::parseMappedAttribute(MappedAttribute* attr)
setOffsetBaseValue(value.left(value.length() - 1).toFloat() / 100.0f);
else
setOffsetBaseValue(value.toFloat());
-
- setNeedsStyleRecalc();
} else
SVGStyledElement::parseMappedAttribute(attr);
}
+void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::offsetAttr)
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
+}
+
void SVGStopElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledElement::synchronizeProperty(attrName);
@@ -68,6 +78,15 @@ RenderObject* SVGStopElement::createRenderer(RenderArena* arena, RenderStyle*)
return new (arena) RenderSVGGradientStop(this);
}
+Color SVGStopElement::stopColorIncludingOpacity() const
+{
+ ASSERT(renderer());
+ ASSERT(renderer()->style());
+
+ const SVGRenderStyle* svgStyle = renderer()->style()->svgStyle();
+ return colorWithOverrideAlpha(svgStyle->stopColor().rgb(), svgStyle->stopOpacity());
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGStopElement.h b/WebCore/svg/SVGStopElement.h
index 23c09bb..1fb60b5 100644
--- a/WebCore/svg/SVGStopElement.h
+++ b/WebCore/svg/SVGStopElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStopElement_h
#define SVGStopElement_h
@@ -32,13 +32,15 @@ namespace WebCore {
SVGStopElement(const QualifiedName&, Document*);
virtual ~SVGStopElement();
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
+ Color stopColorIncludingOpacity() const;
+
private:
virtual bool isGradientStop() const { return true; }
- virtual void parseMappedAttribute(MappedAttribute*);
-
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
DECLARE_ANIMATED_PROPERTY(SVGStopElement, SVGNames::offsetAttr, float, Offset, offset)
diff --git a/WebCore/svg/SVGStopElement.idl b/WebCore/svg/SVGStopElement.idl
index 2a16128..248f519 100644
--- a/WebCore/svg/SVGStopElement.idl
+++ b/WebCore/svg/SVGStopElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGStringList.cpp b/WebCore/svg/SVGStringList.cpp
index 70bfad8..806c70a 100644
--- a/WebCore/svg/SVGStringList.cpp
+++ b/WebCore/svg/SVGStringList.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGStringList.h b/WebCore/svg/SVGStringList.h
index 2fca6bc..bc234ff 100644
--- a/WebCore/svg/SVGStringList.h
+++ b/WebCore/svg/SVGStringList.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStringList_h
#define SVGStringList_h
diff --git a/WebCore/svg/SVGStringList.idl b/WebCore/svg/SVGStringList.idl
index 7bdd5ed..12eed8d 100644
--- a/WebCore/svg/SVGStringList.idl
+++ b/WebCore/svg/SVGStringList.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -29,19 +29,19 @@ module svg {
readonly attribute unsigned long numberOfItems;
void clear()
- raises(core::DOMException);
- core::DOMString initialize(in core::DOMString item)
- raises(core::DOMException, SVGException);
- core::DOMString getItem(in unsigned long index)
- raises(core::DOMException);
- core::DOMString insertItemBefore(in core::DOMString item, in unsigned long index)
- raises(core::DOMException, SVGException);
- core::DOMString replaceItem(in core::DOMString item, in unsigned long index)
- raises(core::DOMException, SVGException);
- core::DOMString removeItem(in unsigned long index)
- raises(core::DOMException);
- core::DOMString appendItem(in core::DOMString item)
- raises(core::DOMException, SVGException);
+ raises(DOMException);
+ DOMString initialize(in DOMString item)
+ raises(DOMException, SVGException);
+ DOMString getItem(in unsigned long index)
+ raises(DOMException);
+ DOMString insertItemBefore(in DOMString item, in unsigned long index)
+ raises(DOMException, SVGException);
+ DOMString replaceItem(in DOMString item, in unsigned long index)
+ raises(DOMException, SVGException);
+ DOMString removeItem(in unsigned long index)
+ raises(DOMException);
+ DOMString appendItem(in DOMString item)
+ raises(DOMException, SVGException);
};
}
diff --git a/WebCore/svg/SVGStylable.cpp b/WebCore/svg/SVGStylable.cpp
index c72843a..510467d 100644
--- a/WebCore/svg/SVGStylable.cpp
+++ b/WebCore/svg/SVGStylable.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGStylable.h b/WebCore/svg/SVGStylable.h
index 7e13d35..37148f9 100644
--- a/WebCore/svg/SVGStylable.h
+++ b/WebCore/svg/SVGStylable.h
@@ -1,34 +1,34 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStylable_h
#define SVGStylable_h
#if ENABLE(SVG)
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
class CSSValue;
class CSSStyleDeclaration;
- class String;
class QualifiedName;
class SVGStylable {
diff --git a/WebCore/svg/SVGStylable.idl b/WebCore/svg/SVGStylable.idl
index 2da2b77..0df1424 100644
--- a/WebCore/svg/SVGStylable.idl
+++ b/WebCore/svg/SVGStylable.idl
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
* Copyright (C) 2007 Rob Buis <rwlbuis@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -12,10 +12,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -29,9 +29,9 @@ module svg {
interface [Conditional=SVG, ObjCProtocol, OmitConstructor] SVGStylable {
readonly attribute SVGAnimatedString className;
- readonly attribute css::CSSStyleDeclaration style;
+ readonly attribute CSSStyleDeclaration style;
- css::CSSValue getPresentationAttribute(in core::DOMString name);
+ CSSValue getPresentationAttribute(in DOMString name);
};
}
diff --git a/WebCore/svg/SVGStyleElement.cpp b/WebCore/svg/SVGStyleElement.cpp
index 2a21670..bb50e67 100644
--- a/WebCore/svg/SVGStyleElement.cpp
+++ b/WebCore/svg/SVGStyleElement.cpp
@@ -1,45 +1,43 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Apple Computer, Inc.
- Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGStyleElement.h"
+#include "Attribute.h"
#include "CSSStyleSheet.h"
#include "Document.h"
#include "ExceptionCode.h"
-#include "MappedAttribute.h"
#include "SVGNames.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
-using namespace SVGNames;
-
-SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* doc, bool createdByParser)
- : SVGElement(tagName, doc)
- , SVGLangSpace()
- , m_createdByParser(createdByParser)
+SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser)
+ : SVGElement(tagName, document)
+ , SVGLangSpace()
+ , StyleElement(document, createdByParser)
{
}
@@ -77,7 +75,7 @@ void SVGStyleElement::setTitle(const AtomicString& title, ExceptionCode& ec)
setAttribute(SVGNames::titleAttr, title, ec);
}
-void SVGStyleElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyleElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::titleAttr && m_sheet)
m_sheet->setTitle(attr->value());
@@ -90,31 +88,26 @@ void SVGStyleElement::parseMappedAttribute(MappedAttribute* attr)
void SVGStyleElement::finishParsingChildren()
{
- StyleElement::sheet(this);
- m_createdByParser = false;
+ StyleElement::finishParsingChildren(this);
SVGElement::finishParsingChildren();
}
void SVGStyleElement::insertedIntoDocument()
{
SVGElement::insertedIntoDocument();
- document()->addStyleSheetCandidateNode(this, m_createdByParser);
- if (!m_createdByParser)
- StyleElement::insertedIntoDocument(document(), this);
+ StyleElement::insertedIntoDocument(document(), this);
}
void SVGStyleElement::removedFromDocument()
{
SVGElement::removedFromDocument();
- if (document()->renderer())
- document()->removeStyleSheetCandidateNode(this);
- StyleElement::removedFromDocument(document());
+ StyleElement::removedFromDocument(document(), this);
}
void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
+ StyleElement::childrenChanged(this);
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- StyleElement::process(this);
}
StyleSheet* SVGStyleElement::sheet()
@@ -122,13 +115,6 @@ StyleSheet* SVGStyleElement::sheet()
return StyleElement::sheet(this);
}
-bool SVGStyleElement::sheetLoaded()
-{
- document()->removePendingSheet();
- return true;
-}
-
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGStyleElement.h b/WebCore/svg/SVGStyleElement.h
index de37f5d..6385039 100644
--- a/WebCore/svg/SVGStyleElement.h
+++ b/WebCore/svg/SVGStyleElement.h
@@ -1,67 +1,62 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStyleElement_h
#define SVGStyleElement_h
-#if ENABLE(SVG)
-#include <SVGElement.h>
+#if ENABLE(SVG)
+#include "SVGElement.h"
#include "SVGLangSpace.h"
#include "StyleElement.h"
namespace WebCore {
- class SVGStyleElement : public SVGElement,
- public SVGLangSpace,
- public StyleElement {
- public:
- SVGStyleElement(const QualifiedName&, Document*, bool createdByParser);
+class SVGStyleElement : public SVGElement
+ , public SVGLangSpace
+ , public StyleElement {
+public:
+ SVGStyleElement(const QualifiedName&, Document*, bool createdByParser);
- // Derived from: 'Element'
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void insertedIntoDocument();
- virtual void removedFromDocument();
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void finishParsingChildren();
+ virtual void finishParsingChildren();
- virtual bool sheetLoaded();
+ virtual bool isLoading() const { return StyleElement::isLoading(); }
+ virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); }
- virtual const AtomicString& type() const;
- void setType(const AtomicString&, ExceptionCode&);
+ virtual const AtomicString& type() const;
+ void setType(const AtomicString&, ExceptionCode&);
- virtual const AtomicString& media() const;
- void setMedia(const AtomicString&, ExceptionCode&);
+ virtual const AtomicString& media() const;
+ void setMedia(const AtomicString&, ExceptionCode&);
- virtual String title() const;
- void setTitle(const AtomicString&, ExceptionCode&);
+ virtual String title() const;
+ void setTitle(const AtomicString&, ExceptionCode&);
- StyleSheet* sheet();
-
- protected:
- bool m_createdByParser;
- };
+ StyleSheet* sheet();
+};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGStyleElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyleElement.idl b/WebCore/svg/SVGStyleElement.idl
index e47ed1d..515e042 100644
--- a/WebCore/svg/SVGStyleElement.idl
+++ b/WebCore/svg/SVGStyleElement.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -28,11 +28,11 @@ module svg {
interface [Conditional=SVG] SVGStyleElement : SVGElement,
SVGLangSpace {
- attribute core::DOMString type
+ attribute DOMString type
setter raises(DOMException);
- attribute core::DOMString media
+ attribute DOMString media
setter raises(DOMException);
- attribute core::DOMString title
+ attribute DOMString title
setter raises(DOMException);
};
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index be1ba9c..6f04382 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -26,21 +26,22 @@
#include "Attr.h"
#include "CSSParser.h"
#include "CSSStyleSelector.h"
-#include "CString.h"
#include "Document.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "RenderObject.h"
+#include "RenderSVGResource.h"
+#include "RenderSVGResourceClipper.h"
+#include "RenderSVGResourceFilter.h"
+#include "RenderSVGResourceMasker.h"
#include "SVGElement.h"
#include "SVGElementInstance.h"
#include "SVGElementRareData.h"
#include "SVGNames.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceClipper.h"
-#include "SVGResourceFilter.h"
-#include "SVGResourceMasker.h"
+#include "SVGRenderSupport.h"
#include "SVGSVGElement.h"
+#include "SVGUseElement.h"
#include <wtf/Assertions.h>
namespace WebCore {
@@ -61,7 +62,50 @@ SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* doc)
SVGStyledElement::~SVGStyledElement()
{
- SVGResource::removeClient(this);
+}
+
+String SVGStyledElement::title() const
+{
+ // According to spec, we should not return titles when hovering over <svg> elements (those
+ // <title> elements are the title of the document, not a tooltip) so we instantly return.
+ if (hasTagName(SVGNames::svgTag))
+ return String();
+
+ // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title.
+ Node* parent = const_cast<SVGStyledElement*>(this);
+ while (parent) {
+ if (!parent->isShadowNode()) {
+ parent = parent->parentNode();
+ continue;
+ }
+
+ // Get the <use> element.
+ ContainerNode* shadowParent = parent->shadowParentNode();
+ if (shadowParent && shadowParent->isSVGElement() && shadowParent->hasTagName(SVGNames::useTag)) {
+ SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowParent);
+ // If the <use> title is not empty we found the title to use.
+ String useTitle(useElement->title());
+ if (useTitle.isEmpty())
+ break;
+ return useTitle;
+ }
+ parent = parent->parentNode();
+ }
+
+ // If we aren't an instance in a <use> or the <use> title was not found, then find the first
+ // <title> child of this element.
+ Element* titleElement = firstElementChild();
+ for (; titleElement; titleElement = titleElement->nextElementSibling()) {
+ if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement())
+ break;
+ }
+
+ // If a title child was found, return the text contents.
+ if (titleElement)
+ return titleElement->innerText();
+
+ // Otherwise return a null/empty string.
+ return String();
}
bool SVGStyledElement::rendererIsNeeded(RenderStyle* style)
@@ -141,6 +185,7 @@ int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attr
mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr);
+ mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr);
@@ -158,7 +203,7 @@ bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttribute
return SVGElement::mapToEntry(attrName, result);
}
-void SVGStyledElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyledElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
// NOTE: Any subclass which overrides parseMappedAttribute for a property handled by
@@ -183,12 +228,7 @@ void SVGStyledElement::parseMappedAttribute(MappedAttribute* attr)
bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName)
{
- // Recognize all style related SVG CSS properties
- int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
- if (propId > 0)
- return true;
-
- return (attrName == idAttributeName() || attrName == HTMLNames::styleAttr);
+ return isIdAttributeName(attrName);
}
void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -198,11 +238,13 @@ void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
if (attrName.matches(HTMLNames::classAttr))
classAttributeChanged(className());
- // If we're the child of a resource element, be sure to invalidate it.
- invalidateResourcesInAncestorChain();
+ RenderObject* object = renderer();
- // If the element is using resources, invalidate them.
- invalidateResources();
+ if (isIdAttributeName(attrName)) {
+ // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions
+ if (object && object->isSVGResourceContainer())
+ object->toRenderSVGResourceContainer()->idChanged();
+ }
// Invalidate all SVGElementInstances associated with us
SVGElementInstance::invalidateAllInstancesOfElement(this);
@@ -216,52 +258,24 @@ void SVGStyledElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeClassName();
}
-void SVGStyledElement::invalidateResources()
+void SVGStyledElement::attach()
{
- RenderObject* object = renderer();
- if (!object)
- return;
-
- const SVGRenderStyle* svgStyle = object->style()->svgStyle();
- Document* document = this->document();
+ SVGElement::attach();
- if (document->parsing())
- return;
-
-#if ENABLE(FILTERS)
- SVGResourceFilter* filter = getFilterById(document, svgStyle->filter(), object);
- if (filter)
- filter->invalidate();
-#endif
-
- SVGResourceMasker* masker = getMaskerById(document, svgStyle->maskElement(), object);
- if (masker)
- masker->invalidate();
-
- SVGResourceClipper* clipper = getClipperById(document, svgStyle->clipPath(), object);
- if (clipper)
- clipper->invalidate();
+ if (RenderObject* object = renderer())
+ object->updateFromElement();
}
-void SVGStyledElement::invalidateResourcesInAncestorChain() const
+void SVGStyledElement::insertedIntoDocument()
{
- Node* node = parentNode();
- while (node) {
- if (!node->isSVGElement())
- break;
-
- SVGElement* element = static_cast<SVGElement*>(node);
- if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0))
- styledElement->invalidateCanvasResources();
-
- node = node->parentNode();
- }
+ SVGElement::insertedIntoDocument();
+ updateRelativeLengthsInformation();
}
-void SVGStyledElement::invalidateCanvasResources()
+void SVGStyledElement::removedFromDocument()
{
- if (SVGResource* resource = canvasResource(renderer()))
- resource->invalidate();
+ updateRelativeLengthsInformation(false, this);
+ SVGElement::removedFromDocument();
}
void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
@@ -269,7 +283,8 @@ void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange,
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
// Invalidate all SVGElementInstances associated with us
- SVGElementInstance::invalidateAllInstancesOfElement(this);
+ if (!changedByParser)
+ SVGElementInstance::invalidateAllInstancesOfElement(this);
}
PassRefPtr<RenderStyle> SVGStyledElement::resolveStyle(RenderStyle* parentStyle)
@@ -281,15 +296,15 @@ PassRefPtr<RenderStyle> SVGStyledElement::resolveStyle(RenderStyle* parentStyle)
PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& name)
{
- if (!mappedAttributes())
+ if (!attributeMap())
return 0;
QualifiedName attributeName(nullAtom, name, nullAtom);
- Attribute* attr = mappedAttributes()->getAttributeItem(attributeName);
+ Attribute* attr = attributeMap()->getAttributeItem(attributeName);
if (!attr || !attr->isMappedAttribute() || !attr->style())
return 0;
- MappedAttribute* cssSVGAttr = static_cast<MappedAttribute*>(attr);
+ Attribute* cssSVGAttr = attr;
// This function returns a pointer to a CSSValue which can be mutated from JavaScript.
// If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration
// as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration
@@ -304,12 +319,6 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na
return cssSVGAttr->style()->getPropertyCSSValue(name);
}
-void SVGStyledElement::detach()
-{
- SVGResource::removeClient(this);
- SVGElement::detach();
-}
-
bool SVGStyledElement::instanceUpdatesBlocked() const
{
return hasRareSVGData() && rareSVGData()->instanceUpdatesBlocked();
@@ -321,6 +330,52 @@ void SVGStyledElement::setInstanceUpdatesBlocked(bool value)
rareSVGData()->setInstanceUpdatesBlocked(value);
}
+AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
+{
+ // To be overriden by SVGStyledLocatableElement/SVGStyledTransformableElement (or as special case SVGTextElement)
+ ASSERT_NOT_REACHED();
+ return AffineTransform();
+}
+
+void SVGStyledElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement* element)
+{
+ // If we're not yet in a document, this function will be called again from insertedIntoDocument(). Do nothing now.
+ if (!inDocument())
+ return;
+
+ // An element wants to notify us that its own relative lengths state changed.
+ // Register it in the relative length map, and register us in the parent relative length map.
+ // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
+
+ if (hasRelativeLengths)
+ m_elementsWithRelativeLengths.add(element);
+ else {
+ if (!m_elementsWithRelativeLengths.contains(element)) {
+ // We were never registered. Do nothing.
+ return;
+ }
+
+ m_elementsWithRelativeLengths.remove(element);
+ }
+
+ // Find first styled parent node, and notify it that we've changed our relative length state.
+ Node* node = parent();
+ while (node) {
+ if (!node->isSVGElement())
+ break;
+
+ SVGElement* element = static_cast<SVGElement*>(node);
+ if (!element->isStyled()) {
+ node = node->parent();
+ continue;
+ }
+
+ // Register us in the parent element map.
+ static_cast<SVGStyledElement*>(element)->updateRelativeLengthsInformation(hasRelativeLengths, this);
+ break;
+ }
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index aec3e75..8431458 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStyledElement_h
#define SVGStyledElement_h
@@ -24,12 +24,12 @@
#if ENABLE(SVG)
#include "HTMLNames.h"
#include "SVGElement.h"
+#include "SVGLocatable.h"
#include "SVGStylable.h"
+#include <wtf/HashSet.h>
namespace WebCore {
- class SVGResource;
-
void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName);
class SVGStyledElement : public SVGElement,
@@ -38,7 +38,10 @@ namespace WebCore {
SVGStyledElement(const QualifiedName&, Document*);
virtual ~SVGStyledElement();
- virtual bool hasRelativeValues() const { return false; }
+ virtual String title() const;
+
+ bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
+
virtual bool isStyled() const { return true; }
virtual bool supportsMarkers() const { return false; }
@@ -48,32 +51,34 @@ namespace WebCore {
bool isKnownAttribute(const QualifiedName&);
virtual bool rendererIsNeeded(RenderStyle*);
- virtual SVGResource* canvasResource(const RenderObject*) { return 0; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
+ virtual void attach();
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
// Centralized place to force a manual style resolution. Hacky but needed for now.
PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle);
- void invalidateResourcesInAncestorChain() const;
- void invalidateResources();
-
- virtual void detach();
-
bool instanceUpdatesBlocked() const;
void setInstanceUpdatesBlocked(bool);
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
+
protected:
static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
+ void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
+ void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
- virtual void invalidateCanvasResources();
+ virtual bool selfHasRelativeLengths() const { return false; }
private:
+ HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;
DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
};
diff --git a/WebCore/svg/SVGStyledLocatableElement.cpp b/WebCore/svg/SVGStyledLocatableElement.cpp
index 79b1fe3..6b49542 100644
--- a/WebCore/svg/SVGStyledLocatableElement.cpp
+++ b/WebCore/svg/SVGStyledLocatableElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -50,19 +50,19 @@ SVGElement* SVGStyledLocatableElement::farthestViewportElement() const
return SVGLocatable::farthestViewportElement(this);
}
-FloatRect SVGStyledLocatableElement::getBBox() const
+FloatRect SVGStyledLocatableElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGLocatable::getBBox(this);
+ return SVGLocatable::getBBox(this, styleUpdateStrategy);
}
-AffineTransform SVGStyledLocatableElement::getCTM() const
+AffineTransform SVGStyledLocatableElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGLocatable::getCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
}
-AffineTransform SVGStyledLocatableElement::getScreenCTM() const
+AffineTransform SVGStyledLocatableElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGLocatable::getScreenCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy);
}
}
diff --git a/WebCore/svg/SVGStyledLocatableElement.h b/WebCore/svg/SVGStyledLocatableElement.h
index 5e835bd..6eab7b0 100644
--- a/WebCore/svg/SVGStyledLocatableElement.h
+++ b/WebCore/svg/SVGStyledLocatableElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStyledLocatableElement_h
#define SVGStyledLocatableElement_h
@@ -40,9 +40,11 @@ namespace WebCore {
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
- virtual FloatRect getBBox() const;
- virtual AffineTransform getCTM() const;
- virtual AffineTransform getScreenCTM() const;
+ virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const;
+ virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
+ virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
+
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGLocatable::localCoordinateSpaceTransform(mode); }
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp
index a71cd16..279f437 100644
--- a/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -25,7 +25,6 @@
#include "AffineTransform.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGDocument.h"
#include "SVGStyledElement.h"
@@ -44,14 +43,14 @@ SVGStyledTransformableElement::~SVGStyledTransformableElement()
{
}
-AffineTransform SVGStyledTransformableElement::getCTM() const
+AffineTransform SVGStyledTransformableElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
}
-AffineTransform SVGStyledTransformableElement::getScreenCTM() const
+AffineTransform SVGStyledTransformableElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getScreenCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy);
}
AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const
@@ -66,7 +65,7 @@ AffineTransform* SVGStyledTransformableElement::supplementalTransform()
return m_supplementalTransform.get();
}
-void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGStyledTransformableElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTransformable::isKnownAttribute(attr->name())) {
SVGTransformList* localTransforms = transformBaseValue();
@@ -102,9 +101,9 @@ SVGElement* SVGStyledTransformableElement::farthestViewportElement() const
return SVGTransformable::farthestViewportElement(this);
}
-FloatRect SVGStyledTransformableElement::getBBox() const
+FloatRect SVGStyledTransformableElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getBBox(this);
+ return SVGTransformable::getBBox(this, styleUpdateStrategy);
}
RenderObject* SVGStyledTransformableElement::createRenderer(RenderArena* arena, RenderStyle*)
diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h
index ee204ad..1d7b197 100644
--- a/WebCore/svg/SVGStyledTransformableElement.h
+++ b/WebCore/svg/SVGStyledTransformableElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGStyledTransformableElement_h
#define SVGStyledTransformableElement_h
@@ -38,17 +38,18 @@ public:
virtual bool isStyledTransformable() const { return true; }
- virtual AffineTransform getCTM() const;
- virtual AffineTransform getScreenCTM() const;
+ virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
+ virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
-
+
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); }
virtual AffineTransform animatedLocalTransform() const;
virtual AffineTransform* supplementalTransform();
- virtual FloatRect getBBox() const;
+ virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
bool isKnownAttribute(const QualifiedName&);
diff --git a/WebCore/svg/SVGSwitchElement.cpp b/WebCore/svg/SVGSwitchElement.cpp
index 3268b9a..5f397af 100644
--- a/WebCore/svg/SVGSwitchElement.cpp
+++ b/WebCore/svg/SVGSwitchElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGSwitchElement.h b/WebCore/svg/SVGSwitchElement.h
index 4d6491a..83b02d5 100644
--- a/WebCore/svg/SVGSwitchElement.h
+++ b/WebCore/svg/SVGSwitchElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGSwitchElement_h
#define SVGSwitchElement_h
diff --git a/WebCore/svg/SVGSwitchElement.idl b/WebCore/svg/SVGSwitchElement.idl
index 18690a4..e4749b7 100644
--- a/WebCore/svg/SVGSwitchElement.idl
+++ b/WebCore/svg/SVGSwitchElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGSymbolElement.cpp b/WebCore/svg/SVGSymbolElement.cpp
index c7edae1..9c110cb 100644
--- a/WebCore/svg/SVGSymbolElement.cpp
+++ b/WebCore/svg/SVGSymbolElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
@@ -39,7 +39,7 @@ SVGSymbolElement::~SVGSymbolElement()
{
}
-void SVGSymbolElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSymbolElement::parseMappedAttribute(Attribute* attr)
{
if (SVGLangSpace::parseMappedAttribute(attr))
return;
@@ -51,6 +51,14 @@ void SVGSymbolElement::parseMappedAttribute(MappedAttribute* attr)
SVGStyledElement::parseMappedAttribute(attr);
}
+void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::viewBoxAttr)
+ updateRelativeLengthsInformation();
+}
+
void SVGSymbolElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledElement::synchronizeProperty(attrName);
@@ -76,6 +84,11 @@ void SVGSymbolElement::synchronizeProperty(const QualifiedName& attrName)
}
}
+bool SVGSymbolElement::selfHasRelativeLengths() const
+{
+ return hasAttribute(SVGNames::viewBoxAttr);
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGSymbolElement.h b/WebCore/svg/SVGSymbolElement.h
index 907bf0f..7d6fdd3 100644
--- a/WebCore/svg/SVGSymbolElement.h
+++ b/WebCore/svg/SVGSymbolElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGSymbolElement_h
#define SVGSymbolElement_h
@@ -37,11 +37,14 @@ namespace WebCore {
SVGSymbolElement(const QualifiedName&, Document*);
virtual ~SVGSymbolElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
private:
+ virtual bool selfHasRelativeLengths() const;
+
// SVGExternalResourcesRequired
DECLARE_ANIMATED_PROPERTY(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
diff --git a/WebCore/svg/SVGSymbolElement.idl b/WebCore/svg/SVGSymbolElement.idl
index 3e591a3..5d93de1 100644
--- a/WebCore/svg/SVGSymbolElement.idl
+++ b/WebCore/svg/SVGSymbolElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTRefElement.cpp b/WebCore/svg/SVGTRefElement.cpp
index 06ae896..c140f05 100644
--- a/WebCore/svg/SVGTRefElement.cpp
+++ b/WebCore/svg/SVGTRefElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,6 +24,7 @@
#include "SVGTRefElement.h"
#include "RenderSVGInline.h"
+#include "RenderSVGResource.h"
#include "SVGDocument.h"
#include "SVGNames.h"
#include "Text.h"
@@ -51,7 +52,7 @@ void SVGTRefElement::updateReferencedText()
setTextContent(textContent, ignore);
}
-void SVGTRefElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTRefElement::parseMappedAttribute(Attribute* attr)
{
if (SVGURIReference::parseMappedAttribute(attr)) {
updateReferencedText();
@@ -69,7 +70,7 @@ void SVGTRefElement::svgAttributeChanged(const QualifiedName& attrName)
return;
if (SVGURIReference::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
}
void SVGTRefElement::synchronizeProperty(const QualifiedName& attrName)
diff --git a/WebCore/svg/SVGTRefElement.h b/WebCore/svg/SVGTRefElement.h
index ff6eac0..f86f015 100644
--- a/WebCore/svg/SVGTRefElement.h
+++ b/WebCore/svg/SVGTRefElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTRefElement_h
#define SVGTRefElement_h
@@ -33,7 +33,7 @@ namespace WebCore {
SVGTRefElement(const QualifiedName&, Document*);
virtual ~SVGTRefElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
diff --git a/WebCore/svg/SVGTRefElement.idl b/WebCore/svg/SVGTRefElement.idl
index 60bd5b2..68ec9be 100644
--- a/WebCore/svg/SVGTRefElement.idl
+++ b/WebCore/svg/SVGTRefElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTSpanElement.cpp b/WebCore/svg/SVGTSpanElement.cpp
index 12bf377..ef36780 100644
--- a/WebCore/svg/SVGTSpanElement.cpp
+++ b/WebCore/svg/SVGTSpanElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGTSpanElement.h b/WebCore/svg/SVGTSpanElement.h
index 17445d3..3b9357b 100644
--- a/WebCore/svg/SVGTSpanElement.h
+++ b/WebCore/svg/SVGTSpanElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTSpanElement_h
#define SVGTSpanElement_h
diff --git a/WebCore/svg/SVGTSpanElement.idl b/WebCore/svg/SVGTSpanElement.idl
index 28728ec..14cdcae 100644
--- a/WebCore/svg/SVGTSpanElement.idl
+++ b/WebCore/svg/SVGTSpanElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTests.cpp b/WebCore/svg/SVGTests.cpp
index 258c12c..9767432 100644
--- a/WebCore/svg/SVGTests.cpp
+++ b/WebCore/svg/SVGTests.cpp
@@ -1,31 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGTests.h"
+#include "Attribute.h"
#include "DOMImplementation.h"
#include "Language.h"
-#include "MappedAttribute.h"
#include "SVGElement.h"
#include "SVGNames.h"
#include "SVGStringList.h"
@@ -93,7 +93,7 @@ bool SVGTests::isValid() const
return true;
}
-bool SVGTests::parseMappedAttribute(MappedAttribute* attr)
+bool SVGTests::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::requiredFeaturesAttr) {
requiredFeatures()->reset(attr->value());
diff --git a/WebCore/svg/SVGTests.h b/WebCore/svg/SVGTests.h
index a2abddf..b638c0a 100644
--- a/WebCore/svg/SVGTests.h
+++ b/WebCore/svg/SVGTests.h
@@ -1,35 +1,35 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTests_h
#define SVGTests_h
#if ENABLE(SVG)
+#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
namespace WebCore {
- class MappedAttribute;
- class String;
- class SVGStringList;
+ class Attribute;
class QualifiedName;
+ class SVGStringList;
class SVGTests {
public:
@@ -44,7 +44,7 @@ namespace WebCore {
bool isValid() const;
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGTests.idl b/WebCore/svg/SVGTests.idl
index 8a5f7c2..3508a98 100644
--- a/WebCore/svg/SVGTests.idl
+++ b/WebCore/svg/SVGTests.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -31,7 +31,7 @@ module svg {
readonly attribute SVGStringList requiredExtensions;
readonly attribute SVGStringList systemLanguage;
- boolean hasExtension(in core::DOMString extension);
+ boolean hasExtension(in DOMString extension);
};
}
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index b28536b..a96ce63 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -25,21 +25,10 @@
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
-#include "ExceptionCode.h"
-#include "FloatPoint.h"
-#include "FloatRect.h"
#include "Frame.h"
-#include "MappedAttribute.h"
-#include "Position.h"
-#include "RenderSVGText.h"
-#include "SVGCharacterLayoutInfo.h"
-#include "SVGInlineTextBox.h"
-#include "SVGLength.h"
-#include "SVGNames.h"
-#include "SVGRootInlineBox.h"
+#include "SVGTextQuery.h"
#include "SelectionController.h"
#include "XMLNames.h"
-#include <wtf/StdLibExtras.h>
namespace WebCore {
@@ -57,330 +46,16 @@ SVGTextContentElement::~SVGTextContentElement()
{
}
-static inline float cumulativeCharacterRangeLength(const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end, SVGInlineTextBox* textBox,
- int startOffset, long startPosition, long length, bool isVerticalText, long& atCharacter)
-{
- if (!length)
- return 0.0f;
-
- float textLength = 0.0f;
- RenderStyle* style = textBox->textRenderer()->style();
-
- bool usesFullRange = (startPosition == -1 && length == -1);
-
- for (Vector<SVGChar>::iterator it = start; it != end; ++it) {
- if (usesFullRange || (atCharacter >= startPosition && atCharacter <= startPosition + length)) {
- unsigned int newOffset = textBox->start() + (it - start) + startOffset;
-
- // Take RTL text into account and pick right glyph width/height.
- if (textBox->direction() == RTL)
- newOffset = textBox->start() + textBox->end() - newOffset;
-
- // FIXME: does this handle multichar glyphs ok? not sure
- int charsConsumed = 0;
- String glyphName;
- if (isVerticalText)
- textLength += textBox->calculateGlyphHeight(style, newOffset, 0);
- else
- textLength += textBox->calculateGlyphWidth(style, newOffset, 0, charsConsumed, glyphName);
- }
-
- if (!usesFullRange) {
- if (atCharacter == startPosition + length - 1)
- break;
-
- atCharacter++;
- }
- }
-
- return textLength;
-}
-
-// Helper class for querying certain glyph information
-struct SVGInlineTextBoxQueryWalker {
- typedef enum {
- NumberOfCharacters,
- TextLength,
- SubStringLength,
- StartPosition,
- EndPosition,
- Extent,
- Rotation,
- CharacterNumberAtPosition
- } QueryMode;
-
- SVGInlineTextBoxQueryWalker(const SVGTextContentElement* reference, QueryMode mode)
- : m_reference(reference)
- , m_mode(mode)
- , m_queryStartPosition(0)
- , m_queryLength(0)
- , m_queryPointInput()
- , m_queryLongResult(0)
- , m_queryFloatResult(0.0f)
- , m_queryPointResult()
- , m_queryRectResult()
- , m_stopProcessing(true)
- , m_atCharacter(0)
- {
- }
-
- void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform&,
- const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
- {
- RenderStyle* style = textBox->textRenderer()->style();
- bool isVerticalText = style->svgStyle()->writingMode() == WM_TBRL || style->svgStyle()->writingMode() == WM_TB;
-
- switch (m_mode) {
- case NumberOfCharacters:
- {
- m_queryLongResult += (end - start);
- m_stopProcessing = false;
- return;
- }
- case TextLength:
- {
- float textLength = cumulativeCharacterRangeLength(start, end, textBox, startOffset, -1, -1, isVerticalText, m_atCharacter);
-
- if (isVerticalText)
- m_queryFloatResult += textLength;
- else
- m_queryFloatResult += textLength;
-
- m_stopProcessing = false;
- return;
- }
- case SubStringLength:
- {
- long startPosition = m_queryStartPosition;
- long length = m_queryLength;
-
- float textLength = cumulativeCharacterRangeLength(start, end, textBox, startOffset, startPosition, length, isVerticalText, m_atCharacter);
-
- if (isVerticalText)
- m_queryFloatResult += textLength;
- else
- m_queryFloatResult += textLength;
-
- if (m_atCharacter == startPosition + length)
- m_stopProcessing = true;
- else
- m_stopProcessing = false;
-
- return;
- }
- case StartPosition:
- {
- for (Vector<SVGChar>::iterator it = start; it != end; ++it) {
- if (m_atCharacter == m_queryStartPosition) {
- m_queryPointResult = FloatPoint(it->x, it->y);
- m_stopProcessing = true;
- return;
- }
-
- m_atCharacter++;
- }
-
- m_stopProcessing = false;
- return;
- }
- case EndPosition:
- {
- for (Vector<SVGChar>::iterator it = start; it != end; ++it) {
- if (m_atCharacter == m_queryStartPosition) {
- unsigned int newOffset = textBox->start() + (it - start) + startOffset;
-
- // Take RTL text into account and pick right glyph width/height.
- if (textBox->direction() == RTL)
- newOffset = textBox->start() + textBox->end() - newOffset;
-
- int charsConsumed;
- String glyphName;
- // calculateGlyph{Height,Width} will consume at least one character. This is the number of characters available
- // to them beyond that first one.
- int extraCharactersAvailable = end - it - 1;
- if (isVerticalText)
- m_queryPointResult.move(it->x, it->y + textBox->calculateGlyphHeight(style, newOffset, extraCharactersAvailable));
- else
- m_queryPointResult.move(it->x + textBox->calculateGlyphWidth(style, newOffset, extraCharactersAvailable, charsConsumed, glyphName), it->y);
-
- m_stopProcessing = true;
- return;
- }
-
- m_atCharacter++;
- }
-
- m_stopProcessing = false;
- return;
- }
- case Extent:
- {
- for (Vector<SVGChar>::iterator it = start; it != end; ++it) {
- if (m_atCharacter == m_queryStartPosition) {
- unsigned int newOffset = textBox->start() + (it - start) + startOffset;
- m_queryRectResult = textBox->calculateGlyphBoundaries(style, newOffset, *it);
- m_stopProcessing = true;
- return;
- }
-
- m_atCharacter++;
- }
-
- m_stopProcessing = false;
- return;
- }
- case Rotation:
- {
- for (Vector<SVGChar>::iterator it = start; it != end; ++it) {
- if (m_atCharacter == m_queryStartPosition) {
- m_queryFloatResult = it->angle;
- m_stopProcessing = true;
- return;
- }
-
- m_atCharacter++;
- }
-
- m_stopProcessing = false;
- return;
- }
- case CharacterNumberAtPosition:
- {
- int offset = 0;
- SVGChar* charAtPos = textBox->closestCharacterToPosition(m_queryPointInput.x(), m_queryPointInput.y(), offset);
-
- offset += m_atCharacter;
- if (charAtPos && offset > m_queryLongResult)
- m_queryLongResult = offset;
-
- m_atCharacter += end - start;
- m_stopProcessing = false;
- return;
- }
- default:
- ASSERT_NOT_REACHED();
- m_stopProcessing = true;
- return;
- }
- }
-
- void setQueryInputParameters(long startPosition, long length, FloatPoint referencePoint)
- {
- m_queryStartPosition = startPosition;
- m_queryLength = length;
- m_queryPointInput = referencePoint;
- }
-
- long longResult() const { return m_queryLongResult; }
- float floatResult() const { return m_queryFloatResult; }
- FloatPoint pointResult() const { return m_queryPointResult; }
- FloatRect rectResult() const { return m_queryRectResult; }
- bool stopProcessing() const { return m_stopProcessing; }
-
-private:
- const SVGTextContentElement* m_reference;
- QueryMode m_mode;
-
- long m_queryStartPosition;
- long m_queryLength;
- FloatPoint m_queryPointInput;
-
- long m_queryLongResult;
- float m_queryFloatResult;
- FloatPoint m_queryPointResult;
- FloatRect m_queryRectResult;
-
- bool m_stopProcessing;
- long m_atCharacter;
-};
-
-static Vector<SVGInlineTextBox*> findInlineTextBoxInTextChunks(const SVGTextContentElement* element, const Vector<SVGTextChunk>& chunks)
-{
- Vector<SVGTextChunk>::const_iterator it = chunks.begin();
- const Vector<SVGTextChunk>::const_iterator end = chunks.end();
-
- Vector<SVGInlineTextBox*> boxes;
-
- for (; it != end; ++it) {
- Vector<SVGInlineBoxCharacterRange>::const_iterator boxIt = it->boxes.begin();
- const Vector<SVGInlineBoxCharacterRange>::const_iterator boxEnd = it->boxes.end();
-
- for (; boxIt != boxEnd; ++boxIt) {
- SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(boxIt->box);
-
- Node* textElement = textBox->textRenderer()->parent()->node();
- ASSERT(textElement);
-
- if (textElement == element || textElement->parent() == element)
- boxes.append(textBox);
- }
- }
-
- return boxes;
-}
-
-static inline SVGRootInlineBox* rootInlineBoxForTextContentElement(const SVGTextContentElement* element)
-{
- RenderObject* object = element->renderer();
-
- if (!object || !object->isSVGText() || object->isText())
- return 0;
-
- RenderBlock* svgText = toRenderBlock(object);
-
- // Find root inline box
- SVGRootInlineBox* rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox());
- if (!rootBox) {
- // Layout is not sync yet!
- element->document()->updateLayoutIgnorePendingStylesheets();
- rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox());
- }
-
- ASSERT(rootBox);
- return rootBox;
-}
-
-static inline SVGInlineTextBoxQueryWalker executeTextQuery(const SVGTextContentElement* element, SVGInlineTextBoxQueryWalker::QueryMode mode,
- long startPosition = 0, long length = 0, FloatPoint referencePoint = FloatPoint())
-{
- SVGRootInlineBox* rootBox = rootInlineBoxForTextContentElement(element);
- if (!rootBox)
- return SVGInlineTextBoxQueryWalker(0, mode);
-
- // Find all inline text box associated with our renderer
- Vector<SVGInlineTextBox*> textBoxes = findInlineTextBoxInTextChunks(element, rootBox->svgTextChunks());
-
- // Walk text chunks to find chunks associated with our inline text box
- SVGInlineTextBoxQueryWalker walkerCallback(element, mode);
- walkerCallback.setQueryInputParameters(startPosition, length, referencePoint);
-
- SVGTextChunkWalker<SVGInlineTextBoxQueryWalker> walker(&walkerCallback, &SVGInlineTextBoxQueryWalker::chunkPortionCallback);
-
- Vector<SVGInlineTextBox*>::iterator it = textBoxes.begin();
- Vector<SVGInlineTextBox*>::iterator end = textBoxes.end();
-
- for (; it != end; ++it) {
- rootBox->walkTextChunks(&walker, *it);
-
- if (walkerCallback.stopProcessing())
- break;
- }
-
- return walkerCallback;
-}
-
unsigned SVGTextContentElement::getNumberOfChars() const
{
document()->updateLayoutIgnorePendingStylesheets();
-
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::NumberOfCharacters).longResult();
+ return SVGTextQuery(renderer()).numberOfCharacters();
}
float SVGTextContentElement::getComputedTextLength() const
{
document()->updateLayoutIgnorePendingStylesheets();
-
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::TextLength).floatResult();
+ return SVGTextQuery(renderer()).textLength();
}
float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec) const
@@ -393,7 +68,7 @@ float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar
return 0.0f;
}
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult();
+ return SVGTextQuery(renderer()).subStringLength(charnum, nchars);
}
FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec) const
@@ -405,7 +80,7 @@ FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excep
return FloatPoint();
}
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::StartPosition, charnum).pointResult();
+ return SVGTextQuery(renderer()).startPositionOfCharacter(charnum);
}
FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec) const
@@ -417,7 +92,7 @@ FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Excepti
return FloatPoint();
}
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::EndPosition, charnum).pointResult();
+ return SVGTextQuery(renderer()).endPositionOfCharacter(charnum);
}
FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec) const
@@ -429,7 +104,7 @@ FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode
return FloatRect();
}
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Extent, charnum).rectResult();
+ return SVGTextQuery(renderer()).extentOfCharacter(charnum);
}
float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec) const
@@ -441,14 +116,13 @@ float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode&
return 0.0f;
}
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Rotation, charnum).floatResult();
+ return SVGTextQuery(renderer()).rotationOfCharacter(charnum);
}
int SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const
{
document()->updateLayoutIgnorePendingStylesheets();
-
- return executeTextQuery(this, SVGInlineTextBoxQueryWalker::CharacterNumberAtPosition, 0.0f, 0.0f, point).longResult();
+ return SVGTextQuery(renderer()).characterNumberAtPosition(point);
}
void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec) const
@@ -482,7 +156,7 @@ void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
controller->setSelection(VisibleSelection(start, end));
}
-void SVGTextContentElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextContentElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::lengthAdjustAttr) {
if (attr->value() == "spacing")
@@ -543,6 +217,11 @@ bool SVGTextContentElement::isKnownAttribute(const QualifiedName& attrName)
SVGStyledElement::isKnownAttribute(attrName));
}
+bool SVGTextContentElement::selfHasRelativeLengths() const
+{
+ return textLength().isRelative();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextContentElement.h b/WebCore/svg/SVGTextContentElement.h
index 7dff3d5..d006a89 100644
--- a/WebCore/svg/SVGTextContentElement.h
+++ b/WebCore/svg/SVGTextContentElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTextContentElement_h
#define SVGTextContentElement_h
@@ -58,11 +58,14 @@ namespace WebCore {
int getCharNumAtPosition(const FloatPoint&) const;
void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
bool isKnownAttribute(const QualifiedName&);
+ protected:
+ virtual bool selfHasRelativeLengths() const;
+
private:
DECLARE_ANIMATED_PROPERTY(SVGTextContentElement, SVGNames::textLengthAttr, SVGLength, TextLength, textLength)
DECLARE_ANIMATED_PROPERTY(SVGTextContentElement, SVGNames::lengthAdjustAttr, int, LengthAdjust, lengthAdjust)
diff --git a/WebCore/svg/SVGTextContentElement.idl b/WebCore/svg/SVGTextContentElement.idl
index 9cf1748..400b184 100644
--- a/WebCore/svg/SVGTextContentElement.idl
+++ b/WebCore/svg/SVGTextContentElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp
index 96fd11a..e13e611 100644
--- a/WebCore/svg/SVGTextElement.cpp
+++ b/WebCore/svg/SVGTextElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,8 +24,9 @@
#include "SVGTextElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
+#include "RenderSVGResource.h"
#include "RenderSVGText.h"
#include "SVGLengthList.h"
#include "SVGRenderStyle.h"
@@ -45,7 +46,7 @@ SVGTextElement::~SVGTextElement()
{
}
-void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextElement::parseMappedAttribute(Attribute* attr)
{
if (SVGTransformable::isKnownAttribute(attr->name())) {
SVGTransformList* localTransforms = transformBaseValue();
@@ -67,19 +68,19 @@ SVGElement* SVGTextElement::farthestViewportElement() const
return SVGTransformable::farthestViewportElement(this);
}
-FloatRect SVGTextElement::getBBox() const
+FloatRect SVGTextElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getBBox(this);
+ return SVGTransformable::getBBox(this, styleUpdateStrategy);
}
-AffineTransform SVGTextElement::getScreenCTM() const
+AffineTransform SVGTextElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getScreenCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
}
-AffineTransform SVGTextElement::getCTM() const
+AffineTransform SVGTextElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const
{
- return SVGTransformable::getCTM(this);
+ return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy);
}
AffineTransform SVGTextElement::animatedLocalTransform() const
@@ -114,11 +115,14 @@ void SVGTextElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGTextPositioningElement::svgAttributeChanged(attrName);
- if (!renderer())
+ RenderObject* renderer = this->renderer();
+ if (!renderer)
return;
- if (SVGTransformable::isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ if (SVGTransformable::isKnownAttribute(attrName)) {
+ renderer->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ }
}
void SVGTextElement::synchronizeProperty(const QualifiedName& attrName)
@@ -129,16 +133,6 @@ void SVGTextElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeTransform();
}
-void SVGTextElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
-{
- SVGTextPositioningElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
- if (!renderer())
- return;
-
- renderer()->setNeedsLayout(true);
-}
-
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h
index 4fca6bf..1788ea9 100644
--- a/WebCore/svg/SVGTextElement.h
+++ b/WebCore/svg/SVGTextElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTextElement_h
#define SVGTextElement_h
@@ -33,23 +33,23 @@ namespace WebCore {
SVGTextElement(const QualifiedName&, Document*);
virtual ~SVGTextElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
- virtual FloatRect getBBox() const;
- virtual AffineTransform getCTM() const;
- virtual AffineTransform getScreenCTM() const;
+ virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const;
+ virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
+ virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const;
virtual AffineTransform animatedLocalTransform() const;
virtual AffineTransform* supplementalTransform();
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool childShouldCreateRenderer(Node*) const;
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
private:
DECLARE_ANIMATED_PROPERTY(SVGTextElement, SVGNames::transformAttr, SVGTransformList*, Transform, transform)
diff --git a/WebCore/svg/SVGTextElement.idl b/WebCore/svg/SVGTextElement.idl
index 046faa3..0867d81 100644
--- a/WebCore/svg/SVGTextElement.idl
+++ b/WebCore/svg/SVGTextElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp
index a428a44..8f21ab3 100644
--- a/WebCore/svg/SVGTextPathElement.cpp
+++ b/WebCore/svg/SVGTextPathElement.cpp
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -23,8 +23,9 @@
#include "SVGTextPathElement.h"
#include "AffineTransform.h"
+#include "Attribute.h"
#include "FloatRect.h"
-#include "MappedAttribute.h"
+#include "RenderSVGResource.h"
#include "RenderSVGTextPath.h"
#include "SVGLengthList.h"
#include "SVGPathElement.h"
@@ -46,7 +47,7 @@ SVGTextPathElement::~SVGTextPathElement()
{
}
-void SVGTextPathElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextPathElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
@@ -69,6 +70,22 @@ void SVGTextPathElement::parseMappedAttribute(MappedAttribute* attr)
}
}
+void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGTextContentElement::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::startOffsetAttr)
+ updateRelativeLengthsInformation();
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::startOffsetAttr
+ || SVGTextContentElement::isKnownAttribute(attrName)
+ || SVGURIReference::isKnownAttribute(attrName))
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
+}
+
void SVGTextPathElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGTextContentElement::synchronizeProperty(attrName);
@@ -110,7 +127,7 @@ bool SVGTextPathElement::childShouldCreateRenderer(Node* child) const
void SVGTextPathElement::insertedIntoDocument()
{
- SVGElement::insertedIntoDocument();
+ SVGTextContentElement::insertedIntoDocument();
String id = SVGURIReference::getTarget(href());
Element* targetElement = ownerDocument()->getElementById(id);
@@ -120,6 +137,12 @@ void SVGTextPathElement::insertedIntoDocument()
}
}
+bool SVGTextPathElement::selfHasRelativeLengths() const
+{
+ return startOffset().isRelative()
+ || SVGTextContentElement::selfHasRelativeLengths();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextPathElement.h b/WebCore/svg/SVGTextPathElement.h
index ff09ed2..537a107 100644
--- a/WebCore/svg/SVGTextPathElement.h
+++ b/WebCore/svg/SVGTextPathElement.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTextPathElement_h
#define SVGTextPathElement_h
@@ -56,14 +56,16 @@ namespace WebCore {
virtual void insertedIntoDocument();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
bool childShouldCreateRenderer(Node*) const;
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::startOffsetAttr, SVGLength, StartOffset, startOffset)
DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::methodAttr, int, Method, method)
DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::spacingAttr, int, Spacing, spacing)
diff --git a/WebCore/svg/SVGTextPathElement.idl b/WebCore/svg/SVGTextPathElement.idl
index 511f792..b8c6e7d 100644
--- a/WebCore/svg/SVGTextPathElement.idl
+++ b/WebCore/svg/SVGTextPathElement.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp
index dd99b49..86231f8 100644
--- a/WebCore/svg/SVGTextPositioningElement.cpp
+++ b/WebCore/svg/SVGTextPositioningElement.cpp
@@ -1,30 +1,31 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGTextPositioningElement.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "RenderObject.h"
+#include "RenderSVGResource.h"
#include "SVGLengthList.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
@@ -45,7 +46,7 @@ SVGTextPositioningElement::~SVGTextPositioningElement()
{
}
-void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGTextPositioningElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
xBaseValue()->parse(attr->value(), LengthModeWidth);
@@ -65,11 +66,17 @@ void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
{
SVGTextContentElement::svgAttributeChanged(attrName);
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr
+ || attrName == SVGNames::dxAttr
+ || attrName == SVGNames::dyAttr)
+ updateRelativeLengthsInformation();
+
if (!renderer())
return;
if (isKnownAttribute(attrName))
- renderer()->setNeedsLayout(true);
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
}
void SVGTextPositioningElement::synchronizeProperty(const QualifiedName& attrName)
@@ -107,6 +114,39 @@ bool SVGTextPositioningElement::isKnownAttribute(const QualifiedName& attrName)
SVGTextContentElement::isKnownAttribute(attrName));
}
+static inline bool listContainsRelativeValue(SVGLengthList* list)
+{
+ if (!list)
+ return false;
+
+ ExceptionCode ec = 0;
+ int length = list->numberOfItems();
+ for (int i = 0; i < length; ++i) {
+ SVGLength length(list->getItem(i, ec));
+ ASSERT(!ec);
+
+ if (length.isRelative())
+ return true;
+ }
+
+ return false;
+}
+
+bool SVGTextPositioningElement::selfHasRelativeLengths() const
+{
+ if (SVGTextContentElement::selfHasRelativeLengths())
+ return true;
+ if (listContainsRelativeValue(x()))
+ return true;
+ if (listContainsRelativeValue(y()))
+ return true;
+ if (listContainsRelativeValue(dx()))
+ return true;
+ if (listContainsRelativeValue(dy()))
+ return true;
+ return false;
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h
index 71e8900..0ad3090 100644
--- a/WebCore/svg/SVGTextPositioningElement.h
+++ b/WebCore/svg/SVGTextPositioningElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTextPositioningElement_h
#define SVGTextPositioningElement_h
@@ -33,13 +33,15 @@ namespace WebCore {
SVGTextPositioningElement(const QualifiedName&, Document*);
virtual ~SVGTextPositioningElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
bool isKnownAttribute(const QualifiedName&);
private:
+ virtual bool selfHasRelativeLengths() const;
+
DECLARE_ANIMATED_PROPERTY(SVGTextPositioningElement, SVGNames::xAttr, SVGLengthList*, X, x)
DECLARE_ANIMATED_PROPERTY(SVGTextPositioningElement, SVGNames::yAttr, SVGLengthList*, Y, y)
DECLARE_ANIMATED_PROPERTY(SVGTextPositioningElement, SVGNames::dxAttr, SVGLengthList*, Dx, dx)
diff --git a/WebCore/svg/SVGTextPositioningElement.idl b/WebCore/svg/SVGTextPositioningElement.idl
index 45ea2ec..6f5d1fa 100644
--- a/WebCore/svg/SVGTextPositioningElement.idl
+++ b/WebCore/svg/SVGTextPositioningElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTitleElement.cpp b/WebCore/svg/SVGTitleElement.cpp
index 5afde8d..7fdb2e0 100644
--- a/WebCore/svg/SVGTitleElement.cpp
+++ b/WebCore/svg/SVGTitleElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGTitleElement.h b/WebCore/svg/SVGTitleElement.h
index 340f725..f3381b1 100644
--- a/WebCore/svg/SVGTitleElement.h
+++ b/WebCore/svg/SVGTitleElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTitleElement_h
#define SVGTitleElement_h
diff --git a/WebCore/svg/SVGTitleElement.idl b/WebCore/svg/SVGTitleElement.idl
index f7a1182..dde5ba2 100644
--- a/WebCore/svg/SVGTitleElement.idl
+++ b/WebCore/svg/SVGTitleElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTransform.cpp b/WebCore/svg/SVGTransform.cpp
index 1af0cd9..594af16 100644
--- a/WebCore/svg/SVGTransform.cpp
+++ b/WebCore/svg/SVGTransform.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGTransform.h b/WebCore/svg/SVGTransform.h
index 88912c2..071d908 100644
--- a/WebCore/svg/SVGTransform.h
+++ b/WebCore/svg/SVGTransform.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTransform_h
#define SVGTransform_h
@@ -24,7 +24,6 @@
#if ENABLE(SVG)
#include "AffineTransform.h"
#include "FloatPoint.h"
-#include "SVGNames.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGTransform.idl b/WebCore/svg/SVGTransform.idl
index fc153a7..dde234c 100644
--- a/WebCore/svg/SVGTransform.idl
+++ b/WebCore/svg/SVGTransform.idl
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
module svg {
diff --git a/WebCore/svg/SVGTransformDistance.cpp b/WebCore/svg/SVGTransformDistance.cpp
index 51dfd74..ef43072 100644
--- a/WebCore/svg/SVGTransformDistance.cpp
+++ b/WebCore/svg/SVGTransformDistance.cpp
@@ -1,22 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/SVGTransformDistance.h b/WebCore/svg/SVGTransformDistance.h
index 7c54dc7..ad46974 100644
--- a/WebCore/svg/SVGTransformDistance.h
+++ b/WebCore/svg/SVGTransformDistance.h
@@ -1,22 +1,20 @@
/*
- Copyright (C) 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGTransformDistance_h
diff --git a/WebCore/svg/SVGTransformList.cpp b/WebCore/svg/SVGTransformList.cpp
index 38dbc9a..ae2f298 100644
--- a/WebCore/svg/SVGTransformList.cpp
+++ b/WebCore/svg/SVGTransformList.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
diff --git a/WebCore/svg/SVGTransformList.h b/WebCore/svg/SVGTransformList.h
index 683f0f7..5bb5e85 100644
--- a/WebCore/svg/SVGTransformList.h
+++ b/WebCore/svg/SVGTransformList.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTransformList_h
#define SVGTransformList_h
@@ -24,12 +24,11 @@
#if ENABLE(SVG)
#include "SVGList.h"
#include "SVGTransform.h"
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
- class String;
-
class SVGTransformList : public SVGPODList<SVGTransform> {
public:
static PassRefPtr<SVGTransformList> create(const QualifiedName& attributeName) { return adoptRef(new SVGTransformList(attributeName)); }
diff --git a/WebCore/svg/SVGTransformList.idl b/WebCore/svg/SVGTransformList.idl
index d03351a..08252c3 100644
--- a/WebCore/svg/SVGTransformList.idl
+++ b/WebCore/svg/SVGTransformList.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGTransformable.cpp b/WebCore/svg/SVGTransformable.cpp
index d710a34..a47cd1f 100644
--- a/WebCore/svg/SVGTransformable.cpp
+++ b/WebCore/svg/SVGTransformable.cpp
@@ -1,25 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- 2007 Eric Seidel <eric@webkit.org>
-
- This file is part of the WebKit project
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -35,7 +33,8 @@
namespace WebCore {
-SVGTransformable::SVGTransformable() : SVGLocatable()
+SVGTransformable::SVGTransformable()
+ : SVGLocatable()
{
}
@@ -43,18 +42,6 @@ SVGTransformable::~SVGTransformable()
{
}
-AffineTransform SVGTransformable::getCTM(const SVGElement* element) const
-{
- AffineTransform ctm = SVGLocatable::getCTM(element);
- return animatedLocalTransform() * ctm;
-}
-
-AffineTransform SVGTransformable::getScreenCTM(const SVGElement* element) const
-{
- AffineTransform ctm = SVGLocatable::getScreenCTM(element);
- return animatedLocalTransform() * ctm;
-}
-
static int parseTransformParamList(const UChar*& ptr, const UChar* end, float* values, int required, int optional)
{
int optionalParams = 0, requiredParams = 0;
diff --git a/WebCore/svg/SVGTransformable.h b/WebCore/svg/SVGTransformable.h
index 7579fa9..8979eb1 100644
--- a/WebCore/svg/SVGTransformable.h
+++ b/WebCore/svg/SVGTransformable.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGTransformable_h
#define SVGTransformable_h
@@ -25,11 +25,11 @@
#include "PlatformString.h"
#include "SVGLocatable.h"
#include "SVGTransformList.h"
+#include <wtf/Forward.h>
namespace WebCore {
class AffineTransform;
-class AtomicString;
class SVGTransform;
class QualifiedName;
@@ -46,10 +46,8 @@ public:
static bool parseTransformAttribute(SVGTransformList*, const AtomicString& transform);
static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end, TransformParsingMode mode = ClearList);
static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
-
- AffineTransform getCTM(const SVGElement*) const;
- AffineTransform getScreenCTM(const SVGElement*) const;
-
+
+ virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return animatedLocalTransform(); }
virtual AffineTransform animatedLocalTransform() const = 0;
bool isKnownAttribute(const QualifiedName&);
diff --git a/WebCore/svg/SVGTransformable.idl b/WebCore/svg/SVGTransformable.idl
index 13a4520..86822b7 100644
--- a/WebCore/svg/SVGTransformable.idl
+++ b/WebCore/svg/SVGTransformable.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp
index 5fe71ab..97003e5 100644
--- a/WebCore/svg/SVGURIReference.cpp
+++ b/WebCore/svg/SVGURIReference.cpp
@@ -1,29 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGURIReference.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
namespace WebCore {
@@ -35,7 +35,7 @@ SVGURIReference::~SVGURIReference()
{
}
-bool SVGURIReference::parseMappedAttribute(MappedAttribute* attr)
+bool SVGURIReference::parseMappedAttribute(Attribute* attr)
{
if (attr->name().matches(XLinkNames::hrefAttr)) {
setHrefBaseValue(attr->value());
@@ -53,15 +53,14 @@ bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
String SVGURIReference::getTarget(const String& url)
{
if (url.startsWith("url(")) { // URI References, ie. fill:url(#target)
- unsigned int start = url.find('#') + 1;
- unsigned int end = url.reverseFind(')');
-
+ size_t start = url.find('#') + 1;
+ size_t end = url.reverseFind(')');
return url.substring(start, end - start);
- } else if (url.find('#') > -1) { // format is #target
- unsigned int start = url.find('#') + 1;
+ } else if (url.find('#') != notFound) { // format is #target
+ size_t start = url.find('#') + 1;
return url.substring(start, url.length() - start);
- } else // Normal Reference, ie. style="color-profile:changeColor"
- return url;
+ } else // The url doesn't have any target.
+ return String();
}
}
diff --git a/WebCore/svg/SVGURIReference.h b/WebCore/svg/SVGURIReference.h
index ea09f2e..0900215 100644
--- a/WebCore/svg/SVGURIReference.h
+++ b/WebCore/svg/SVGURIReference.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGURIReference_h
#define SVGURIReference_h
@@ -27,14 +27,14 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class SVGURIReference {
public:
SVGURIReference();
virtual ~SVGURIReference();
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
static String getTarget(const String& url);
diff --git a/WebCore/svg/SVGURIReference.idl b/WebCore/svg/SVGURIReference.idl
index 4981eb1..cc9498a 100644
--- a/WebCore/svg/SVGURIReference.idl
+++ b/WebCore/svg/SVGURIReference.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGUnitTypes.h b/WebCore/svg/SVGUnitTypes.h
index b639f29..d30132c 100644
--- a/WebCore/svg/SVGUnitTypes.h
+++ b/WebCore/svg/SVGUnitTypes.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGUnitTypes_h
#define SVGUnitTypes_h
@@ -38,9 +38,9 @@ private:
SVGUnitTypes() { }
};
-} // namespace WebCore
+static inline SVGUnitTypes::SVGUnitType toUnitType(int type) { return static_cast<SVGUnitTypes::SVGUnitType>(type); }
-#endif // ENABLE(SVG)
-#endif // SVGUnitTypes_h
+}
-// vim:ts=4:noet
+#endif
+#endif
diff --git a/WebCore/svg/SVGUnitTypes.idl b/WebCore/svg/SVGUnitTypes.idl
index 9095e7a..6eb3919 100644
--- a/WebCore/svg/SVGUnitTypes.idl
+++ b/WebCore/svg/SVGUnitTypes.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp
index 2ce1bd1..68c087c 100644
--- a/WebCore/svg/SVGUseElement.cpp
+++ b/WebCore/svg/SVGUseElement.cpp
@@ -1,47 +1,47 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
- Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGUseElement.h"
+#include "Attribute.h"
#include "CSSStyleSelector.h"
-#include "CString.h"
#include "Document.h"
#include "Event.h"
#include "EventListener.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "NodeRenderStyle.h"
#include "RegisteredEventListener.h"
+#include "RenderSVGResource.h"
#include "RenderSVGShadowTreeRootContainer.h"
#include "SVGElementInstance.h"
#include "SVGElementInstanceList.h"
#include "SVGGElement.h"
#include "SVGLength.h"
#include "SVGPreserveAspectRatio.h"
-#include "SVGShadowTreeElements.h"
#include "SVGSMILElement.h"
#include "SVGSVGElement.h"
+#include "SVGShadowTreeElements.h"
#include "SVGSymbolElement.h"
#include "XLinkNames.h"
#include "XMLSerializer.h"
@@ -64,6 +64,7 @@ SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* doc)
, m_y(LengthModeHeight)
, m_width(LengthModeWidth)
, m_height(LengthModeHeight)
+ , m_updatesBlocked(false)
, m_isPendingResource(false)
, m_needsShadowTreeRecreation(false)
{
@@ -91,7 +92,7 @@ SVGElementInstance* SVGUseElement::animatedInstanceRoot() const
return 0;
}
-void SVGUseElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGUseElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
@@ -121,7 +122,7 @@ void SVGUseElement::parseMappedAttribute(MappedAttribute* attr)
void SVGUseElement::insertedIntoDocument()
{
// This functions exists to assure assumptions made in the code regarding SVGElementInstance creation/destruction are satisfied.
- SVGElement::insertedIntoDocument();
+ SVGStyledTransformableElement::insertedIntoDocument();
ASSERT(!m_targetElementInstance);
ASSERT(!m_isPendingResource);
}
@@ -129,14 +130,21 @@ void SVGUseElement::insertedIntoDocument()
void SVGUseElement::removedFromDocument()
{
m_targetElementInstance = 0;
- SVGElement::removedFromDocument();
+ SVGStyledTransformableElement::removedFromDocument();
}
void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
- if (!renderer())
+ bool isXYAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr;
+ bool isWidthHeightAttribute = attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr;
+
+ if (isXYAttribute || isWidthHeightAttribute)
+ updateRelativeLengthsInformation();
+
+ RenderObject* object = renderer();
+ if (!object)
return;
if (SVGURIReference::isKnownAttribute(attrName)) {
@@ -150,12 +158,12 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
+ if (isXYAttribute) {
updateContainerOffsets();
return;
}
- if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
+ if (isWidthHeightAttribute) {
updateContainerSizes();
return;
}
@@ -166,12 +174,16 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
+ if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ object->setNeedsTransformUpdate();
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
+ return;
+ }
+
if (SVGTests::isKnownAttribute(attrName)
|| SVGLangSpace::isKnownAttribute(attrName)
- || SVGExternalResourcesRequired::isKnownAttribute(attrName)
- || SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ || SVGExternalResourcesRequired::isKnownAttribute(attrName))
invalidateShadowTree();
- }
}
void SVGUseElement::synchronizeProperty(const QualifiedName& attrName)
@@ -246,8 +258,8 @@ void SVGUseElement::updateContainerSizes()
// Update whole subtree, scanning for shadow container elements, that correspond to <svg>/<symbol> tags
updateContainerSize(this, m_targetElementInstance.get());
- if (renderer())
- renderer()->setNeedsLayout(true);
+ if (RenderObject* object = renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
}
static void updateContainerOffset(SVGElementInstance* targetInstance)
@@ -298,20 +310,24 @@ void SVGUseElement::updateContainerOffsets()
// Update whole subtree, scanning for shadow container elements, marking a cloned use subtree
updateContainerOffset(m_targetElementInstance.get());
- if (renderer())
- renderer()->setNeedsLayout(true);
+ if (RenderObject* object = renderer())
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
}
void SVGUseElement::recalcStyle(StyleChange change)
{
// Eventually mark shadow root element needing style recalc
- if (needsStyleRecalc() && m_targetElementInstance) {
+ if (needsStyleRecalc() && m_targetElementInstance && !m_updatesBlocked) {
if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement())
shadowRoot->setNeedsStyleRecalc();
}
SVGStyledTransformableElement::recalcStyle(change);
+ // Assure that the shadow tree has not been marked for recreation, while we're building it.
+ if (m_updatesBlocked)
+ ASSERT(!m_needsShadowTreeRecreation);
+
bool needsStyleUpdate = !m_needsShadowTreeRecreation;
if (m_needsShadowTreeRecreation) {
static_cast<RenderSVGShadowTreeRootContainer*>(renderer())->markShadowTreeForRecreation();
@@ -339,7 +355,7 @@ void dumpInstanceTree(unsigned int& depth, String& text, SVGElementInstance* tar
SVGElement* shadowTreeElement = targetInstance->shadowTreeElement();
ASSERT(shadowTreeElement);
- String elementId = element->getIDAttribute();
+ String elementId = element->getIdAttribute();
String elementNodeName = element->nodeName();
String shadowTreeElementNodeName = shadowTreeElement->nodeName();
String parentNodeName = element->parentNode() ? element->parentNode()->nodeName() : "null";
@@ -414,7 +430,7 @@ void SVGUseElement::buildPendingResource()
ASSERT(!m_targetElementInstance);
if (!targetElement) {
- if (m_isPendingResource)
+ if (m_isPendingResource || id.isEmpty())
return;
m_isPendingResource = true;
@@ -432,9 +448,34 @@ void SVGUseElement::buildPendingResource()
void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowRoot)
{
+ struct ShadowTreeUpdateBlocker {
+ ShadowTreeUpdateBlocker(SVGUseElement* currentUseElement)
+ : useElement(currentUseElement)
+ {
+ useElement->setUpdatesBlocked(true);
+ }
+
+ ~ShadowTreeUpdateBlocker()
+ {
+ useElement->setUpdatesBlocked(false);
+ }
+
+ SVGUseElement* useElement;
+ };
+
+ // When cloning the target nodes, they may decide to synchronize style and/or animated SVG attributes.
+ // That causes calls to SVGElementInstance::updateAllInstancesOfElement(), which mark the shadow tree for recreation.
+ // Solution: block any updates to the shadow tree while we're building it.
+ ShadowTreeUpdateBlocker blocker(this);
+
String id = SVGURIReference::getTarget(href());
Element* targetElement = document()->getElementById(id);
- ASSERT(targetElement);
+ if (!targetElement) {
+ // The only time we should get here is when the use element has not been
+ // given a resource to target.
+ ASSERT(m_resourceId.isEmpty());
+ return;
+ }
// Do not build the shadow/instance tree for <use> elements living in a shadow tree.
// The will be expanded soon anyway - see expandUseElementsInShadowTree().
@@ -544,6 +585,9 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR
// Update container offset/size
updateContainerOffsets();
updateContainerSizes();
+
+ // Update relative length information
+ updateRelativeLengthsInformation();
}
RenderObject* SVGUseElement::createRenderer(RenderArena* arena, RenderStyle*)
@@ -567,8 +611,8 @@ void SVGUseElement::attach()
void SVGUseElement::detach()
{
- SVGStyledTransformableElement::detach();
m_targetElementInstance = 0;
+ SVGStyledTransformableElement::detach();
}
static bool isDirectReference(Node* n)
@@ -592,13 +636,29 @@ Path SVGUseElement::toClipPath() const
if (!isDirectReference(n))
// Spec: Indirect references are an error (14.3.5)
document()->accessSVGExtensions()->reportError("Not allowed to use indirect reference in <clip-path>");
- else
- return static_cast<SVGStyledTransformableElement*>(n)->toClipPath();
+ else {
+ Path clipPath = static_cast<SVGStyledTransformableElement*>(n)->toClipPath();
+ clipPath.translate(FloatSize(x().value(this), y().value(this)));
+ clipPath.transform(animatedLocalTransform());
+ return clipPath;
+ }
}
return Path();
}
+RenderObject* SVGUseElement::rendererClipChild() const
+{
+ Node* n = m_targetElementInstance ? m_targetElementInstance->shadowTreeElement() : 0;
+ if (!n)
+ return 0;
+
+ if (n->isSVGElement() && isDirectReference(n))
+ return static_cast<SVGElement*>(n)->renderer();
+
+ return 0;
+}
+
void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem)
{
ASSERT(target);
@@ -657,7 +717,8 @@ void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInsta
while (instance) {
SVGElement* element = instance->correspondingElement();
- if (element->getIDAttribute() == id) {
+ // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution.
+ if (element->hasID() && element->idForStyleResolution() == id) {
foundProblem = true;
return;
}
@@ -736,27 +797,15 @@ void SVGUseElement::expandUseElementsInShadowTree(SVGShadowTreeRootElement* shad
target = static_cast<SVGElement*>(targetElement);
// Don't ASSERT(target) here, it may be "pending", too.
- if (target) {
- // Setup sub-shadow tree root node
- RefPtr<SVGShadowTreeContainerElement> cloneParent = new SVGShadowTreeContainerElement(document());
-
- // Spec: In the generated content, the 'use' will be replaced by 'g', where all attributes from the
- // 'use' element except for x, y, width, height and xlink:href are transferred to the generated 'g' element.
- transferUseAttributesToReplacedElement(use, cloneParent.get());
-
- ExceptionCode ec = 0;
-
- // For instance <use> on <foreignObject> (direct case).
- if (isDisallowedElement(target)) {
- // We still have to setup the <use> replacment (<g>). Otherwhise
- // associateInstancesWithShadowTreeElements() makes wrong assumptions.
- // Replace <use> with referenced content.
- ASSERT(use->parentNode());
- use->parentNode()->replaceChild(cloneParent.release(), use, ec);
- ASSERT(!ec);
- return;
- }
+ // Setup sub-shadow tree root node
+ RefPtr<SVGShadowTreeContainerElement> cloneParent = new SVGShadowTreeContainerElement(document());
+
+ // Spec: In the generated content, the 'use' will be replaced by 'g', where all attributes from the
+ // 'use' element except for x, y, width, height and xlink:href are transferred to the generated 'g' element.
+ transferUseAttributesToReplacedElement(use, cloneParent.get());
+ ExceptionCode ec = 0;
+ if (target && !isDisallowedElement(target)) {
RefPtr<Element> newChild = target->cloneElementWithChildren();
// We don't walk the target tree element-by-element, and clone each element,
@@ -774,16 +823,16 @@ void SVGUseElement::expandUseElementsInShadowTree(SVGShadowTreeRootElement* shad
cloneParent->appendChild(newChild.release(), ec);
ASSERT(!ec);
+ }
- // Replace <use> with referenced content.
- ASSERT(use->parentNode());
- use->parentNode()->replaceChild(cloneParent.release(), use, ec);
- ASSERT(!ec);
+ // Replace <use> with referenced content.
+ ASSERT(use->parentNode());
+ use->parentNode()->replaceChild(cloneParent.release(), use, ec);
+ ASSERT(!ec);
- // Immediately stop here, and restart expanding.
- expandUseElementsInShadowTree(shadowRoot, shadowRoot);
- return;
- }
+ // Immediately stop here, and restart expanding.
+ expandUseElementsInShadowTree(shadowRoot, shadowRoot);
+ return;
}
for (RefPtr<Node> child = element->firstChild(); child; child = child->nextSibling())
@@ -937,6 +986,10 @@ SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element, S
void SVGUseElement::invalidateShadowTree()
{
+ // Don't mutate the shadow tree while we're building it.
+ if (m_updatesBlocked)
+ return;
+
m_needsShadowTreeRecreation = true;
setNeedsStyleRecalc();
}
@@ -966,9 +1019,22 @@ void SVGUseElement::transferUseAttributesToReplacedElement(SVGElement* from, SVG
ASSERT(!ec);
}
-bool SVGUseElement::hasRelativeValues() const
+bool SVGUseElement::selfHasRelativeLengths() const
{
- return x().isRelative() || y().isRelative() || width().isRelative() || height().isRelative();
+ if (x().isRelative()
+ || y().isRelative()
+ || width().isRelative()
+ || height().isRelative())
+ return true;
+
+ if (!m_targetElementInstance)
+ return false;
+
+ SVGElement* element = m_targetElementInstance->correspondingElement();
+ if (!element || !element->isStyled())
+ return false;
+
+ return static_cast<SVGStyledElement*>(element)->hasRelativeLengths();
}
}
diff --git a/WebCore/svg/SVGUseElement.h b/WebCore/svg/SVGUseElement.h
index 6fb3925..52f3f6e 100644
--- a/WebCore/svg/SVGUseElement.h
+++ b/WebCore/svg/SVGUseElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGUseElement_h
#define SVGUseElement_h
@@ -52,7 +52,7 @@ namespace WebCore {
virtual void removedFromDocument();
virtual void buildPendingResource();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
@@ -62,18 +62,21 @@ namespace WebCore {
virtual void detach();
virtual Path toClipPath() const;
+ RenderObject* rendererClipChild() const;
static void removeDisallowedElementsFromSubtree(Node* element);
SVGElementInstance* instanceForShadowTreeElement(Node* element) const;
void invalidateShadowTree();
+ void setUpdatesBlocked(bool blocked) { m_updatesBlocked = blocked; }
+
private:
friend class RenderSVGShadowTreeRootContainer;
bool isPendingResource() const { return m_isPendingResource; }
void buildShadowAndInstanceTree(SVGShadowTreeRootElement*);
private:
- virtual bool hasRelativeValues() const;
+ virtual bool selfHasRelativeLengths() const;
DECLARE_ANIMATED_PROPERTY(SVGUseElement, SVGNames::xAttr, SVGLength, X, x)
DECLARE_ANIMATED_PROPERTY(SVGUseElement, SVGNames::yAttr, SVGLength, Y, y)
@@ -109,6 +112,7 @@ namespace WebCore {
void updateContainerOffsets();
void updateContainerSizes();
+ bool m_updatesBlocked;
bool m_isPendingResource;
bool m_needsShadowTreeRecreation;
String m_resourceId;
diff --git a/WebCore/svg/SVGUseElement.idl b/WebCore/svg/SVGUseElement.idl
index 0b3652d..6c1cf12 100644
--- a/WebCore/svg/SVGUseElement.idl
+++ b/WebCore/svg/SVGUseElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGVKernElement.cpp b/WebCore/svg/SVGVKernElement.cpp
new file mode 100644
index 0000000..662f714
--- /dev/null
+++ b/WebCore/svg/SVGVKernElement.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG_FONTS)
+#include "SVGVKernElement.h"
+
+#include "SVGFontData.h"
+#include "SVGFontElement.h"
+#include "SVGFontFaceElement.h"
+#include "SVGNames.h"
+#include "SimpleFontData.h"
+#include "XMLNames.h"
+
+namespace WebCore {
+
+using namespace SVGNames;
+
+SVGVKernElement::SVGVKernElement(const QualifiedName& tagName, Document* doc)
+ : SVGElement(tagName, doc)
+{
+}
+
+SVGVKernElement::~SVGVKernElement()
+{
+}
+
+void SVGVKernElement::insertedIntoDocument()
+{
+ Node* fontNode = parentNode();
+ if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
+ if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
+ element->invalidateGlyphCache();
+ }
+}
+
+void SVGVKernElement::removedFromDocument()
+{
+ Node* fontNode = parentNode();
+ if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
+ if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
+ element->invalidateGlyphCache();
+ }
+}
+
+void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs)
+{
+ String u1 = getAttribute(u1Attr);
+ String g1 = getAttribute(g1Attr);
+ String u2 = getAttribute(u2Attr);
+ String g2 = getAttribute(g2Attr);
+ if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty()))
+ return;
+
+ SVGKerningPair kerningPair;
+ if (parseGlyphName(g1, kerningPair.glyphName1)
+ && parseGlyphName(g2, kerningPair.glyphName2)
+ && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1)
+ && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2)) {
+ kerningPair.kerning = getAttribute(kAttr).string().toFloat();
+ kerningPairs.append(kerningPair);
+ }
+}
+
+}
+
+#endif // ENABLE(SVG_FONTS)
diff --git a/WebCore/svg/SVGVKernElement.h b/WebCore/svg/SVGVKernElement.h
new file mode 100644
index 0000000..c4bc90f
--- /dev/null
+++ b/WebCore/svg/SVGVKernElement.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGVKernElement_h
+#define SVGVKernElement_h
+
+#if ENABLE(SVG_FONTS)
+#include "SVGFontElement.h"
+#include "SVGParserUtilities.h"
+#include "SVGStyledElement.h"
+#include <wtf/Forward.h>
+
+#include <limits>
+
+namespace WebCore {
+
+class SVGFontData;
+
+class SVGVKernElement : public SVGElement {
+public:
+ SVGVKernElement(const QualifiedName&, Document*);
+ virtual ~SVGVKernElement();
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+
+ void buildVerticalKerningPair(KerningPairVector&);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG_FONTS)
+#endif
diff --git a/WebCore/svg/SVGVKernElement.idl b/WebCore/svg/SVGVKernElement.idl
new file mode 100644
index 0000000..8280da1
--- /dev/null
+++ b/WebCore/svg/SVGVKernElement.idl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+module svg {
+
+ interface [Conditional=SVG&SVG_FONTS] SVGVKernElement : SVGElement {
+ };
+
+}
diff --git a/WebCore/svg/SVGViewElement.cpp b/WebCore/svg/SVGViewElement.cpp
index aba7283..2b9b6cc 100644
--- a/WebCore/svg/SVGViewElement.cpp
+++ b/WebCore/svg/SVGViewElement.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -24,7 +24,6 @@
#include "SVGViewElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
#include "PlatformString.h"
#include "SVGFitToViewBox.h"
#include "SVGNames.h"
@@ -53,7 +52,7 @@ SVGStringList* SVGViewElement::viewTarget() const
return m_viewTarget.get();
}
-void SVGViewElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGViewElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::viewTargetAttr)
viewTarget()->reset(attr->value());
diff --git a/WebCore/svg/SVGViewElement.h b/WebCore/svg/SVGViewElement.h
index f913fcd..14ea19e 100644
--- a/WebCore/svg/SVGViewElement.h
+++ b/WebCore/svg/SVGViewElement.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGViewElement_h
#define SVGViewElement_h
@@ -38,7 +38,7 @@ namespace WebCore {
SVGViewElement(const QualifiedName&, Document*);
virtual ~SVGViewElement();
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void synchronizeProperty(const QualifiedName&);
SVGStringList* viewTarget() const;
diff --git a/WebCore/svg/SVGViewElement.idl b/WebCore/svg/SVGViewElement.idl
index b80868a..2365438 100644
--- a/WebCore/svg/SVGViewElement.idl
+++ b/WebCore/svg/SVGViewElement.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp
index 608bdbf..25fb66b 100644
--- a/WebCore/svg/SVGViewSpec.cpp
+++ b/WebCore/svg/SVGViewSpec.cpp
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
@@ -48,14 +48,14 @@ void SVGViewSpec::setTransform(const String& transform)
SVGTransformable::parseTransformAttribute(m_transform.get(), transform);
}
-void SVGViewSpec::setViewBoxString(const String& viewBox)
+void SVGViewSpec::setViewBoxString(const String& viewBoxStr)
{
- float x, y, w, h;
- const UChar* c = viewBox.characters();
- const UChar* end = c + viewBox.length();
- if (!parseViewBox(m_contextElement->document(), c, end, x, y, w, h, false))
- return;
- setViewBoxBaseValue(FloatRect(x, y, w, h));
+ FloatRect viewBox;
+ const UChar* c = viewBoxStr.characters();
+ const UChar* end = c + viewBoxStr.length();
+ if (!parseViewBox(m_contextElement->document(), c, end, viewBox, false))
+ return;
+ setViewBoxBaseValue(viewBox);
}
void SVGViewSpec::setPreserveAspectRatioString(const String& preserve)
@@ -101,10 +101,10 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
- float x, y, w, h;
- if (!parseViewBox(m_contextElement->document(), currViewSpec, end, x, y, w, h, false))
+ FloatRect viewBox;
+ if (!parseViewBox(m_contextElement->document(), currViewSpec, end, viewBox, false))
return false;
- setViewBoxBaseValue(FloatRect(x, y, w, h));
+ setViewBoxBaseValue(viewBox);
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
diff --git a/WebCore/svg/SVGViewSpec.h b/WebCore/svg/SVGViewSpec.h
index 12358dc..3355fce 100644
--- a/WebCore/svg/SVGViewSpec.h
+++ b/WebCore/svg/SVGViewSpec.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGViewSpec_h
#define SVGViewSpec_h
diff --git a/WebCore/svg/SVGViewSpec.idl b/WebCore/svg/SVGViewSpec.idl
index 24d18f8..e58ca37 100644
--- a/WebCore/svg/SVGViewSpec.idl
+++ b/WebCore/svg/SVGViewSpec.idl
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGZoomAndPan.cpp b/WebCore/svg/SVGZoomAndPan.cpp
index b1ea995..d256bd0 100644
--- a/WebCore/svg/SVGZoomAndPan.cpp
+++ b/WebCore/svg/SVGZoomAndPan.cpp
@@ -1,29 +1,29 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
#include "SVGZoomAndPan.h"
-#include "MappedAttribute.h"
+#include "Attribute.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -48,7 +48,7 @@ void SVGZoomAndPan::setZoomAndPan(unsigned short zoomAndPan)
m_zoomAndPan = zoomAndPan;
}
-bool SVGZoomAndPan::parseMappedAttribute(MappedAttribute* attr)
+bool SVGZoomAndPan::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::zoomAndPanAttr) {
const UChar* start = attr->value().characters();
diff --git a/WebCore/svg/SVGZoomAndPan.h b/WebCore/svg/SVGZoomAndPan.h
index c11f8e2..a85304d 100644
--- a/WebCore/svg/SVGZoomAndPan.h
+++ b/WebCore/svg/SVGZoomAndPan.h
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGZoomAndPan_h
#define SVGZoomAndPan_h
@@ -26,7 +26,7 @@
namespace WebCore {
- class MappedAttribute;
+ class Attribute;
class QualifiedName;
class SVGZoomAndPan {
@@ -43,7 +43,7 @@ namespace WebCore {
unsigned short zoomAndPan() const;
virtual void setZoomAndPan(unsigned short zoomAndPan);
- bool parseMappedAttribute(MappedAttribute*);
+ bool parseMappedAttribute(Attribute*);
bool isKnownAttribute(const QualifiedName&);
bool parseZoomAndPan(const UChar*& start, const UChar* end);
diff --git a/WebCore/svg/SVGZoomAndPan.idl b/WebCore/svg/SVGZoomAndPan.idl
index bd738f3..8135852 100644
--- a/WebCore/svg/SVGZoomAndPan.idl
+++ b/WebCore/svg/SVGZoomAndPan.idl
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/svg/SVGZoomEvent.cpp b/WebCore/svg/SVGZoomEvent.cpp
index 92609b1..f8d94e4 100644
--- a/WebCore/svg/SVGZoomEvent.cpp
+++ b/WebCore/svg/SVGZoomEvent.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG)
diff --git a/WebCore/svg/SVGZoomEvent.h b/WebCore/svg/SVGZoomEvent.h
index a16f131..d4b7de0 100644
--- a/WebCore/svg/SVGZoomEvent.h
+++ b/WebCore/svg/SVGZoomEvent.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
- Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGZoomEvent_h
#define SVGZoomEvent_h
diff --git a/WebCore/svg/SVGZoomEvent.idl b/WebCore/svg/SVGZoomEvent.idl
index 8327bef..520f202 100644
--- a/WebCore/svg/SVGZoomEvent.idl
+++ b/WebCore/svg/SVGZoomEvent.idl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -25,7 +25,7 @@
module svg {
- interface [Conditional=SVG] SVGZoomEvent : events::UIEvent {
+ interface [Conditional=SVG] SVGZoomEvent : UIEvent {
readonly attribute [Immutable] SVGRect zoomRectScreen;
readonly attribute float previousScale;
readonly attribute [Immutable] SVGPoint previousTranslate;
diff --git a/WebCore/svg/animation/SMILTime.cpp b/WebCore/svg/animation/SMILTime.cpp
index 44e96a2..3ae1bfb 100644
--- a/WebCore/svg/animation/SMILTime.cpp
+++ b/WebCore/svg/animation/SMILTime.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/WebCore/svg/animation/SMILTime.h b/WebCore/svg/animation/SMILTime.h
index ebbd765..ec61a08 100644
--- a/WebCore/svg/animation/SMILTime.h
+++ b/WebCore/svg/animation/SMILTime.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/WebCore/svg/animation/SMILTimeContainer.cpp b/WebCore/svg/animation/SMILTimeContainer.cpp
index f0b479d..b9f210e 100644
--- a/WebCore/svg/animation/SMILTimeContainer.cpp
+++ b/WebCore/svg/animation/SMILTimeContainer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -236,7 +236,8 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed)
ASSERT(animation->timeContainer() == this);
SVGElement* targetElement = animation->targetElement();
- if (!targetElement || targetElement->getIDAttribute() != m_nextSamplingTarget)
+ // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution.
+ if (!targetElement || !targetElement->hasID() || targetElement->idForStyleResolution() != m_nextSamplingTarget)
continue;
samplingDiff = animation->intervalBegin();
diff --git a/WebCore/svg/animation/SMILTimeContainer.h b/WebCore/svg/animation/SMILTimeContainer.h
index e11cc6f..4664c68 100644
--- a/WebCore/svg/animation/SMILTimeContainer.h
+++ b/WebCore/svg/animation/SMILTimeContainer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,19 +23,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SMILTimeContainer_H
-#define SMILTimeContainer_H
+#ifndef SMILTimeContainer_h
+#define SMILTimeContainer_h
#if ENABLE(SVG)
#include "PlatformString.h"
#include "SMILTime.h"
-#include "StringHash.h"
#include "Timer.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/svg/animation/SVGSMILElement.cpp b/WebCore/svg/animation/SVGSMILElement.cpp
index 3957b81..99a5189 100644
--- a/WebCore/svg/animation/SVGSMILElement.cpp
+++ b/WebCore/svg/animation/SVGSMILElement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
#if ENABLE(SVG_ANIMATION)
#include "SVGSMILElement.h"
+#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "Event.h"
@@ -35,7 +36,6 @@
#include "FloatConversion.h"
#include "FrameView.h"
#include "HTMLNames.h"
-#include "MappedAttribute.h"
#include "SMILTimeContainer.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -56,9 +56,9 @@ static const double invalidCachedTime = -1.;
class ConditionEventListener : public EventListener {
public:
- static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation, Element* eventBase, SVGSMILElement::Condition* condition)
+ static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation, SVGSMILElement::Condition* condition)
{
- return adoptRef(new ConditionEventListener(animation, eventBase, condition));
+ return adoptRef(new ConditionEventListener(animation, condition));
}
static const ConditionEventListener* cast(const EventListener* listener)
@@ -69,42 +69,38 @@ public:
}
virtual bool operator==(const EventListener& other);
-
- void unregister()
+
+ void disconnectAnimation()
{
- // If this has only one ref then the event base is dead already and we don't need to remove ourself.
- if (!hasOneRef())
- m_eventBase->removeEventListener(m_condition->m_name, this, false);
+ m_animation = 0;
}
private:
- ConditionEventListener(SVGSMILElement* animation, Element* eventBase, SVGSMILElement::Condition* condition)
+ ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition* condition)
: EventListener(ConditionEventListenerType)
, m_animation(animation)
, m_condition(condition)
- , m_eventBase(eventBase)
{
- m_eventBase->addEventListener(m_condition->m_name, this, false);
}
virtual void handleEvent(ScriptExecutionContext*, Event*);
SVGSMILElement* m_animation;
SVGSMILElement::Condition* m_condition;
- Element* m_eventBase;
};
bool ConditionEventListener::operator==(const EventListener& listener)
{
if (const ConditionEventListener* conditionEventListener = ConditionEventListener::cast(&listener))
- return m_animation == conditionEventListener->m_animation
- && m_condition == conditionEventListener->m_condition
- && m_eventBase == conditionEventListener->m_eventBase;
+ return m_animation == conditionEventListener->m_animation &&
+ m_condition == conditionEventListener->m_condition;
return false;
}
void ConditionEventListener::handleEvent(ScriptExecutionContext*, Event* event)
{
+ if (!m_animation)
+ return;
m_animation->handleConditionEvent(event, m_condition);
}
@@ -223,8 +219,8 @@ SMILTime SVGSMILElement::parseClockValue(const String& data)
double result = 0;
bool ok;
- int doublePointOne = parse.find(':');
- int doublePointTwo = parse.find(':', doublePointOne + 1);
+ size_t doublePointOne = parse.find(':');
+ size_t doublePointTwo = parse.find(':', doublePointOne + 1);
if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) {
result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60;
if (!ok)
@@ -233,7 +229,7 @@ SMILTime SVGSMILElement::parseClockValue(const String& data)
if (!ok)
return SMILTime::unresolved();
result += parse.substring(6).toDouble(&ok);
- } else if (doublePointOne == 2 && doublePointTwo == -1 && parse.length() >= 5) {
+ } else if (doublePointOne == 2 && doublePointTwo == notFound && parse.length() >= 5) {
result += parse.substring(0, 2).toUIntStrict(&ok) * 60;
if (!ok)
return SMILTime::unresolved();
@@ -257,15 +253,15 @@ bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd)
double sign = 1.;
bool ok;
- int pos = parseString.find('+');
- if (pos == -1) {
+ size_t pos = parseString.find('+');
+ if (pos == notFound) {
pos = parseString.find('-');
- if (pos != -1)
+ if (pos != notFound)
sign = -1.;
}
String conditionString;
SMILTime offset = 0;
- if (pos == -1)
+ if (pos == notFound)
conditionString = parseString;
else {
conditionString = parseString.left(pos).stripWhiteSpace();
@@ -281,7 +277,7 @@ bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd)
String baseID;
String nameString;
- if (pos == -1)
+ if (pos == notFound)
nameString = conditionString;
else {
baseID = conditionString.left(pos);
@@ -346,7 +342,7 @@ void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin
sortTimeList(timeList);
}
-void SVGSMILElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGSMILElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == SVGNames::beginAttr) {
if (!m_conditions.isEmpty()) {
@@ -394,6 +390,11 @@ void SVGSMILElement::attributeChanged(Attribute* attr, bool preserveDecls)
}
}
+inline Element* SVGSMILElement::eventBaseFor(const Condition& condition) const
+{
+ return condition.m_baseID.isEmpty() ? targetElement() : document()->getElementById(condition.m_baseID);
+}
+
void SVGSMILElement::connectConditions()
{
if (m_conditionsConnected)
@@ -403,11 +404,12 @@ void SVGSMILElement::connectConditions()
Condition& condition = m_conditions[n];
if (condition.m_type == Condition::EventBase) {
ASSERT(!condition.m_syncbase);
- Element* eventBase = condition.m_baseID.isEmpty() ? targetElement() : document()->getElementById(condition.m_baseID);
+ Element* eventBase = eventBaseFor(condition);
if (!eventBase)
continue;
ASSERT(!condition.m_eventListener);
- condition.m_eventListener = ConditionEventListener::create(this, eventBase, &condition);
+ condition.m_eventListener = ConditionEventListener::create(this, &condition);
+ eventBase->addEventListener(condition.m_name, condition.m_eventListener, false);
} else if (condition.m_type == Condition::Syncbase) {
ASSERT(!condition.m_baseID.isEmpty());
condition.m_syncbase = document()->getElementById(condition.m_baseID);
@@ -430,10 +432,18 @@ void SVGSMILElement::disconnectConditions()
Condition& condition = m_conditions[n];
if (condition.m_type == Condition::EventBase) {
ASSERT(!condition.m_syncbase);
- if (condition.m_eventListener) {
- condition.m_eventListener->unregister();
- condition.m_eventListener = 0;
- }
+ if (!condition.m_eventListener)
+ continue;
+ // Note: It's a memory optimization to try to remove our condition
+ // event listener, but it's not guaranteed to work, since we have
+ // no guarantee that eventBaseFor() will be able to find our condition's
+ // original eventBase. So, we also have to disconnect ourselves from
+ // our condition event listener, in case it later fires.
+ Element* eventBase = eventBaseFor(condition);
+ if (eventBase)
+ eventBase->removeEventListener(condition.m_name, condition.m_eventListener.get(), false);
+ condition.m_eventListener->disconnectAnimation();
+ condition.m_eventListener = 0;
} else if (condition.m_type == Condition::Syncbase) {
if (condition.m_syncbase) {
ASSERT(isSMILElement(condition.m_syncbase.get()));
diff --git a/WebCore/svg/animation/SVGSMILElement.h b/WebCore/svg/animation/SVGSMILElement.h
index b61f20d..ed8bbf8 100644
--- a/WebCore/svg/animation/SVGSMILElement.h
+++ b/WebCore/svg/animation/SVGSMILElement.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,7 +45,7 @@ namespace WebCore {
static bool isSMILElement(Node* node);
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(Attribute*);
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
@@ -133,7 +133,8 @@ private:
};
bool parseCondition(const String&, BeginOrEnd beginOrEnd);
void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd);
-
+ Element* eventBaseFor(const Condition&) const;
+
void connectConditions();
void disconnectConditions();
diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp
index 348df4f..6608c9e 100644
--- a/WebCore/svg/graphics/SVGImage.cpp
+++ b/WebCore/svg/graphics/SVGImage.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
+ * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -70,7 +70,7 @@ private:
m_image = 0;
}
- virtual void repaint(const IntRect& r, bool, bool, bool)
+ virtual void invalidateContentsAndWindow(const IntRect& r, bool)
{
if (m_image && m_image->imageObserver())
m_image->imageObserver()->changedInRect(m_image, r);
@@ -186,13 +186,22 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
context->clip(enclosingIntRect(dstRect));
if (compositeOp != CompositeSourceOver)
context->beginTransparencyLayer(1);
- context->translate(dstRect.location().x(), dstRect.location().y());
- context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()));
+
+ FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height());
+
+ // We can only draw the entire frame, clipped to the rect we want. So compute where the top left
+ // of the image would be if we were drawing without clipping, and translate accordingly.
+ FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height());
+ FloatPoint destOffset = dstRect.location() - topLeftOffset;
+
+ context->translate(destOffset.x(), destOffset.y());
+ context->scale(scale);
view->resize(size());
if (view->needsLayout())
view->layout();
+
view->paint(context, IntRect(0, 0, view->width(), view->height()));
if (compositeOp != CompositeSourceOver)
@@ -212,12 +221,13 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame()
if (!m_frameCache) {
if (!m_page)
return 0;
- m_frameCache = ImageBuffer::create(size());
- if (!m_frameCache) // failed to allocate image
+ OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size());
+ if (!buffer) // failed to allocate image
return 0;
- renderSubtreeToImage(m_frameCache.get(), m_page->mainFrame()->contentRenderer());
+ draw(buffer->context(), rect(), rect(), DeviceColorSpace, CompositeSourceOver);
+ m_frameCache = buffer->copyImage();
}
- return m_frameCache->image()->nativeImageForCurrentFrame();
+ return m_frameCache->nativeImageForCurrentFrame();
}
bool SVGImage::dataChanged(bool allDataReceived)
@@ -228,25 +238,34 @@ bool SVGImage::dataChanged(bool allDataReceived)
if (allDataReceived) {
static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient;
- static EditorClient* dummyEditorClient = new EmptyEditorClient;
+
+ Page::PageClients pageClients;
+ m_chromeClient.set(new SVGImageChromeClient(this));
+ pageClients.chromeClient = m_chromeClient.get();
#if ENABLE(CONTEXT_MENUS)
static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
-#else
- static ContextMenuClient* dummyContextMenuClient = 0;
+ pageClients.contextMenuClient = dummyContextMenuClient;
#endif
+ static EditorClient* dummyEditorClient = new EmptyEditorClient;
+ pageClients.editorClient = dummyEditorClient;
#if ENABLE(DRAG_SUPPORT)
static DragClient* dummyDragClient = new EmptyDragClient;
-#else
- static DragClient* dummyDragClient = 0;
+ pageClients.dragClient = dummyDragClient;
#endif
static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;
+ pageClients.inspectorClient = dummyInspectorClient;
+#if ENABLE(DEVICE_ORIENTATION)
+ static DeviceMotionClient* dummyDeviceMotionClient = new EmptyDeviceMotionClient;
+ pageClients.deviceMotionClient = dummyDeviceMotionClient;
+ static DeviceOrientationClient* dummyDeviceOrientationClient = new EmptyDeviceOrientationClient;
+ pageClients.deviceOrientationClient = dummyDeviceOrientationClient;
+#endif
- m_chromeClient.set(new SVGImageChromeClient(this));
-
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The comment said that the Cache code does not know about CachedImages
// holding Frames and won't know to break the cycle. But
- m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0, 0));
+ m_page.set(new Page(pageClients));
+ m_page->settings()->setMediaEnabled(false);
m_page->settings()->setJavaScriptEnabled(false);
m_page->settings()->setPluginsEnabled(false);
@@ -255,13 +274,14 @@ bool SVGImage::dataChanged(bool allDataReceived)
frame->init();
ResourceRequest fakeRequest(KURL(ParsedURLString, ""));
FrameLoader* loader = frame->loader();
+ loader->setForcedSandboxFlags(SandboxAll);
loader->load(fakeRequest, false); // Make sure the DocumentLoader is created
loader->policyChecker()->cancelCheck(); // cancel any policy checks
- loader->commitProvisionalLoad(0);
- loader->setResponseMIMEType("image/svg+xml");
- loader->begin(KURL()); // create the empty document
- loader->write(data()->data(), data()->size());
- loader->end();
+ loader->commitProvisionalLoad();
+ loader->writer()->setMIMEType("image/svg+xml");
+ loader->writer()->begin(KURL()); // create the empty document
+ loader->writer()->addData(data()->data(), data()->size());
+ loader->writer()->end();
frame->view()->setTransparent(true); // SVG Images are transparent.
}
diff --git a/WebCore/svg/graphics/SVGImage.h b/WebCore/svg/graphics/SVGImage.h
index a0414fe..01eae71 100644
--- a/WebCore/svg/graphics/SVGImage.h
+++ b/WebCore/svg/graphics/SVGImage.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
+ * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -33,7 +33,6 @@
namespace WebCore {
- class ImageBuffer;
class Page;
class SVGImageChromeClient;
@@ -72,7 +71,7 @@ namespace WebCore {
OwnPtr<SVGImageChromeClient> m_chromeClient;
OwnPtr<Page> m_page;
- OwnPtr<ImageBuffer> m_frameCache;
+ RefPtr<Image> m_frameCache;
};
}
diff --git a/WebCore/svg/graphics/SVGPaintServer.cpp b/WebCore/svg/graphics/SVGPaintServer.cpp
deleted file mode 100644
index fdb6581..0000000
--- a/WebCore/svg/graphics/SVGPaintServer.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 2007 Rob Buis <buis@kde.org>
- * 2008 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServer.h"
-
-#include "GraphicsContext.h"
-#include "NodeRenderStyle.h"
-#include "RenderObject.h"
-#include "RenderStyle.h"
-#include "SVGPaintServerSolid.h"
-#include "SVGStyledElement.h"
-#include "SVGURIReference.h"
-
-#if PLATFORM(SKIA) && !PLATFORM(ANDROID)
-#include "PlatformContextSkia.h"
-#endif
-
-namespace WebCore {
-
-SVGPaintServer::SVGPaintServer()
-{
-}
-
-SVGPaintServer::~SVGPaintServer()
-{
-}
-
-TextStream& operator<<(TextStream& ts, const SVGPaintServer& paintServer)
-{
- return paintServer.externalRepresentation(ts);
-}
-
-SVGPaintServer* getPaintServerById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- SVGResource* resource = getResourceById(document, id, object);
- if (resource && resource->isPaintServer())
- return static_cast<SVGPaintServer*>(resource);
-
- return 0;
-}
-
-SVGPaintServerSolid* SVGPaintServer::sharedSolidPaintServer()
-{
- static SVGPaintServerSolid* _sharedSolidPaintServer = SVGPaintServerSolid::create().releaseRef();
-
- return _sharedSolidPaintServer;
-}
-
-SVGPaintServer* SVGPaintServer::fillPaintServer(const RenderStyle* style, const RenderObject* item)
-{
- if (!style->svgStyle()->hasFill())
- return 0;
-
- SVGPaint* fill = style->svgStyle()->fillPaint();
-
- SVGPaintServer* fillPaintServer = 0;
- SVGPaint::SVGPaintType paintType = fill->paintType();
- if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
- paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
- AtomicString id(SVGURIReference::getTarget(fill->uri()));
- fillPaintServer = getPaintServerById(item->document(), id, item);
-
- SVGElement* svgElement = static_cast<SVGElement*>(item->node());
- ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
-
- if (item->isRenderPath() && fillPaintServer)
- fillPaintServer->addClient(static_cast<SVGStyledElement*>(svgElement));
- else if (!fillPaintServer && paintType == SVGPaint::SVG_PAINTTYPE_URI)
- svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement));
- }
- if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintServer) {
- fillPaintServer = sharedSolidPaintServer();
- SVGPaintServerSolid* fillPaintServerSolid = static_cast<SVGPaintServerSolid*>(fillPaintServer);
- if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
- fillPaintServerSolid->setColor(style->color());
- else
- fillPaintServerSolid->setColor(fill->color());
- // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT
- if (!fillPaintServerSolid->color().isValid())
- fillPaintServer = 0;
- }
- if (!fillPaintServer) {
- // default value (black), see bug 11017
- fillPaintServer = sharedSolidPaintServer();
- static_cast<SVGPaintServerSolid*>(fillPaintServer)->setColor(Color::black);
- }
- return fillPaintServer;
-}
-
-SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, const RenderObject* item)
-{
- if (!style->svgStyle()->hasStroke())
- return 0;
-
- SVGPaint* stroke = style->svgStyle()->strokePaint();
-
- SVGPaintServer* strokePaintServer = 0;
- SVGPaint::SVGPaintType paintType = stroke->paintType();
- if (paintType == SVGPaint::SVG_PAINTTYPE_URI ||
- paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
- AtomicString id(SVGURIReference::getTarget(stroke->uri()));
- strokePaintServer = getPaintServerById(item->document(), id, item);
-
- SVGElement* svgElement = static_cast<SVGElement*>(item->node());
- ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
-
- if (item->isRenderPath() && strokePaintServer)
- strokePaintServer->addClient(static_cast<SVGStyledElement*>(svgElement));
- else if (!strokePaintServer && paintType == SVGPaint::SVG_PAINTTYPE_URI)
- svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement));
- }
- if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintServer) {
- strokePaintServer = sharedSolidPaintServer();
- SVGPaintServerSolid* strokePaintServerSolid = static_cast<SVGPaintServerSolid*>(strokePaintServer);
- if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
- strokePaintServerSolid->setColor(style->color());
- else
- strokePaintServerSolid->setColor(stroke->color());
- // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT
- if (!strokePaintServerSolid->color().isValid())
- strokePaintServer = 0;
- }
-
- return strokePaintServer;
-}
-
-void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
-{
- context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
- context->setLineCap(style->svgStyle()->capStyle());
- context->setLineJoin(style->svgStyle()->joinStyle());
- if (style->svgStyle()->joinStyle() == MiterJoin)
- context->setMiterLimit(style->svgStyle()->strokeMiterLimit());
-
- const DashArray& dashes = dashArrayFromRenderingStyle(object->style(), object->document()->documentElement()->renderStyle());
- float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f);
- context->setLineDash(dashes, dashOffset);
-}
-
-bool SVGPaintServer::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
-{
- return setup(context, object, object ? object->style() : 0, type, isPaintingText);
-}
-
-void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
-{
- if (!setup(context, path, type))
- return;
-
- renderPath(context, path, type);
- teardown(context, path, type);
-}
-
-void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
-{
- const SVGRenderStyle* style = path ? path->style()->svgStyle() : 0;
-
- if ((type & ApplyToFillTargetType) && (!style || style->hasFill()))
- context->fillPath();
-
- if ((type & ApplyToStrokeTargetType) && (!style || style->hasStroke()))
- context->strokePath();
-}
-
-#if PLATFORM(SKIA) && !PLATFORM(ANDROID)
-void SVGPaintServer::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const
-{
- // FIXME: Move this into the GraphicsContext
- // WebKit implicitly expects us to reset the path.
- // For example in fillAndStrokePath() of RenderPath.cpp the path is
- // added back to the context after filling. This is because internally it
- // calls CGContextFillPath() which closes the path.
- context->beginPath();
- context->platformContext()->setFillShader(0);
- context->platformContext()->setStrokeShader(0);
-}
-#else
-void SVGPaintServer::teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool) const
-{
-}
-#endif
-
-DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)
-{
- DashArray array;
-
- CSSValueList* dashes = style->svgStyle()->strokeDashArray();
- if (dashes) {
- CSSPrimitiveValue* dash = 0;
- unsigned long len = dashes->length();
- for (unsigned long i = 0; i < len; i++) {
- dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
- if (!dash)
- continue;
-
- array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));
- }
- }
-
- return array;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGPaintServer.h b/WebCore/svg/graphics/SVGPaintServer.h
deleted file mode 100644
index d9d2218..0000000
--- a/WebCore/svg/graphics/SVGPaintServer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGPaintServer_h
-#define SVGPaintServer_h
-
-#if ENABLE(SVG)
-
-#include "DashArray.h"
-#include "RenderObject.h"
-#include "SVGResource.h"
-
-#if PLATFORM(CG)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-namespace WebCore {
-
- enum SVGPaintServerType {
- // Painting mode
- SolidPaintServer = 0,
- PatternPaintServer = 1,
- LinearGradientPaintServer = 2,
- RadialGradientPaintServer = 3
- };
-
- enum SVGPaintTargetType {
- // Target mode
- ApplyToFillTargetType = 1,
- ApplyToStrokeTargetType = 2
- };
-
- class GraphicsContext;
- class RenderObject;
- class RenderStyle;
- class SVGPaintServerSolid;
-
- class SVGPaintServer : public SVGResource {
- public:
- virtual ~SVGPaintServer();
-
- virtual SVGResourceType resourceType() const { return PaintServerResourceType; }
-
- virtual SVGPaintServerType type() const = 0;
- virtual TextStream& externalRepresentation(TextStream&) const = 0;
-
- // To be implemented in platform specific code.
- virtual void draw(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
- virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
- virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
-
- virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
-
- bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
-
- static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
- static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
- static SVGPaintServerSolid* sharedSolidPaintServer();
-
- protected:
- SVGPaintServer();
- };
-
- TextStream& operator<<(TextStream&, const SVGPaintServer&);
-
- SVGPaintServer* getPaintServerById(Document*, const AtomicString&, const RenderObject*);
-
- void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
- DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
-} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServer_h
diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp
deleted file mode 100644
index c4ed95b..0000000
--- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 2008 Eric Seidel <eric@webkit.org>
- * 2008 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServerGradient.h"
-
-#include "FloatConversion.h"
-#include "GraphicsContext.h"
-#include "ImageBuffer.h"
-#include "RenderObject.h"
-#include "RenderView.h"
-#include "SVGGradientElement.h"
-#include "SVGPaintServerLinearGradient.h"
-#include "SVGPaintServerRadialGradient.h"
-#include "SVGRenderSupport.h"
-#include "SVGRenderTreeAsText.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static TextStream& operator<<(TextStream& ts, GradientSpreadMethod m)
-{
- switch (m) {
- case SpreadMethodPad:
- ts << "PAD"; break;
- case SpreadMethodRepeat:
- ts << "REPEAT"; break;
- case SpreadMethodReflect:
- ts << "REFLECT"; break;
- }
-
- return ts;
-}
-
-static TextStream& operator<<(TextStream& ts, const Vector<SVGGradientStop>& l)
-{
- ts << "[";
- for (Vector<SVGGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) {
- ts << "(" << it->first << "," << it->second << ")";
- if (it + 1 != l.end())
- ts << ", ";
- }
- ts << "]";
- return ts;
-}
-
-SVGPaintServerGradient::SVGPaintServerGradient(const SVGGradientElement* owner)
- : m_boundingBoxMode(true)
- , m_ownerElement(owner)
-#if PLATFORM(CG)
- , m_savedContext(0)
- , m_imageBuffer(0)
-#endif
-{
- ASSERT(owner);
-}
-
-SVGPaintServerGradient::~SVGPaintServerGradient()
-{
-}
-
-Gradient* SVGPaintServerGradient::gradient() const
-{
- return m_gradient.get();
-}
-
-void SVGPaintServerGradient::setGradient(PassRefPtr<Gradient> gradient)
-{
- m_gradient = gradient;
-}
-
-bool SVGPaintServerGradient::boundingBoxMode() const
-{
- return m_boundingBoxMode;
-}
-
-void SVGPaintServerGradient::setBoundingBoxMode(bool mode)
-{
- m_boundingBoxMode = mode;
-}
-
-AffineTransform SVGPaintServerGradient::gradientTransform() const
-{
- return m_gradientTransform;
-}
-
-void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform)
-{
- m_gradientTransform = transform;
-}
-
-#if PLATFORM(CG)
-static inline const RenderObject* findTextRootObject(const RenderObject* start)
-{
- while (start && !start->isSVGText())
- start = start->parent();
- ASSERT(start);
- ASSERT(start->isSVGText());
-
- return start;
-}
-
-static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object)
-{
- AffineTransform absoluteTransform;
-
- const RenderObject* currentObject = object;
- while (currentObject) {
- absoluteTransform = currentObject->localToParentTransform() * absoluteTransform;
- currentObject = currentObject->parent();
- }
-
- return absoluteTransform;
-}
-
-static inline bool createMaskAndSwapContextForTextGradient(
- GraphicsContext*& context, GraphicsContext*& savedContext,
- OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object)
-{
- const RenderObject* textRootBlock = findTextRootObject(object);
-
- AffineTransform transform = absoluteTransformForRenderer(textRootBlock);
- FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates());
-
- IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox);
- if (maskImageRect.isEmpty())
- return false;
-
- // Allocate an image buffer as big as the absolute unclipped size of the object
- OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size());
- if (!maskImage)
- return false;
-
- GraphicsContext* maskImageContext = maskImage->context();
-
- // Transform the mask image coordinate system to absolute screen coordinates
- maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y());
- maskImageContext->concatCTM(transform);
-
- imageBuffer.set(maskImage.release());
- savedContext = context;
- context = maskImageContext;
-
- return true;
-}
-
-static inline AffineTransform clipToTextMask(GraphicsContext* context,
- OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object,
- const SVGPaintServerGradient* gradientServer)
-{
- const RenderObject* textRootBlock = findTextRootObject(object);
- context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get());
-
- AffineTransform matrix;
- if (gradientServer->boundingBoxMode()) {
- FloatRect maskBoundingBox = textRootBlock->objectBoundingBox();
- matrix.translate(maskBoundingBox.x(), maskBoundingBox.y());
- matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height());
- }
- matrix.multiply(gradientServer->gradientTransform());
- return matrix;
-}
-#endif
-
-bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle*style, SVGPaintTargetType type, bool isPaintingText) const
-{
- m_ownerElement->buildGradient();
-
- const SVGRenderStyle* svgStyle = style->svgStyle();
- bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
- bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
-
- ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
-
- context->save();
-
- if (isPaintingText) {
-#if PLATFORM(CG)
- if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, object)) {
- context->restore();
- return false;
- }
-#endif
- context->setTextDrawingMode(isFilled ? cTextFill : cTextStroke);
- }
-
- if (isFilled) {
- context->setAlpha(svgStyle->fillOpacity());
- context->setFillGradient(m_gradient);
- context->setFillRule(svgStyle->fillRule());
- }
- if (isStroked) {
- context->setAlpha(svgStyle->strokeOpacity());
- context->setStrokeGradient(m_gradient);
- applyStrokeStyleToContext(context, style, object);
- }
-
- AffineTransform matrix;
- // CG platforms will handle the gradient space transform for text in
- // teardown, so we don't apply it here. For non-CG platforms, we
- // want the text bounding box applied to the gradient space transform now,
- // so the gradient shader can use it.
-#if PLATFORM(CG)
- if (boundingBoxMode() && !isPaintingText) {
-#else
- if (boundingBoxMode()) {
-#endif
- FloatRect bbox = object->objectBoundingBox();
- // Don't use gradients for 1d objects like horizontal/vertical
- // lines or rectangles without width or height.
- if (bbox.width() == 0 || bbox.height() == 0) {
- Color color(0, 0, 0);
- context->setStrokeColor(color, style->colorSpace());
- return true;
- }
- matrix.translate(bbox.x(), bbox.y());
- matrix.scaleNonUniform(bbox.width(), bbox.height());
- }
- matrix.multiply(gradientTransform());
- m_gradient->setGradientSpaceTransform(matrix);
-
- return true;
-}
-
-void SVGPaintServerGradient::teardown(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType, bool isPaintingText) const
-{
-#if PLATFORM(CG)
- // renderPath() is not used when painting text, so we paint the gradient during teardown()
- if (isPaintingText && m_savedContext) {
- // Restore on-screen drawing context
- context = m_savedContext;
- m_savedContext = 0;
-
- AffineTransform matrix = clipToTextMask(context, m_imageBuffer, object, this);
- m_gradient->setGradientSpaceTransform(matrix);
- context->setFillGradient(m_gradient);
-
- const RenderObject* textRootBlock = findTextRootObject(object);
- context->fillRect(textRootBlock->repaintRectInLocalCoordinates());
-
- m_imageBuffer.clear();
- }
-#endif
- context->restore();
-}
-
-TextStream& SVGPaintServerGradient::externalRepresentation(TextStream& ts) const
-{
- // Gradients/patterns aren't setup, until they are used for painting. Work around that fact.
- m_ownerElement->buildGradient();
-
- // abstract, don't stream type
- ts << "[stops=" << gradientStops() << "]";
- if (m_gradient->spreadMethod() != SpreadMethodPad)
- ts << "[method=" << m_gradient->spreadMethod() << "]";
- if (!boundingBoxMode())
- ts << " [bounding box mode=" << boundingBoxMode() << "]";
- if (!gradientTransform().isIdentity())
- ts << " [transform=" << gradientTransform() << "]";
-
- return ts;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.h b/WebCore/svg/graphics/SVGPaintServerGradient.h
deleted file mode 100644
index 953b0d9..0000000
--- a/WebCore/svg/graphics/SVGPaintServerGradient.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 2008 Eric Seidel <eric@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGPaintServerGradient_h
-#define SVGPaintServerGradient_h
-
-#if ENABLE(SVG)
-
-#include "AffineTransform.h"
-#include "Color.h"
-#include "Gradient.h"
-#include "GraphicsContext.h"
-#include "SVGPaintServer.h"
-
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
- class ImageBuffer;
- class SVGGradientElement;
-
- typedef std::pair<float, Color> SVGGradientStop;
-
- class SVGPaintServerGradient : public SVGPaintServer {
- public:
- virtual ~SVGPaintServerGradient();
-
- void setGradient(PassRefPtr<Gradient>);
- Gradient* gradient() const;
-
- // Gradient start and end points are percentages when used in boundingBox mode.
- // For instance start point with value (0,0) is top-left and end point with
- // value (100, 100) is bottom-right. BoundingBox mode is enabled by default.
- bool boundingBoxMode() const;
- void setBoundingBoxMode(bool mode = true);
-
- AffineTransform gradientTransform() const;
- void setGradientTransform(const AffineTransform&);
-
- void setGradientStops(const Vector<SVGGradientStop>& stops) { m_stops = stops; }
- const Vector<SVGGradientStop>& gradientStops() const { return m_stops; }
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
- virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
-
- protected:
- SVGPaintServerGradient(const SVGGradientElement* owner);
-
- private:
- Vector<SVGGradientStop> m_stops;
- RefPtr<Gradient> m_gradient;
- bool m_boundingBoxMode;
- AffineTransform m_gradientTransform;
- const SVGGradientElement* m_ownerElement;
-
-#if PLATFORM(CG)
- public:
- mutable GraphicsContext* m_savedContext;
- mutable OwnPtr<ImageBuffer> m_imageBuffer;
-#endif
- };
-
- inline SVGGradientStop makeGradientStop(float offset, const Color& color)
- {
- return std::make_pair(offset, color);
- }
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServerGradient_h
diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp b/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp
deleted file mode 100644
index 08db2d2..0000000
--- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServerLinearGradient.h"
-#include "SVGRenderTreeAsText.h"
-
-namespace WebCore {
-
-SVGPaintServerLinearGradient::SVGPaintServerLinearGradient(const SVGGradientElement* owner)
- : SVGPaintServerGradient(owner)
-{
-}
-
-SVGPaintServerLinearGradient::~SVGPaintServerLinearGradient()
-{
-}
-
-FloatPoint SVGPaintServerLinearGradient::gradientStart() const
-{
- return m_start;
-}
-
-void SVGPaintServerLinearGradient::setGradientStart(const FloatPoint& start)
-{
- m_start = start;
-}
-
-FloatPoint SVGPaintServerLinearGradient::gradientEnd() const
-{
- return m_end;
-}
-
-void SVGPaintServerLinearGradient::setGradientEnd(const FloatPoint& end)
-{
- m_end = end;
-}
-
-TextStream& SVGPaintServerLinearGradient::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=LINEAR-GRADIENT] ";
- SVGPaintServerGradient::externalRepresentation(ts);
- ts << " [start=" << gradientStart() << "]"
- << " [end=" << gradientEnd() << "]";
- return ts;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h b/WebCore/svg/graphics/SVGPaintServerLinearGradient.h
deleted file mode 100644
index f0568c7..0000000
--- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGPaintServerLinearGradient_h
-#define SVGPaintServerLinearGradient_h
-
-#if ENABLE(SVG)
-
-#include "FloatPoint.h"
-#include "SVGPaintServerGradient.h"
-
-namespace WebCore {
-
- class SVGPaintServerLinearGradient : public SVGPaintServerGradient {
- public:
- static PassRefPtr<SVGPaintServerLinearGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerLinearGradient(owner)); }
- virtual ~SVGPaintServerLinearGradient();
-
- virtual SVGPaintServerType type() const { return LinearGradientPaintServer; }
-
- FloatPoint gradientStart() const;
- void setGradientStart(const FloatPoint&);
-
- FloatPoint gradientEnd() const;
- void setGradientEnd(const FloatPoint&);
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- private:
- SVGPaintServerLinearGradient(const SVGGradientElement* owner);
-
- FloatPoint m_start;
- FloatPoint m_end;
- };
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServerLinearGradient_h
diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.cpp b/WebCore/svg/graphics/SVGPaintServerPattern.cpp
deleted file mode 100644
index 7fc75fb..0000000
--- a/WebCore/svg/graphics/SVGPaintServerPattern.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 2008 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServerPattern.h"
-
-#include "AffineTransform.h"
-#include "GraphicsContext.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "Pattern.h"
-#include "RenderObject.h"
-#include "SVGPatternElement.h"
-#include "SVGRenderTreeAsText.h"
-
-using namespace std;
-
-namespace WebCore {
-
-SVGPaintServerPattern::SVGPaintServerPattern(const SVGPatternElement* owner)
- : m_ownerElement(owner)
- , m_pattern(0)
-{
- ASSERT(owner);
-}
-
-SVGPaintServerPattern::~SVGPaintServerPattern()
-{
-}
-
-FloatRect SVGPaintServerPattern::patternBoundaries() const
-{
- return m_patternBoundaries;
-}
-
-void SVGPaintServerPattern::setPatternBoundaries(const FloatRect& rect)
-{
- m_patternBoundaries = rect;
-}
-
-ImageBuffer* SVGPaintServerPattern::tile() const
-{
- return m_tile.get();
-}
-
-void SVGPaintServerPattern::setTile(PassOwnPtr<ImageBuffer> tile)
-{
- m_tile = tile;
-}
-
-AffineTransform SVGPaintServerPattern::patternTransform() const
-{
- return m_patternTransform;
-}
-
-void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform)
-{
- m_patternTransform = transform;
-}
-
-TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const
-{
- // Gradients/patterns aren't setup, until they are used for painting. Work around that fact.
- m_ownerElement->buildPattern(FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
-
- ts << "[type=PATTERN]"
- << " [bbox=" << patternBoundaries() << "]";
- if (!patternTransform().isIdentity())
- ts << " [pattern transform=" << patternTransform() << "]";
- return ts;
-}
-
-bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
-{
- FloatRect targetRect = object->objectBoundingBox();
-
- const SVGRenderStyle* svgStyle = style->svgStyle();
- bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
- bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
-
- ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
-
- m_ownerElement->buildPattern(targetRect);
- if (!tile())
- return false;
-
- context->save();
-
- ASSERT(!m_pattern);
-
- IntRect tileRect = tile()->image()->rect();
- if (tileRect.width() > patternBoundaries().width() || tileRect.height() > patternBoundaries().height()) {
- // Draw the first cell of the pattern manually to support overflow="visible" on all platforms.
- int tileWidth = static_cast<int>(patternBoundaries().width() + 0.5f);
- int tileHeight = static_cast<int>(patternBoundaries().height() + 0.5f);
- OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(IntSize(tileWidth, tileHeight));
-
- GraphicsContext* tileImageContext = tileImage->context();
-
- int numY = static_cast<int>(ceilf(tileRect.height() / tileHeight)) + 1;
- int numX = static_cast<int>(ceilf(tileRect.width() / tileWidth)) + 1;
-
- tileImageContext->save();
- tileImageContext->translate(-patternBoundaries().width() * numX, -patternBoundaries().height() * numY);
- for (int i = numY; i > 0; i--) {
- tileImageContext->translate(0, patternBoundaries().height());
- for (int j = numX; j > 0; j--) {
- tileImageContext->translate(patternBoundaries().width(), 0);
- tileImageContext->drawImage(tile()->image(), style->colorSpace(), tileRect, tileRect);
- }
- tileImageContext->translate(-patternBoundaries().width() * numX, 0);
- }
- tileImageContext->restore();
-
- m_pattern = Pattern::create(tileImage->image(), true, true);
- }
- else
- m_pattern = Pattern::create(tile()->image(), true, true);
-
- if (isFilled) {
- context->setAlpha(svgStyle->fillOpacity());
- context->setFillPattern(m_pattern);
- context->setFillRule(svgStyle->fillRule());
- }
- if (isStroked) {
- context->setAlpha(svgStyle->strokeOpacity());
- context->setStrokePattern(m_pattern);
- applyStrokeStyleToContext(context, style, object);
- }
-
- AffineTransform matrix;
- matrix.translate(patternBoundaries().x(), patternBoundaries().y());
- matrix.multiply(patternTransform());
- m_pattern->setPatternSpaceTransform(matrix);
-
- if (isPaintingText) {
- context->setTextDrawingMode(isFilled ? cTextFill : cTextStroke);
-#if PLATFORM(CG)
- if (isFilled)
- context->applyFillPattern();
- else
- context->applyStrokePattern();
-#endif
- }
-
- return true;
-}
-
-void SVGPaintServerPattern::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const
-{
- m_pattern = 0;
-
- context->restore();
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.h b/WebCore/svg/graphics/SVGPaintServerPattern.h
deleted file mode 100644
index 3d3da49..0000000
--- a/WebCore/svg/graphics/SVGPaintServerPattern.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGPaintServerPattern_h
-#define SVGPaintServerPattern_h
-
-#if ENABLE(SVG)
-
-#include "AffineTransform.h"
-#include "FloatRect.h"
-#include "Pattern.h"
-#include "SVGPaintServer.h"
-
-#include <memory>
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
- class GraphicsContext;
- class ImageBuffer;
- class SVGPatternElement;
-
- class SVGPaintServerPattern : public SVGPaintServer {
- public:
- static PassRefPtr<SVGPaintServerPattern> create(const SVGPatternElement* owner) { return adoptRef(new SVGPaintServerPattern(owner)); }
-
- virtual ~SVGPaintServerPattern();
-
- virtual SVGPaintServerType type() const { return PatternPaintServer; }
-
- // Pattern boundaries
- void setPatternBoundaries(const FloatRect&);
- FloatRect patternBoundaries() const;
-
- ImageBuffer* tile() const;
- void setTile(PassOwnPtr<ImageBuffer>);
-
- AffineTransform patternTransform() const;
- void setPatternTransform(const AffineTransform&);
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
- virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
-
- private:
- SVGPaintServerPattern(const SVGPatternElement*);
-
- OwnPtr<ImageBuffer> m_tile;
- const SVGPatternElement* m_ownerElement;
- AffineTransform m_patternTransform;
- FloatRect m_patternBoundaries;
-
- mutable RefPtr<Pattern> m_pattern;
- };
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServerPattern_h
diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp b/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp
deleted file mode 100644
index a795ab5..0000000
--- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServerRadialGradient.h"
-#include "SVGRenderTreeAsText.h"
-
-namespace WebCore {
-
-SVGPaintServerRadialGradient::SVGPaintServerRadialGradient(const SVGGradientElement* owner)
- : SVGPaintServerGradient(owner)
- , m_radius(0.0f)
-{
-}
-
-SVGPaintServerRadialGradient::~SVGPaintServerRadialGradient()
-{
-}
-
-
-FloatPoint SVGPaintServerRadialGradient::gradientCenter() const
-{
- return m_center;
-}
-
-void SVGPaintServerRadialGradient::setGradientCenter(const FloatPoint& center)
-{
- m_center = center;
-}
-
-FloatPoint SVGPaintServerRadialGradient::gradientFocal() const
-{
- return m_focal;
-}
-
-void SVGPaintServerRadialGradient::setGradientFocal(const FloatPoint& focal)
-{
- m_focal = focal;
-}
-
-float SVGPaintServerRadialGradient::gradientRadius() const
-{
- return m_radius;
-}
-
-void SVGPaintServerRadialGradient::setGradientRadius(float radius)
-{
- m_radius = radius;
-}
-
-TextStream& SVGPaintServerRadialGradient::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=RADIAL-GRADIENT] ";
- SVGPaintServerGradient::externalRepresentation(ts);
- ts << " [center=" << gradientCenter() << "]"
- << " [focal=" << gradientFocal() << "]"
- << " [radius=" << gradientRadius() << "]";
- return ts;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h b/WebCore/svg/graphics/SVGPaintServerRadialGradient.h
deleted file mode 100644
index 749ba08..0000000
--- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGPaintServerRadialGradient_h
-#define SVGPaintServerRadialGradient_h
-
-#if ENABLE(SVG)
-
-#include "FloatPoint.h"
-#include "SVGPaintServerGradient.h"
-
-namespace WebCore {
-
- class SVGPaintServerRadialGradient : public SVGPaintServerGradient {
- public:
- static PassRefPtr<SVGPaintServerRadialGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerRadialGradient(owner)); }
- virtual ~SVGPaintServerRadialGradient();
-
- virtual SVGPaintServerType type() const { return RadialGradientPaintServer; }
-
- FloatPoint gradientCenter() const;
- void setGradientCenter(const FloatPoint&);
-
- FloatPoint gradientFocal() const;
- void setGradientFocal(const FloatPoint&);
-
- float gradientRadius() const;
- void setGradientRadius(float);
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- private:
- SVGPaintServerRadialGradient(const SVGGradientElement* owner);
-
- float m_radius;
- FloatPoint m_center;
- FloatPoint m_focal;
- };
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGPaintServerRadialGradient_h
diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.cpp b/WebCore/svg/graphics/SVGPaintServerSolid.cpp
deleted file mode 100644
index 8921bb0..0000000
--- a/WebCore/svg/graphics/SVGPaintServerSolid.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGPaintServerSolid.h"
-
-#include "GraphicsContext.h"
-#include "RenderPath.h"
-#include "SVGRenderTreeAsText.h"
-
-namespace WebCore {
-
-SVGPaintServerSolid::SVGPaintServerSolid()
-{
-}
-
-SVGPaintServerSolid::~SVGPaintServerSolid()
-{
-}
-
-Color SVGPaintServerSolid::color() const
-{
- return m_color;
-}
-
-void SVGPaintServerSolid::setColor(const Color& color)
-{
- m_color = color;
-}
-
-TextStream& SVGPaintServerSolid::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=SOLID]"
- << " [color="<< color() << "]";
- return ts;
-}
-
-bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
-{
- const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
- ColorSpace colorSpace = style ? style->colorSpace() : DeviceColorSpace;
-
- if ((type & ApplyToFillTargetType) && (!style || svgStyle->hasFill())) {
- context->setAlpha(style ? svgStyle->fillOpacity() : 1);
- context->setFillColor(color().rgb(), colorSpace);
- context->setFillRule(style ? svgStyle->fillRule() : RULE_NONZERO);
-
- if (isPaintingText)
- context->setTextDrawingMode(cTextFill);
- }
-
- if ((type & ApplyToStrokeTargetType) && (!style || svgStyle->hasStroke())) {
- context->setAlpha(style ? svgStyle->strokeOpacity() : 1);
- context->setStrokeColor(color().rgb(), colorSpace);
-
- if (style)
- applyStrokeStyleToContext(context, style, object);
-
- if (isPaintingText)
- context->setTextDrawingMode(cTextStroke);
- }
-
- return true;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp
deleted file mode 100644
index a071996..0000000
--- a/WebCore/svg/graphics/SVGResource.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGResource.h"
-
-#include "RenderPath.h"
-#include "SVGElement.h"
-#include "SVGStyledElement.h"
-#include <wtf/HashSet.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-typedef HashSet<SVGResource*> ResourceSet;
-
-static ResourceSet& resourceSet()
-{
- DEFINE_STATIC_LOCAL(ResourceSet, set, ());
- return set;
-}
-
-SVGResource::SVGResource()
-{
- ASSERT(!resourceSet().contains(this));
- resourceSet().add(this);
-}
-
-
-SVGResource::~SVGResource()
-{
- ASSERT(resourceSet().contains(this));
- resourceSet().remove(this);
-}
-
-void SVGResource::invalidate()
-{
- HashSet<SVGStyledElement*>::const_iterator it = m_clients.begin();
- const HashSet<SVGStyledElement*>::const_iterator end = m_clients.end();
-
- for (; it != end; ++it) {
- SVGStyledElement* cur = *it;
-
- if (cur->renderer())
- cur->renderer()->setNeedsLayout(true);
-
- cur->invalidateResourcesInAncestorChain();
- }
-}
-
-void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients)
-{
- HashSet<SVGStyledElement*>::const_iterator it = clients.begin();
- const HashSet<SVGStyledElement*>::const_iterator end = clients.end();
-
- for (; it != end; ++it) {
- SVGStyledElement* cur = *it;
-
- if (cur->renderer())
- cur->renderer()->setNeedsLayout(true);
-
- cur->invalidateResourcesInAncestorChain();
- }
-}
-
-void SVGResource::removeClient(SVGStyledElement* item)
-{
- ResourceSet::iterator it = resourceSet().begin();
- ResourceSet::iterator end = resourceSet().end();
-
- for (; it != end; ++it) {
- SVGResource* resource = *it;
- if (!resource->m_clients.contains(item))
- continue;
- resource->m_clients.remove(item);
- }
-}
-
-void SVGResource::addClient(SVGStyledElement* item)
-{
- if (m_clients.contains(item))
- return;
-
- m_clients.add(item);
-}
-
-TextStream& SVGResource::externalRepresentation(TextStream& ts) const
-{
- return ts;
-}
-
-SVGResource* getResourceById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- if (id.isEmpty())
- return 0;
-
- Element* element = document->getElementById(id);
- SVGElement* svgElement = 0;
- if (element && element->isSVGElement())
- svgElement = static_cast<SVGElement*>(element);
-
- if (svgElement && svgElement->isStyled())
- return static_cast<SVGStyledElement*>(svgElement)->canvasResource(object);
-
- return 0;
-}
-
-TextStream& operator<<(TextStream& ts, const SVGResource& r)
-{
- return r.externalRepresentation(ts);
-}
-
-}
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h
deleted file mode 100644
index 8f303b5..0000000
--- a/WebCore/svg/graphics/SVGResource.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGResource_h
-#define SVGResource_h
-
-#if ENABLE(SVG)
-#include "PlatformString.h"
-#include "RenderObject.h"
-#include "StringHash.h"
-
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
- class AtomicString;
- class Document;
- class SVGStyledElement;
- class TextStream;
-
- enum SVGResourceType {
- // Painting mode
- ClipperResourceType = 0,
- MarkerResourceType,
- ImageResourceType,
- FilterResourceType,
- MaskerResourceType,
- PaintServerResourceType,
-
- // For resource tracking we need to know how many types of resource there are
- _ResourceTypeCount
- };
-
- // The SVGResource file represent various graphics resources:
- // - Filter resource
- // - Clipper resource
- // - Masker resource
- // - Marker resource
- // - Pattern resource
- // - Linear/Radial gradient resource
- //
- // SVG creates/uses these resources.
-
- class SVGResource : public RefCounted<SVGResource> {
- public:
- virtual ~SVGResource();
-
- virtual void invalidate();
-
- void addClient(SVGStyledElement*);
- virtual SVGResourceType resourceType() const = 0;
-
- bool isPaintServer() const { return resourceType() == PaintServerResourceType; }
- bool isFilter() const { return resourceType() == FilterResourceType; }
- bool isClipper() const { return resourceType() == ClipperResourceType; }
- bool isMarker() const { return resourceType() == MarkerResourceType; }
- bool isMasker() const { return resourceType() == MaskerResourceType; }
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- static void invalidateClients(HashSet<SVGStyledElement*>);
- static void removeClient(SVGStyledElement*);
-
- protected:
- SVGResource();
-
- private:
- HashSet<SVGStyledElement*> m_clients;
- };
-
- SVGResource* getResourceById(Document*, const AtomicString&, const RenderObject*);
-
- TextStream& operator<<(TextStream&, const SVGResource&);
-
-} // namespace WebCore
-
-#endif
-#endif // SVGResource_h
diff --git a/WebCore/svg/graphics/SVGResourceClipper.cpp b/WebCore/svg/graphics/SVGResourceClipper.cpp
deleted file mode 100644
index 5316c95..0000000
--- a/WebCore/svg/graphics/SVGResourceClipper.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * (C) 2009 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGResourceClipper.h"
-
-#include "AffineTransform.h"
-#include "GraphicsContext.h"
-#include "SVGRenderTreeAsText.h"
-
-#if PLATFORM(CG)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-namespace WebCore {
-
-SVGResourceClipper::SVGResourceClipper()
- : SVGResource()
-{
-}
-
-SVGResourceClipper::~SVGResourceClipper()
-{
-}
-
-void SVGResourceClipper::resetClipData()
-{
- m_clipData.clear();
- m_clipperBoundingBox = FloatRect();
-}
-
-void SVGResourceClipper::invalidate()
-{
- SVGResource::invalidate();
- resetClipData();
-}
-
-FloatRect SVGResourceClipper::clipperBoundingBox(const FloatRect& objectBoundingBox)
-{
- // FIXME: We need a different calculation for other clip content than paths.
- if (!m_clipperBoundingBox.isEmpty())
- return m_clipperBoundingBox;
-
- if (m_clipData.clipData().isEmpty())
- return FloatRect();
-
- for (unsigned x = 0; x < m_clipData.clipData().size(); x++) {
- ClipData clipData = m_clipData.clipData()[x];
-
- FloatRect clipPathRect = clipData.path.boundingRect();
- if (clipData.bboxUnits) {
- clipPathRect.scale(objectBoundingBox.width(), objectBoundingBox.height());
- clipPathRect.move(objectBoundingBox.x(), objectBoundingBox.y());
- }
- m_clipperBoundingBox.unite(clipPathRect);
- }
-
- return m_clipperBoundingBox;
-}
-
-void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const
-{
- if (m_clipData.clipData().isEmpty())
- return;
-
- bool heterogenousClipRules = false;
- WindRule clipRule = m_clipData.clipData()[0].windRule;
-
- context->beginPath();
-
- for (unsigned x = 0; x < m_clipData.clipData().size(); x++) {
- ClipData clipData = m_clipData.clipData()[x];
- if (clipData.windRule != clipRule)
- heterogenousClipRules = true;
-
- Path clipPath = clipData.path;
-
- if (clipData.bboxUnits) {
- AffineTransform transform;
- transform.translate(boundingBox.x(), boundingBox.y());
- transform.scaleNonUniform(boundingBox.width(), boundingBox.height());
- clipPath.transform(transform);
- }
- context->addPath(clipPath);
- }
-
- // FIXME!
- // We don't currently allow for heterogenous clip rules.
- // we would have to detect such, draw to a mask, and then clip
- // to that mask
- context->clipPath(clipRule);
-}
-
-void SVGResourceClipper::addClipData(const Path& path, WindRule rule, bool bboxUnits)
-{
- m_clipData.addPath(path, rule, bboxUnits);
-}
-
-const ClipDataList& SVGResourceClipper::clipData() const
-{
- return m_clipData;
-}
-
-TextStream& SVGResourceClipper::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=CLIPPER]";
- ts << " [clip data=" << clipData().clipData() << "]";
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, WindRule rule)
-{
- switch (rule) {
- case RULE_NONZERO:
- ts << "NON-ZERO"; break;
- case RULE_EVENODD:
- ts << "EVEN-ODD"; break;
- }
-
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, const ClipData& d)
-{
- ts << "[winding=" << d.windRule << "]";
-
- if (d.bboxUnits)
- ts << " [bounding box mode=" << d.bboxUnits << "]";
-
- ts << " [path=" << d.path.debugString() << "]";
- return ts;
-}
-
-SVGResourceClipper* getClipperById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- SVGResource* resource = getResourceById(document, id, object);
- if (resource && resource->isClipper())
- return static_cast<SVGResourceClipper*>(resource);
-
- return 0;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResourceClipper.h b/WebCore/svg/graphics/SVGResourceClipper.h
deleted file mode 100644
index df5562d..0000000
--- a/WebCore/svg/graphics/SVGResourceClipper.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGResourceClipper_h
-#define SVGResourceClipper_h
-
-#if ENABLE(SVG)
-#include "FloatRect.h"
-#include "Path.h"
-#include "RenderObject.h"
-#include "SVGResource.h"
-
-namespace WebCore {
-
- struct ClipData {
- Path path;
- WindRule windRule;
- bool bboxUnits : 1;
- };
-
- class ClipDataList {
- public:
- void addPath(const Path& pathData, WindRule windRule, bool bboxUnits)
- {
- ClipData clipData;
-
- clipData.path = pathData;
- clipData.windRule = windRule;
- clipData.bboxUnits = bboxUnits;
-
- m_clipData.append(clipData);
- }
-
- void clear() { m_clipData.clear(); }
- const Vector<ClipData>& clipData() const { return m_clipData; }
- bool isEmpty() const { return m_clipData.isEmpty(); }
- private:
- Vector<ClipData> m_clipData;
- };
-
- class GraphicsContext;
-
- class SVGResourceClipper : public SVGResource {
- public:
- static PassRefPtr<SVGResourceClipper> create() { return adoptRef(new SVGResourceClipper); }
- virtual ~SVGResourceClipper();
-
- virtual void invalidate();
-
- void resetClipData();
- void addClipData(const Path&, WindRule, bool bboxUnits);
-
- const ClipDataList& clipData() const;
-
- virtual SVGResourceType resourceType() const { return ClipperResourceType; }
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- // To be implemented by the specific rendering devices
- void applyClip(GraphicsContext*, const FloatRect& boundingBox) const;
- FloatRect clipperBoundingBox(const FloatRect& oob);
- private:
- SVGResourceClipper();
- ClipDataList m_clipData;
- FloatRect m_clipperBoundingBox;
- };
-
- TextStream& operator<<(TextStream&, WindRule);
- TextStream& operator<<(TextStream&, const ClipData&);
-
- SVGResourceClipper* getClipperById(Document*, const AtomicString&, const RenderObject*);
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGResourceClipper_h
diff --git a/WebCore/svg/graphics/SVGResourceFilter.cpp b/WebCore/svg/graphics/SVGResourceFilter.cpp
deleted file mode 100644
index 72ae203..0000000
--- a/WebCore/svg/graphics/SVGResourceFilter.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "SVGResourceFilter.h"
-
-#include "FilterEffect.h"
-#include "GraphicsContext.h"
-#include "ImageBuffer.h"
-#include "PlatformString.h"
-#include "SVGFilter.h"
-#include "SVGFilterBuilder.h"
-#include "SVGFilterElement.h"
-#include "SVGRenderSupport.h"
-#include "SVGRenderTreeAsText.h"
-#include "SVGFilterPrimitiveStandardAttributes.h"
-
-static const float kMaxFilterSize = 5000.0f;
-
-using std::min;
-
-namespace WebCore {
-
-SVGResourceFilter::SVGResourceFilter(const SVGFilterElement* ownerElement)
- : SVGResource()
- , m_ownerElement(ownerElement)
- , m_filterBBoxMode(false)
- , m_effectBBoxMode(false)
- , m_filterRes(false)
- , m_scaleX(1.f)
- , m_scaleY(1.f)
- , m_savedContext(0)
- , m_sourceGraphicBuffer(0)
-{
- m_filterBuilder.set(new SVGFilterBuilder());
-}
-
-SVGResourceFilter::~SVGResourceFilter()
-{
-}
-
-FloatRect SVGResourceFilter::filterBoundingBox(const FloatRect& obb) const
-{
- return m_ownerElement->filterBoundingBox(obb);
-}
-
-static inline bool shouldProcessFilter(SVGResourceFilter* filter, const FloatRect& filterRect)
-{
- return (!filter->scaleX() || !filter->scaleY() || !filterRect.width() || !filterRect.height());
-}
-
-void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect)
-{
- effectAttributes->setStandardAttributes(this, effect.get());
- builder()->add(effectAttributes->result(), effect);
-}
-
-bool SVGResourceFilter::fitsInMaximumImageSize(const FloatSize& size)
-{
- bool matchesFilterSize = true;
- if (size.width() > kMaxFilterSize) {
- m_scaleX *= kMaxFilterSize / size.width();
- matchesFilterSize = false;
- }
- if (size.height() > kMaxFilterSize) {
- m_scaleY *= kMaxFilterSize / size.height();
- matchesFilterSize = false;
- }
-
- return matchesFilterSize;
-}
-
-bool SVGResourceFilter::prepareFilter(GraphicsContext*& context, const RenderObject* object)
-{
- m_ownerElement->buildFilter(object->objectBoundingBox());
- const SVGRenderBase* renderer = object->toSVGRenderBase();
- if (!renderer)
- return false;
-
- FloatRect paintRect = renderer->strokeBoundingBox();
- paintRect.unite(renderer->markerBoundingBox());
-
- if (shouldProcessFilter(this, m_filterBBox))
- return false;
-
- // clip sourceImage to filterRegion
- FloatRect clippedSourceRect = paintRect;
- clippedSourceRect.intersect(m_filterBBox);
-
- // scale filter size to filterRes
- FloatRect tempSourceRect = clippedSourceRect;
- if (m_filterRes) {
- m_scaleX = m_filterResSize.width() / m_filterBBox.width();
- m_scaleY = m_filterResSize.height() / m_filterBBox.height();
- }
-
- // scale to big sourceImage size to kMaxFilterSize
- tempSourceRect.scale(m_scaleX, m_scaleY);
- fitsInMaximumImageSize(tempSourceRect.size());
-
- // prepare Filters
- m_filter = SVGFilter::create(paintRect, m_filterBBox, m_effectBBoxMode);
- m_filter->setFilterResolution(FloatSize(m_scaleX, m_scaleY));
-
- FilterEffect* lastEffect = m_filterBuilder->lastEffect();
- if (lastEffect) {
- lastEffect->calculateEffectRect(m_filter.get());
- // at least one FilterEffect has a too big image size,
- // recalculate the effect sizes with new scale factors
- if (!fitsInMaximumImageSize(m_filter->maxImageSize())) {
- m_filter->setFilterResolution(FloatSize(m_scaleX, m_scaleY));
- lastEffect->calculateEffectRect(m_filter.get());
- }
- } else
- return false;
-
- clippedSourceRect.scale(m_scaleX, m_scaleY);
-
- // Draw the content of the current element and it's childs to a imageBuffer to get the SourceGraphic.
- // The size of the SourceGraphic is clipped to the size of the filterRegion.
- IntRect bufferRect = enclosingIntRect(clippedSourceRect);
- OwnPtr<ImageBuffer> sourceGraphic(ImageBuffer::create(bufferRect.size(), LinearRGB));
-
- if (!sourceGraphic.get())
- return false;
-
- GraphicsContext* sourceGraphicContext = sourceGraphic->context();
- sourceGraphicContext->translate(-clippedSourceRect.x(), -clippedSourceRect.y());
- sourceGraphicContext->scale(FloatSize(m_scaleX, m_scaleY));
- sourceGraphicContext->clearRect(FloatRect(FloatPoint(), paintRect.size()));
- m_sourceGraphicBuffer.set(sourceGraphic.release());
- m_savedContext = context;
-
- context = sourceGraphicContext;
- return true;
-}
-
-void SVGResourceFilter::applyFilter(GraphicsContext*& context, const RenderObject* object)
-{
- if (!m_savedContext)
- return;
-
- context = m_savedContext;
- m_savedContext = 0;
-#if !PLATFORM(CG)
- m_sourceGraphicBuffer->transformColorSpace(DeviceRGB, LinearRGB);
-#endif
-
- FilterEffect* lastEffect = m_filterBuilder->lastEffect();
-
- if (lastEffect && !m_filterBBox.isEmpty() && !lastEffect->subRegion().isEmpty()) {
- m_filter->setSourceImage(m_sourceGraphicBuffer.release());
- lastEffect->apply(m_filter.get());
-
- ImageBuffer* resultImage = lastEffect->resultImage();
- if (resultImage) {
-#if !PLATFORM(CG)
- resultImage->transformColorSpace(LinearRGB, DeviceRGB);
-#endif
- ColorSpace colorSpace = DeviceColorSpace;
- if (object)
- colorSpace = object->style()->colorSpace();
- context->drawImage(resultImage->image(), colorSpace, lastEffect->subRegion());
- }
- }
-
- m_sourceGraphicBuffer.clear();
-}
-
-TextStream& SVGResourceFilter::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=FILTER] ";
-
- FloatRect bbox = filterRect();
- static FloatRect defaultFilterRect(0, 0, 1, 1);
-
- if (!filterBoundingBoxMode() || bbox != defaultFilterRect) {
- ts << " [bounding box=";
- if (filterBoundingBoxMode()) {
- bbox.scale(100.f);
- ts << "at (" << bbox.x() << "%," << bbox.y() << "%) size " << bbox.width() << "%x" << bbox.height() << "%";
- } else
- ts << filterRect();
- ts << "]";
- }
-
- if (!filterBoundingBoxMode()) // default is true
- ts << " [bounding box mode=" << filterBoundingBoxMode() << "]";
- if (effectBoundingBoxMode()) // default is false
- ts << " [effect bounding box mode=" << effectBoundingBoxMode() << "]";
-
- return ts;
-}
-
-SVGResourceFilter* getFilterById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- SVGResource* resource = getResourceById(document, id, object);
- if (resource && resource->isFilter())
- return static_cast<SVGResourceFilter*>(resource);
-
- return 0;
-}
-
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
diff --git a/WebCore/svg/graphics/SVGResourceFilter.h b/WebCore/svg/graphics/SVGResourceFilter.h
deleted file mode 100644
index ee8627c..0000000
--- a/WebCore/svg/graphics/SVGResourceFilter.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef SVGResourceFilter_h
-#define SVGResourceFilter_h
-
-#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "SVGResource.h"
-
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "FloatRect.h"
-#include "RenderObject.h"
-#include "SVGFilterPrimitiveStandardAttributes.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Filter;
-class FilterEffect;
-class GraphicsContext;
-class SVGFilterBuilder;
-class SVGFilterElement;
-class SVGFilterPrimitiveStandardAttributes;
-
-class SVGResourceFilter : public SVGResource {
-public:
- static PassRefPtr<SVGResourceFilter> create(const SVGFilterElement* ownerElement) { return adoptRef(new SVGResourceFilter(ownerElement)); }
- virtual ~SVGResourceFilter();
-
- virtual SVGResourceType resourceType() const { return FilterResourceType; }
-
- void setFilterResolution(const FloatSize& filterResSize) { m_filterResSize = filterResSize; }
- void setHasFilterResolution(bool filterRes) { m_filterRes = filterRes; }
-
- bool filterBoundingBoxMode() const { return m_filterBBoxMode; }
- void setFilterBoundingBoxMode(bool bboxMode) { m_filterBBoxMode = bboxMode; }
-
- bool effectBoundingBoxMode() const { return m_effectBBoxMode; }
- void setEffectBoundingBoxMode(bool bboxMode) { m_effectBBoxMode = bboxMode; }
-
- FloatRect filterRect() const { return m_filterRect; }
- void setFilterRect(const FloatRect& rect) { m_filterRect = rect; }
-
- float scaleX() const { return m_scaleX; }
- float scaleY() const { return m_scaleY; }
-
- FloatRect filterBoundingBox(const FloatRect& obb) const;
- void setFilterBoundingBox(const FloatRect& rect) { m_filterBBox = rect; }
-
- bool prepareFilter(GraphicsContext*&, const RenderObject*);
- void applyFilter(GraphicsContext*&, const RenderObject*);
-
- bool fitsInMaximumImageSize(const FloatSize&);
-
- void addFilterEffect(SVGFilterPrimitiveStandardAttributes*, PassRefPtr<FilterEffect>);
-
- SVGFilterBuilder* builder() { return m_filterBuilder.get(); }
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
-private:
- SVGResourceFilter(const SVGFilterElement*);
-
- const SVGFilterElement* m_ownerElement;
-
- bool m_filterBBoxMode : 1;
- bool m_effectBBoxMode : 1;
- bool m_filterRes : 1;
- float m_scaleX;
- float m_scaleY;
-
- FloatRect m_filterRect;
- FloatRect m_filterBBox;
- FloatSize m_filterResSize;
-
- OwnPtr<SVGFilterBuilder> m_filterBuilder;
- GraphicsContext* m_savedContext;
- OwnPtr<ImageBuffer> m_sourceGraphicBuffer;
- RefPtr<Filter> m_filter;
-};
-
-SVGResourceFilter* getFilterById(Document*, const AtomicString&, const RenderObject*);
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
-
-#endif // SVGResourceFilter_h
diff --git a/WebCore/svg/graphics/SVGResourceListener.h b/WebCore/svg/graphics/SVGResourceListener.h
deleted file mode 100644
index e69de29..0000000
--- a/WebCore/svg/graphics/SVGResourceListener.h
+++ /dev/null
diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp
deleted file mode 100644
index 2c036a4..0000000
--- a/WebCore/svg/graphics/SVGResourceMarker.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGResourceMarker.h"
-
-#include "AffineTransform.h"
-#include "GraphicsContext.h"
-#include "RenderSVGViewportContainer.h"
-#include "TextStream.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-SVGResourceMarker::SVGResourceMarker()
- : SVGResource()
- , m_angle(-1) // just like using setAutoAngle()
- , m_renderer(0)
- , m_useStrokeWidth(true)
-{
-}
-
-SVGResourceMarker::~SVGResourceMarker()
-{
-}
-
-AffineTransform SVGResourceMarker::markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const
-{
- ASSERT(m_renderer);
-
- AffineTransform transform;
- transform.translate(origin.x(), origin.y());
- transform.rotate(m_angle == -1 ? angle : m_angle);
- transform = m_renderer->markerContentTransformation(transform, m_referencePoint, m_useStrokeWidth ? strokeWidth : -1);
- return transform;
-}
-
-void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const AffineTransform& transform)
-{
- if (!m_renderer)
- return;
-
- DEFINE_STATIC_LOCAL(HashSet<SVGResourceMarker*>, currentlyDrawingMarkers, ());
-
- // avoid drawing circular marker references
- if (currentlyDrawingMarkers.contains(this))
- return;
-
- currentlyDrawingMarkers.add(this);
- ASSERT(!m_renderer->drawsContents());
- RenderObject::PaintInfo info(paintInfo);
- info.context->save();
- applyTransformToPaintInfo(info, transform);
- m_renderer->setDrawsContents(true);
- m_renderer->paint(info, 0, 0);
- m_renderer->setDrawsContents(false);
- info.context->restore();
-
- currentlyDrawingMarkers.remove(this);
-}
-
-TextStream& SVGResourceMarker::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=MARKER]"
- << " [angle=";
-
- if (angle() == -1)
- ts << "auto" << "]";
- else
- ts << angle() << "]";
-
- ts << " [ref x=" << m_referencePoint.x() << " y=" << m_referencePoint.y() << "]";
- return ts;
-}
-
-SVGResourceMarker* getMarkerById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- SVGResource* resource = getResourceById(document, id, object);
- if (resource && resource->isMarker())
- return static_cast<SVGResourceMarker*>(resource);
-
- return 0;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h
deleted file mode 100644
index f2ce33d..0000000
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGResourceMarker_h
-#define SVGResourceMarker_h
-
-#if ENABLE(SVG)
-#include "FloatPoint.h"
-#include "FloatRect.h"
-#include "RenderObject.h"
-#include "SVGResource.h"
-
-namespace WebCore {
-
- class RenderSVGViewportContainer;
- class AffineTransform;
-
- class SVGResourceMarker : public SVGResource {
- public:
- static PassRefPtr<SVGResourceMarker> create() { return adoptRef(new SVGResourceMarker); }
- virtual ~SVGResourceMarker();
-
- RenderSVGViewportContainer* renderer() const { return m_renderer; }
- void setRenderer(RenderSVGViewportContainer* marker) { m_renderer = marker; }
-
- void setReferencePoint(const FloatPoint& point) { m_referencePoint = point; }
- FloatPoint referencePoint() const { return m_referencePoint; }
-
- void setAngle(float angle) { m_angle = angle; }
- void setAutoAngle() { m_angle = -1; }
- float angle() const { return m_angle; }
-
- void setUseStrokeWidth(bool useStrokeWidth = true) { m_useStrokeWidth = useStrokeWidth; }
- bool useStrokeWidth() const { return m_useStrokeWidth; }
-
- AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
- void draw(RenderObject::PaintInfo&, const AffineTransform&);
-
- virtual SVGResourceType resourceType() const { return MarkerResourceType; }
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- private:
- SVGResourceMarker();
-
- FloatPoint m_referencePoint;
- float m_angle;
- RenderSVGViewportContainer* m_renderer;
- bool m_useStrokeWidth;
- };
-
- SVGResourceMarker* getMarkerById(Document*, const AtomicString&, const RenderObject*);
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGResourceMarker_h
diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp
deleted file mode 100644
index 18bc71a..0000000
--- a/WebCore/svg/graphics/SVGResourceMasker.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 2009 Dirk Schulze <krit@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGResourceMasker.h"
-
-#include "CanvasPixelArray.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "ImageData.h"
-#include "GraphicsContext.h"
-#include "RenderObject.h"
-#include "SVGMaskElement.h"
-#include "SVGRenderSupport.h"
-#include "SVGRenderStyle.h"
-#include "TextStream.h"
-
-using namespace std;
-
-namespace WebCore {
-
-SVGResourceMasker::SVGResourceMasker(const SVGMaskElement* ownerElement)
- : SVGResource()
- , m_ownerElement(ownerElement)
- , m_emptyMask(false)
-{
-}
-
-SVGResourceMasker::~SVGResourceMasker()
-{
-}
-
-void SVGResourceMasker::invalidate()
-{
- SVGResource::invalidate();
- m_mask.clear();
- m_emptyMask = false;
-}
-
-FloatRect SVGResourceMasker::maskerBoundingBox(const FloatRect& objectBoundingBox) const
-{
- return m_ownerElement->maskBoundingBox(objectBoundingBox);
-}
-
-bool SVGResourceMasker::applyMask(GraphicsContext* context, const RenderObject* object)
-{
- if (!m_mask && !m_emptyMask)
- m_mask = m_ownerElement->drawMaskerContent(object, m_maskRect, m_emptyMask);
-
- if (!m_mask)
- return false;
-
- context->clipToImageBuffer(m_maskRect, m_mask.get());
- return true;
-}
-
-TextStream& SVGResourceMasker::externalRepresentation(TextStream& ts) const
-{
- ts << "[type=MASKER]";
- return ts;
-}
-
-SVGResourceMasker* getMaskerById(Document* document, const AtomicString& id, const RenderObject* object)
-{
- SVGResource* resource = getResourceById(document, id, object);
- if (resource && resource->isMasker())
- return static_cast<SVGResourceMasker*>(resource);
-
- return 0;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/svg/graphics/SVGResourceMasker.h b/WebCore/svg/graphics/SVGResourceMasker.h
deleted file mode 100644
index 27364c2..0000000
--- a/WebCore/svg/graphics/SVGResourceMasker.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SVGResourceMasker_h
-#define SVGResourceMasker_h
-
-#if ENABLE(SVG)
-
-#include "GraphicsContext.h"
-#include "RenderObject.h"
-#include "SVGMaskElement.h"
-#include "SVGResource.h"
-
-#include <memory>
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
- class FloatRect;
- class ImageBuffer;
- class SVGMaskElement;
-
- class SVGResourceMasker : public SVGResource {
- public:
- static PassRefPtr<SVGResourceMasker> create(const SVGMaskElement* ownerElement) { return adoptRef(new SVGResourceMasker(ownerElement)); }
- virtual ~SVGResourceMasker();
-
- virtual void invalidate();
-
- virtual SVGResourceType resourceType() const { return MaskerResourceType; }
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- FloatRect maskerBoundingBox(const FloatRect&) const;
- bool applyMask(GraphicsContext*, const RenderObject*);
-
- private:
- SVGResourceMasker(const SVGMaskElement*);
-
- const SVGMaskElement* m_ownerElement;
-
- OwnPtr<ImageBuffer> m_mask;
- FloatRect m_maskRect;
- bool m_emptyMask;
- };
-
- SVGResourceMasker* getMaskerById(Document*, const AtomicString&, const RenderObject* object);
-
-} // namespace WebCore
-
-#endif
-
-#endif // SVGResourceMasker_h
diff --git a/WebCore/svg/graphics/filters/SVGDistantLightSource.h b/WebCore/svg/graphics/filters/SVGDistantLightSource.h
index db9b59d..93c5f2a 100644
--- a/WebCore/svg/graphics/filters/SVGDistantLightSource.h
+++ b/WebCore/svg/graphics/filters/SVGDistantLightSource.h
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
- 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGDistantLightSource_h
#define SVGDistantLightSource_h
@@ -28,29 +28,32 @@
namespace WebCore {
- class DistantLightSource : public LightSource {
- public:
- static PassRefPtr<DistantLightSource> create(float azimuth, float elevation)
- {
- return adoptRef(new DistantLightSource(azimuth, elevation));
- }
-
- float azimuth() const { return m_azimuth; }
- float elevation() const { return m_elevation; }
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- private:
- DistantLightSource(float azimuth, float elevation)
- : LightSource(LS_DISTANT)
- , m_azimuth(azimuth)
- , m_elevation(elevation)
- {
- }
-
- float m_azimuth;
- float m_elevation;
- };
+class DistantLightSource : public LightSource {
+public:
+ static PassRefPtr<DistantLightSource> create(float azimuth, float elevation)
+ {
+ return adoptRef(new DistantLightSource(azimuth, elevation));
+ }
+
+ float azimuth() const { return m_azimuth; }
+ float elevation() const { return m_elevation; }
+
+ virtual void initPaintingData(PaintingData&);
+ virtual void updatePaintingData(PaintingData&, int x, int y, float z);
+
+ virtual TextStream& externalRepresentation(TextStream&) const;
+
+private:
+ DistantLightSource(float azimuth, float elevation)
+ : LightSource(LS_DISTANT)
+ , m_azimuth(azimuth)
+ , m_elevation(elevation)
+ {
+ }
+
+ float m_azimuth;
+ float m_elevation;
+};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
index 5197215..c1a1166 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
@@ -1,39 +1,43 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEConvolveMatrix.h"
+
+#include "CanvasPixelArray.h"
#include "Filter.h"
+#include "ImageData.h"
#include "SVGRenderTreeAsText.h"
namespace WebCore {
-FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, FilterEffect* in2, const FloatSize& kernelSize,
- const float& divisor, const float& bias, const FloatSize& targetOffset, EdgeModeType edgeMode,
+FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,
+ float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
: FilterEffect()
, m_in(in)
- , m_in2(in2)
, m_kernelSize(kernelSize)
, m_divisor(divisor)
, m_bias(bias)
@@ -45,21 +49,21 @@ FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, FilterEffect* in2, const Fl
{
}
-PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(FilterEffect* in, FilterEffect* in2, const FloatSize& kernelSize,
- const float& divisor, const float& bias, const FloatSize& targetOffset, EdgeModeType edgeMode,
+PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(FilterEffect* in, const IntSize& kernelSize,
+ float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
{
- return adoptRef(new FEConvolveMatrix(in, in2, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
+ return adoptRef(new FEConvolveMatrix(in, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
preserveAlpha, kernelMatrix));
}
-FloatSize FEConvolveMatrix::kernelSize() const
+IntSize FEConvolveMatrix::kernelSize() const
{
return m_kernelSize;
}
-void FEConvolveMatrix::setKernelSize(FloatSize kernelSize)
+void FEConvolveMatrix::setKernelSize(IntSize kernelSize)
{
m_kernelSize = kernelSize;
}
@@ -94,12 +98,12 @@ void FEConvolveMatrix::setBias(float bias)
m_bias = bias;
}
-FloatSize FEConvolveMatrix::targetOffset() const
+IntPoint FEConvolveMatrix::targetOffset() const
{
return m_targetOffset;
}
-void FEConvolveMatrix::setTargetOffset(FloatSize targetOffset)
+void FEConvolveMatrix::setTargetOffset(IntPoint targetOffset)
{
m_targetOffset = targetOffset;
}
@@ -134,42 +138,332 @@ void FEConvolveMatrix::setPreserveAlpha(bool preserveAlpha)
m_preserveAlpha = preserveAlpha;
}
-void FEConvolveMatrix::apply(Filter*)
+/*
+ -----------------------------------
+ ConvolveMatrix implementation
+ -----------------------------------
+
+ The image rectangle is split in the following way:
+
+ +---------------------+
+ | A |
+ +---------------------+
+ | | | |
+ | B | C | D |
+ | | | |
+ +---------------------+
+ | E |
+ +---------------------+
+
+ Where region C contains those pixels, whose values
+ can be calculated without crossing the edge of the rectangle.
+
+ Example:
+ Image size: width: 10, height: 10
+
+ Order (kernel matrix size): width: 3, height 4
+ Target: x:1, y:3
+
+ The following figure shows the target inside the kernel matrix:
+
+ ...
+ ...
+ ...
+ .X.
+
+ The regions in this case are the following:
+ Note: (x1, y1) top-left and (x2, y2) is the bottom-right corner
+ Note: row x2 and column y2 is not part of the region
+ only those (x, y) pixels, where x1 <= x < x2 and y1 <= y < y2
+
+ Region A: x1: 0, y1: 0, x2: 10, y2: 3
+ Region B: x1: 0, y1: 3, x2: 1, y2: 10
+ Region C: x1: 1, y1: 3, x2: 9, y2: 10
+ Region D: x1: 9, y1: 3, x2: 10, y2: 10
+ Region E: x1: 0, y1: 10, x2: 10, y2: 10 (empty region)
+
+ Since region C (often) contains most of the pixels, we implemented
+ a fast algoritm to calculate these values, called fastSetInteriorPixels.
+ For other regions, fastSetOuterPixels is used, which calls getPixelValue,
+ to handle pixels outside of the image. In a rare situations, when
+ kernel matrix is bigger than the image, all pixels are calculated by this
+ function.
+
+ Although these two functions have lot in common, I decided not to make
+ common a template for them, since there are key differences as well,
+ and would make it really hard to understand.
+*/
+
+static ALWAYS_INLINE unsigned char clampRGBAValue(float channel, unsigned char max = 255)
+{
+ if (channel <= 0)
+ return 0;
+ if (channel >= max)
+ return max;
+ return channel;
+}
+
+template<bool preserveAlphaValues>
+ALWAYS_INLINE void setDestinationPixels(CanvasPixelArray* image, int& pixel, float* totals, float divisor, float bias, CanvasPixelArray* src)
+{
+ unsigned char maxAlpha = preserveAlphaValues ? 255 : clampRGBAValue(totals[3] / divisor + bias);
+ for (int i = 0; i < 3; ++i)
+ image->set(pixel++, clampRGBAValue(totals[i] / divisor + bias, maxAlpha));
+
+ if (preserveAlphaValues) {
+ image->set(pixel, src->get(pixel));
+ ++pixel;
+ } else
+ image->set(pixel++, maxAlpha);
+}
+
+// Only for region C
+template<bool preserveAlphaValues>
+ALWAYS_INLINE void FEConvolveMatrix::fastSetInteriorPixels(PaintingData& paintingData, int clipRight, int clipBottom)
+{
+ // edge mode does not affect these pixels
+ int pixel = (m_targetOffset.y() * paintingData.width + m_targetOffset.x()) * 4;
+ int startKernelPixel = 0;
+ int kernelIncrease = clipRight * 4;
+ int xIncrease = (m_kernelSize.width() - 1) * 4;
+ // Contains the sum of rgb(a) components
+ float totals[3 + (preserveAlphaValues ? 0 : 1)];
+
+ // m_divisor cannot be 0, SVGFEConvolveMatrixElement ensures this
+ ASSERT(m_divisor);
+
+ for (int y = clipBottom + 1; y > 0; --y) {
+ for (int x = clipRight + 1; x > 0; --x) {
+ int kernelValue = m_kernelMatrix.size() - 1;
+ int kernelPixel = startKernelPixel;
+ int width = m_kernelSize.width();
+
+ totals[0] = 0;
+ totals[1] = 0;
+ totals[2] = 0;
+ if (!preserveAlphaValues)
+ totals[3] = 0;
+
+ while (kernelValue >= 0) {
+ totals[0] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(kernelPixel++));
+ totals[1] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(kernelPixel++));
+ totals[2] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(kernelPixel++));
+ if (!preserveAlphaValues)
+ totals[3] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(kernelPixel));
+ ++kernelPixel;
+ --kernelValue;
+ if (!--width) {
+ kernelPixel += kernelIncrease;
+ width = m_kernelSize.width();
+ }
+ }
+
+ setDestinationPixels<preserveAlphaValues>(paintingData.dstPixelArray, pixel, totals, m_divisor, paintingData.bias, paintingData.srcPixelArray);
+ startKernelPixel += 4;
+ }
+ pixel += xIncrease;
+ startKernelPixel += xIncrease;
+ }
+}
+
+ALWAYS_INLINE int FEConvolveMatrix::getPixelValue(PaintingData& paintingData, int x, int y)
+{
+ if (x >= 0 && x < paintingData.width && x >= 0 && y < paintingData.height)
+ return (y * paintingData.width + x) << 2;
+
+ switch (m_edgeMode) {
+ default: // EDGEMODE_NONE
+ return -1;
+ case EDGEMODE_DUPLICATE:
+ if (x < 0)
+ x = 0;
+ else if (x >= paintingData.width)
+ x = paintingData.width - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= paintingData.height)
+ y = paintingData.height - 1;
+ return (y * paintingData.width + x) << 2;
+ case EDGEMODE_WRAP:
+ while (x < 0)
+ x += paintingData.width;
+ x %= paintingData.width;
+ while (y < 0)
+ y += paintingData.height;
+ y %= paintingData.height;
+ return (y * paintingData.width + x) << 2;
+ }
+}
+
+// For other regions than C
+template<bool preserveAlphaValues>
+void FEConvolveMatrix::fastSetOuterPixels(PaintingData& paintingData, int x1, int y1, int x2, int y2)
+{
+ int pixel = (y1 * paintingData.width + x1) * 4;
+ int height = y2 - y1;
+ int width = x2 - x1;
+ int beginKernelPixelX = x1 - m_targetOffset.x();
+ int startKernelPixelX = beginKernelPixelX;
+ int startKernelPixelY = y1 - m_targetOffset.y();
+ int xIncrease = (paintingData.width - width) * 4;
+ // Contains the sum of rgb(a) components
+ float totals[3 + (preserveAlphaValues ? 0 : 1)];
+
+ // m_divisor cannot be 0, SVGFEConvolveMatrixElement ensures this
+ ASSERT(m_divisor);
+
+ for (int y = height; y > 0; --y) {
+ for (int x = width; x > 0; --x) {
+ int kernelValue = m_kernelMatrix.size() - 1;
+ int kernelPixelX = startKernelPixelX;
+ int kernelPixelY = startKernelPixelY;
+ int width = m_kernelSize.width();
+
+ totals[0] = 0;
+ totals[1] = 0;
+ totals[2] = 0;
+ if (!preserveAlphaValues)
+ totals[3] = 0;
+
+ while (kernelValue >= 0) {
+ int pixelIndex = getPixelValue(paintingData, kernelPixelX, kernelPixelY);
+ if (pixelIndex >= 0) {
+ totals[0] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(pixelIndex));
+ totals[1] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(pixelIndex + 1));
+ totals[2] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(pixelIndex + 2));
+ }
+ if (!preserveAlphaValues && pixelIndex >= 0)
+ totals[3] += m_kernelMatrix[kernelValue] * static_cast<float>(paintingData.srcPixelArray->get(pixelIndex + 3));
+ ++kernelPixelX;
+ --kernelValue;
+ if (!--width) {
+ kernelPixelX = startKernelPixelX;
+ ++kernelPixelY;
+ width = m_kernelSize.width();
+ }
+ }
+
+ setDestinationPixels<preserveAlphaValues>(paintingData.dstPixelArray, pixel, totals, m_divisor, paintingData.bias, paintingData.srcPixelArray);
+ ++startKernelPixelX;
+ }
+ pixel += xIncrease;
+ startKernelPixelX = beginKernelPixelX;
+ ++startKernelPixelY;
+ }
+}
+
+ALWAYS_INLINE void FEConvolveMatrix::setInteriorPixels(PaintingData& paintingData, int clipRight, int clipBottom)
{
+ // Must be implemented here, since it refers another ALWAYS_INLINE
+ // function, which defined in this C++ source file as well
+ if (m_preserveAlpha)
+ fastSetInteriorPixels<true>(paintingData, clipRight, clipBottom);
+ else
+ fastSetInteriorPixels<false>(paintingData, clipRight, clipBottom);
+}
+
+ALWAYS_INLINE void FEConvolveMatrix::setOuterPixels(PaintingData& paintingData, int x1, int y1, int x2, int y2)
+{
+ // Although this function can be moved to the header, it is implemented here
+ // because setInteriorPixels is also implemented here
+ if (m_preserveAlpha)
+ fastSetOuterPixels<true>(paintingData, x1, y1, x2, y2);
+ else
+ fastSetOuterPixels<false>(paintingData, x1, y1, x2, y2);
+}
+
+void FEConvolveMatrix::apply(Filter* filter)
+{
+ m_in->apply(filter);
+ if (!m_in->resultImage())
+ return;
+
+ if (!getEffectContext())
+ return;
+
+ IntRect imageRect(IntPoint(), resultImage()->size());
+ IntRect effectDrawingRect = calculateDrawingIntRect(m_in->subRegion());
+
+ RefPtr<CanvasPixelArray> srcPixelArray;
+ if (m_preserveAlpha)
+ srcPixelArray = m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect)->data();
+ else
+ srcPixelArray = m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data();
+
+ RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
+
+ PaintingData paintingData;
+ paintingData.srcPixelArray = srcPixelArray.get();
+ paintingData.dstPixelArray = imageData->data();
+ paintingData.width = imageRect.width();
+ paintingData.height = imageRect.height();
+ paintingData.bias = m_bias * 255;
+
+ // Drawing fully covered pixels
+ int clipRight = imageRect.width() - m_kernelSize.width();
+ int clipBottom = imageRect.height() - m_kernelSize.height();
+
+ if (clipRight >= 0 && clipBottom >= 0) {
+ setInteriorPixels(paintingData, clipRight, clipBottom);
+
+ clipRight += m_targetOffset.x() + 1;
+ clipBottom += m_targetOffset.y() + 1;
+ if (m_targetOffset.y() > 0)
+ setOuterPixels(paintingData, 0, 0, imageRect.width(), m_targetOffset.y());
+ if (clipBottom < imageRect.height())
+ setOuterPixels(paintingData, 0, clipBottom, imageRect.width(), imageRect.height());
+ if (m_targetOffset.x() > 0)
+ setOuterPixels(paintingData, 0, m_targetOffset.y(), m_targetOffset.x(), clipBottom);
+ if (clipRight < imageRect.width())
+ setOuterPixels(paintingData, clipRight, m_targetOffset.y(), imageRect.width(), clipBottom);
+ } else {
+ // Rare situation, not optimizied for speed
+ setOuterPixels(paintingData, 0, 0, imageRect.width(), imageRect.height());
+ }
+
+ if (m_preserveAlpha)
+ resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint());
+ else
+ resultImage()->putPremultipliedImageData(imageData.get(), imageRect, IntPoint());
}
void FEConvolveMatrix::dump()
{
}
-static TextStream& operator<<(TextStream& ts, EdgeModeType t)
+static TextStream& operator<<(TextStream& ts, const EdgeModeType& type)
{
- switch (t)
- {
- case EDGEMODE_UNKNOWN:
- ts << "UNKNOWN";break;
- case EDGEMODE_DUPLICATE:
- ts << "DUPLICATE";break;
- case EDGEMODE_WRAP:
- ts << "WRAP"; break;
- case EDGEMODE_NONE:
- ts << "NONE"; break;
+ switch (type) {
+ case EDGEMODE_UNKNOWN:
+ ts << "UNKNOWN";
+ break;
+ case EDGEMODE_DUPLICATE:
+ ts << "DUPLICATE";
+ break;
+ case EDGEMODE_WRAP:
+ ts << "WRAP";
+ break;
+ case EDGEMODE_NONE:
+ ts << "NONE";
+ break;
}
return ts;
}
-TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts) const
+TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=CONVOLVE-MATRIX] ";
+ writeIndent(ts, indent);
+ ts << "[feConvolveMatrix";
FilterEffect::externalRepresentation(ts);
- ts << " [order " << m_kernelSize << "]"
- << " [kernel matrix=" << m_kernelMatrix << "]"
- << " [divisor=" << m_divisor << "]"
- << " [bias=" << m_bias << "]"
- << " [target " << m_targetOffset << "]"
- << " [edge mode=" << m_edgeMode << "]"
- << " [kernel unit length " << m_kernelUnitLength << "]"
- << " [preserve alpha=" << m_preserveAlpha << "]";
+ ts << " order=\"" << m_kernelSize << "\" "
+ << "kernelMatrix=\"" << m_kernelMatrix << "\" "
+ << "divisor=\"" << m_divisor << "\" "
+ << "bias=\"" << m_bias << "\" "
+ << "target=\"" << m_targetOffset << "\" "
+ << "edgeMode=\"" << m_edgeMode << "\" "
+ << "kernelUnitLength=\"" << m_kernelUnitLength << "\" "
+ << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
index f850412..662d097 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
@@ -1,23 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEConvolveMatrix_h
#define SVGFEConvolveMatrix_h
@@ -27,68 +28,90 @@
#include "FloatPoint.h"
#include "FloatSize.h"
#include "Filter.h"
+#include <wtf/AlwaysInline.h>
#include <wtf/Vector.h>
namespace WebCore {
- enum EdgeModeType {
- EDGEMODE_UNKNOWN = 0,
- EDGEMODE_DUPLICATE = 1,
- EDGEMODE_WRAP = 2,
- EDGEMODE_NONE = 3
- };
+enum EdgeModeType {
+ EDGEMODE_UNKNOWN = 0,
+ EDGEMODE_DUPLICATE = 1,
+ EDGEMODE_WRAP = 2,
+ EDGEMODE_NONE = 3
+};
+
+class CanvasPixelArray;
- class FEConvolveMatrix : public FilterEffect {
- public:
- static PassRefPtr<FEConvolveMatrix> create(FilterEffect*, FilterEffect*, const FloatSize&,
- const float&, const float&, const FloatSize&, EdgeModeType, const FloatPoint&,
- bool, const Vector<float>&);
+class FEConvolveMatrix : public FilterEffect {
+public:
+ static PassRefPtr<FEConvolveMatrix> create(FilterEffect*, const IntSize&,
+ float, float, const IntPoint&, EdgeModeType, const FloatPoint&,
+ bool, const Vector<float>&);
- FloatSize kernelSize() const;
- void setKernelSize(FloatSize);
+ IntSize kernelSize() const;
+ void setKernelSize(IntSize);
- const Vector<float>& kernel() const;
- void setKernel(const Vector<float>&);
+ const Vector<float>& kernel() const;
+ void setKernel(const Vector<float>&);
- float divisor() const;
- void setDivisor(float);
+ float divisor() const;
+ void setDivisor(float);
- float bias() const;
- void setBias(float);
+ float bias() const;
+ void setBias(float);
- FloatSize targetOffset() const;
- void setTargetOffset(FloatSize);
+ IntPoint targetOffset() const;
+ void setTargetOffset(IntPoint);
- EdgeModeType edgeMode() const;
- void setEdgeMode(EdgeModeType);
+ EdgeModeType edgeMode() const;
+ void setEdgeMode(EdgeModeType);
- FloatPoint kernelUnitLength() const;
- void setKernelUnitLength(FloatPoint);
+ FloatPoint kernelUnitLength() const;
+ void setKernelUnitLength(FloatPoint);
- bool preserveAlpha() const;
- void setPreserveAlpha(bool);
+ bool preserveAlpha() const;
+ void setPreserveAlpha(bool);
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
- void apply(Filter*);
- void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
+ void apply(Filter*);
+ void dump();
+ TextStream& externalRepresentation(TextStream&, int indent) const;
- private:
- FEConvolveMatrix(FilterEffect*, FilterEffect*, const FloatSize&, const float&, const float&,
- const FloatSize&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&);
+private:
+ FEConvolveMatrix(FilterEffect*, const IntSize&, float, float,
+ const IntPoint&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&);
- RefPtr<FilterEffect> m_in;
- RefPtr<FilterEffect> m_in2;
- FloatSize m_kernelSize;
- float m_divisor;
- float m_bias;
- FloatSize m_targetOffset;
- EdgeModeType m_edgeMode;
- FloatPoint m_kernelUnitLength;
- bool m_preserveAlpha;
- Vector<float> m_kernelMatrix;
+ struct PaintingData {
+ CanvasPixelArray* srcPixelArray;
+ CanvasPixelArray* dstPixelArray;
+ int width;
+ int height;
+ float bias;
};
+ template<bool preserveAlphaValues>
+ ALWAYS_INLINE void fastSetInteriorPixels(PaintingData&, int clipRight, int clipBottom);
+
+ ALWAYS_INLINE int getPixelValue(PaintingData&, int x, int y);
+
+ template<bool preserveAlphaValues>
+ void fastSetOuterPixels(PaintingData&, int x1, int y1, int x2, int y2);
+
+ // Wrapper functions
+ ALWAYS_INLINE void setInteriorPixels(PaintingData& paintingData, int clipRight, int clipBottom);
+ ALWAYS_INLINE void setOuterPixels(PaintingData& paintingData, int x1, int y1, int x2, int y2);
+
+ RefPtr<FilterEffect> m_in;
+ IntSize m_kernelSize;
+ float m_divisor;
+ float m_bias;
+ IntPoint m_targetOffset;
+ EdgeModeType m_edgeMode;
+ FloatPoint m_kernelUnitLength;
+ bool m_preserveAlpha;
+ Vector<float> m_kernelMatrix;
+};
+
} // namespace WebCore
#endif // ENABLE(SVG) && ENABLE(FILTERS)
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
index 93921df..3a008fa 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
@@ -1,50 +1,43 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "SVGLightSource.h"
#include "SVGFEDiffuseLighting.h"
+
+#include "SVGLightSource.h"
#include "SVGRenderTreeAsText.h"
-#include "Filter.h"
namespace WebCore {
-FEDiffuseLighting::FEDiffuseLighting(FilterEffect* in , const Color& lightingColor, const float& surfaceScale,
- const float& diffuseConstant, const float& kernelUnitLengthX, const float& kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
- : FilterEffect()
- , m_in(in)
- , m_lightingColor(lightingColor)
- , m_surfaceScale(surfaceScale)
- , m_diffuseConstant(diffuseConstant)
- , m_kernelUnitLengthX(kernelUnitLengthX)
- , m_kernelUnitLengthY(kernelUnitLengthY)
- , m_lightSource(lightSource)
+FEDiffuseLighting::FEDiffuseLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+ float diffuseConstant, float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
+ : FELighting(DiffuseLighting, in, lightingColor, surfaceScale, diffuseConstant, 0.0f, 0.0f, kernelUnitLengthX, kernelUnitLengthY, lightSource)
{
}
PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(FilterEffect* in , const Color& lightingColor,
- const float& surfaceScale, const float& diffuseConstant, const float& kernelUnitLengthX,
- const float& kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
+ float surfaceScale, float diffuseConstant, float kernelUnitLengthX,
+ float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
{
return adoptRef(new FEDiffuseLighting(in, lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource));
}
@@ -113,21 +106,19 @@ void FEDiffuseLighting::setLightSource(PassRefPtr<LightSource> lightSource)
m_lightSource = lightSource;
}
-void FEDiffuseLighting::apply(Filter*)
-{
-}
-
void FEDiffuseLighting::dump()
{
}
-TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts) const
+TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=DIFFUSE-LIGHTING] ";
+ writeIndent(ts, indent);
+ ts << "[feDiffuseLighting";
FilterEffect::externalRepresentation(ts);
- ts << " [surface scale=" << m_surfaceScale << "]"
- << " [diffuse constant=" << m_diffuseConstant << "]"
- << " [kernel unit length " << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "]";
+ ts << " surfaceScale=\"" << m_surfaceScale << "\" "
+ << "diffuseConstant=\"" << m_diffuseConstant << "\" "
+ << "kernelUnitLength=\"" << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
index bf7f28e..ee4d5b1 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
@@ -1,77 +1,65 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEDiffuseLighting_h
#define SVGFEDiffuseLighting_h
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "Color.h"
-#include "FilterEffect.h"
-#include "Filter.h"
+#include "SVGFELighting.h"
namespace WebCore {
- class LightSource;
-
- class FEDiffuseLighting : public FilterEffect {
- public:
- static PassRefPtr<FEDiffuseLighting> create(FilterEffect*, const Color&, const float&, const float&,
- const float&, const float&, PassRefPtr<LightSource>);
- virtual ~FEDiffuseLighting();
-
- Color lightingColor() const;
- void setLightingColor(const Color&);
-
- float surfaceScale() const;
- void setSurfaceScale(float);
-
- float diffuseConstant() const;
- void setDiffuseConstant(float);
-
- float kernelUnitLengthX() const;
- void setKernelUnitLengthX(float);
-
- float kernelUnitLengthY() const;
- void setKernelUnitLengthY(float);
-
- const LightSource* lightSource() const;
- void setLightSource(PassRefPtr<LightSource>);
-
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
- void apply(Filter*);
- void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
-
- private:
- FEDiffuseLighting(FilterEffect*, const Color&, const float&, const float&,
- const float&, const float&, PassRefPtr<LightSource>);
-
- RefPtr<FilterEffect> m_in;
- Color m_lightingColor;
- float m_surfaceScale;
- float m_diffuseConstant;
- float m_kernelUnitLengthX;
- float m_kernelUnitLengthY;
- RefPtr<LightSource> m_lightSource;
- };
+class LightSource;
+
+class FEDiffuseLighting : public FELighting {
+public:
+ static PassRefPtr<FEDiffuseLighting> create(FilterEffect*, const Color&, float, float,
+ float, float, PassRefPtr<LightSource>);
+ virtual ~FEDiffuseLighting();
+
+ Color lightingColor() const;
+ void setLightingColor(const Color&);
+
+ float surfaceScale() const;
+ void setSurfaceScale(float);
+
+ float diffuseConstant() const;
+ void setDiffuseConstant(float);
+
+ float kernelUnitLengthX() const;
+ void setKernelUnitLengthX(float);
+
+ float kernelUnitLengthY() const;
+ void setKernelUnitLengthY(float);
+
+ const LightSource* lightSource() const;
+ void setLightSource(PassRefPtr<LightSource>);
+
+ void dump();
+ TextStream& externalRepresentation(TextStream&, int indent) const;
+
+private:
+ FEDiffuseLighting(FilterEffect*, const Color&, float, float,
+ float, float, PassRefPtr<LightSource>);
+};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
index a22bc94..3305f27 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -133,32 +133,38 @@ void FEDisplacementMap::dump()
{
}
-static TextStream& operator<<(TextStream& ts, ChannelSelectorType t)
+static TextStream& operator<<(TextStream& ts, const ChannelSelectorType& type)
{
- switch (t)
- {
- case CHANNEL_UNKNOWN:
- ts << "UNKNOWN"; break;
- case CHANNEL_R:
- ts << "RED"; break;
- case CHANNEL_G:
- ts << "GREEN"; break;
- case CHANNEL_B:
- ts << "BLUE"; break;
- case CHANNEL_A:
- ts << "ALPHA"; break;
+ switch (type) {
+ case CHANNEL_UNKNOWN:
+ ts << "UNKNOWN";
+ break;
+ case CHANNEL_R:
+ ts << "RED";
+ break;
+ case CHANNEL_G:
+ ts << "GREEN";
+ break;
+ case CHANNEL_B:
+ ts << "BLUE";
+ break;
+ case CHANNEL_A:
+ ts << "ALPHA";
+ break;
}
return ts;
}
-TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts) const
+TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=DISPLACEMENT-MAP] ";
+ writeIndent(ts, indent);
+ ts << "[feDisplacementMap";
FilterEffect::externalRepresentation(ts);
- ts << " [in2=" << m_in2.get() << "]"
- << " [scale=" << m_scale << "]"
- << " [x channel selector=" << m_xChannelSelector << "]"
- << " [y channel selector=" << m_yChannelSelector << "]";
+ ts << " scale=\"" << m_scale << "\" "
+ << "xChannelSelector=\"" << m_xChannelSelector << "\" "
+ << "yChannelSelector=\"" << m_yChannelSelector << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
+ m_in2->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
index 007f6ba..7bb9d19 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEDisplacementMap_h
#define SVGFEDisplacementMap_h
@@ -54,7 +54,7 @@ namespace WebCore {
virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEDisplacementMap(FilterEffect*, FilterEffect*, ChannelSelectorType,
diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
index 648bf54..5286d80 100644
--- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -77,12 +77,13 @@ void FEFlood::dump()
{
}
-TextStream& FEFlood::externalRepresentation(TextStream& ts) const
+TextStream& FEFlood::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=FLOOD] ";
+ writeIndent(ts, indent);
+ ts << "[feFlood";
FilterEffect::externalRepresentation(ts);
- ts << " [color=" << floodColor() << "]"
- << " [opacity=" << floodOpacity() << "]";
+ ts << " flood-color=\"" << floodColor() << "\" "
+ << "flood-opacity=\"" << floodOpacity() << "\"]\n";
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.h b/WebCore/svg/graphics/filters/SVGFEFlood.h
index 91795dd..8ae251d 100644
--- a/WebCore/svg/graphics/filters/SVGFEFlood.h
+++ b/WebCore/svg/graphics/filters/SVGFEFlood.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEFlood_h
#define SVGFEFlood_h
@@ -41,7 +41,7 @@ namespace WebCore {
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEFlood(const Color&, const float&);
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index 950203a..b21ceae 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
- 2010 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -66,10 +66,14 @@ void FEImage::dump()
{
}
-TextStream& FEImage::externalRepresentation(TextStream& ts) const
+TextStream& FEImage::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=IMAGE] ";
+ ASSERT(m_image);
+ IntSize imageSize = m_image->size();
+ writeIndent(ts, indent);
+ ts << "[feImage";
FilterEffect::externalRepresentation(ts);
+ ts << " image-size=\"" << imageSize.width() << "x" << imageSize.height() << "\"]\n";
// FIXME: should this dump also object returned by SVGFEImage::image() ?
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.h b/WebCore/svg/graphics/filters/SVGFEImage.h
index 0883aad..97a9cda 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.h
+++ b/WebCore/svg/graphics/filters/SVGFEImage.h
@@ -1,32 +1,30 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
- 2010 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEImage_h
#define SVGFEImage_h
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "Image.h"
#include "FilterEffect.h"
-#include "Filter.h"
#include "SVGPreserveAspectRatio.h"
namespace WebCore {
@@ -37,7 +35,7 @@ namespace WebCore {
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEImage(RefPtr<Image>, SVGPreserveAspectRatio);
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.cpp b/WebCore/svg/graphics/filters/SVGFELighting.cpp
new file mode 100644
index 0000000..7c3c81c
--- /dev/null
+++ b/WebCore/svg/graphics/filters/SVGFELighting.cpp
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) 2010 University of Szeged
+ * Copyright (C) 2010 Zoltan Herczeg
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "SVGFELighting.h"
+
+#include "CanvasPixelArray.h"
+#include "ImageData.h"
+#include "SVGLightSource.h"
+
+namespace WebCore {
+
+FELighting::FELighting(LightingType lightingType, FilterEffect* in, const Color& lightingColor, float surfaceScale,
+ float diffuseConstant, float specularConstant, float specularExponent,
+ float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
+ : FilterEffect()
+ , m_lightingType(lightingType)
+ , m_in(in)
+ , m_lightSource(lightSource)
+ , m_lightingColor(lightingColor)
+ , m_surfaceScale(surfaceScale)
+ , m_diffuseConstant(diffuseConstant)
+ , m_specularConstant(specularConstant)
+ , m_specularExponent(specularExponent)
+ , m_kernelUnitLengthX(kernelUnitLengthX)
+ , m_kernelUnitLengthY(kernelUnitLengthY)
+{
+}
+
+const static int cPixelSize = 4;
+const static int cAlphaChannelOffset = 3;
+const static unsigned char cOpaqueAlpha = static_cast<unsigned char>(0xff);
+
+ALWAYS_INLINE int FELighting::LightingData::upLeftPixelValue()
+{
+ return static_cast<int>(pixels->get(offset - widthMultipliedByPixelSize - cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::upPixelValue()
+{
+ return static_cast<int>(pixels->get(offset - widthMultipliedByPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::upRightPixelValue()
+{
+ return static_cast<int>(pixels->get(offset - widthMultipliedByPixelSize + cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::leftPixelValue()
+{
+ return static_cast<int>(pixels->get(offset - cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::centerPixelValue()
+{
+ return static_cast<int>(pixels->get(offset + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::rightPixelValue()
+{
+ return static_cast<int>(pixels->get(offset + cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::downLeftPixelValue()
+{
+ return static_cast<int>(pixels->get(offset + widthMultipliedByPixelSize - cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::downPixelValue()
+{
+ return static_cast<int>(pixels->get(offset + widthMultipliedByPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE int FELighting::LightingData::downRightPixelValue()
+{
+ return static_cast<int>(pixels->get(offset + widthMultipliedByPixelSize + cPixelSize + cAlphaChannelOffset));
+}
+
+ALWAYS_INLINE void FELighting::setPixel(LightingData& data, LightSource::PaintingData& paintingData,
+ int lightX, int lightY, float factorX, int normalX, float factorY, int normalY)
+{
+ m_lightSource->updatePaintingData(paintingData, lightX, lightY, static_cast<float>(data.pixels->get(data.offset + 3)) * data.surfaceScale);
+
+ data.normalVector.setX(factorX * static_cast<float>(normalX) * data.surfaceScale);
+ data.normalVector.setY(factorY * static_cast<float>(normalY) * data.surfaceScale);
+ data.normalVector.setZ(1.0f);
+ data.normalVector.normalize();
+
+ if (m_lightingType == FELighting::DiffuseLighting)
+ data.lightStrength = m_diffuseConstant * (data.normalVector * paintingData.lightVector);
+ else {
+ FloatPoint3D halfwayVector = paintingData.lightVector;
+ halfwayVector.setZ(halfwayVector.z() + 1.0f);
+ halfwayVector.normalize();
+ if (m_specularExponent == 1.0f)
+ data.lightStrength = m_specularConstant * (data.normalVector * halfwayVector);
+ else
+ data.lightStrength = m_specularConstant * powf(data.normalVector * halfwayVector, m_specularExponent);
+ }
+
+ if (data.lightStrength > 1.0f)
+ data.lightStrength = 1.0f;
+ if (data.lightStrength < 0.0f)
+ data.lightStrength = 0.0f;
+
+ data.pixels->set(data.offset, static_cast<unsigned char>(data.lightStrength * paintingData.colorVector.x()));
+ data.pixels->set(data.offset + 1, static_cast<unsigned char>(data.lightStrength * paintingData.colorVector.y()));
+ data.pixels->set(data.offset + 2, static_cast<unsigned char>(data.lightStrength * paintingData.colorVector.z()));
+}
+
+bool FELighting::drawLighting(CanvasPixelArray* pixels, int width, int height)
+{
+ LightSource::PaintingData paintingData;
+ LightingData data;
+
+ if (!m_lightSource)
+ return false;
+
+ // FIXME: do something if width or height (or both) is 1 pixel.
+ // The W3 spec does not define this case. Now the filter just returns.
+ if (width <= 2 || height <= 2)
+ return false;
+
+ data.pixels = pixels;
+ data.surfaceScale = m_surfaceScale / 255.0f;
+ data.widthMultipliedByPixelSize = width * cPixelSize;
+ data.widthDecreasedByOne = width - 1;
+ data.heightDecreasedByOne = height - 1;
+ paintingData.colorVector = FloatPoint3D(m_lightingColor.red(), m_lightingColor.green(), m_lightingColor.blue());
+ m_lightSource->initPaintingData(paintingData);
+
+ // Top/Left corner
+ data.offset = 0;
+ setPixel(data, paintingData, 0, 0,
+ -2.0f / 3.0f, -2 * data.centerPixelValue() + 2 * data.rightPixelValue() - data.downPixelValue() + data.downRightPixelValue(),
+ -2.0f / 3.0f, -2 * data.centerPixelValue() - data.rightPixelValue() + 2 * data.downPixelValue() + data.downRightPixelValue());
+
+ // Top/Right pixel
+ data.offset = data.widthMultipliedByPixelSize - cPixelSize;
+ setPixel(data, paintingData, data.widthDecreasedByOne, 0,
+ -2.0f / 3.0f, -2 * data.leftPixelValue() + 2 * data.centerPixelValue() - data.downLeftPixelValue() + data.downPixelValue(),
+ -2.0f / 3.0f, -data.leftPixelValue() - 2 * data.centerPixelValue() + data.downLeftPixelValue() + 2 * data.downPixelValue());
+
+ // Bottom/Left pixel
+ data.offset = data.heightDecreasedByOne * data.widthMultipliedByPixelSize;
+ setPixel(data, paintingData, 0, data.heightDecreasedByOne,
+ -2.0f / 3.0f, -data.upPixelValue() + data.upRightPixelValue() - 2 * data.centerPixelValue() + 2 * data.rightPixelValue(),
+ -2.0f / 3.0f, -2 * data.upPixelValue() - data.upRightPixelValue() + 2 * data.centerPixelValue() + data.rightPixelValue());
+
+ // Bottom/Right pixel
+ data.offset = height * data.widthMultipliedByPixelSize - cPixelSize;
+ setPixel(data, paintingData, data.widthDecreasedByOne, data.heightDecreasedByOne,
+ -2.0f / 3.0f, -data.upLeftPixelValue() + data.upPixelValue() - 2 * data.leftPixelValue() + 2 * data.centerPixelValue(),
+ -2.0f / 3.0f, -data.upLeftPixelValue() - 2 * data.upPixelValue() + data.leftPixelValue() + 2 * data.centerPixelValue());
+
+ if (width >= 3) {
+ // Top line
+ data.offset = cPixelSize;
+ for (int x = 1; x < data.widthDecreasedByOne; ++x, data.offset += cPixelSize) {
+ setPixel(data, paintingData, x, 0,
+ -1.0f / 3.0f, -2 * data.leftPixelValue() + 2 * data.rightPixelValue() - data.downLeftPixelValue() + data.downRightPixelValue(),
+ -1.0f / 2.0f, -data.leftPixelValue() - 2 * data.centerPixelValue() - data.rightPixelValue() + data.downLeftPixelValue() + 2 * data.downPixelValue() + data.downRightPixelValue());
+ }
+ // Bottom line
+ data.offset = data.heightDecreasedByOne * data.widthMultipliedByPixelSize + cPixelSize;
+ for (int x = 1; x < data.widthDecreasedByOne; ++x, data.offset += cPixelSize) {
+ setPixel(data, paintingData, x, data.heightDecreasedByOne,
+ -1.0f / 3.0f, -data.upLeftPixelValue() + data.upRightPixelValue() - 2 * data.leftPixelValue() + 2 * data.rightPixelValue(),
+ -1.0f / 2.0f, -data.upLeftPixelValue() - 2 * data.upPixelValue() - data.upRightPixelValue() + data.leftPixelValue() + 2 * data.centerPixelValue() + data.rightPixelValue());
+ }
+ }
+
+ if (height >= 3) {
+ // Left line
+ data.offset = data.widthMultipliedByPixelSize;
+ for (int y = 1; y < data.heightDecreasedByOne; ++y, data.offset += data.widthMultipliedByPixelSize) {
+ setPixel(data, paintingData, 0, y,
+ -1.0f / 2.0f, -data.upPixelValue() + data.upRightPixelValue() - 2 * data.centerPixelValue() + 2 * data.rightPixelValue() - data.downPixelValue() + data.downRightPixelValue(),
+ -1.0f / 3.0f, -2 * data.upPixelValue() - data.upRightPixelValue() + 2 * data.downPixelValue() + data.downRightPixelValue());
+ }
+ // Right line
+ data.offset = data.widthMultipliedByPixelSize + data.widthMultipliedByPixelSize - cPixelSize;
+ for (int y = 1; y < data.heightDecreasedByOne; ++y, data.offset += data.widthMultipliedByPixelSize) {
+ setPixel(data, paintingData, data.widthDecreasedByOne, y,
+ -1.0f / 2.0f, -data.upLeftPixelValue() + data.upPixelValue() -2 * data.leftPixelValue() + 2 * data.centerPixelValue() - data.downLeftPixelValue() + data.downPixelValue(),
+ -1.0f / 3.0f, -data.upLeftPixelValue() - 2 * data.upPixelValue() + data.downLeftPixelValue() + 2 * data.downPixelValue());
+ }
+ }
+
+ if (width >= 3 && height >= 3) {
+ // Interior pixels
+ for (int y = 1; y < data.heightDecreasedByOne; ++y) {
+ data.offset = y * data.widthMultipliedByPixelSize + cPixelSize;
+ for (int x = 1; x < data.widthDecreasedByOne; ++x, data.offset += cPixelSize) {
+ setPixel(data, paintingData, x, y,
+ -1.0f / 4.0f, -data.upLeftPixelValue() + data.upRightPixelValue() - 2 * data.leftPixelValue() + 2 * data.rightPixelValue() - data.downLeftPixelValue() + data.downRightPixelValue(),
+ -1.0f / 4.0f, -data.upLeftPixelValue() - 2 * data.upPixelValue() - data.upRightPixelValue() + data.downLeftPixelValue() + 2 * data.downPixelValue() + data.downRightPixelValue());
+ }
+ }
+ }
+
+ int totalSize = data.widthMultipliedByPixelSize * height;
+ if (m_lightingType == DiffuseLighting) {
+ for (int i = 3; i < totalSize; i += 4)
+ data.pixels->set(i, cOpaqueAlpha);
+ } else {
+ for (int i = 0; i < totalSize; i += 4) {
+ unsigned char a1 = data.pixels->get(i);
+ unsigned char a2 = data.pixels->get(i + 1);
+ unsigned char a3 = data.pixels->get(i + 2);
+ // alpha set to set to max(a1, a2, a3)
+ data.pixels->set(i + 3, a1 >= a2 ? (a1 >= a3 ? a1 : a3) : (a2 >= a3 ? a2 : a3));
+ }
+ }
+
+ return true;
+}
+
+void FELighting::apply(Filter* filter)
+{
+ m_in->apply(filter);
+ if (!m_in->resultImage())
+ return;
+
+ if (!getEffectContext())
+ return;
+
+ setIsAlphaImage(false);
+
+ IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
+ RefPtr<ImageData> srcImageData(m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
+ CanvasPixelArray* srcPixelArray(srcImageData->data());
+
+ // FIXME: support kernelUnitLengths other than (1,1). The issue here is that the W3
+ // standard has no test case for them, and other browsers (like Firefox) has strange
+ // output for various kernelUnitLengths, and I am not sure they are reliable.
+ // Anyway, feConvolveMatrix should also use the implementation
+
+ if (drawLighting(srcPixelArray, effectDrawingRect.width(), effectDrawingRect.height()))
+ resultImage()->putUnmultipliedImageData(srcImageData.get(), IntRect(IntPoint(), resultImage()->size()), IntPoint());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG) && ENABLE(FILTERS)
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.h b/WebCore/svg/graphics/filters/SVGFELighting.h
new file mode 100644
index 0000000..7db50e0
--- /dev/null
+++ b/WebCore/svg/graphics/filters/SVGFELighting.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2010 University of Szeged
+ * Copyright (C) 2010 Zoltan Herczeg
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SVGFELighting_h
+#define SVGFELighting_h
+
+#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "Color.h"
+#include "Filter.h"
+#include "FilterEffect.h"
+#include "SVGLightSource.h"
+#include <wtf/AlwaysInline.h>
+
+// Common base class for FEDiffuseLighting and FESpecularLighting
+
+namespace WebCore {
+
+class CanvasPixelArray;
+
+class FELighting : public FilterEffect {
+public:
+ virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
+ void apply(Filter*);
+
+protected:
+ enum LightingType {
+ DiffuseLighting,
+ SpecularLighting
+ };
+
+ struct LightingData {
+ FloatPoint3D normalVector;
+ CanvasPixelArray* pixels;
+ float lightStrength;
+ float surfaceScale;
+ int offset;
+ int widthMultipliedByPixelSize;
+ int widthDecreasedByOne;
+ int heightDecreasedByOne;
+
+ ALWAYS_INLINE int upLeftPixelValue();
+ ALWAYS_INLINE int upPixelValue();
+ ALWAYS_INLINE int upRightPixelValue();
+ ALWAYS_INLINE int leftPixelValue();
+ ALWAYS_INLINE int centerPixelValue();
+ ALWAYS_INLINE int rightPixelValue();
+ ALWAYS_INLINE int downLeftPixelValue();
+ ALWAYS_INLINE int downPixelValue();
+ ALWAYS_INLINE int downRightPixelValue();
+ };
+
+ FELighting(LightingType, FilterEffect*, const Color&, float, float, float,
+ float, float, float, PassRefPtr<LightSource>);
+
+ bool drawLighting(CanvasPixelArray*, int, int);
+ ALWAYS_INLINE void setPixel(LightingData&, LightSource::PaintingData&,
+ int lightX, int lightY, float factorX, int normalX, float factorY, int normalY);
+
+ LightingType m_lightingType;
+ RefPtr<FilterEffect> m_in;
+ RefPtr<LightSource> m_lightSource;
+
+ Color m_lightingColor;
+ float m_surfaceScale;
+ float m_diffuseConstant;
+ float m_specularConstant;
+ float m_specularExponent;
+ float m_kernelUnitLengthX;
+ float m_kernelUnitLengthY;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG) && ENABLE(FILTERS)
+
+#endif // SVGFELighting_h
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
index 6ea0fb9..11c7407 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -79,7 +79,7 @@ void FEMerge::apply(Filter* filter)
for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->scaledSubRegion());
- filterContext->drawImage(m_mergeInputs[i]->resultImage()->image(), DeviceColorSpace, destRect);
+ filterContext->drawImageBuffer(m_mergeInputs[i]->resultImage(), DeviceColorSpace, destRect);
}
}
@@ -87,20 +87,17 @@ void FEMerge::dump()
{
}
-TextStream& FEMerge::externalRepresentation(TextStream& ts) const
+TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=MERGE] ";
+ writeIndent(ts, indent);
+ ts << "[feMerge";
FilterEffect::externalRepresentation(ts);
- ts << "[merge inputs=[";
- unsigned x = 0;
- unsigned size = m_mergeInputs.size();
- while (x < size) {
- ts << m_mergeInputs[x];
- x++;
- if (x < m_mergeInputs.size())
- ts << ", ";
+ ts << " mergeNodes=\"" << m_mergeInputs.size() << "\"]\n";
+ if (!m_mergeInputs.isEmpty()) {
+ const Vector<RefPtr<FilterEffect> >::const_iterator end = m_mergeInputs.end();
+ for (Vector<RefPtr<FilterEffect> >::const_iterator it = m_mergeInputs.begin(); it != end; ++it)
+ (*it)->externalRepresentation(ts, indent + 1);
}
- ts << "]]";
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/svg/graphics/filters/SVGFEMerge.h
index 7653be3..66decfc 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.h
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEMerge_h
#define SVGFEMerge_h
@@ -39,7 +39,7 @@ namespace WebCore {
virtual FloatRect uniteChildEffectSubregions(Filter*);
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEMerge(const Vector<RefPtr<FilterEffect> >&);
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
index 987350d..3fdf369 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -92,7 +92,9 @@ void FEMorphology::apply(Filter* filter)
setIsAlphaImage(m_in->isAlphaImage());
- if (!m_radiusX || !m_radiusY)
+ int radiusX = static_cast<int>(m_radiusX * filter->filterResolution().width());
+ int radiusY = static_cast<int>(m_radiusY * filter->filterResolution().height());
+ if (radiusX <= 0 || radiusY <= 0)
return;
IntRect imageRect(IntPoint(), resultImage()->size());
@@ -100,12 +102,11 @@ void FEMorphology::apply(Filter* filter)
RefPtr<CanvasPixelArray> srcPixelArray(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
- int radiusX = static_cast<int>(m_radiusX * filter->filterResolution().width());
- int radiusY = static_cast<int>(m_radiusY * filter->filterResolution().height());
int effectWidth = effectDrawingRect.width() * 4;
- // Limit the radius size to effect width
+ // Limit the radius size to effect dimensions
radiusX = min(effectDrawingRect.width() - 1, radiusX);
+ radiusY = min(effectDrawingRect.height() - 1, radiusY);
Vector<unsigned char> extrema;
for (int y = 0; y < effectDrawingRect.height(); ++y) {
@@ -156,26 +157,30 @@ void FEMorphology::dump()
{
}
-static TextStream& operator<<(TextStream& ts, MorphologyOperatorType t)
+static TextStream& operator<<(TextStream& ts, const MorphologyOperatorType& type)
{
- switch (t)
- {
- case FEMORPHOLOGY_OPERATOR_UNKNOWN:
- ts << "UNKNOWN"; break;
- case FEMORPHOLOGY_OPERATOR_ERODE:
- ts << "ERODE"; break;
- case FEMORPHOLOGY_OPERATOR_DILATE:
- ts << "DILATE"; break;
+ switch (type) {
+ case FEMORPHOLOGY_OPERATOR_UNKNOWN:
+ ts << "UNKNOWN";
+ break;
+ case FEMORPHOLOGY_OPERATOR_ERODE:
+ ts << "ERODE";
+ break;
+ case FEMORPHOLOGY_OPERATOR_DILATE:
+ ts << "DILATE";
+ break;
}
return ts;
}
-TextStream& FEMorphology::externalRepresentation(TextStream& ts) const
+TextStream& FEMorphology::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=MORPHOLOGY] ";
+ writeIndent(ts, indent);
+ ts << "[feMorphology";
FilterEffect::externalRepresentation(ts);
- ts << " [operator type=" << morphologyOperator() << "]"
- << " [radius x=" << radiusX() << " y=" << radiusY() << "]";
+ ts << " operator=\"" << morphologyOperator() << "\" "
+ << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h
index 6a321c8..79f292d 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.h
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEMorphology_h
#define SVGFEMorphology_h
@@ -49,7 +49,7 @@ namespace WebCore {
virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEMorphology(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY);
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
index 0066c3e..e12b8e0 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
@@ -1,24 +1,24 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -91,18 +91,20 @@ void FEOffset::apply(Filter* filter)
m_in->scaledSubRegion().width(),
m_in->scaledSubRegion().height());
- filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, dstRect);
+ filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, dstRect);
}
void FEOffset::dump()
{
}
-TextStream& FEOffset::externalRepresentation(TextStream& ts) const
+TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=OFFSET] ";
+ writeIndent(ts, indent);
+ ts << "[feOffset";
FilterEffect::externalRepresentation(ts);
- ts << " [dx=" << dx() << " dy=" << dy() << "]";
+ ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/svg/graphics/filters/SVGFEOffset.h
index 8435db1..ad071d6 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.h
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFEOffset_h
#define SVGFEOffset_h
@@ -41,7 +41,7 @@ namespace WebCore {
virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FEOffset(FilterEffect*, const float&, const float&);
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
index 0b43aba..5c6dc2a 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
@@ -1,51 +1,44 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFESpecularLighting.h"
+
+#include "SVGLightSource.h"
#include "SVGRenderTreeAsText.h"
-#include "Filter.h"
namespace WebCore {
-FESpecularLighting::FESpecularLighting(FilterEffect* in, const Color& lightingColor, const float& surfaceScale,
- const float& specularConstant, const float& specularExponent, const float& kernelUnitLengthX,
- const float& kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
- : FilterEffect()
- , m_in(in)
- , m_lightingColor(lightingColor)
- , m_surfaceScale(surfaceScale)
- , m_specularConstant(specularConstant)
- , m_specularExponent(specularExponent)
- , m_kernelUnitLengthX(kernelUnitLengthX)
- , m_kernelUnitLengthY(kernelUnitLengthY)
- , m_lightSource(lightSource)
+FESpecularLighting::FESpecularLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+ float specularConstant, float specularExponent, float kernelUnitLengthX,
+ float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
+ : FELighting(SpecularLighting, in, lightingColor, surfaceScale, 0.0f, specularConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource)
{
}
PassRefPtr<FESpecularLighting> FESpecularLighting::create(FilterEffect* in, const Color& lightingColor,
- const float& surfaceScale, const float& specularConstant, const float& specularExponent,
- const float& kernelUnitLengthX, const float& kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
+ float surfaceScale, float specularConstant, float specularExponent,
+ float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
{
return adoptRef(new FESpecularLighting(in, lightingColor, surfaceScale, specularConstant, specularExponent,
kernelUnitLengthX, kernelUnitLengthY, lightSource));
@@ -125,21 +118,19 @@ void FESpecularLighting::setLightSource(PassRefPtr<LightSource> lightSource)
m_lightSource = lightSource;
}
-void FESpecularLighting::apply(Filter*)
-{
-}
-
void FESpecularLighting::dump()
{
}
-TextStream& FESpecularLighting::externalRepresentation(TextStream& ts) const
+TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=SPECULAR-LIGHTING] ";
+ writeIndent(ts, indent);
+ ts << "[feSpecularLighting";
FilterEffect::externalRepresentation(ts);
- ts << " [surface scale=" << m_surfaceScale << "]"
- << " [specual constant=" << m_specularConstant << "]"
- << " [specular exponent=" << m_specularExponent << "]";
+ ts << " surfaceScale=\"" << m_surfaceScale << "\" "
+ << "specualConstant=\"" << m_specularConstant << "\" "
+ << "specularExponent=\"" << m_specularExponent << "\"]\n";
+ m_in->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
index f4947fd..3a49c1e 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
@@ -1,80 +1,66 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFESpecularLighting_h
#define SVGFESpecularLighting_h
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "Color.h"
-#include "FilterEffect.h"
-#include "SVGLightSource.h"
-#include "Filter.h"
+#include "SVGFELighting.h"
namespace WebCore {
- class FESpecularLighting : public FilterEffect {
- public:
- static PassRefPtr<FESpecularLighting> create(FilterEffect*, const Color&, const float&, const float&,
- const float&, const float&, const float&, PassRefPtr<LightSource>);
- virtual ~FESpecularLighting();
+class FESpecularLighting : public FELighting {
+public:
+ static PassRefPtr<FESpecularLighting> create(FilterEffect*, const Color&, float, float,
+ float, float, float, PassRefPtr<LightSource>);
+ virtual ~FESpecularLighting();
- Color lightingColor() const;
- void setLightingColor(const Color&);
+ Color lightingColor() const;
+ void setLightingColor(const Color&);
- float surfaceScale() const;
- void setSurfaceScale(float);
+ float surfaceScale() const;
+ void setSurfaceScale(float);
- float specularConstant() const;
- void setSpecularConstant(float);
+ float specularConstant() const;
+ void setSpecularConstant(float);
- float specularExponent() const;
- void setSpecularExponent(float);
+ float specularExponent() const;
+ void setSpecularExponent(float);
- float kernelUnitLengthX() const;
- void setKernelUnitLengthX(float);
+ float kernelUnitLengthX() const;
+ void setKernelUnitLengthX(float);
- float kernelUnitLengthY() const;
- void setKernelUnitLengthY(float);
+ float kernelUnitLengthY() const;
+ void setKernelUnitLengthY(float);
- const LightSource* lightSource() const;
- void setLightSource(PassRefPtr<LightSource>);
+ const LightSource* lightSource() const;
+ void setLightSource(PassRefPtr<LightSource>);
- virtual FloatRect uniteEffectRect(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
- void apply(Filter*);
- void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ void dump();
+ TextStream& externalRepresentation(TextStream&, int indent) const;
- private:
- FESpecularLighting(FilterEffect*, const Color&, const float&, const float&, const float&,
- const float&, const float&, PassRefPtr<LightSource>);
-
- RefPtr<FilterEffect> m_in;
- Color m_lightingColor;
- float m_surfaceScale;
- float m_specularConstant;
- float m_specularExponent;
- float m_kernelUnitLengthX;
- float m_kernelUnitLengthY;
- RefPtr<LightSource> m_lightSource;
- };
+private:
+ FESpecularLighting(FilterEffect*, const Color&, float, float, float,
+ float, float, PassRefPtr<LightSource>);
+};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp
index 5bc2129..56cbc1e 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETile.cpp
@@ -1,22 +1,22 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
- 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
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
@@ -72,8 +72,8 @@ void FETile::apply(Filter* filter)
OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size());
GraphicsContext* tileImageContext = tileImage->context();
- tileImageContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, IntPoint());
- RefPtr<Pattern> pattern = Pattern::create(tileImage->image(), true, true);
+ tileImageContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, IntPoint());
+ RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(), true, true);
AffineTransform matrix;
matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y());
@@ -87,10 +87,14 @@ void FETile::dump()
{
}
-TextStream& FETile::externalRepresentation(TextStream& ts) const
+TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=TILE]";
+ writeIndent(ts, indent);
+ ts << "[feTile";
FilterEffect::externalRepresentation(ts);
+ ts << "]\n";
+ m_in->externalRepresentation(ts, indent + 1);
+
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/svg/graphics/filters/SVGFETile.h
index c845085..7af9c13 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.h
+++ b/WebCore/svg/graphics/filters/SVGFETile.h
@@ -1,23 +1,23 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFETile_h
#define SVGFETile_h
@@ -35,7 +35,7 @@ namespace WebCore {
virtual FloatRect uniteChildEffectSubregions(Filter*);
void apply(Filter*);
void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+ TextStream& externalRepresentation(TextStream&, int indent) const;
private:
FETile(FilterEffect*);
diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
index 542c576..399f7fc 100644
--- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
@@ -1,35 +1,55 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFETurbulence.h"
-#include "SVGRenderTreeAsText.h"
+
+#include "CanvasPixelArray.h"
#include "Filter.h"
+#include "ImageData.h"
+#include "SVGRenderTreeAsText.h"
+
+#include <wtf/MathExtras.h>
namespace WebCore {
-FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY,
- const int& numOctaves, const float& seed, bool stitchTiles)
+/*
+ Produces results in the range [1, 2**31 - 2]. Algorithm is:
+ r = (a * r) mod m where a = randAmplitude = 16807 and
+ m = randMaximum = 2**31 - 1 = 2147483647, r = seed.
+ See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988
+ To test: the algorithm should produce the result 1043618065
+ as the 10,000th generated number if the original seed is 1.
+*/
+static const int s_perlinNoise = 4096;
+static const long s_randMaximum = 2147483647; // 2**31 - 1
+static const int s_randAmplitude = 16807; // 7**5; primitive root of m
+static const int s_randQ = 127773; // m / a
+static const int s_randR = 2836; // m % a
+
+FETurbulence::FETurbulence(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
: FilterEffect()
, m_type(type)
, m_baseFrequencyX(baseFrequencyX)
@@ -40,8 +60,7 @@ FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, con
{
}
-PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY,
- const int& numOctaves, const float& seed, bool stitchTiles)
+PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
{
return adoptRef(new FETurbulence(type, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles));
}
@@ -106,38 +125,260 @@ void FETurbulence::setStitchTiles(bool stitch)
m_stitchTiles = stitch;
}
-void FETurbulence::apply(Filter*)
+// The turbulence calculation code is an adapted version of what appears in the SVG 1.1 specification:
+// http://www.w3.org/TR/SVG11/filters.html#feTurbulence
+
+FETurbulence::PaintingData::PaintingData(long paintingSeed, const IntSize& paintingSize)
+ : seed(paintingSeed)
+ , width(0)
+ , height(0)
+ , wrapX(0)
+ , wrapY(0)
+ , channel(0)
+ , filterSize(paintingSize)
{
}
+// Compute pseudo random number.
+inline long FETurbulence::PaintingData::random()
+{
+ long result = s_randAmplitude * (seed % s_randQ) - s_randR * (seed / s_randQ);
+ if (result <= 0)
+ result += s_randMaximum;
+ seed = result;
+ return result;
+}
+
+inline float smoothCurve(float t)
+{
+ return t * t * (3 - 2 * t);
+}
+
+inline float linearInterpolation(float t, float a, float b)
+{
+ return a + t * (b - a);
+}
+
+inline void FETurbulence::initPaint(PaintingData& paintingData)
+{
+ float normalizationFactor;
+
+ // The seed value clamp to the range [1, s_randMaximum - 1].
+ if (paintingData.seed <= 0)
+ paintingData.seed = -(paintingData.seed % (s_randMaximum - 1)) + 1;
+ if (paintingData.seed > s_randMaximum - 1)
+ paintingData.seed = s_randMaximum - 1;
+
+ float* gradient;
+ for (int channel = 0; channel < 4; ++channel) {
+ for (int i = 0; i < s_blockSize; ++i) {
+ paintingData.latticeSelector[i] = i;
+ gradient = paintingData.gradient[channel][i];
+ gradient[0] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize;
+ gradient[1] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize;
+ normalizationFactor = sqrtf(gradient[0] * gradient[0] + gradient[1] * gradient[1]);
+ gradient[0] /= normalizationFactor;
+ gradient[1] /= normalizationFactor;
+ }
+ }
+ for (int i = s_blockSize - 1; i > 0; --i) {
+ int k = paintingData.latticeSelector[i];
+ int j = paintingData.random() % s_blockSize;
+ ASSERT(j >= 0);
+ ASSERT(j < 2 * s_blockSize + 2);
+ paintingData.latticeSelector[i] = paintingData.latticeSelector[j];
+ paintingData.latticeSelector[j] = k;
+ }
+ for (int i = 0; i < s_blockSize + 2; ++i) {
+ paintingData.latticeSelector[s_blockSize + i] = paintingData.latticeSelector[i];
+ for (int channel = 0; channel < 4; ++channel) {
+ paintingData.gradient[channel][s_blockSize + i][0] = paintingData.gradient[channel][i][0];
+ paintingData.gradient[channel][s_blockSize + i][1] = paintingData.gradient[channel][i][1];
+ }
+ }
+}
+
+inline void checkNoise(int& noiseValue, int limitValue, int newValue)
+{
+ if (noiseValue >= limitValue)
+ noiseValue -= newValue;
+ if (noiseValue >= limitValue - 1)
+ noiseValue -= newValue - 1;
+}
+
+float FETurbulence::noise2D(PaintingData& paintingData, const FloatPoint& noiseVector)
+{
+ struct Noise {
+ int noisePositionIntegerValue;
+ float noisePositionFractionValue;
+
+ Noise(float component)
+ {
+ float position = component + s_perlinNoise;
+ noisePositionIntegerValue = static_cast<int>(position);
+ noisePositionFractionValue = position - noisePositionIntegerValue;
+ }
+ };
+
+ Noise noiseX(noiseVector.x());
+ Noise noiseY(noiseVector.y());
+ float* q;
+ float sx, sy, a, b, u, v;
+
+ // If stitching, adjust lattice points accordingly.
+ if (m_stitchTiles) {
+ checkNoise(noiseX.noisePositionIntegerValue, paintingData.wrapX, paintingData.width);
+ checkNoise(noiseY.noisePositionIntegerValue, paintingData.wrapY, paintingData.height);
+ }
+
+ noiseX.noisePositionIntegerValue &= s_blockMask;
+ noiseY.noisePositionIntegerValue &= s_blockMask;
+ int latticeIndex = paintingData.latticeSelector[noiseX.noisePositionIntegerValue];
+ int nextLatticeIndex = paintingData.latticeSelector[(noiseX.noisePositionIntegerValue + 1) & s_blockMask];
+
+ sx = smoothCurve(noiseX.noisePositionFractionValue);
+ sy = smoothCurve(noiseY.noisePositionFractionValue);
+
+ // This is taken 1:1 from SVG spec: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement.
+ int temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue];
+ q = paintingData.gradient[paintingData.channel][temp];
+ u = noiseX.noisePositionFractionValue * q[0] + noiseY.noisePositionFractionValue * q[1];
+ temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue];
+ q = paintingData.gradient[paintingData.channel][temp];
+ v = (noiseX.noisePositionFractionValue - 1) * q[0] + noiseY.noisePositionFractionValue * q[1];
+ a = linearInterpolation(sx, u, v);
+ temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue + 1];
+ q = paintingData.gradient[paintingData.channel][temp];
+ u = noiseX.noisePositionFractionValue * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1];
+ temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue + 1];
+ q = paintingData.gradient[paintingData.channel][temp];
+ v = (noiseX.noisePositionFractionValue - 1) * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1];
+ b = linearInterpolation(sx, u, v);
+ return linearInterpolation(sy, a, b);
+}
+
+unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paintingData, const FloatPoint& point)
+{
+ float tileWidth = paintingData.filterSize.width();
+ ASSERT(tileWidth > 0);
+ float tileHeight = paintingData.filterSize.height();
+ ASSERT(tileHeight > 0);
+ // Adjust the base frequencies if necessary for stitching.
+ if (m_stitchTiles) {
+ // When stitching tiled turbulence, the frequencies must be adjusted
+ // so that the tile borders will be continuous.
+ if (m_baseFrequencyX) {
+ float lowFrequency = floorf(tileWidth * m_baseFrequencyX) / tileWidth;
+ float highFrequency = ceilf(tileWidth * m_baseFrequencyX) / tileWidth;
+ // BaseFrequency should be non-negative according to the standard.
+ if (m_baseFrequencyX / lowFrequency < highFrequency / m_baseFrequencyX)
+ m_baseFrequencyX = lowFrequency;
+ else
+ m_baseFrequencyX = highFrequency;
+ }
+ if (m_baseFrequencyY) {
+ float lowFrequency = floorf(tileHeight * m_baseFrequencyY) / tileHeight;
+ float highFrequency = ceilf(tileHeight * m_baseFrequencyY) / tileHeight;
+ if (m_baseFrequencyY / lowFrequency < highFrequency / m_baseFrequencyY)
+ m_baseFrequencyY = lowFrequency;
+ else
+ m_baseFrequencyY = highFrequency;
+ }
+ // Set up TurbulenceInitial stitch values.
+ paintingData.width = roundf(tileWidth * m_baseFrequencyX);
+ paintingData.wrapX = s_perlinNoise + paintingData.width;
+ paintingData.height = roundf(tileHeight * m_baseFrequencyY);
+ paintingData.wrapY = s_perlinNoise + paintingData.height;
+ }
+ float turbulenceFunctionResult = 0;
+ FloatPoint noiseVector(point.x() * m_baseFrequencyX, point.y() * m_baseFrequencyY);
+ float ratio = 1;
+ for (int octave = 0; octave < m_numOctaves; ++octave) {
+ if (m_type == FETURBULENCE_TYPE_FRACTALNOISE)
+ turbulenceFunctionResult += noise2D(paintingData, noiseVector) / ratio;
+ else
+ turbulenceFunctionResult += fabsf(noise2D(paintingData, noiseVector)) / ratio;
+ noiseVector.setX(noiseVector.x() * 2);
+ noiseVector.setY(noiseVector.y() * 2);
+ ratio *= 2;
+ if (m_stitchTiles) {
+ // Update stitch values. Subtracting s_perlinNoiseoise before the multiplication and
+ // adding it afterward simplifies to subtracting it once.
+ paintingData.width *= 2;
+ paintingData.wrapX = 2 * paintingData.wrapX - s_perlinNoise;
+ paintingData.height *= 2;
+ paintingData.wrapY = 2 * paintingData.wrapY - s_perlinNoise;
+ }
+ }
+
+ // The value of turbulenceFunctionResult comes from ((turbulenceFunctionResult * 255) + 255) / 2 by fractalNoise
+ // and (turbulenceFunctionResult * 255) by turbulence.
+ if (m_type == FETURBULENCE_TYPE_FRACTALNOISE)
+ turbulenceFunctionResult = turbulenceFunctionResult * 0.5f + 0.5f;
+ // Clamp result
+ turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 1.f), 0.f);
+ return static_cast<unsigned char>(turbulenceFunctionResult * 255);
+}
+
+void FETurbulence::apply(Filter* filter)
+{
+ if (!getEffectContext())
+ return;
+
+ IntRect imageRect(IntPoint(), resultImage()->size());
+ if (!imageRect.size().width() || !imageRect.size().height())
+ return;
+
+ RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
+ PaintingData paintingData(m_seed, imageRect.size());
+ initPaint(paintingData);
+
+ FloatRect filterRegion = filter->filterRegion();
+ FloatPoint point;
+ point.setY(filterRegion.y());
+ int indexOfPixelChannel = 0;
+ for (int y = 0; y < imageRect.height(); ++y) {
+ point.setY(point.y() + 1);
+ point.setX(filterRegion.x());
+ for (int x = 0; x < imageRect.width(); ++x) {
+ point.setX(point.x() + 1);
+ for (paintingData.channel = 0; paintingData.channel < 4; ++paintingData.channel, ++indexOfPixelChannel)
+ imageData->data()->set(indexOfPixelChannel, calculateTurbulenceValueForPoint(paintingData, point));
+ }
+ }
+ resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint());
+}
+
void FETurbulence::dump()
{
}
-static TextStream& operator<<(TextStream& ts, TurbulanceType t)
+static TextStream& operator<<(TextStream& ts, const TurbulanceType& type)
{
- switch (t)
- {
- case FETURBULENCE_TYPE_UNKNOWN:
- ts << "UNKNOWN"; break;
- case FETURBULENCE_TYPE_TURBULENCE:
- ts << "TURBULANCE"; break;
- case FETURBULENCE_TYPE_FRACTALNOISE:
- ts << "NOISE"; break;
+ switch (type) {
+ case FETURBULENCE_TYPE_UNKNOWN:
+ ts << "UNKNOWN";
+ break;
+ case FETURBULENCE_TYPE_TURBULENCE:
+ ts << "TURBULANCE";
+ break;
+ case FETURBULENCE_TYPE_FRACTALNOISE:
+ ts << "NOISE";
+ break;
}
return ts;
}
-TextStream& FETurbulence::externalRepresentation(TextStream& ts) const
+TextStream& FETurbulence::externalRepresentation(TextStream& ts, int indent) const
{
- ts << "[type=TURBULENCE] ";
+ writeIndent(ts, indent);
+ ts << "[feTurbulence";
FilterEffect::externalRepresentation(ts);
- ts << " [turbulence type=" << type() << "]"
- << " [base frequency x=" << baseFrequencyX() << " y=" << baseFrequencyY() << "]"
- << " [seed=" << seed() << "]"
- << " [num octaves=" << numOctaves() << "]"
- << " [stitch tiles=" << stitchTiles() << "]";
-
+ ts << " type=\"" << type() << "\" "
+ << "baseFrequency=\"" << baseFrequencyX() << ", " << baseFrequencyY() << "\" "
+ << "seed=\"" << seed() << "\" "
+ << "numOctaves=\"" << numOctaves() << "\" "
+ << "stitchTiles=\"" << stitchTiles() << "\"]\n";
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/svg/graphics/filters/SVGFETurbulence.h
index e7f40f6..d27b7f6 100644
--- a/WebCore/svg/graphics/filters/SVGFETurbulence.h
+++ b/WebCore/svg/graphics/filters/SVGFETurbulence.h
@@ -1,23 +1,25 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFETurbulence_h
#define SVGFETurbulence_h
@@ -28,51 +30,71 @@
namespace WebCore {
- enum TurbulanceType {
- FETURBULENCE_TYPE_UNKNOWN = 0,
- FETURBULENCE_TYPE_FRACTALNOISE = 1,
- FETURBULENCE_TYPE_TURBULENCE = 2
- };
+enum TurbulanceType {
+ FETURBULENCE_TYPE_UNKNOWN = 0,
+ FETURBULENCE_TYPE_FRACTALNOISE = 1,
+ FETURBULENCE_TYPE_TURBULENCE = 2
+};
+
+class FETurbulence : public FilterEffect {
+public:
+ static PassRefPtr<FETurbulence> create(TurbulanceType, float, float, int, float, bool);
- class FETurbulence : public FilterEffect {
- public:
- static PassRefPtr<FETurbulence> create(TurbulanceType, const float&, const float&, const int&, const float&,
- bool);
+ TurbulanceType type() const;
+ void setType(TurbulanceType);
- TurbulanceType type() const;
- void setType(TurbulanceType);
+ float baseFrequencyY() const;
+ void setBaseFrequencyY(float);
- float baseFrequencyY() const;
- void setBaseFrequencyY(float);
+ float baseFrequencyX() const;
+ void setBaseFrequencyX(float);
- float baseFrequencyX() const;
- void setBaseFrequencyX(float);
+ float seed() const;
+ void setSeed(float);
- float seed() const;
- void setSeed(float);
+ int numOctaves() const;
+ void setNumOctaves(bool);
- int numOctaves() const;
- void setNumOctaves(bool);
+ bool stitchTiles() const;
+ void setStitchTiles(bool);
- bool stitchTiles() const;
- void setStitchTiles(bool);
+ void apply(Filter*);
+ void dump();
+ TextStream& externalRepresentation(TextStream&, int indent) const;
- void apply(Filter*);
- void dump();
- TextStream& externalRepresentation(TextStream& ts) const;
+private:
+ static const int s_blockSize = 256;
+ static const int s_blockMask = s_blockSize - 1;
- private:
- FETurbulence(TurbulanceType, const float&, const float&, const int&, const float&,
- bool);
+ struct PaintingData {
+ long seed;
+ int latticeSelector[2 * s_blockSize + 2];
+ float gradient[4][2 * s_blockSize + 2][2];
+ int width; // How much to subtract to wrap for stitching.
+ int height;
+ int wrapX; // Minimum value to wrap.
+ int wrapY;
+ int channel;
+ IntSize filterSize;
- TurbulanceType m_type;
- float m_baseFrequencyX;
- float m_baseFrequencyY;
- int m_numOctaves;
- float m_seed;
- bool m_stitchTiles;
+ PaintingData(long paintingSeed, const IntSize& paintingSize);
+ inline long random();
};
+ FETurbulence(TurbulanceType, float, float, int, float, bool);
+
+ inline void initPaint(PaintingData&);
+ float noise2D(PaintingData&, const FloatPoint&);
+ unsigned char calculateTurbulenceValueForPoint(PaintingData&, const FloatPoint&);
+
+ TurbulanceType m_type;
+ float m_baseFrequencyX;
+ float m_baseFrequencyY;
+ int m_numOctaves;
+ float m_seed;
+ bool m_stitchTiles;
+};
+
} // namespace WebCore
#endif // ENABLE(SVG) && ENABLE(FILTERS)
diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp
index 4ec4e6e..947dbed 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilter.cpp
@@ -1,20 +1,20 @@
/*
- * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/graphics/filters/SVGFilter.h b/WebCore/svg/graphics/filters/SVGFilter.h
index c4714c6..1ee5e8a 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.h
+++ b/WebCore/svg/graphics/filters/SVGFilter.h
@@ -1,20 +1,20 @@
/*
- * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef SVGFilter_h
diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
index fc6924a..5a6d0b9 100644
--- a/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
@@ -1,21 +1,20 @@
-
/*
- * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) 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
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h
index 55844c9..4ef6ffe 100644
--- a/WebCore/svg/graphics/filters/SVGFilterBuilder.h
+++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h
@@ -1,21 +1,21 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGFilterBuilder_h
#define SVGFilterBuilder_h
@@ -23,27 +23,31 @@
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "AtomicStringHash.h"
#include "FilterEffect.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/text/AtomicStringHash.h>
namespace WebCore {
class SVGFilterBuilder : public RefCounted<SVGFilterBuilder> {
public:
- SVGFilterBuilder();
+ static PassRefPtr<SVGFilterBuilder> create() { return adoptRef(new SVGFilterBuilder); }
void add(const AtomicString& id, RefPtr<FilterEffect> effect);
FilterEffect* getEffectById(const AtomicString& id) const;
FilterEffect* lastEffect() const { return m_lastEffect.get(); }
+ const HashMap<AtomicString, RefPtr<FilterEffect> >& namedEffects() { return m_namedEffects; }
+
void clearEffects();
private:
+ SVGFilterBuilder();
+
HashMap<AtomicString, RefPtr<FilterEffect> > m_builtinEffects;
HashMap<AtomicString, RefPtr<FilterEffect> > m_namedEffects;
diff --git a/WebCore/svg/graphics/filters/SVGLightSource.cpp b/WebCore/svg/graphics/filters/SVGLightSource.cpp
index 9176b4c..2981f25 100644
--- a/WebCore/svg/graphics/filters/SVGLightSource.cpp
+++ b/WebCore/svg/graphics/filters/SVGLightSource.cpp
@@ -1,34 +1,138 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "SVGLightSource.h"
+
+#include "SVGDistantLightSource.h"
#include "SVGPointLightSource.h"
#include "SVGRenderTreeAsText.h"
#include "SVGSpotLightSource.h"
-#include "SVGDistantLightSource.h"
+#include <wtf/MathExtras.h>
namespace WebCore {
+void PointLightSource::initPaintingData(PaintingData&)
+{
+}
+
+void PointLightSource::updatePaintingData(PaintingData& paintingData, int x, int y, float z)
+{
+ paintingData.lightVector.setX(m_position.x() - x);
+ paintingData.lightVector.setY(m_position.y() - y);
+ paintingData.lightVector.setZ(m_position.z() - z);
+ paintingData.lightVector.normalize();
+}
+
+// spot-light edge darkening depends on an absolute treshold
+// according to the SVG 1.1 SE light regression tests
+static const float antiAliasTreshold = 0.016f;
+
+void SpotLightSource::initPaintingData(PaintingData& paintingData)
+{
+ paintingData.privateColorVector = paintingData.colorVector;
+ paintingData.directionVector.setX(m_direction.x() - m_position.x());
+ paintingData.directionVector.setY(m_direction.y() - m_position.y());
+ paintingData.directionVector.setZ(m_direction.z() - m_position.z());
+ paintingData.directionVector.normalize();
+
+ if (!m_limitingConeAngle) {
+ paintingData.coneCutOffLimit = 0.0f;
+ paintingData.coneFullLight = -antiAliasTreshold;
+ } else {
+ float limitingConeAngle = m_limitingConeAngle;
+ if (limitingConeAngle < 0.0f)
+ limitingConeAngle = -limitingConeAngle;
+ if (limitingConeAngle > 90.0f)
+ limitingConeAngle = 90.0f;
+ paintingData.coneCutOffLimit = cosf(deg2rad(180.0f - limitingConeAngle));
+ paintingData.coneFullLight = paintingData.coneCutOffLimit - antiAliasTreshold;
+ }
+
+ // Optimization for common specularExponent values
+ if (!m_specularExponent)
+ paintingData.specularExponent = 0;
+ else if (m_specularExponent == 1.0f)
+ paintingData.specularExponent = 1;
+ else // It is neither 0.0f nor 1.0f
+ paintingData.specularExponent = 2;
+}
+
+void SpotLightSource::updatePaintingData(PaintingData& paintingData, int x, int y, float z)
+{
+ paintingData.lightVector.setX(m_position.x() - x);
+ paintingData.lightVector.setY(m_position.y() - y);
+ paintingData.lightVector.setZ(m_position.z() - z);
+ paintingData.lightVector.normalize();
+
+ float cosineOfAngle = paintingData.lightVector * paintingData.directionVector;
+ if (cosineOfAngle > paintingData.coneCutOffLimit) {
+ // No light is produced, scanlines are not updated
+ paintingData.colorVector.setX(0.0f);
+ paintingData.colorVector.setY(0.0f);
+ paintingData.colorVector.setZ(0.0f);
+ return;
+ }
+
+ // Set the color of the pixel
+ float lightStrength;
+ switch (paintingData.specularExponent) {
+ case 0:
+ lightStrength = 1.0f; // -cosineOfAngle ^ 0 == 1
+ break;
+ case 1:
+ lightStrength = -cosineOfAngle; // -cosineOfAngle ^ 1 == -cosineOfAngle
+ break;
+ default:
+ lightStrength = powf(-cosineOfAngle, m_specularExponent);
+ break;
+ }
+
+ if (cosineOfAngle > paintingData.coneFullLight)
+ lightStrength *= (paintingData.coneCutOffLimit - cosineOfAngle) / (paintingData.coneCutOffLimit - paintingData.coneFullLight);
+
+ if (lightStrength > 1.0f)
+ lightStrength = 1.0f;
+
+ paintingData.colorVector.setX(paintingData.privateColorVector.x() * lightStrength);
+ paintingData.colorVector.setY(paintingData.privateColorVector.y() * lightStrength);
+ paintingData.colorVector.setZ(paintingData.privateColorVector.z() * lightStrength);
+}
+
+void DistantLightSource::initPaintingData(PaintingData& paintingData)
+{
+ float azimuth = deg2rad(m_azimuth);
+ float elevation = deg2rad(m_elevation);
+ paintingData.lightVector.setX(cosf(azimuth) * cosf(elevation));
+ paintingData.lightVector.setY(sinf(azimuth) * cosf(elevation));
+ paintingData.lightVector.setZ(sinf(elevation));
+}
+
+void DistantLightSource::updatePaintingData(PaintingData&, int, int, float)
+{
+}
+
static TextStream& operator<<(TextStream& ts, const FloatPoint3D& p)
{
ts << "x=" << p.x() << " y=" << p.y() << " z=" << p.z();
diff --git a/WebCore/svg/graphics/filters/SVGLightSource.h b/WebCore/svg/graphics/filters/SVGLightSource.h
index 6f0075c..6795107 100644
--- a/WebCore/svg/graphics/filters/SVGLightSource.h
+++ b/WebCore/svg/graphics/filters/SVGLightSource.h
@@ -1,56 +1,81 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
- 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGLightSource_h
#define SVGLightSource_h
#if ENABLE(SVG) && ENABLE(FILTERS)
+#include "FloatPoint3D.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
- enum LightType {
- LS_DISTANT,
- LS_POINT,
- LS_SPOT
+enum LightType {
+ LS_DISTANT,
+ LS_POINT,
+ LS_SPOT
+};
+
+class TextStream;
+
+class LightSource : public RefCounted<LightSource> {
+public:
+
+ // Light vectors must be calculated for every pixel during
+ // painting. It is expensive to pass all these arguments to
+ // a frequently called function, especially because not all
+ // light sources require all of them. Instead, we just pass
+ // a reference to the following structure
+ struct PaintingData {
+ // SVGFELighting also use them
+ FloatPoint3D lightVector;
+ FloatPoint3D colorVector;
+ // Private members
+ FloatPoint3D directionVector;
+ FloatPoint3D privateColorVector;
+ float coneCutOffLimit;
+ float coneFullLight;
+ int specularExponent;
};
- class TextStream;
+ LightSource(LightType type)
+ : m_type(type)
+ { }
- class LightSource : public RefCounted<LightSource> {
- public:
- LightSource(LightType type)
- : m_type(type)
- { }
+ virtual ~LightSource() { }
- virtual ~LightSource() { }
+ LightType type() const { return m_type; }
+ virtual TextStream& externalRepresentation(TextStream&) const = 0;
- LightType type() const { return m_type; }
- virtual TextStream& externalRepresentation(TextStream&) const = 0;
+ virtual void initPaintingData(PaintingData&) = 0;
+ // z is a float number, since it is the alpha value scaled by a user
+ // specified "surfaceScale" constant, which type is <number> in the SVG standard
+ virtual void updatePaintingData(PaintingData&, int x, int y, float z) = 0;
- private:
- LightType m_type;
- };
+private:
+ LightType m_type;
+};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGPointLightSource.h b/WebCore/svg/graphics/filters/SVGPointLightSource.h
index 1e966cc..cd8f9b2 100644
--- a/WebCore/svg/graphics/filters/SVGPointLightSource.h
+++ b/WebCore/svg/graphics/filters/SVGPointLightSource.h
@@ -1,54 +1,56 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
- 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGPointLightSource_h
#define SVGPointLightSource_h
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "FloatPoint3D.h"
#include "SVGLightSource.h"
namespace WebCore {
- class PointLightSource : public LightSource {
- public:
- static PassRefPtr<PointLightSource> create(const FloatPoint3D& position)
- {
- return adoptRef(new PointLightSource(position));
- }
+class PointLightSource : public LightSource {
+public:
+ static PassRefPtr<PointLightSource> create(const FloatPoint3D& position)
+ {
+ return adoptRef(new PointLightSource(position));
+ }
- const FloatPoint3D& position() const { return m_position; }
+ const FloatPoint3D& position() const { return m_position; }
- virtual TextStream& externalRepresentation(TextStream&) const;
+ virtual void initPaintingData(PaintingData&);
+ virtual void updatePaintingData(PaintingData&, int x, int y, float z);
- private:
- PointLightSource(const FloatPoint3D& position)
- : LightSource(LS_POINT)
- , m_position(position)
- {
- }
+ virtual TextStream& externalRepresentation(TextStream&) const;
- FloatPoint3D m_position;
- };
+private:
+ PointLightSource(const FloatPoint3D& position)
+ : LightSource(LS_POINT)
+ , m_position(position)
+ {
+ }
+
+ FloatPoint3D m_position;
+};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGSpotLightSource.h b/WebCore/svg/graphics/filters/SVGSpotLightSource.h
index 05280d2..31c5674 100644
--- a/WebCore/svg/graphics/filters/SVGSpotLightSource.h
+++ b/WebCore/svg/graphics/filters/SVGSpotLightSource.h
@@ -1,67 +1,69 @@
/*
- Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
- 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
- 2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric@webkit.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- aint with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#ifndef SVGSpotLightSource_h
#define SVGSpotLightSource_h
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "FloatPoint3D.h"
#include "SVGLightSource.h"
namespace WebCore {
- class SpotLightSource : public LightSource {
- public:
- static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position, const FloatPoint3D& direction,
- float specularExponent, float limitingConeAngle)
- {
- return adoptRef(new SpotLightSource(position, direction, specularExponent, limitingConeAngle));
- }
-
- const FloatPoint3D& position() const { return m_position; }
- const FloatPoint3D& direction() const { return m_direction; }
-
- float specularExponent() const { return m_specularExponent; }
- float limitingConeAngle() const { return m_limitingConeAngle; }
-
- virtual TextStream& externalRepresentation(TextStream&) const;
-
- private:
- SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction,
- float specularExponent, float limitingConeAngle)
- : LightSource(LS_SPOT)
- , m_position(position)
- , m_direction(direction)
- , m_specularExponent(specularExponent)
- , m_limitingConeAngle(limitingConeAngle)
- {
- }
-
- FloatPoint3D m_position;
- FloatPoint3D m_direction;
-
- float m_specularExponent;
- float m_limitingConeAngle;
- };
+class SpotLightSource : public LightSource {
+public:
+ static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position,
+ const FloatPoint3D& direction, float specularExponent, float limitingConeAngle)
+ {
+ return adoptRef(new SpotLightSource(position, direction, specularExponent, limitingConeAngle));
+ }
+
+ const FloatPoint3D& position() const { return m_position; }
+ const FloatPoint3D& direction() const { return m_direction; }
+
+ float specularExponent() const { return m_specularExponent; }
+ float limitingConeAngle() const { return m_limitingConeAngle; }
+
+ virtual void initPaintingData(PaintingData&);
+ virtual void updatePaintingData(PaintingData&, int x, int y, float z);
+
+ virtual TextStream& externalRepresentation(TextStream&) const;
+
+private:
+ SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction,
+ float specularExponent, float limitingConeAngle)
+ : LightSource(LS_SPOT)
+ , m_position(position)
+ , m_direction(direction)
+ , m_specularExponent(specularExponent)
+ , m_limitingConeAngle(limitingConeAngle)
+ {
+ }
+
+ FloatPoint3D m_position;
+ FloatPoint3D m_direction;
+
+ float m_specularExponent;
+ float m_limitingConeAngle;
+};
} // namespace WebCore
diff --git a/WebCore/svg/svgattrs.in b/WebCore/svg/svgattrs.in
index 6081039..fe48c8a 100644
--- a/WebCore/svg/svgattrs.in
+++ b/WebCore/svg/svgattrs.in
@@ -141,6 +141,8 @@ onzoom
opacity
operator
order
+orderX
+orderY
orient
orientation
origin
@@ -228,6 +230,7 @@ v-hanging
v-ideographic
v-mathematical
values
+vector-effect
version
vert-adv-y
vert-origin-x
diff --git a/WebCore/svg/svgtags.in b/WebCore/svg/svgtags.in
index adc05f2..adf0b24 100644
--- a/WebCore/svg/svgtags.in
+++ b/WebCore/svg/svgtags.in
@@ -1,7 +1,7 @@
namespace="SVG"
namespaceURI="http://www.w3.org/2000/svg"
guardFactoryWith="ENABLE(SVG)"
-
+
a createWithNew
#if ENABLE_SVG_FONTS
altGlyph createWithNew
@@ -31,9 +31,7 @@ feBlend createWithNew
feColorMatrix createWithNew
feComponentTransfer createWithNew
feComposite createWithNew
-#if 0
feConvolveMatrix createWithNew
-#endif
feDiffuseLighting createWithNew
feDisplacementMap createWithNew
feDistantLight createWithNew
@@ -105,6 +103,4 @@ tref interfaceName=SVGTRefElement, createWithNew
tspan interfaceName=SVGTSpanElement, createWithNew
use createWithNew
view createWithNew
-#if 0
vkern interfaceName=SVGVKernElement, createWithNew
-#endif