+2006-09-05 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ Fixes: http://bugzilla.opendarwin.org/show_bug.cgi?id=10490
+
+ -> Remove all SVGAnimated* usage from ksvg2.
+ This is all done using a set of macros which live in svg/SVGElement.h
+ (ANIMATED_PROPERTY_DECLARATIONS / ANIMATED_PROPERTY_DEFINITIONS).
+ Transform all properties to this new concept using Eric ruby script.
+
+ -> Replace all usages of "property()->baseVal()" with "propertyBaseValue()".
+ -> Replace all usages of "property()->setBaseVal()" with "setPropertyBaseValue()".
+
+ -> Add "virtual const SVGElement* contextElement() const".
+ This concept allows to access the document (needed to access the SVGDocumentExtensions)
+ from lowest-base-classes like SVGURIReference / SVGExternalResourcesRequired etc.
+
+ These classes contain this contextElement() function as pure virtual functions.
+ The topmost classes (like SVGCircleElement) implement this function with "return this".
+
+ -> Move default value initialization to constructors.
+ As the lazy_create usage, which was involved in default property initialization,
+ has been removed, we need to do the initialization in the constructor.
+
+ This forces us to fix the SVGLength class, as calling viewportElement() from the
+ constructor does not work. This SVGLength cleanup is one of the next things to fix.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * kcanvas/RenderForeignObject.cpp:
+ (WebCore::RenderForeignObject::translationForAttributes):
+ * kcanvas/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::paint):
+ (WebCore::RenderSVGImage::relativeBBox):
+ (WebCore::RenderSVGImage::getAbsoluteRepaintRect):
+ (WebCore::RenderSVGImage::translationForAttributes):
+ * kcanvas/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::translationForAttributes):
+ * ksvg2/misc/KSVGTimeScheduler.cpp:
+ (WebCore::SVGTimer::notifyAll):
+ * ksvg2/misc/SVGDocumentExtensions.cpp:
+ * ksvg2/misc/SVGDocumentExtensions.h:
+ (WebCore::SVGDocumentExtensions::baseValueMap):
+ (WebCore::SVGDocumentExtensions::baseValue):
+ (WebCore::SVGDocumentExtensions::setBaseValue):
+ (WebCore::SVGDocumentExtensions::hasBaseValue):
+ (WebCore::String):
+ (WebCore::bool):
+ (WebCore::double):
+ * ksvg2/misc/SVGImageLoader.cpp:
+ (WebCore::SVGImageLoader::updateFromElement):
+ * ksvg2/svg/SVGAElement.cpp:
+ (WebCore::SVGAElement::parseMappedAttribute):
+ (WebCore::SVGAElement::defaultEventHandler):
+ * ksvg2/svg/SVGAElement.h:
+ (WebCore::SVGAElement::contextElement):
+ * ksvg2/svg/SVGAnimateColorElement.h:
+ (WebCore::SVGAnimateColorElement::contextElement):
+ * ksvg2/svg/SVGAnimateElement.h:
+ (WebCore::SVGAnimateElement::contextElement):
+ * ksvg2/svg/SVGAnimateTransformElement.cpp:
+ (WebCore::SVGAnimateTransformElement::handleTimerEvent):
+ (WebCore::SVGAnimateTransformElement::initialMatrix):
+ * ksvg2/svg/SVGAnimateTransformElement.h:
+ (WebCore::SVGAnimateTransformElement::contextElement):
+ * ksvg2/svg/SVGCircleElement.cpp:
+ (SVGCircleElement::SVGCircleElement):
+ (SVGCircleElement::parseMappedAttribute):
+ (SVGCircleElement::toPathData):
+ (SVGCircleElement::pushAttributeContext):
+ * ksvg2/svg/SVGCircleElement.h:
+ (WebCore::SVGCircleElement::contextElement):
+ * ksvg2/svg/SVGClipPathElement.cpp:
+ (SVGClipPathElement::SVGClipPathElement):
+ (SVGClipPathElement::parseMappedAttribute):
+ (SVGClipPathElement::canvasResource):
+ * ksvg2/svg/SVGClipPathElement.h:
+ (WebCore::SVGClipPathElement::contextElement):
+ * ksvg2/svg/SVGComponentTransferFunctionElement.cpp:
+ (SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
+ (SVGComponentTransferFunctionElement::parseMappedAttribute):
+ (SVGComponentTransferFunctionElement::transferFunction):
+ * ksvg2/svg/SVGComponentTransferFunctionElement.h:
+ * ksvg2/svg/SVGCursorElement.cpp:
+ (SVGCursorElement::SVGCursorElement):
+ (SVGCursorElement::parseMappedAttribute):
+ * ksvg2/svg/SVGCursorElement.h:
+ (WebCore::SVGCursorElement::contextElement):
+ * ksvg2/svg/SVGDefsElement.h:
+ (WebCore::SVGDefsElement::contextElement):
+ * ksvg2/svg/SVGElement.h:
+ * ksvg2/svg/SVGEllipseElement.cpp:
+ (WebCore::SVGEllipseElement::SVGEllipseElement):
+ (WebCore::SVGEllipseElement::parseMappedAttribute):
+ (WebCore::SVGEllipseElement::toPathData):
+ (WebCore::SVGEllipseElement::pushAttributeContext):
+ * ksvg2/svg/SVGEllipseElement.h:
+ (WebCore::SVGEllipseElement::contextElement):
+ * ksvg2/svg/SVGExternalResourcesRequired.cpp:
+ (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
+ (WebCore::SVGExternalResourcesRequired::parseMappedAttribute):
+ * ksvg2/svg/SVGExternalResourcesRequired.h:
+ * ksvg2/svg/SVGFEBlendElement.cpp:
+ (SVGFEBlendElement::SVGFEBlendElement):
+ (SVGFEBlendElement::parseMappedAttribute):
+ (SVGFEBlendElement::filterEffect):
+ * ksvg2/svg/SVGFEBlendElement.h:
+ (WebCore::SVGFEBlendElement::contextElement):
+ * ksvg2/svg/SVGFEColorMatrixElement.cpp:
+ (SVGFEColorMatrixElement::SVGFEColorMatrixElement):
+ (SVGFEColorMatrixElement::parseMappedAttribute):
+ (SVGFEColorMatrixElement::filterEffect):
+ * ksvg2/svg/SVGFEColorMatrixElement.h:
+ (WebCore::SVGFEColorMatrixElement::contextElement):
+ * ksvg2/svg/SVGFEComponentTransferElement.cpp:
+ (SVGFEComponentTransferElement::SVGFEComponentTransferElement):
+ (SVGFEComponentTransferElement::parseMappedAttribute):
+ (SVGFEComponentTransferElement::filterEffect):
+ * ksvg2/svg/SVGFEComponentTransferElement.h:
+ (WebCore::SVGFEComponentTransferElement::contextElement):
+ * ksvg2/svg/SVGFECompositeElement.cpp:
+ (SVGFECompositeElement::SVGFECompositeElement):
+ (SVGFECompositeElement::parseMappedAttribute):
+ (SVGFECompositeElement::filterEffect):
+ * ksvg2/svg/SVGFECompositeElement.h:
+ (WebCore::SVGFECompositeElement::contextElement):
+ * ksvg2/svg/SVGFEDiffuseLightingElement.cpp:
+ (WebCore::SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement):
+ (WebCore::SVGFEDiffuseLightingElement::parseMappedAttribute):
+ (WebCore::SVGFEDiffuseLightingElement::filterEffect):
+ * ksvg2/svg/SVGFEDiffuseLightingElement.h:
+ (WebCore::SVGFEDiffuseLightingElement::contextElement):
+ * ksvg2/svg/SVGFEDisplacementMapElement.cpp:
+ (SVGFEDisplacementMapElement::SVGFEDisplacementMapElement):
+ (SVGFEDisplacementMapElement::parseMappedAttribute):
+ (SVGFEDisplacementMapElement::filterEffect):
+ * ksvg2/svg/SVGFEDisplacementMapElement.h:
+ (WebCore::SVGFEDisplacementMapElement::contextElement):
+ * ksvg2/svg/SVGFEDistantLightElement.cpp:
+ (WebCore::SVGFEDistantLightElement::lightSource):
+ * ksvg2/svg/SVGFEFloodElement.cpp:
+ (SVGFEFloodElement::parseMappedAttribute):
+ (SVGFEFloodElement::filterEffect):
+ * ksvg2/svg/SVGFEFloodElement.h:
+ (WebCore::SVGFEFloodElement::contextElement):
+ * ksvg2/svg/SVGFEGaussianBlurElement.cpp:
+ (SVGFEGaussianBlurElement::SVGFEGaussianBlurElement):
+ (SVGFEGaussianBlurElement::parseMappedAttribute):
+ (SVGFEGaussianBlurElement::filterEffect):
+ * ksvg2/svg/SVGFEGaussianBlurElement.h:
+ (WebCore::SVGFEGaussianBlurElement::contextElement):
+ * ksvg2/svg/SVGFEImageElement.cpp:
+ (SVGFEImageElement::SVGFEImageElement):
+ (SVGFEImageElement::parseMappedAttribute):
+ * ksvg2/svg/SVGFEImageElement.h:
+ (WebCore::SVGFEImageElement::contextElement):
+ * ksvg2/svg/SVGFELightElement.cpp:
+ (SVGFELightElement::SVGFELightElement):
+ (SVGFELightElement::parseMappedAttribute):
+ * ksvg2/svg/SVGFELightElement.h:
+ * ksvg2/svg/SVGFEMergeElement.cpp:
+ (SVGFEMergeElement::SVGFEMergeElement):
+ (SVGFEMergeElement::filterEffect):
+ * ksvg2/svg/SVGFEMergeElement.h:
+ (WebCore::SVGFEMergeElement::contextElement):
+ * ksvg2/svg/SVGFEMergeNodeElement.cpp:
+ (SVGFEMergeNodeElement::parseMappedAttribute):
+ * ksvg2/svg/SVGFEMergeNodeElement.h:
+ (WebCore::SVGFEMergeNodeElement::contextElement):
+ * ksvg2/svg/SVGFEOffsetElement.cpp:
+ (SVGFEOffsetElement::SVGFEOffsetElement):
+ (SVGFEOffsetElement::parseMappedAttribute):
+ (SVGFEOffsetElement::filterEffect):
+ * ksvg2/svg/SVGFEOffsetElement.h:
+ (WebCore::SVGFEOffsetElement::contextElement):
+ * ksvg2/svg/SVGFEPointLightElement.cpp:
+ (WebCore::SVGFEPointLightElement::lightSource):
+ * ksvg2/svg/SVGFESpecularLightingElement.cpp:
+ (SVGFESpecularLightingElement::SVGFESpecularLightingElement):
+ (SVGFESpecularLightingElement::parseMappedAttribute):
+ (SVGFESpecularLightingElement::filterEffect):
+ * ksvg2/svg/SVGFESpecularLightingElement.h:
+ (WebCore::SVGFESpecularLightingElement::contextElement):
+ * ksvg2/svg/SVGFESpotLightElement.cpp:
+ (WebCore::SVGFESpotLightElement::lightSource):
+ * ksvg2/svg/SVGFETileElement.cpp:
+ (SVGFETileElement::parseMappedAttribute):
+ (SVGFETileElement::filterEffect):
+ * ksvg2/svg/SVGFETileElement.h:
+ (WebCore::SVGFETileElement::contextElement):
+ * ksvg2/svg/SVGFETurbulenceElement.cpp:
+ (SVGFETurbulenceElement::SVGFETurbulenceElement):
+ (SVGFETurbulenceElement::parseMappedAttribute):
+ (SVGFETurbulenceElement::filterEffect):
+ * ksvg2/svg/SVGFETurbulenceElement.h:
+ (WebCore::SVGFETurbulenceElement::contextElement):
+ * ksvg2/svg/SVGFilterElement.cpp:
+ (SVGFilterElement::SVGFilterElement):
+ (SVGFilterElement::parseMappedAttribute):
+ (SVGFilterElement::canvasResource):
+ * ksvg2/svg/SVGFilterElement.h:
+ (WebCore::SVGFilterElement::contextElement):
+ * ksvg2/svg/SVGFilterPrimitiveStandardAttributes.cpp:
+ (SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
+ (SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes):
+ (SVGFilterPrimitiveStandardAttributes::parseMappedAttribute):
+ (SVGFilterPrimitiveStandardAttributes::setStandardAttributes):
+ * ksvg2/svg/SVGFilterPrimitiveStandardAttributes.h:
+ (WebCore::SVGFilterPrimitiveStandardAttributes::contextElement):
+ * ksvg2/svg/SVGFitToViewBox.cpp:
+ (WebCore::SVGFitToViewBox::SVGFitToViewBox):
+ (WebCore::SVGFitToViewBox::parseViewBox):
+ (WebCore::SVGFitToViewBox::viewBoxToViewTransform):
+ (WebCore::SVGFitToViewBox::parseMappedAttribute):
+ * ksvg2/svg/SVGFitToViewBox.h:
+ * ksvg2/svg/SVGForeignObjectElement.cpp:
+ (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
+ (WebCore::SVGForeignObjectElement::parseMappedAttribute):
+ * ksvg2/svg/SVGForeignObjectElement.h:
+ (WebCore::SVGForeignObjectElement::isValid):
+ (WebCore::SVGForeignObjectElement::contextElement):
+ * ksvg2/svg/SVGGElement.h:
+ (WebCore::SVGGElement::contextElement):
+ * ksvg2/svg/SVGGradientElement.cpp:
+ (SVGGradientElement::SVGGradientElement):
+ (SVGGradientElement::parseMappedAttribute):
+ (SVGGradientElement::rebuildStops):
+ * ksvg2/svg/SVGGradientElement.h:
+ * ksvg2/svg/SVGHelper.cpp:
+ (WebCore::SVGHelper::PercentageOfViewport):
+ * ksvg2/svg/SVGImageElement.cpp:
+ (SVGImageElement::SVGImageElement):
+ (SVGImageElement::parseMappedAttribute):
+ (SVGImageElement::haveLoadedRequiredResources):
+ * ksvg2/svg/SVGImageElement.h:
+ (WebCore::SVGImageElement::contextElement):
+ * ksvg2/svg/SVGLangSpace.h:
+ * ksvg2/svg/SVGLength.cpp:
+ * ksvg2/svg/SVGLineElement.cpp:
+ (SVGLineElement::SVGLineElement):
+ (SVGLineElement::parseMappedAttribute):
+ (SVGLineElement::toPathData):
+ (SVGLineElement::pushAttributeContext):
+ * ksvg2/svg/SVGLineElement.h:
+ (WebCore::SVGLineElement::contextElement):
+ * ksvg2/svg/SVGLinearGradientElement.cpp:
+ (SVGLinearGradientElement::SVGLinearGradientElement):
+ (SVGLinearGradientElement::parseMappedAttribute):
+ (SVGLinearGradientElement::buildGradient):
+ * ksvg2/svg/SVGLinearGradientElement.h:
+ (WebCore::SVGLinearGradientElement::contextElement):
+ * ksvg2/svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::SVGMarkerElement):
+ (WebCore::SVGMarkerElement::parseMappedAttribute):
+ (WebCore::SVGMarkerElement::setOrientToAuto):
+ (WebCore::SVGMarkerElement::setOrientToAngle):
+ (WebCore::SVGMarkerElement::canvasResource):
+ * ksvg2/svg/SVGMarkerElement.h:
+ (WebCore::SVGMarkerElement::contextElement):
+ * ksvg2/svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::SVGMaskElement):
+ (WebCore::SVGMaskElement::attributeChanged):
+ (WebCore::SVGMaskElement::parseMappedAttribute):
+ (WebCore::SVGMaskElement::drawMaskerContent):
+ * ksvg2/svg/SVGMaskElement.h:
+ (WebCore::SVGMaskElement::contextElement):
+ * ksvg2/svg/SVGPathElement.cpp:
+ (WebCore::SVGPathElement::SVGPathElement):
+ * ksvg2/svg/SVGPathElement.h:
+ (WebCore::SVGPathElement::isValid):
+ (WebCore::SVGPathElement::contextElement):
+ * ksvg2/svg/SVGPatternElement.cpp:
+ (WebCore::SVGPatternElement::SVGPatternElement):
+ (WebCore::SVGPatternElement::parseMappedAttribute):
+ (WebCore::SVGPatternElement::pushAttributeContext):
+ (WebCore::SVGPatternElement::fillAttributesFromReferencePattern):
+ (WebCore::SVGPatternElement::drawPatternContentIntoTile):
+ (WebCore::SVGPatternElement::notifyAttributeChange):
+ (WebCore::SVGPatternElement::getCTM):
+ * ksvg2/svg/SVGPatternElement.h:
+ (WebCore::SVGPatternElement::contextElement):
+ * ksvg2/svg/SVGPolyElement.h:
+ (WebCore::SVGPolyElement::contextElement):
+ * ksvg2/svg/SVGRadialGradientElement.cpp:
+ (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
+ (WebCore::SVGRadialGradientElement::~SVGRadialGradientElement):
+ (WebCore::SVGRadialGradientElement::parseMappedAttribute):
+ (WebCore::SVGRadialGradientElement::buildGradient):
+ * ksvg2/svg/SVGRadialGradientElement.h:
+ (WebCore::SVGRadialGradientElement::contextElement):
+ * ksvg2/svg/SVGRectElement.cpp:
+ (WebCore::SVGRectElement::SVGRectElement):
+ (WebCore::SVGRectElement::parseMappedAttribute):
+ (WebCore::SVGRectElement::toPathData):
+ (WebCore::SVGRectElement::pushAttributeContext):
+ * ksvg2/svg/SVGRectElement.h:
+ (WebCore::SVGRectElement::contextElement):
+ * ksvg2/svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::SVGSVGElement):
+ (WebCore::SVGSVGElement::~SVGSVGElement):
+ (WebCore::SVGSVGElement::viewport):
+ (WebCore::SVGSVGElement::parseMappedAttribute):
+ (WebCore::SVGSVGElement::getCTM):
+ (WebCore::SVGSVGElement::getScreenCTM):
+ (WebCore::SVGSVGElement::createRenderer):
+ * ksvg2/svg/SVGSVGElement.h:
+ (WebCore::SVGSVGElement::contextElement):
+ * ksvg2/svg/SVGScriptElement.h:
+ (WebCore::SVGScriptElement::contextElement):
+ * ksvg2/svg/SVGSetElement.h:
+ (WebCore::SVGSetElement::contextElement):
+ * ksvg2/svg/SVGStopElement.cpp:
+ (SVGStopElement::SVGStopElement):
+ (SVGStopElement::parseMappedAttribute):
+ * ksvg2/svg/SVGStopElement.h:
+ * ksvg2/svg/SVGStylable.h:
+ * ksvg2/svg/SVGStyledElement.cpp:
+ * ksvg2/svg/SVGStyledElement.h:
+ * ksvg2/svg/SVGStyledTransformableElement.cpp:
+ (SVGStyledTransformableElement::SVGStyledTransformableElement):
+ (SVGStyledTransformableElement::parseMappedAttribute):
+ * ksvg2/svg/SVGStyledTransformableElement.h:
+ * ksvg2/svg/SVGSwitchElement.cpp:
+ * ksvg2/svg/SVGSwitchElement.h:
+ (WebCore::SVGSwitchElement::contextElement):
+ * ksvg2/svg/SVGSymbolElement.h:
+ (WebCore::SVGSymbolElement::contextElement):
+ * ksvg2/svg/SVGTRefElement.cpp:
+ (SVGTRefElement::updateReferencedText):
+ * ksvg2/svg/SVGTRefElement.h:
+ (WebCore::SVGTRefElement::contextElement):
+ * ksvg2/svg/SVGTSpanElement.h:
+ (WebCore::SVGTSpanElement::contextElement):
+ * ksvg2/svg/SVGTextContentElement.cpp:
+ (SVGTextContentElement::SVGTextContentElement):
+ (SVGTextContentElement::parseMappedAttribute):
+ * ksvg2/svg/SVGTextContentElement.h:
+ * ksvg2/svg/SVGTextElement.cpp:
+ (WebCore::SVGTextElement::SVGTextElement):
+ (WebCore::SVGTextElement::parseMappedAttribute):
+ * ksvg2/svg/SVGTextElement.h:
+ (WebCore::SVGTextElement::contextElement):
+ * ksvg2/svg/SVGTextPositioningElement.cpp:
+ (SVGTextPositioningElement::SVGTextPositioningElement):
+ (SVGTextPositioningElement::parseMappedAttribute):
+ * ksvg2/svg/SVGTextPositioningElement.h:
+ * ksvg2/svg/SVGTransformable.cpp:
+ * ksvg2/svg/SVGTransformable.h:
+ * ksvg2/svg/SVGURIReference.cpp:
+ (SVGURIReference::parseMappedAttribute):
+ * ksvg2/svg/SVGURIReference.h:
+ * ksvg2/svg/SVGUseElement.cpp:
+ (SVGUseElement::SVGUseElement):
+ (SVGUseElement::parseMappedAttribute):
+ (SVGUseElement::closeRenderer):
+ * ksvg2/svg/SVGUseElement.h:
+ (WebCore::SVGUseElement::contextElement):
+ * ksvg2/svg/SVGViewElement.h:
+ (WebCore::SVGViewElement::contextElement):
+
2006-09-05 Eric Seidel <eric@eseidel.com>
Reviewed by aroben.
my $value = shift;
my $type = $codeGenerator->StripModule($signature->type);
-
+
+ # FIXME: Temporary hack until we implement the JSSVGAnimated* stuff.
+
+ if($type eq "SVGAnimatedString") {
+ $type = "DOMString";
+ } elsif($type eq "SVGAnimatedBoolean") {
+ $type = "boolean";
+ } elsif($type eq "SVGAnimatedEnumeration") {
+ $type = "long";
+ } elsif($type eq "SVGAnimatedInteger") {
+ $type = "long";
+ } elsif($type eq "SVGAnimatedNumber") {
+ $type = "double";
+ } elsif($type eq "SVGAnimatedLength") {
+ $type = "SVGLength";
+ }
+
if ($type eq "boolean") {
return "jsBoolean($value)";
} elsif ($type eq "long" or
#include "GraphicsContext.h"
#include "KRenderingDevice.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
#include "SVGForeignObjectElement.h"
namespace WebCore {
AffineTransform RenderForeignObject::translationForAttributes()
{
SVGForeignObjectElement *foreign = static_cast<SVGForeignObjectElement *>(element());
- return AffineTransform().translate(foreign->x()->baseVal()->value(), foreign->y()->baseVal()->value());
+ return AffineTransform().translate(foreign->xBaseValue()->value(), foreign->yBaseValue()->value());
}
void RenderForeignObject::paint(PaintInfo& paintInfo, int parentX, int parentY)
#include "GraphicsContext.h"
#include "KCanvasRenderingStyle.h"
#include "KRenderingDevice.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
+#include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
#include "SVGImageElement.h"
#include "SVGImageElement.h"
#include "ksvg.h"
SVGImageElement *imageElt = static_cast<SVGImageElement *>(node());
- if (imageElt->preserveAspectRatio()->baseVal()->align() == SVG_PRESERVEASPECTRATIO_NONE)
+ if (imageElt->preserveAspectRatioBaseValue()->align() == SVG_PRESERVEASPECTRATIO_NONE)
RenderImage::paint(pi, 0, 0);
else {
FloatRect destRect(m_x, m_y, contentWidth(), contentHeight());
FloatRect srcRect(0, 0, image()->width(), image()->height());
- adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio()->baseVal());
+ adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatioBaseValue());
c->drawImage(image(), destRect, srcRect);
}
FloatRect RenderSVGImage::relativeBBox(bool includeStroke) const
{
SVGImageElement *image = static_cast<SVGImageElement *>(node());
- float xOffset = image->x()->baseVal() ? image->x()->baseVal()->value() : 0;
- float yOffset = image->y()->baseVal() ? image->y()->baseVal()->value() : 0;
- return FloatRect(xOffset, yOffset, width(), height());
+ return FloatRect(image->xBaseValue()->value(), image->yBaseValue()->value(), width(), height());
}
void RenderSVGImage::imageChanged(CachedImage* image)
IntRect RenderSVGImage::getAbsoluteRepaintRect()
{
SVGImageElement *image = static_cast<SVGImageElement *>(node());
- float xOffset = image->x()->baseVal() ? image->x()->baseVal()->value() : 0;
- float yOffset = image->y()->baseVal() ? image->y()->baseVal()->value() : 0;
- FloatRect repaintRect = absoluteTransform().mapRect(FloatRect(xOffset, yOffset, width(), height()));
+ FloatRect repaintRect = absoluteTransform().mapRect(FloatRect(image->xBaseValue()->value(), image->yBaseValue()->value(), width(), height()));
// Filters can expand the bounding box
KCanvasFilter *filter = getFilterById(document(), style()->svgStyle()->filter().mid(1));
AffineTransform RenderSVGImage::translationForAttributes()
{
SVGImageElement *image = static_cast<SVGImageElement *>(node());
- float xOffset = image->x()->baseVal() ? image->x()->baseVal()->value() : 0;
- float yOffset = image->y()->baseVal() ? image->y()->baseVal()->value() : 0;
- return AffineTransform().translate(xOffset, yOffset);
+ return AffineTransform().translate(image->xBaseValue()->value(), image->yBaseValue()->value());
}
void RenderSVGImage::translateForAttributes()
#include "GraphicsContext.h"
#include "KCanvasRenderingStyle.h"
#include "KRenderingDevice.h"
-#include "SVGAnimatedLengthList.h"
+#include "SVGLengthList.h"
#include "SVGTextElement.h"
#include <wtf/OwnPtr.h>
{
SVGTextElement *text = static_cast<SVGTextElement *>(element());
- float xOffset = text->x()->baseVal()->getFirst() ? text->x()->baseVal()->getFirst()->value() : 0;
- float yOffset = text->y()->baseVal()->getFirst() ? text->y()->baseVal()->getFirst()->value() : 0;
+ float xOffset = text->xBaseValue()->getFirst() ? text->xBaseValue()->getFirst()->value() : 0;
+ float yOffset = text->yBaseValue()->getFirst() ? text->yBaseValue()->getFirst()->value() : 0;
return AffineTransform().translate(xOffset, yOffset);
}
#include "Document.h"
#include "SVGAnimateColorElement.h"
#include "SVGAnimateTransformElement.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
#include "SVGDOMImplementation.h"
#include "SVGMatrix.h"
#include "SVGNames.h"
SVGElement* key = targetIterator->first;
if (key && key->isStyled() && key->isStyledTransformable()) {
SVGStyledTransformableElement *transform = static_cast<SVGStyledTransformableElement *>(key);
- transform->transform()->setAnimVal(targetTransforms.get());
- transform->updateLocalTransform(transform->transform()->animVal());
+ transform->setTransform(targetTransforms.get());
+ transform->updateLocalTransform(transform->transform());
}
}
#include "EventListener.h"
#include "Frame.h"
#include "KSVGTimeScheduler.h"
+#include "AtomicString.h"
#include "kjs_proxy.h"
#include "SVGSVGElement.h"
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
+#include <wtf/HashMap.h>
+#include "StringHash.h"
+#include "StringImpl.h"
+#include "AtomicString.h"
namespace WebCore {
+class AtomicString;
class Document;
class EventListener;
class Node;
+class SVGElement;
class String;
-class SVGSVGElement;
class TimeScheduler;
+class SVGSVGElement;
class SVGDocumentExtensions {
public:
SVGDocumentExtensions(const SVGDocumentExtensions&);
SVGDocumentExtensions& operator=(const SVGDocumentExtensions&);
+
+ template<typename ValueType>
+ HashMap<const SVGElement*, HashMap<StringImpl*, ValueType>*> baseValueMap() const
+ {
+ static HashMap<const SVGElement*, HashMap<StringImpl*, ValueType>*> s_valueType;
+ return s_valueType;
+ }
+
+public:
+ template<typename ValueType>
+ ValueType baseValue(const SVGElement* element, const AtomicString& propertyName) const
+ {
+ HashMap<StringImpl*, ValueType>* propertyMap = baseValueMap<ValueType>().get(element);
+ if (propertyMap)
+ return propertyMap->get(propertyName.impl());
+
+ return 0;
+ }
+
+ template<typename ValueType>
+ void setBaseValue(const SVGElement* element, const AtomicString& propertyName, ValueType newValue)
+ {
+ HashMap<StringImpl*, ValueType>* propertyMap = baseValueMap<ValueType>().get(element);
+ if (!propertyMap) {
+ propertyMap = new HashMap<StringImpl*, ValueType>();
+ baseValueMap<ValueType>().set(element, propertyMap);
+ }
+
+ propertyMap->set(propertyName.impl(), newValue);
+ }
+
+ template<typename ValueType>
+ bool hasBaseValue(const SVGElement* element, const AtomicString& propertyName) const
+ {
+ HashMap<StringImpl*, ValueType>* propertyMap = baseValueMap<ValueType>().get(element);
+ if (propertyMap)
+ return propertyMap->contains(propertyName.impl());
+
+ return false;
+ }
};
+// Special handling for WebCore::String
+template<>
+inline String SVGDocumentExtensions::baseValue<String>(const SVGElement* element, const AtomicString& propertyName) const
+{
+ HashMap<StringImpl*, String>* propertyMap = baseValueMap<String>().get(element);
+ if (propertyMap)
+ return propertyMap->get(propertyName.impl());
+
+ return String();
+}
+
+// Special handling for booleans
+template<>
+inline bool SVGDocumentExtensions::baseValue<bool>(const SVGElement* element, const AtomicString& propertyName) const
+{
+ HashMap<StringImpl*, bool>* propertyMap = baseValueMap<bool>().get(element);
+ if (propertyMap)
+ return propertyMap->get(propertyName.impl());
+
+ return false;
+}
+
+// Special handling for doubles
+template<>
+inline double SVGDocumentExtensions::baseValue<double>(const SVGElement* element, const AtomicString& propertyName) const
+{
+ HashMap<StringImpl*, double>* propertyMap = baseValueMap<double>().get(element);
+ if (propertyMap)
+ return propertyMap->get(propertyName.impl());
+
+ return 0.0;
+}
+
}
#endif // SVG_SUPPORT
#include "SVGNames.h"
#include "SVGImageElement.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedString.h"
+#include "SVGLength.h"
#include "SVGMatrix.h"
#include "KCanvasRenderingStyle.h"
WebCore::Document* doc = imageElement->ownerDocument();
CachedImage *newImage = 0;
- if (imageElement->href()->baseVal())
- newImage = doc->docLoader()->requestImage(imageElement->href()->baseVal());
+ if (!imageElement->hrefBaseValue().isEmpty())
+ newImage = doc->docLoader()->requestImage(imageElement->hrefBaseValue());
CachedImage *oldImage = image();
if (newImage != oldImage) {
#include "Frame.h"
#include "MouseEvent.h"
#include "MouseEvent.h"
-#include "SVGAnimatedString.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include "csshelper.h"
{
}
-SVGAnimatedString *SVGAElement::target() const
-{
- return lazy_create<SVGAnimatedString>(m_target, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGAElement, String, String, string, Target, target, SVGNames::targetAttr.localName(), m_target)
void SVGAElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value(attr->value());
if (attr->name() == SVGNames::targetAttr) {
- target()->setBaseVal(value.impl());
+ setTargetBaseValue(value.impl());
} else {
if (SVGURIReference::parseMappedAttribute(attr)) {
m_isLink = attr->value() != 0;
SVGStyledTransformableElement::defaultEventHandler(evt);
return;
}
- url = parseURL(href()->baseVal()).deprecatedString();
+ url = parseURL(hrefBaseValue()).deprecatedString();
utarget = getAttribute(SVGNames::targetAttr).deprecatedString();
if(e && e->button() == 1)
namespace WebCore {
- class SVGAnimatedString;
-
class SVGAElement : public SVGStyledTransformableElement,
public SVGURIReference,
public SVGTests,
virtual ~SVGAElement();
// 'SVGAElement' functions
- SVGAnimatedString *target() const;
-
virtual bool isValid() const { return SVGTests::isValid(); }
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual void defaultEventHandler(Event *evt);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_target;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, Target, target)
};
} // namespace WebCore
Color color() const;
Color initialColor() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
Color m_lastColor;
Color m_currentColor;
virtual void handleTimerEvent(double timePercentage);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
int m_currentItem;
#include "SVGTransform.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTransformList.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
#include "SVGAnimateTransformElement.h"
#include "KSVGTimeScheduler.h"
#include "Document.h"
// Save initial transform... (needed for fill="remove" or additve="sum")
if (targetElement()->isStyledTransformable()) {
SVGStyledTransformableElement *transform = static_cast<SVGStyledTransformableElement *>(targetElement());
- RefPtr<SVGTransformList> transformList = transform->transform()->baseVal();
+ RefPtr<SVGTransformList> transformList = transform->transformBaseValue();
if (transformList) {
for (unsigned long i = 0; i < transformList->numberOfItems(); i++) {
SVGTransform *value = transformList->getItem(i);
if (!targetElement()->isStyledTransformable())
return 0;
SVGStyledTransformableElement *transform = static_cast<SVGStyledTransformableElement *>(targetElement());
- SVGTransformList *transformList = (transform ? transform->transform()->baseVal() : 0);
+ SVGTransformList *transformList = (transform ? transform->transformBaseValue() : 0);
if (!transformList)
return 0;
SVGMatrix *initialMatrix() const;
SVGMatrix *transformMatrix() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
int m_currentItem;
SVGTransformType m_type;
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGCircleElement.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
using namespace WebCore;
SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_cx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_cy(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_r(new SVGLength(this, LM_OTHER, viewportElement()))
{
}
{
}
-SVGAnimatedLength *SVGCircleElement::cx() const
-{
- return lazy_create<SVGAnimatedLength>(m_cx, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGCircleElement::cy() const
-{
- return lazy_create<SVGAnimatedLength>(m_cy, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGCircleElement::r() const
-{
- return lazy_create<SVGAnimatedLength>(m_r, this, LM_OTHER, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength*, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength*, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength*, Length, length, R, r, SVGNames::rAttr.localName(), m_r.get())
void SVGCircleElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::cxAttr)
- cx()->baseVal()->setValueAsString(value.impl());
+ cxBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::cyAttr)
- cy()->baseVal()->setValueAsString(value.impl());
+ cyBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::rAttr)
- r()->baseVal()->setValueAsString(value.impl());
+ rBaseValue()->setValueAsString(value.impl());
else
{
if(SVGTests::parseMappedAttribute(attr)) return;
Path SVGCircleElement::toPathData() const
{
- float _cx = cx()->baseVal()->value(), _cy = cy()->baseVal()->value();
- float _r = r()->baseVal()->value();
+ float _cx = cxBaseValue()->value(), _cy = cyBaseValue()->value();
+ float _r = rBaseValue()->value();
return Path::createCircle(FloatPoint(_cx, _cy), _r);
}
const SVGStyledElement *SVGCircleElement::pushAttributeContext(const SVGStyledElement *context)
{
// All attribute's contexts are equal (so just take the one from 'cx').
- const SVGStyledElement *restore = cx()->baseVal()->context();
+ const SVGStyledElement *restore = cxBaseValue()->context();
- cx()->baseVal()->setContext(context);
- cy()->baseVal()->setContext(context);
- r()->baseVal()->setContext(context);
+ cxBaseValue()->setContext(context);
+ cyBaseValue()->setContext(context);
+ rBaseValue()->setContext(context);
SVGStyledElement::pushAttributeContext(context);
return restore;
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGCircleElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGCircleElement' functions
- SVGAnimatedLength *cx() const;
- SVGAnimatedLength *cy() const;
- SVGAnimatedLength *r() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_cx;
- mutable RefPtr<SVGAnimatedLength> m_cy;
- mutable RefPtr<SVGAnimatedLength> m_r;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cx, cx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cy, cy)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, R, r)
};
} // namespace WebCore
#include "Attr.h"
#include "Document.h"
#include "RenderView.h"
-#include "SVGAnimatedEnumeration.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include "SVGMatrix.h"
using namespace WebCore;
SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_clipPathUnits(SVG_UNIT_TYPE_USERSPACEONUSE)
{
m_clipper = 0;
}
delete m_clipper;
}
-SVGAnimatedEnumeration *SVGClipPathElement::clipPathUnits() const
-{
- if(!m_clipPathUnits)
- {
- lazy_create<SVGAnimatedEnumeration>(m_clipPathUnits, this);
- m_clipPathUnits->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
- }
-
- return m_clipPathUnits.get();
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGClipPathElement, int, Enumeration, enumeration, ClipPathUnits, clipPathUnits, SVGNames::clipPathUnitsAttr.localName(), m_clipPathUnits)
void SVGClipPathElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::clipPathUnitsAttr)
{
if(value == "userSpaceOnUse")
- clipPathUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setClipPathUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if(value == "objectBoundingBox")
- clipPathUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setClipPathUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
else
{
else
m_clipper->resetClipData();
- bool bbox = clipPathUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ bool bbox = clipPathUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
RenderStyle *clipPathStyle = styleForRenderer(parent()->renderer()); // FIXME: Manual style resolution is a hack
for (Node *n = firstChild(); n != 0; n = n->nextSibling()) {
namespace WebCore
{
- class SVGAnimatedEnumeration;
class SVGClipPathElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
virtual KCanvasClipper *canvasResource();
// 'SVGClipPathElement' functions
- SVGAnimatedEnumeration *clipPathUnits() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedEnumeration> m_clipPathUnits;
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, ClipPathUnits, clipPathUnits)
KCanvasClipper *m_clipper;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGComponentTransferFunctionElement.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedNumberList.h"
+#include "SVGNumberList.h"
using namespace WebCore;
-SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document *doc) :
-SVGElement(tagName, doc)
+SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document *doc)
+ : SVGElement(tagName, doc)
+ , m_type(0)
+ , m_tableValues(new SVGNumberList(0))
+ , m_slope(0.0)
+ , m_intercept(0.0)
+ , m_amplitude(0.0)
+ , m_exponent(0.0)
+ , m_offset(0.0)
{
}
{
}
-SVGAnimatedEnumeration *SVGComponentTransferFunctionElement::type() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_type, dummy);
-}
-
-SVGAnimatedNumberList *SVGComponentTransferFunctionElement::tableValues() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumberList>(m_tableValues, dummy);
-}
-
-SVGAnimatedNumber *SVGComponentTransferFunctionElement::slope() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_slope, dummy);
-}
-
-SVGAnimatedNumber *SVGComponentTransferFunctionElement::intercept() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_intercept, dummy);
-}
-
-SVGAnimatedNumber *SVGComponentTransferFunctionElement::amplitude() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_amplitude, dummy);
-}
-
-SVGAnimatedNumber *SVGComponentTransferFunctionElement::exponent() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_exponent, dummy);
-}
-
-SVGAnimatedNumber *SVGComponentTransferFunctionElement::offset() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_offset, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, SVGNumberList*, NumberList, numberList, TableValues, tableValues, SVGNames::tableValuesAttr.localName(), m_tableValues.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, double, Number, number, Slope, slope, SVGNames::slopeAttr.localName(), m_slope)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, double, Number, number, Intercept, intercept, SVGNames::interceptAttr.localName(), m_intercept)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, double, Number, number, Amplitude, amplitude, SVGNames::amplitudeAttr.localName(), m_amplitude)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, double, Number, number, Exponent, exponent, SVGNames::exponentAttr.localName(), m_exponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, double, Number, number, Offset, offset, SVGNames::offsetAttr.localName(), m_offset)
void SVGComponentTransferFunctionElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::typeAttr)
{
if(value == "identity")
- type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY);
+ setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY);
else if(value == "table")
- type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_TABLE);
+ setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_TABLE);
else if(value == "discrete")
- type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE);
+ setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE);
else if(value == "linear")
- type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_LINEAR);
+ setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_LINEAR);
else if(value == "gamma")
- type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_GAMMA);
+ setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_GAMMA);
}
else if (attr->name() == SVGNames::tableValuesAttr)
- tableValues()->baseVal()->parse(value.deprecatedString());
+ tableValuesBaseValue()->parse(value.deprecatedString());
else if (attr->name() == SVGNames::slopeAttr)
- slope()->setBaseVal(value.deprecatedString().toDouble());
+ setSlopeBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::interceptAttr)
- intercept()->setBaseVal(value.deprecatedString().toDouble());
+ setInterceptBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::amplitudeAttr)
- amplitude()->setBaseVal(value.deprecatedString().toDouble());
+ setAmplitudeBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::exponentAttr)
- exponent()->setBaseVal(value.deprecatedString().toDouble());
+ setExponentBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::offsetAttr)
- offset()->setBaseVal(value.deprecatedString().toDouble());
+ setOffsetBaseValue(value.deprecatedString().toDouble());
else
SVGElement::parseMappedAttribute(attr);
}
KCComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
{
KCComponentTransferFunction func;
- func.type = (KCComponentTransferType)(type()->baseVal() - 1);
- func.slope = slope()->baseVal();
- func.intercept = intercept()->baseVal();
- func.amplitude = amplitude()->baseVal();
- func.exponent = exponent()->baseVal();
- func.offset = offset()->baseVal();
- SVGNumberList *numbers = tableValues()->baseVal();
+ func.type = (KCComponentTransferType)(typeBaseValue() - 1);
+ func.slope = slopeBaseValue();
+ func.intercept = interceptBaseValue();
+ func.amplitude = amplitudeBaseValue();
+ func.exponent = exponentBaseValue();
+ func.offset = offsetBaseValue();
+ SVGNumberList *numbers = tableValuesBaseValue();
unsigned int nr = numbers->numberOfItems();
for (unsigned int i = 0; i < nr; i++)
func.tableValues.append(numbers->getItem(i)->value());
namespace WebCore
{
- class SVGAnimatedNumber;
- class SVGAnimatedNumberList;
- class SVGAnimatedEnumeration;
+ class SVGNumberList;
class SVGComponentTransferFunctionElement : public SVGElement
{
virtual ~SVGComponentTransferFunctionElement();
// 'SVGComponentTransferFunctionElement' functions
- SVGAnimatedEnumeration *type() const;
- SVGAnimatedNumberList *tableValues() const;
- SVGAnimatedNumber *slope() const;
- SVGAnimatedNumber *intercept() const;
- SVGAnimatedNumber *amplitude() const;
- SVGAnimatedNumber *exponent() const;
- SVGAnimatedNumber *offset() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
KCComponentTransferFunction transferFunction() const;
private:
- mutable RefPtr<SVGAnimatedEnumeration> m_type;
- mutable RefPtr<SVGAnimatedNumberList> m_tableValues;
- mutable RefPtr<SVGAnimatedNumber> m_slope;
- mutable RefPtr<SVGAnimatedNumber> m_intercept;
- mutable RefPtr<SVGAnimatedNumber> m_amplitude;
- mutable RefPtr<SVGAnimatedNumber> m_exponent;
- mutable RefPtr<SVGAnimatedNumber> m_offset;
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, Type, type)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGNumberList*, RefPtr<SVGNumberList>, TableValues, tableValues)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Slope, slope)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Intercept, intercept)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Amplitude, amplitude)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Exponent, exponent)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Offset, offset)
};
} // namespace WebCore
#include "DocLoader.h"
#include "SVGNames.h"
#include "SVGHelper.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedString.h"
+#include "SVGLength.h"
using namespace WebCore;
SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document *doc)
-: SVGElement(tagName, doc), SVGTests(), SVGExternalResourcesRequired(), SVGURIReference(), CachedResourceClient()
+ : SVGElement(tagName, doc)
+ , SVGTests()
+ , SVGExternalResourcesRequired()
+ , SVGURIReference()
+ , CachedResourceClient()
+ , m_x(new SVGLength(0, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(0, LM_HEIGHT, viewportElement()))
{
m_cachedImage = 0;
}
m_cachedImage->deref(this);
}
-SVGAnimatedLength *SVGCursorElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, static_cast<const SVGStyledElement *>(0) /* correct? */, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGCursorElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, static_cast<const SVGStyledElement *>(0) /* correct? */, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
void SVGCursorElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else
{
if(SVGTests::parseMappedAttribute(attr)) return;
if (SVGURIReference::parseMappedAttribute(attr)) {
if (m_cachedImage)
m_cachedImage->deref(this);
- m_cachedImage = ownerDocument()->docLoader()->requestImage(href()->baseVal());
+ m_cachedImage = ownerDocument()->docLoader()->requestImage(hrefBaseValue());
if (m_cachedImage)
m_cachedImage->ref(this);
return;
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGCursorElement : public SVGElement,
public SVGTests,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGCursorElement' functions
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
CachedImage* cachedImage() const { return m_cachedImage; }
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
CachedImage *m_cachedImage;
};
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
};
} // namespace WebCore
#include "StyledElement.h"
#include "SVGNames.h"
+#include "SVGDocumentExtensions.h"
+#include "Document.h"
+
+// FIXME: Templatify as much as possible here!
+#define ANIMATED_PROPERTY_DECLARATIONS(BareType, StorageType, UpperProperty, LowerProperty) \
+public: \
+ BareType LowerProperty() const; \
+ void set##UpperProperty(BareType newValue); \
+ BareType LowerProperty##BaseValue() const; \
+ void set##UpperProperty##BaseValue(BareType newValue); \
+private: \
+ StorageType m_##LowerProperty;
+
+#define ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, ContextElement) \
+BareType ClassName::LowerProperty() const \
+{ \
+ return StorageGetter; \
+} \
+void ClassName::set##UpperProperty(BareType newValue) \
+{ \
+ m_##LowerProperty = newValue; \
+} \
+BareType ClassName::LowerProperty##BaseValue() const \
+{ \
+ const SVGElement* context = ContextElement; \
+ ASSERT(context != 0); \
+ SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
+ if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) \
+ return extensions->baseValue<BareType>(context, AttrName); \
+ return LowerProperty(); \
+} \
+void ClassName::set##UpperProperty##BaseValue(BareType newValue) \
+{ \
+ const SVGElement* context = ContextElement; \
+ ASSERT(context != 0); \
+ SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
+ if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) \
+ extensions->setBaseValue<BareType>(context, AttrName, newValue); \
+ set##UpperProperty(newValue); \
+}
+
+#define ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, contextElement())
+
+#define ANIMATED_PROPERTY_DEFINITIONS(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, this)
namespace WebCore {
class DocumentPtr;
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGEllipseElement.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
namespace WebCore {
SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_cx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_cy(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_rx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_ry(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
-}
+}
SVGEllipseElement::~SVGEllipseElement()
{
}
-SVGAnimatedLength *SVGEllipseElement::cx() const
-{
- return lazy_create<SVGAnimatedLength>(m_cx, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGEllipseElement::cy() const
-{
- return lazy_create<SVGAnimatedLength>(m_cy, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGEllipseElement::rx() const
-{
- return lazy_create<SVGAnimatedLength>(m_rx, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGEllipseElement::ry() const
-{
- return lazy_create<SVGAnimatedLength>(m_ry, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength*, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength*, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength*, Length, length, Rx, rx, SVGNames::rxAttr.localName(), m_rx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength*, Length, length, Ry, ry, SVGNames::ryAttr.localName(), m_ry.get())
void SVGEllipseElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::cxAttr)
- cx()->baseVal()->setValueAsString(value.impl());
+ cxBaseValue()->setValueAsString(value.impl());
if (attr->name() == SVGNames::cyAttr)
- cy()->baseVal()->setValueAsString(value.impl());
+ cyBaseValue()->setValueAsString(value.impl());
if (attr->name() == SVGNames::rxAttr)
- rx()->baseVal()->setValueAsString(value.impl());
+ rxBaseValue()->setValueAsString(value.impl());
if (attr->name() == SVGNames::ryAttr)
- ry()->baseVal()->setValueAsString(value.impl());
+ ryBaseValue()->setValueAsString(value.impl());
else
{
if(SVGTests::parseMappedAttribute(attr)) return;
Path SVGEllipseElement::toPathData() const
{
- float _cx = cx()->baseVal()->value(), _cy = cy()->baseVal()->value();
- float _rx = rx()->baseVal()->value(), _ry = ry()->baseVal()->value();
+ float _cx = cxBaseValue()->value(), _cy = cyBaseValue()->value();
+ float _rx = rxBaseValue()->value(), _ry = ryBaseValue()->value();
return Path::createEllipse(FloatPoint(_cx, _cy), _rx, _ry);
}
const SVGStyledElement *SVGEllipseElement::pushAttributeContext(const SVGStyledElement *context)
{
// All attribute's contexts are equal (so just take the one from 'cx').
- const SVGStyledElement *restore = cx()->baseVal()->context();
+ const SVGStyledElement *restore = cxBaseValue()->context();
- cx()->baseVal()->setContext(context);
- cy()->baseVal()->setContext(context);
- rx()->baseVal()->setContext(context);
- ry()->baseVal()->setContext(context);
+ cxBaseValue()->setContext(context);
+ cyBaseValue()->setContext(context);
+ rxBaseValue()->setContext(context);
+ ryBaseValue()->setContext(context);
SVGStyledElement::pushAttributeContext(context);
return restore;
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGEllipseElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGEllipseElement' functions
- SVGAnimatedLength *cx() const;
- SVGAnimatedLength *cy() const;
- SVGAnimatedLength *rx() const;
- SVGAnimatedLength *ry() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_cx;
- mutable RefPtr<SVGAnimatedLength> m_cy;
- mutable RefPtr<SVGAnimatedLength> m_rx;
- mutable RefPtr<SVGAnimatedLength> m_ry;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cx, cx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cy, cy)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Rx, rx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Ry, ry)
};
} // namespace WebCore
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGElement.h"
-#include "SVGAnimatedBoolean.h"
namespace WebCore {
SVGExternalResourcesRequired::SVGExternalResourcesRequired()
+ : m_externalResourcesRequired(false)
{
}
{
}
-SVGAnimatedBoolean *SVGExternalResourcesRequired::externalResourcesRequired() const
-{
- return lazy_create<SVGAnimatedBoolean>(m_external, static_cast<const SVGStyledElement *>(0));
-}
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGExternalResourcesRequired, bool, Boolean, boolean, ExternalResourcesRequired, externalResourcesRequired, SVGNames::externalResourcesRequiredAttr.localName(), m_externalResourcesRequired)
bool SVGExternalResourcesRequired::parseMappedAttribute(MappedAttribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::externalResourcesRequiredAttr) {
- externalResourcesRequired()->setBaseVal(value == "true");
+ setExternalResourcesRequiredBaseValue(value == "true");
return true;
}
#ifdef SVG_SUPPORT
#include <wtf/RefPtr.h>
+#include "SVGElement.h"
namespace WebCore {
class MappedAttribute;
- class SVGAnimatedBoolean;
// FIXME: This is wrong for several reasons:
// 1. externalResourcesRequired is not animateable according to SVG 1.1 section 5.9
virtual ~SVGExternalResourcesRequired();
// 'SVGExternalResourcesRequired' functions
- SVGAnimatedBoolean *externalResourcesRequired() const;
-
bool parseMappedAttribute(MappedAttribute*);
+ protected:
+ virtual const SVGElement* contextElement() const = 0;
+
private:
- mutable RefPtr<SVGAnimatedBoolean> m_external;
+ ANIMATED_PROPERTY_DECLARATIONS(bool, bool, ExternalResourcesRequired, externalResourcesRequired)
};
} // namespace WebCore
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFEBlendElement.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
-SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_mode(0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEBlendElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedString *SVGFEBlendElement::in2() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in2, dummy);
-}
-
-SVGAnimatedEnumeration *SVGFEBlendElement::mode() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_mode, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, int, Enumeration, enumeration, Mode, mode, SVGNames::modeAttr.localName(), m_mode)
void SVGFEBlendElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::modeAttr)
{
if(value == "normal")
- mode()->setBaseVal(SVG_FEBLEND_MODE_NORMAL);
+ setModeBaseValue(SVG_FEBLEND_MODE_NORMAL);
else if(value == "multiply")
- mode()->setBaseVal(SVG_FEBLEND_MODE_MULTIPLY);
+ setModeBaseValue(SVG_FEBLEND_MODE_MULTIPLY);
else if(value == "screen")
- mode()->setBaseVal(SVG_FEBLEND_MODE_SCREEN);
+ setModeBaseValue(SVG_FEBLEND_MODE_SCREEN);
else if(value == "darken")
- mode()->setBaseVal(SVG_FEBLEND_MODE_DARKEN);
+ setModeBaseValue(SVG_FEBLEND_MODE_DARKEN);
else if(value == "lighten")
- mode()->setBaseVal(SVG_FEBLEND_MODE_LIGHTEN);
+ setModeBaseValue(SVG_FEBLEND_MODE_LIGHTEN);
}
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::in2Attr)
- in2()->setBaseVal(value.impl());
+ setIn2BaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEBlend *>(renderingDevice()->createFilterEffect(FE_BLEND));
if (!m_filterEffect)
return 0;
- m_filterEffect->setBlendMode((KCBlendModeType)(mode()->baseVal()-1));
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
- m_filterEffect->setIn2(String(in2()->baseVal()).deprecatedString());
+ m_filterEffect->setBlendMode((KCBlendModeType)(modeBaseValue()-1));
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
+ m_filterEffect->setIn2(String(in2BaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
- class SVGAnimatedEnumeration;
class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEBlendElement();
// 'SVGFEBlendElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedString *in2() const;
- SVGAnimatedEnumeration *mode() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEBlend *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedString> m_in2;
- mutable RefPtr<SVGAnimatedEnumeration> m_mode;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In2, in2)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, Mode, mode)
mutable KCanvasFEBlend *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFEColorMatrixElement.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedNumberList.h"
+#include "SVGNumberList.h"
using namespace WebCore;
-SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_type(0)
+ , m_values(new SVGNumberList(0))
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEColorMatrixElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedEnumeration *SVGFEColorMatrixElement::type() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_type, dummy);
-}
-
-SVGAnimatedNumberList *SVGFEColorMatrixElement::values() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumberList>(m_values, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, SVGNumberList*, NumberList, numberList, Values, values, SVGNames::valuesAttr.localName(), m_values.get())
void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::typeAttr)
{
if(value == "matrix")
- type()->setBaseVal(SVG_FECOLORMATRIX_TYPE_MATRIX);
+ setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_MATRIX);
else if(value == "saturate")
- type()->setBaseVal(SVG_FECOLORMATRIX_TYPE_SATURATE);
+ setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_SATURATE);
else if(value == "hueRotate")
- type()->setBaseVal(SVG_FECOLORMATRIX_TYPE_HUEROTATE);
+ setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_HUEROTATE);
else if(value == "luminanceToAlpha")
- type()->setBaseVal(SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
+ setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
}
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::valuesAttr)
- values()->baseVal()->parse(value.deprecatedString(), this);
+ valuesBaseValue()->parse(value.deprecatedString(), this);
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
DeprecatedValueList<float> _values;
- SVGNumberList *numbers = values()->baseVal();
+ SVGNumberList *numbers = valuesBaseValue();
unsigned int nr = numbers->numberOfItems();
for(unsigned int i = 0;i < nr;i++)
_values.append(numbers->getItem(i)->value());
m_filterEffect->setValues(_values);
- m_filterEffect->setType((KCColorMatrixType)(type()->baseVal() - 1));
+ m_filterEffect->setType((KCColorMatrixType)(typeBaseValue() - 1));
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
- class SVGAnimatedNumberList;
- class SVGAnimatedEnumeration;
+ class SVGNumberList;
class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEColorMatrixElement();
// 'SVGFEColorMatrixElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedEnumeration *type() const;
- SVGAnimatedNumberList *values() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEColorMatrix *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedEnumeration> m_type;
- mutable RefPtr<SVGAnimatedNumberList> m_values;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, Type, type)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGNumberList*, RefPtr<SVGNumberList>, Values, values)
mutable KCanvasFEColorMatrix *m_filterEffect;
};
#include "SVGFEFuncGElement.h"
#include "SVGFEFuncBElement.h"
#include "SVGFEFuncAElement.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedEnumeration.h"
using namespace WebCore;
-SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEComponentTransferElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEComponentTransferElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
void SVGFEComponentTransferElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
for (Node *n = firstChild(); n != 0; n = n->nextSibling()) {
namespace WebCore
{
- class SVGAnimatedString;
class SVGFEComponentTransferElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEComponentTransferElement();
// 'SVGFEComponentTransferElement' functions
- SVGAnimatedString *in1() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEComponentTransfer *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
mutable KCanvasFEComponentTransfer *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFECompositeElement.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
-SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m__operator(0)
+ , m_k1(0.0)
+ , m_k2(0.0)
+ , m_k3(0.0)
+ , m_k4(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFECompositeElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedString *SVGFECompositeElement::in2() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in2, dummy);
-}
-
-SVGAnimatedEnumeration *SVGFECompositeElement::_operator() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_operator, dummy);
-}
-
-SVGAnimatedNumber *SVGFECompositeElement::k1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_k1, dummy);
-}
-
-SVGAnimatedNumber *SVGFECompositeElement::k2() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_k2, dummy);
-}
-
-SVGAnimatedNumber *SVGFECompositeElement::k3() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_k3, dummy);
-}
-
-SVGAnimatedNumber *SVGFECompositeElement::k4() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_k4, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, int, Enumeration, enumeration, _operator, _operator, SVGNames::operatorAttr.localName(), m__operator)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, double, Number, number, K1, k1, SVGNames::k1Attr.localName(), m_k1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, double, Number, number, K2, k2, SVGNames::k2Attr.localName(), m_k2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, double, Number, number, K3, k3, SVGNames::k3Attr.localName(), m_k3)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, double, Number, number, K4, k4, SVGNames::k4Attr.localName(), m_k4)
void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::operatorAttr)
{
if(value == "over")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_OVER);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OVER);
else if(value == "in")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_IN);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_IN);
else if(value == "out")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_OUT);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OUT);
else if(value == "atop")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_ATOP);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ATOP);
else if(value == "xor")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_XOR);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_XOR);
else if(value == "arithmetic")
- _operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
+ set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
}
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::in2Attr)
- in2()->setBaseVal(value.impl());
+ setIn2BaseValue(value.impl());
else if (attr->name() == SVGNames::k1Attr)
- k1()->setBaseVal(value.deprecatedString().toDouble());
+ setK1BaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::k2Attr)
- k2()->setBaseVal(value.deprecatedString().toDouble());
+ setK2BaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::k3Attr)
- k3()->setBaseVal(value.deprecatedString().toDouble());
+ setK3BaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::k4Attr)
- k4()->setBaseVal(value.deprecatedString().toDouble());
+ setK4BaseValue(value.deprecatedString().toDouble());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEComposite *>(renderingDevice()->createFilterEffect(FE_COMPOSITE));
if (!m_filterEffect)
return 0;
- m_filterEffect->setOperation((KCCompositeOperationType)(_operator()->baseVal() - 1));
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
- m_filterEffect->setIn2(String(in2()->baseVal()).deprecatedString());
+ m_filterEffect->setOperation((KCCompositeOperationType)(_operatorBaseValue() - 1));
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
+ m_filterEffect->setIn2(String(in2BaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
- m_filterEffect->setK1(k1()->baseVal());
- m_filterEffect->setK2(k2()->baseVal());
- m_filterEffect->setK3(k3()->baseVal());
- m_filterEffect->setK4(k4()->baseVal());
+ m_filterEffect->setK1(k1BaseValue());
+ m_filterEffect->setK2(k2BaseValue());
+ m_filterEffect->setK3(k3BaseValue());
+ m_filterEffect->setK4(k4BaseValue());
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
- class SVGAnimatedNumber;
- class SVGAnimatedEnumeration;
class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFECompositeElement();
// 'SVGFECompositeElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedString *in2() const;
- SVGAnimatedEnumeration *_operator() const;
- SVGAnimatedNumber *k1() const;
- SVGAnimatedNumber *k2() const;
- SVGAnimatedNumber *k3() const;
- SVGAnimatedNumber *k4() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEComposite *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedString> m_in2;
- mutable RefPtr<SVGAnimatedEnumeration> m_operator;
- mutable RefPtr<SVGAnimatedNumber> m_k1;
- mutable RefPtr<SVGAnimatedNumber> m_k2;
- mutable RefPtr<SVGAnimatedNumber> m_k3;
- mutable RefPtr<SVGAnimatedNumber> m_k4;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In2, in2)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, _operator, _operator)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, K1, k1)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, K2, k2)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, K3, k3)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, K4, k4)
mutable KCanvasFEComposite *m_filterEffect;
};
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
-#include "SVGAnimatedColor.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedString.h"
+#include "SVGColor.h"
#include "SVGFELightElement.h"
#include "SVGFEDiffuseLightingElement.h"
namespace WebCore {
-SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_diffuseConstant(0.0)
+ , m_surfaceScale(0.0)
+ , m_lightingColor(new SVGColor())
+ , m_kernelUnitLengthX(0.0)
+ , m_kernelUnitLengthY(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEDiffuseLightingElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedNumber *SVGFEDiffuseLightingElement::diffuseConstant() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_diffuseConstant, dummy);
-}
-
-SVGAnimatedNumber *SVGFEDiffuseLightingElement::surfaceScale() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_surfaceScale, dummy);
-}
-
-SVGAnimatedNumber *SVGFEDiffuseLightingElement::kernelUnitLengthX() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_kernelUnitLengthX, dummy);
-}
-
-SVGAnimatedNumber *SVGFEDiffuseLightingElement::kernelUnitLengthY() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_kernelUnitLengthY, dummy);
-}
-
-SVGAnimatedColor *SVGFEDiffuseLightingElement::lightingColor() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedColor>(m_lightingColor, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, double, Number, number, DiffuseConstant, diffuseConstant, SVGNames::diffuseConstantAttr.localName(), m_diffuseConstant)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, double, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr.localName(), m_surfaceScale)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, double, Number, number, KernelUnitLengthX, kernelUnitLengthX, "kernelUnitLengthX", m_kernelUnitLengthX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, double, Number, number, KernelUnitLengthY, kernelUnitLengthY, "kernelUnitLengthY", m_kernelUnitLengthY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, SVGColor*, Color, color, LightingColor, lightingColor, SVGNames::lighting_colorAttr.localName(), m_lightingColor.get())
void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::surfaceScaleAttr)
- surfaceScale()->setBaseVal(value.deprecatedString().toDouble());
+ setSurfaceScaleBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::diffuseConstantAttr)
- diffuseConstant()->setBaseVal(value.toInt());
+ setDiffuseConstantBaseValue(value.toInt());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
- kernelUnitLengthX()->setBaseVal(numbers[0].toDouble());
+ setKernelUnitLengthXBaseValue(numbers[0].toDouble());
if (numbers.count() == 1)
- kernelUnitLengthY()->setBaseVal(numbers[0].toDouble());
+ setKernelUnitLengthYBaseValue(numbers[0].toDouble());
else
- kernelUnitLengthY()->setBaseVal(numbers[1].toDouble());
+ setKernelUnitLengthYBaseValue(numbers[1].toDouble());
} else if (attr->name() == SVGNames::lighting_colorAttr)
- lightingColor()->setBaseVal(new SVGColor(value.impl()));
+ setLightingColorBaseValue(new SVGColor(value.impl()));
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
{
if (!m_filterEffect)
m_filterEffect = static_cast<KCanvasFEDiffuseLighting *>(renderingDevice()->createFilterEffect(FE_DIFFUSE_LIGHTING));
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
- m_filterEffect->setDiffuseConstant((diffuseConstant()->baseVal()));
- m_filterEffect->setSurfaceScale((surfaceScale()->baseVal()));
- m_filterEffect->setKernelUnitLengthX((kernelUnitLengthX()->baseVal()));
- m_filterEffect->setKernelUnitLengthY((kernelUnitLengthY()->baseVal()));
- m_filterEffect->setLightingColor(lightingColor()->baseVal()->color());
+ m_filterEffect->setDiffuseConstant((diffuseConstantBaseValue()));
+ m_filterEffect->setSurfaceScale((surfaceScaleBaseValue()));
+ m_filterEffect->setKernelUnitLengthX((kernelUnitLengthXBaseValue()));
+ m_filterEffect->setKernelUnitLengthY((kernelUnitLengthYBaseValue()));
+ m_filterEffect->setLightingColor(lightingColorBaseValue()->color());
updateLights();
return m_filterEffect;
}
namespace WebCore {
class KCanvasFEDiffuseLighting;
- class SVGAnimatedNumber;
- class SVGAnimatedString;
- class SVGAnimatedColor;
+ class SVGColor;
class SVGFEDiffuseLightingElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEDiffuseLightingElement();
// 'SVGFEDiffuseLightingElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedNumber *diffuseConstant() const;
- SVGAnimatedNumber *surfaceScale() const;
- SVGAnimatedNumber *kernelUnitLengthX() const;
- SVGAnimatedNumber *kernelUnitLengthY() const;
- SVGAnimatedColor *lightingColor() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEDiffuseLighting *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedNumber> m_diffuseConstant;
- mutable RefPtr<SVGAnimatedNumber> m_surfaceScale;
- mutable RefPtr<SVGAnimatedColor> m_lightingColor;
- mutable RefPtr<SVGAnimatedNumber> m_kernelUnitLengthX;
- mutable RefPtr<SVGAnimatedNumber> m_kernelUnitLengthY;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, DiffuseConstant, diffuseConstant)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, SurfaceScale, surfaceScale)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGColor*, RefPtr<SVGColor>, LightingColor, lightingColor)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, KernelUnitLengthX, kernelUnitLengthX)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, KernelUnitLengthY, kernelUnitLengthY)
//need other properties here...
mutable KCanvasFEDiffuseLighting *m_filterEffect;
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFEDisplacementMapElement.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedNumber.h"
using namespace WebCore;
-SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document* doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document* doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_xChannelSelector(0)
+ , m_yChannelSelector(0)
+ , m_scale(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString* SVGFEDisplacementMapElement::in1() const
-{
- SVGStyledElement* dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedString* SVGFEDisplacementMapElement::in2() const
-{
- SVGStyledElement* dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in2, dummy);
-}
-
-SVGAnimatedEnumeration* SVGFEDisplacementMapElement::xChannelSelector() const
-{
- SVGStyledElement* dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_xChannelSelector, dummy);
-}
-
-SVGAnimatedEnumeration* SVGFEDisplacementMapElement::yChannelSelector() const
-{
- SVGStyledElement* dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_yChannelSelector, dummy);
-}
-
-SVGAnimatedNumber* SVGFEDisplacementMapElement::scale() const
-{
- SVGStyledElement* dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_scale, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, XChannelSelector, xChannelSelector, SVGNames::xChannelSelectorAttr.localName(), m_xChannelSelector)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, YChannelSelector, yChannelSelector, SVGNames::yChannelSelectorAttr.localName(), m_yChannelSelector)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, double, Number, number, Scale, scale, SVGNames::scaleAttr.localName(), m_scale)
KCChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& key)
{
{
const String& value = attr->value();
if (attr->name() == SVGNames::xChannelSelectorAttr)
- xChannelSelector()->setBaseVal(stringToChannel(value));
+ setXChannelSelectorBaseValue(stringToChannel(value));
else if (attr->name() == SVGNames::yChannelSelectorAttr)
- yChannelSelector()->setBaseVal(stringToChannel(value));
+ setYChannelSelectorBaseValue(stringToChannel(value));
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::in2Attr)
- in2()->setBaseVal(value.impl());
+ setIn2BaseValue(value.impl());
else if (attr->name() == SVGNames::scaleAttr)
- scale()->setBaseVal(value.deprecatedString().toDouble());
+ setScaleBaseValue(value.deprecatedString().toDouble());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEDisplacementMap *>(renderingDevice()->createFilterEffect(FE_DISPLACEMENT_MAP));
if (!m_filterEffect)
return 0;
- m_filterEffect->setXChannelSelector((KCChannelSelectorType)(xChannelSelector()->baseVal()));
- m_filterEffect->setYChannelSelector((KCChannelSelectorType)(yChannelSelector()->baseVal()));
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
- m_filterEffect->setIn2(String(in2()->baseVal()).deprecatedString());
- m_filterEffect->setScale(scale()->baseVal());
+ m_filterEffect->setXChannelSelector((KCChannelSelectorType)(xChannelSelectorBaseValue()));
+ m_filterEffect->setYChannelSelector((KCChannelSelectorType)(yChannelSelectorBaseValue()));
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
+ m_filterEffect->setIn2(String(in2BaseValue()).deprecatedString());
+ m_filterEffect->setScale(scaleBaseValue());
setStandardAttributes(m_filterEffect);
return m_filterEffect;
}
#include "KCanvasFilters.h"
namespace WebCore {
- class SVGAnimatedNumber;
- class SVGAnimatedString;
- class SVGAnimatedEnumeration;
class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
public:
virtual ~SVGFEDisplacementMapElement();
// 'SVGFEDisplacementMapElement' functions
- SVGAnimatedString* in1() const;
- SVGAnimatedString* in2() const;
- SVGAnimatedEnumeration* xChannelSelector() const;
- SVGAnimatedEnumeration* yChannelSelector() const;
- SVGAnimatedNumber* scale() const;
-
static KCChannelSelectorType stringToChannel(const String&);
// Derived from: 'Element'
virtual KCanvasFEDisplacementMap* filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedString> m_in2;
- mutable RefPtr<SVGAnimatedEnumeration> m_xChannelSelector;
- mutable RefPtr<SVGAnimatedEnumeration> m_yChannelSelector;
- mutable RefPtr<SVGAnimatedNumber> m_scale;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In2, in2)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, XChannelSelector, xChannelSelector)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, YChannelSelector, yChannelSelector)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Scale, scale)
mutable KCanvasFEDisplacementMap* m_filterEffect;
};
#ifdef SVG_SUPPORT
#include "SVGFEDistantLightElement.h"
-#include "SVGAnimatedNumber.h"
namespace WebCore {
KCLightSource *SVGFEDistantLightElement::lightSource() const
{
- return new KCDistantLightSource(azimuth()->baseVal(), elevation()->baseVal());
+ return new KCDistantLightSource(azimuthBaseValue(), elevationBaseValue());
}
}
#include "Attr.h"
#include "DeprecatedStringList.h"
#include "RenderView.h"
-#include "SVGAnimatedString.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include "SVGRenderStyle.h"
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEFloodElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEFloodElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
void SVGFEFloodElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEFlood *>(renderingDevice()->createFilterEffect(FE_FLOOD));
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
RenderStyle *filterStyle = const_cast<SVGFEFloodElement *>(this)->styleForRenderer(parentNode()->renderer());
const SVGRenderStyle *svgStyle = filterStyle->svgStyle();
namespace WebCore
{
- class SVGAnimatedString;
class SVGFEFloodElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEFloodElement();
// 'SVGFEFloodElement' functions
- SVGAnimatedString *in1() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEFlood *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
mutable KCanvasFEFlood *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFEGaussianBlurElement.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
-SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_stdDeviationX(0.0)
+ , m_stdDeviationY(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEGaussianBlurElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedNumber *SVGFEGaussianBlurElement::stdDeviationX() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_stdDeviationX, dummy);
-}
-
-SVGAnimatedNumber *SVGFEGaussianBlurElement::stdDeviationY() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_stdDeviationY, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, double, Number, number, StdDeviationX, stdDeviationX, "stdDeviationX", m_stdDeviationX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, double, Number, number, StdDeviationY, stdDeviationY, "stdDeviationY", m_stdDeviationY)
void SVGFEGaussianBlurElement::setStdDeviation(float stdDeviationX, float stdDeviationY)
{
const String& value = attr->value();
if (attr->name() == SVGNames::stdDeviationAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
- stdDeviationX()->setBaseVal(numbers[0].toDouble());
+ setStdDeviationXBaseValue(numbers[0].toDouble());
if(numbers.count() == 1)
- stdDeviationY()->setBaseVal(numbers[0].toDouble());
+ setStdDeviationYBaseValue(numbers[0].toDouble());
else
- stdDeviationY()->setBaseVal(numbers[1].toDouble());
+ setStdDeviationYBaseValue(numbers[1].toDouble());
}
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEGaussianBlur *>(renderingDevice()->createFilterEffect(FE_GAUSSIAN_BLUR));
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
- m_filterEffect->setStdDeviationX(stdDeviationX()->baseVal());
- m_filterEffect->setStdDeviationY(stdDeviationY()->baseVal());
+ m_filterEffect->setStdDeviationX(stdDeviationXBaseValue());
+ m_filterEffect->setStdDeviationY(stdDeviationYBaseValue());
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
- class SVGAnimatedNumber;
class SVGFEGaussianBlurElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEGaussianBlurElement();
// 'SVGFEGaussianBlurElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedNumber *stdDeviationX() const;
- SVGAnimatedNumber *stdDeviationY() const;
-
void setStdDeviation(float stdDeviationX, float stdDeviationY);
// Derived from: 'Element'
virtual KCanvasFEGaussianBlur *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedNumber> m_stdDeviationX;
- mutable RefPtr<SVGAnimatedNumber> m_stdDeviationY;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, StdDeviationX, stdDeviationX)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, StdDeviationY, stdDeviationY)
mutable KCanvasFEGaussianBlur *m_filterEffect;
};
#include "Document.h"
#include "KCanvasRenderingStyle.h"
#include "KCanvasRenderingStyle.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedString.h"
+#include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include <kcanvas/KCanvasImage.h>
using namespace WebCore;
SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document *doc)
-: SVGFilterPrimitiveStandardAttributes(tagName, doc), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , SVGURIReference()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_preserveAspectRatio(new SVGPreserveAspectRatio(this))
{
m_filterEffect = 0;
m_cachedImage = 0;
m_cachedImage->deref(this);
}
-SVGAnimatedPreserveAspectRatio *SVGFEImageElement::preserveAspectRatio() const
-{
- return lazy_create<SVGAnimatedPreserveAspectRatio>(m_preserveAspectRatio, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
void SVGFEImageElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::preserveAspectRatioAttr)
- preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.impl());
+ preserveAspectRatioBaseValue()->parsePreserveAspectRatio(value.impl());
else
{
if (SVGURIReference::parseMappedAttribute(attr)) {
if (m_cachedImage)
m_cachedImage->deref(this);
- m_cachedImage = ownerDocument()->docLoader()->requestImage(href()->baseVal());
+ m_cachedImage = ownerDocument()->docLoader()->requestImage(hrefBaseValue());
if (m_cachedImage)
m_cachedImage->ref(this);
return;
#include "KCanvasFilters.h"
namespace WebCore {
- class SVGAnimatedPreserveAspectRatio;
+ class SVGPreserveAspectRatio;
class SVGFEImageElement : public SVGFilterPrimitiveStandardAttributes,
public SVGURIReference,
virtual ~SVGFEImageElement();
// 'SVGFEImageElement' functions
- SVGAnimatedPreserveAspectRatio *preserveAspectRatio() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual void notifyFinished(CachedResource *finishedObj);
protected:
virtual KCanvasFEImage *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGPreserveAspectRatio*, RefPtr<SVGPreserveAspectRatio>, PreserveAspectRatio, preserveAspectRatio)
CachedImage *m_cachedImage;
mutable KCanvasFEImage *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFELightElement.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedEnumeration.h"
using namespace WebCore;
-SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document *doc) :
-SVGElement(tagName, doc)
+SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document *doc)
+ : SVGElement(tagName, doc)
+ , m_azimuth(0.0)
+ , m_elevation(0.0)
+ , m_x(0.0)
+ , m_y(0.0)
+ , m_z(0.0)
+ , m_pointsAtX(0.0)
+ , m_pointsAtY(0.0)
+ , m_pointsAtZ(0.0)
+ , m_specularExponent(0.0)
+ , m_limitingConeAngle(0.0)
{
}
{
}
-SVGAnimatedNumber *SVGFELightElement::azimuth() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_azimuth, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::elevation() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_elevation, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::x() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_x, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::y() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_y, dummy);
-}
-
-
-SVGAnimatedNumber *SVGFELightElement::z() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_z, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, Azimuth, azimuth, SVGNames::azimuthAttr.localName(), m_azimuth)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, Elevation, elevation, SVGNames::elevationAttr.localName(), m_elevation)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, X, x, SVGNames::xAttr.localName(), m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, Y, y, SVGNames::yAttr.localName(), m_y)
-SVGAnimatedNumber *SVGFELightElement::pointsAtX() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_pointsAtX, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::pointsAtY() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_pointsAtY, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::pointsAtZ() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_pointsAtZ, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::specularExponent() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_specularExponent, dummy);
-}
-
-SVGAnimatedNumber *SVGFELightElement::limitingConeAngle() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_limitingConeAngle, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, Z, z, SVGNames::zAttr.localName(), m_z)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, PointsAtX, pointsAtX, SVGNames::pointsAtXAttr.localName(), m_pointsAtX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, PointsAtY, pointsAtY, SVGNames::pointsAtYAttr.localName(), m_pointsAtY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, PointsAtZ, pointsAtZ, SVGNames::pointsAtZAttr.localName(), m_pointsAtZ)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr.localName(), m_specularExponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, double, Number, number, LimitingConeAngle, limitingConeAngle, SVGNames::limitingConeAngleAttr.localName(), m_limitingConeAngle)
void SVGFELightElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::azimuthAttr)
- azimuth()->setBaseVal(value.deprecatedString().toDouble());
+ setAzimuthBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::elevationAttr)
- elevation()->setBaseVal(value.deprecatedString().toDouble());
+ setElevationBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::xAttr)
- x()->setBaseVal(value.deprecatedString().toDouble());
+ setXBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::yAttr)
- y()->setBaseVal(value.deprecatedString().toDouble());
+ setYBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::zAttr)
- z()->setBaseVal(value.deprecatedString().toDouble());
+ setZBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::pointsAtXAttr)
- pointsAtX()->setBaseVal(value.deprecatedString().toDouble());
+ setPointsAtXBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::pointsAtYAttr)
- pointsAtY()->setBaseVal(value.deprecatedString().toDouble());
+ setPointsAtYBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::pointsAtZAttr)
- pointsAtZ()->setBaseVal(value.deprecatedString().toDouble());
+ setPointsAtZBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::specularExponentAttr)
- specularExponent()->setBaseVal(value.deprecatedString().toDouble());
+ setSpecularExponentBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::limitingConeAngleAttr)
- limitingConeAngle()->setBaseVal(value.deprecatedString().toDouble());
+ setLimitingConeAngleBaseValue(value.deprecatedString().toDouble());
else
SVGElement::parseMappedAttribute(attr);
}
namespace WebCore
{
- class SVGAnimatedNumber;
- class SVGAnimatedNumberList;
- class SVGAnimatedEnumeration;
+ class SVGNumberList;
class SVGFELightElement : public SVGElement
{
virtual ~SVGFELightElement();
// 'SVGComponentTransferFunctionElement' functions
- SVGAnimatedNumber *azimuth() const;
- SVGAnimatedNumber *elevation() const;
- SVGAnimatedNumber *x() const;
- SVGAnimatedNumber *y() const;
- SVGAnimatedNumber *z() const;
- SVGAnimatedNumber *pointsAtX() const;
- SVGAnimatedNumber *pointsAtY() const;
- SVGAnimatedNumber *pointsAtZ() const;
- SVGAnimatedNumber *specularExponent() const;
- SVGAnimatedNumber *limitingConeAngle() const;
-
virtual KCLightSource *lightSource() const = 0;
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
private:
- mutable RefPtr<SVGAnimatedNumber> m_azimuth;
- mutable RefPtr<SVGAnimatedNumber> m_elevation;
- mutable RefPtr<SVGAnimatedNumber> m_x;
- mutable RefPtr<SVGAnimatedNumber> m_y;
- mutable RefPtr<SVGAnimatedNumber> m_z;
- mutable RefPtr<SVGAnimatedNumber> m_pointsAtX;
- mutable RefPtr<SVGAnimatedNumber> m_pointsAtY;
- mutable RefPtr<SVGAnimatedNumber> m_pointsAtZ;
- mutable RefPtr<SVGAnimatedNumber> m_specularExponent;
- mutable RefPtr<SVGAnimatedNumber> m_limitingConeAngle;
-
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Azimuth, azimuth)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Elevation, elevation)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Z, z)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, PointsAtX, pointsAtX)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, PointsAtY, pointsAtY)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, PointsAtZ, pointsAtZ)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, SpecularExponent, specularExponent)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, LimitingConeAngle, limitingConeAngle)
};
} // namespace WebCore
#include "SVGRenderStyle.h"
#include "SVGFEMergeElement.h"
#include "SVGFEMergeNodeElement.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
-SVGFEMergeElement::SVGFEMergeElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEMergeElement::SVGFEMergeElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
{
m_filterEffect = 0;
}
{
if(n->hasTagName(SVGNames::feMergeNodeTag))
{
- String mergeInput = static_cast<SVGFEMergeNodeElement *>(n)->in1()->baseVal();
+ String mergeInput = static_cast<SVGFEMergeNodeElement *>(n)->inBaseValue();
mergeInputs.append(mergeInput.deprecatedString());
}
}
virtual KCanvasFEMerge *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
mutable KCanvasFEMerge *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGFEMergeNodeElement.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
{
}
-SVGAnimatedString *SVGFEMergeNodeElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEMergeNodeElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
void SVGFEMergeNodeElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGElement::parseMappedAttribute(attr);
}
namespace WebCore
{
- class SVGAnimatedString;
class SVGFEMergeNodeElement : public SVGElement
{
public:
virtual void parseMappedAttribute(MappedAttribute *attr);
// 'SVGFEMergeNodeElement' functions
- SVGAnimatedString *in1() const;
+
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
};
} // namespace WebCore
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFEOffsetElement.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
-SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_dx(0.0)
+ , m_dy(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFEOffsetElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedNumber *SVGFEOffsetElement::dx() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_dx, dummy);
-}
-
-SVGAnimatedNumber *SVGFEOffsetElement::dy() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_dy, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, double, Number, number, Dx, dx, SVGNames::dxAttr.localName(), m_dx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, double, Number, number, Dy, dy, SVGNames::dyAttr.localName(), m_dy)
void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::dxAttr)
- dx()->setBaseVal(value.deprecatedString().toDouble());
+ setDxBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::dyAttr)
- dy()->setBaseVal(value.deprecatedString().toDouble());
+ setDyBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFEOffset *>(renderingDevice()->createFilterEffect(FE_OFFSET));
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
- m_filterEffect->setDx(dx()->baseVal());
- m_filterEffect->setDy(dy()->baseVal());
+ m_filterEffect->setDx(dxBaseValue());
+ m_filterEffect->setDy(dyBaseValue());
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
- class SVGAnimatedNumber;
class SVGFEOffsetElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFEOffsetElement();
// 'SVGFEOffsetElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedNumber *dx() const;
- SVGAnimatedNumber *dy() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFEOffset *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedNumber> m_dx;
- mutable RefPtr<SVGAnimatedNumber> m_dy;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Dx, dx)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Dy, dy)
mutable KCanvasFEOffset *m_filterEffect;
};
#ifdef SVG_SUPPORT
#include "SVGFEPointLightElement.h"
-#include "SVGAnimatedNumber.h"
namespace WebCore {
KCLightSource *SVGFEPointLightElement::lightSource() const
{
- KCanvasPoint3F pos(x()->baseVal(), y()->baseVal(), z()->baseVal());
+ KCanvasPoint3F pos(xBaseValue(), yBaseValue(), zBaseValue());
return new KCPointLightSource(pos);
}
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
-#include "SVGAnimatedColor.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedString.h"
+#include "SVGColor.h"
#include "SVGFELightElement.h"
#include "SVGFESpecularLightingElement.h"
using namespace WebCore;
-SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_specularConstant(0.0)
+ , m_specularExponent(0.0)
+ , m_surfaceScale(0.0)
+ , m_lightingColor(new SVGColor())
+ , m_kernelUnitLengthX(0.0)
+ , m_kernelUnitLengthY(0.0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedString *SVGFESpecularLightingElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
-
-SVGAnimatedNumber *SVGFESpecularLightingElement::specularConstant() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_specularConstant, dummy);
-}
-
-SVGAnimatedNumber *SVGFESpecularLightingElement::specularExponent() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_specularExponent, dummy);
-}
-
-SVGAnimatedNumber *SVGFESpecularLightingElement::surfaceScale() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_surfaceScale, dummy);
-}
-
-SVGAnimatedNumber *SVGFESpecularLightingElement::kernelUnitLengthX() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_kernelUnitLengthX, dummy);
-}
-
-SVGAnimatedNumber *SVGFESpecularLightingElement::kernelUnitLengthY() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_kernelUnitLengthY, dummy);
-}
-
-SVGAnimatedColor *SVGFESpecularLightingElement::lightingColor() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedColor>(m_lightingColor, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, double, Number, number, SpecularConstant, specularConstant, SVGNames::specularConstantAttr.localName(), m_specularConstant)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, double, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr.localName(), m_specularExponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, double, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr.localName(), m_surfaceScale)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, double, Number, number, KernelUnitLengthX, kernelUnitLengthX, "kernelUnitLengthX", m_kernelUnitLengthX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, double, Number, number, KernelUnitLengthY, kernelUnitLengthY, "kernelUnitLengthY", m_kernelUnitLengthY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, SVGColor*, Color, color, LightingColor, lightingColor, SVGNames::lighting_colorAttr.localName(), m_lightingColor.get())
void SVGFESpecularLightingElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else if (attr->name() == SVGNames::surfaceScaleAttr)
- surfaceScale()->setBaseVal(value.deprecatedString().toDouble());
+ setSurfaceScaleBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::specularConstantAttr)
- specularConstant()->setBaseVal(value.deprecatedString().toDouble());
+ setSpecularConstantBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::specularExponentAttr)
- specularExponent()->setBaseVal(value.deprecatedString().toDouble());
+ setSpecularExponentBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
- kernelUnitLengthX()->setBaseVal(numbers[0].toDouble());
+ setKernelUnitLengthXBaseValue(numbers[0].toDouble());
if (numbers.count() == 1)
- kernelUnitLengthY()->setBaseVal(numbers[0].toDouble());
+ setKernelUnitLengthYBaseValue(numbers[0].toDouble());
else
- kernelUnitLengthY()->setBaseVal(numbers[1].toDouble());
+ setKernelUnitLengthYBaseValue(numbers[1].toDouble());
} else if (attr->name() == SVGNames::lighting_colorAttr)
- lightingColor()->setBaseVal(new SVGColor(value.impl()));
+ setLightingColorBaseValue(new SVGColor(value.impl()));
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
{
if (!m_filterEffect)
m_filterEffect = static_cast<KCanvasFESpecularLighting *>(renderingDevice()->createFilterEffect(FE_SPECULAR_LIGHTING));
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
- m_filterEffect->setSpecularConstant((specularConstant()->baseVal()));
- m_filterEffect->setSpecularExponent((specularExponent()->baseVal()));
- m_filterEffect->setSurfaceScale((surfaceScale()->baseVal()));
- m_filterEffect->setKernelUnitLengthX((kernelUnitLengthX()->baseVal()));
- m_filterEffect->setKernelUnitLengthY((kernelUnitLengthY()->baseVal()));
- m_filterEffect->setLightingColor(lightingColor()->baseVal()->color());
+ m_filterEffect->setSpecularConstant((specularConstantBaseValue()));
+ m_filterEffect->setSpecularExponent((specularExponentBaseValue()));
+ m_filterEffect->setSurfaceScale((surfaceScaleBaseValue()));
+ m_filterEffect->setKernelUnitLengthX((kernelUnitLengthXBaseValue()));
+ m_filterEffect->setKernelUnitLengthY((kernelUnitLengthYBaseValue()));
+ m_filterEffect->setLightingColor(lightingColorBaseValue()->color());
updateLights();
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedNumber;
- class SVGAnimatedString;
- class SVGAnimatedColor;
+ class SVGColor;
class SVGFESpecularLightingElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFESpecularLightingElement();
// 'SVGFEDiffuseLightingElement' functions
- SVGAnimatedString *in1() const;
- SVGAnimatedNumber *specularConstant() const;
- SVGAnimatedNumber *specularExponent() const;
- SVGAnimatedNumber *surfaceScale() const;
- SVGAnimatedNumber *kernelUnitLengthX() const;
- SVGAnimatedNumber *kernelUnitLengthY() const;
- SVGAnimatedColor *lightingColor() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFESpecularLighting *filterEffect() const;
+
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
- mutable RefPtr<SVGAnimatedNumber> m_specularConstant;
- mutable RefPtr<SVGAnimatedNumber> m_specularExponent;
- mutable RefPtr<SVGAnimatedNumber> m_surfaceScale;
- mutable RefPtr<SVGAnimatedColor> m_lightingColor;
- mutable RefPtr<SVGAnimatedNumber> m_kernelUnitLengthX;
- mutable RefPtr<SVGAnimatedNumber> m_kernelUnitLengthY;
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, SpecularConstant, specularConstant)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, SpecularExponent, specularExponent)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, SurfaceScale, surfaceScale)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGColor*, RefPtr<SVGColor>, LightingColor, lightingColor)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, KernelUnitLengthX, kernelUnitLengthX)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, KernelUnitLengthY, kernelUnitLengthY)
//need other properties here...
mutable KCanvasFESpecularLighting *m_filterEffect;
#ifdef SVG_SUPPORT
#include "SVGFESpotLightElement.h"
-#include "SVGAnimatedNumber.h"
namespace WebCore {
KCLightSource *SVGFESpotLightElement::lightSource() const
{
- KCanvasPoint3F pos(x()->baseVal(), y()->baseVal(), z()->baseVal());
+ KCanvasPoint3F pos(xBaseValue(), yBaseValue(), zBaseValue());
//convert lookAt to a direction
- KCanvasPoint3F direction(pointsAtX()->baseVal() - pos.x(),
- pointsAtY()->baseVal() - pos.y(),
- pointsAtZ()->baseVal() - pos.z());
+ KCanvasPoint3F direction(pointsAtXBaseValue() - pos.x(),
+ pointsAtYBaseValue() - pos.y(),
+ pointsAtZBaseValue() - pos.z());
direction.normalize();
- return new KCSpotLightSource(pos, direction, specularExponent()->baseVal(), limitingConeAngle()->baseVal());
+ return new KCSpotLightSource(pos, direction, specularExponentBaseValue(), limitingConeAngleBaseValue());
}
}
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFETileElement.h"
-#include "SVGAnimatedString.h"
using namespace WebCore;
delete m_filterEffect;
}
-SVGAnimatedString *SVGFETileElement::in1() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedString>(m_in1, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETileElement, String, String, string, In, in, SVGNames::inAttr.localName(), m_in)
void SVGFETileElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
- in1()->setBaseVal(value.impl());
+ setInBaseValue(value.impl());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
m_filterEffect = static_cast<KCanvasFETile *>(renderingDevice()->createFilterEffect(FE_TILE));
if (!m_filterEffect)
return 0;
- m_filterEffect->setIn(String(in1()->baseVal()).deprecatedString());
+ m_filterEffect->setIn(String(inBaseValue()).deprecatedString());
setStandardAttributes(m_filterEffect);
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedString;
class SVGFETileElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFETileElement();
// 'SVGFETileElement' functions
- SVGAnimatedString *in1() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFETile *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedString> m_in1;
+
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, In, in)
mutable KCanvasFETile *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFETurbulenceElement.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedInteger.h"
using namespace WebCore;
-SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document *doc) :
-SVGFilterPrimitiveStandardAttributes(tagName, doc)
+SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document *doc)
+ : SVGFilterPrimitiveStandardAttributes(tagName, doc)
+ , m_baseFrequencyX(0.0)
+ , m_baseFrequencyY(0.0)
+ , m_numOctaves(0)
+ , m_seed(0.0)
+ , m_stitchTiles(0)
+ , m_type(0)
{
m_filterEffect = 0;
}
delete m_filterEffect;
}
-SVGAnimatedNumber *SVGFETurbulenceElement::baseFrequencyX() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_baseFrequencyX, dummy);
-}
-
-SVGAnimatedNumber *SVGFETurbulenceElement::baseFrequencyY() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_baseFrequencyY, dummy);
-}
-
-SVGAnimatedNumber *SVGFETurbulenceElement::seed() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedNumber>(m_seed, dummy);
-}
-
-SVGAnimatedInteger *SVGFETurbulenceElement::numOctaves() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedInteger>(m_numOctaves, dummy);
-}
-
-SVGAnimatedEnumeration *SVGFETurbulenceElement::stitchTiles() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_stitchTiles, dummy);
-}
-
-SVGAnimatedEnumeration *SVGFETurbulenceElement::type() const
-{
- SVGStyledElement *dummy = 0;
- return lazy_create<SVGAnimatedEnumeration>(m_type, dummy);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, double, Number, number, BaseFrequencyX, baseFrequencyX, "baseFrequencyX", m_baseFrequencyX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, double, Number, number, BaseFrequencyY, baseFrequencyY, "baseFrequencyY", m_baseFrequencyY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, double, Number, number, Seed, seed, SVGNames::seedAttr.localName(), m_seed)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Integer, integer, NumOctaves, numOctaves, SVGNames::numOctavesAttr.localName(), m_numOctaves)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, StitchTiles, stitchTiles, SVGNames::stitchTilesAttr.localName(), m_stitchTiles)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::typeAttr)
{
if(value == "fractalNoise")
- type()->setBaseVal(SVG_TURBULENCE_TYPE_FRACTALNOISE);
+ setTypeBaseValue(SVG_TURBULENCE_TYPE_FRACTALNOISE);
else if(value == "turbulence")
- type()->setBaseVal(SVG_TURBULENCE_TYPE_TURBULENCE);
+ setTypeBaseValue(SVG_TURBULENCE_TYPE_TURBULENCE);
}
else if (attr->name() == SVGNames::stitchTilesAttr)
{
if(value == "stitch")
- stitchTiles()->setBaseVal(SVG_STITCHTYPE_STITCH);
+ setStitchTilesBaseValue(SVG_STITCHTYPE_STITCH);
else if(value == "nostitch")
- stitchTiles()->setBaseVal(SVG_STITCHTYPE_NOSTITCH);
+ setStitchTilesBaseValue(SVG_STITCHTYPE_NOSTITCH);
}
else if (attr->name() == SVGNames::baseFrequencyAttr)
{
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
- baseFrequencyX()->setBaseVal(numbers[0].toDouble());
+ setBaseFrequencyXBaseValue(numbers[0].toDouble());
if(numbers.count() == 1)
- baseFrequencyY()->setBaseVal(numbers[0].toDouble());
+ setBaseFrequencyYBaseValue(numbers[0].toDouble());
else
- baseFrequencyY()->setBaseVal(numbers[1].toDouble());
+ setBaseFrequencyYBaseValue(numbers[1].toDouble());
}
else if (attr->name() == SVGNames::seedAttr)
- seed()->setBaseVal(value.deprecatedString().toDouble());
+ setSeedBaseValue(value.deprecatedString().toDouble());
else if (attr->name() == SVGNames::numOctavesAttr)
- numOctaves()->setBaseVal(value.deprecatedString().toUInt());
+ setNumOctavesBaseValue(value.deprecatedString().toUInt());
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
if (!m_filterEffect)
return 0;
- m_filterEffect->setType((KCTurbulanceType)(type()->baseVal() - 1));
+ m_filterEffect->setType((KCTurbulanceType)(typeBaseValue() - 1));
setStandardAttributes(m_filterEffect);
- m_filterEffect->setBaseFrequencyX(baseFrequencyX()->baseVal());
- m_filterEffect->setBaseFrequencyY(baseFrequencyY()->baseVal());
- m_filterEffect->setNumOctaves(numOctaves()->baseVal());
- m_filterEffect->setSeed(seed()->baseVal());
- m_filterEffect->setStitchTiles(stitchTiles()->baseVal() == SVG_STITCHTYPE_STITCH);
+ m_filterEffect->setBaseFrequencyX(baseFrequencyXBaseValue());
+ m_filterEffect->setBaseFrequencyY(baseFrequencyYBaseValue());
+ m_filterEffect->setNumOctaves(numOctavesBaseValue());
+ m_filterEffect->setSeed(seedBaseValue());
+ m_filterEffect->setStitchTiles(stitchTilesBaseValue() == SVG_STITCHTYPE_STITCH);
return m_filterEffect;
}
namespace WebCore
{
- class SVGAnimatedInteger;
- class SVGAnimatedNumber;
- class SVGAnimatedEnumeration;
class SVGFETurbulenceElement : public SVGFilterPrimitiveStandardAttributes
{
virtual ~SVGFETurbulenceElement();
// 'SVGFETurbulenceElement' functions
- SVGAnimatedNumber *baseFrequencyX() const;
- SVGAnimatedNumber *baseFrequencyY() const;
- SVGAnimatedInteger *numOctaves() const;
- SVGAnimatedNumber *seed() const;
- SVGAnimatedEnumeration *stitchTiles() const;
- SVGAnimatedEnumeration *type() const;
-
// Derived from: 'Element'
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFETurbulence *filterEffect() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedNumber> m_baseFrequencyX;
- mutable RefPtr<SVGAnimatedNumber> m_baseFrequencyY;
- mutable RefPtr<SVGAnimatedInteger> m_numOctaves;
- mutable RefPtr<SVGAnimatedNumber> m_seed;
- mutable RefPtr<SVGAnimatedEnumeration> m_stitchTiles;
- mutable RefPtr<SVGAnimatedEnumeration> m_type;
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, BaseFrequencyX, baseFrequencyX)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, BaseFrequencyY, baseFrequencyY)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, NumOctaves, numOctaves)
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Seed, seed)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, StitchTiles, stitchTiles)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, Type, type)
mutable KCanvasFETurbulence *m_filterEffect;
};
#include "SVGHelper.h"
#include "SVGFilterElement.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedInteger.h"
+#include "SVGLength.h"
#include "KCanvasRenderingStyle.h"
using namespace WebCore;
SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledElement(tagName, doc), SVGURIReference(), SVGLangSpace(), SVGExternalResourcesRequired()
-{
- m_filter = 0;
-}
-
-SVGFilterElement::~SVGFilterElement()
-{
- delete m_filter;
-}
-
-SVGAnimatedEnumeration *SVGFilterElement::filterUnits() const
-{
- if (!m_filterUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_filterUnits, this);
- m_filterUnits->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
- }
-
- return m_filterUnits.get();
-}
-
-SVGAnimatedEnumeration *SVGFilterElement::primitiveUnits() const
-{
- if (!m_primitiveUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_primitiveUnits, this);
- m_primitiveUnits->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
- }
-
- return m_primitiveUnits.get();
-}
-
-SVGAnimatedLength *SVGFilterElement::x() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "-10%" were specified.
- if (!m_x) {
- lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
- m_x->baseVal()->setValueAsString(String("-10%").impl());
- }
+ : SVGStyledElement(tagName, doc)
+ , SVGURIReference()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_filterUnits(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ , m_primitiveUnits(SVG_UNIT_TYPE_USERSPACEONUSE)
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_filterResX(0)
+ , m_filterResY(0)
- return m_x.get();
-}
-
-SVGAnimatedLength *SVGFilterElement::y() const
{
- // Spec : If the attribute is not specified, the effect is as if a value of "-10%" were specified.
- if (!m_y) {
- lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
- m_y->baseVal()->setValueAsString(String("-10%").impl());
- }
+ // Spec: If the attribute is not specified, the effect is as if a value of "-10%" were specified.
+ m_x->setValueAsString("-10%");
+ m_y->setValueAsString("-10%");
- return m_y.get();
-}
+ // Spec: If the attribute is not specified, the effect is as if a value of "120%" were specified.
+ m_width->setValueAsString("120%");
+ m_height->setValueAsString("120%");
-SVGAnimatedLength *SVGFilterElement::width() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "120%" were specified.
- if (!m_width) {
- lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
- m_width->baseVal()->setValueAsString(String("120%").impl());
- }
-
- return m_width.get();
-}
-
-SVGAnimatedLength *SVGFilterElement::height() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "120%" were specified.
- if (!m_height) {
- lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
- m_height->baseVal()->setValueAsString(String("120%").impl());
- }
-
- return m_height.get();
+ m_filter = 0;
}
-SVGAnimatedInteger *SVGFilterElement::filterResX() const
+SVGFilterElement::~SVGFilterElement()
{
- return lazy_create<SVGAnimatedInteger>(m_filterResX, this);
+ delete m_filter;
}
-SVGAnimatedInteger *SVGFilterElement::filterResY() const
-{
- return lazy_create<SVGAnimatedInteger>(m_filterResY, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, FilterUnits, filterUnits, SVGNames::filterUnitsAttr.localName(), m_filterUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, PrimitiveUnits, primitiveUnits, SVGNames::primitiveUnitsAttr.localName(), m_primitiveUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Integer, integer, FilterResX, filterResX, "filterResX", m_filterResX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Integer, integer, FilterResY, filterResY, "filterResY", m_filterResY)
void SVGFilterElement::setFilterRes(unsigned long, unsigned long) const
{
if (attr->name() == SVGNames::filterUnitsAttr)
{
if(value == "userSpaceOnUse")
- filterUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setFilterUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if(value == "objectBoundingBox")
- filterUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setFilterUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
else if (attr->name() == SVGNames::primitiveUnitsAttr)
{
if(value == "userSpaceOnUse")
- primitiveUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setPrimitiveUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if(value == "objectBoundingBox")
- primitiveUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setPrimitiveUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
else if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr)
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::heightAttr)
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
else
{
if(SVGURIReference::parseMappedAttribute(attr)) return;
if (!m_filter)
m_filter = static_cast<KCanvasFilter *>(renderingDevice()->createResource(RS_FILTER));
- bool filterBBoxMode = filterUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ bool filterBBoxMode = filterUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
m_filter->setFilterBoundingBoxMode(filterBBoxMode);
- x()->baseVal()->setBboxRelative(filterBBoxMode);
- y()->baseVal()->setBboxRelative(filterBBoxMode);
- width()->baseVal()->setBboxRelative(filterBBoxMode);
- height()->baseVal()->setBboxRelative(filterBBoxMode);
- float _x = x()->baseVal()->value(), _y = y()->baseVal()->value();
- float _width = width()->baseVal()->value(), _height = height()->baseVal()->value();
+ xBaseValue()->setBboxRelative(filterBBoxMode);
+ yBaseValue()->setBboxRelative(filterBBoxMode);
+ widthBaseValue()->setBboxRelative(filterBBoxMode);
+ heightBaseValue()->setBboxRelative(filterBBoxMode);
+ float _x = xBaseValue()->value(), _y = yBaseValue()->value();
+ float _width = widthBaseValue()->value(), _height = heightBaseValue()->value();
m_filter->setFilterRect(FloatRect(_x, _y, _width, _height));
- bool primitiveBBoxMode = primitiveUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ bool primitiveBBoxMode = primitiveUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
m_filter->setEffectBoundingBoxMode(primitiveBBoxMode);
// FIXME: When does this info get passed to the filters elements?
#include "KCanvasFilters.h"
namespace WebCore {
- class SVGAnimatedEnumeration;
- class SVGAnimatedInteger;
- class SVGAnimatedLength;
+ class SVGLength;
class SVGFilterElement : public SVGStyledElement,
public SVGURIReference,
virtual KCanvasFilter *canvasResource();
// 'SVGFilterElement' functions
- SVGAnimatedEnumeration *filterUnits() const;
- SVGAnimatedEnumeration *primitiveUnits() const;
-
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
- SVGAnimatedInteger *filterResX() const;
- SVGAnimatedInteger *filterResY() const;
-
void setFilterRes(unsigned long filterResX, unsigned long filterResY) const;
virtual void parseMappedAttribute(MappedAttribute *attr);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedEnumeration> m_filterUnits;
- mutable RefPtr<SVGAnimatedEnumeration> m_primitiveUnits;
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
- mutable RefPtr<SVGAnimatedInteger> m_filterResX;
- mutable RefPtr<SVGAnimatedInteger> m_filterResY;
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, FilterUnits, filterUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, PrimitiveUnits, primitiveUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, FilterResX, filterResX)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, FilterResY, filterResY)
KCanvasFilter *m_filter;
};
#include "ksvg.h"
#include "SVGNames.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
#include "SVGStyledElement.h"
#include "SVGFilterElement.h"
using namespace WebCore;
SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document *doc)
-: SVGStyledElement(tagName, doc)
-{
-}
-
-SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes()
-{
-}
-
-SVGAnimatedLength *SVGFilterPrimitiveStandardAttributes::x() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH);
-}
-
-SVGAnimatedLength *SVGFilterPrimitiveStandardAttributes::y() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT);
-}
-
-SVGAnimatedLength *SVGFilterPrimitiveStandardAttributes::width() const
+ : SVGStyledElement(tagName, doc)
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
// Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
- if (!m_width) {
- lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH);
- m_width->baseVal()->setValueAsString(String("100%").impl());
- }
-
- return m_width.get();
+ m_width->setValueAsString("100%");
+ m_height->setValueAsString("100%");
}
-SVGAnimatedLength *SVGFilterPrimitiveStandardAttributes::height() const
+SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes()
{
- // Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
- if (!m_height) {
- lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT);
- m_height->baseVal()->setValueAsString(String("100%").impl());
- }
-
- return m_height.get();
}
-SVGAnimatedString *SVGFilterPrimitiveStandardAttributes::result() const
-{
- return lazy_create<SVGAnimatedString>(m_result, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, String, String, string, Result, result, SVGNames::resultAttr.localName(), m_result)
void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr)
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::heightAttr)
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::resultAttr)
- result()->setBaseVal(value.impl());
+ setResultBaseValue(value.impl());
else
return SVGStyledElement::parseMappedAttribute(attr);
}
return;
bool bbox = false;
if(parentNode() && parentNode()->hasTagName(SVGNames::filterTag))
- bbox = static_cast<SVGFilterElement *>(parentNode())->primitiveUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
-
- x()->baseVal()->setBboxRelative(bbox);
- y()->baseVal()->setBboxRelative(bbox);
- width()->baseVal()->setBboxRelative(bbox);
- height()->baseVal()->setBboxRelative(bbox);
- float _x = x()->baseVal()->value(), _y = y()->baseVal()->value();
- float _width = width()->baseVal()->value(), _height = height()->baseVal()->value();
+ bbox = static_cast<SVGFilterElement *>(parentNode())->primitiveUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+
+ xBaseValue()->setBboxRelative(bbox);
+ yBaseValue()->setBboxRelative(bbox);
+ widthBaseValue()->setBboxRelative(bbox);
+ heightBaseValue()->setBboxRelative(bbox);
+ float _x = xBaseValue()->value(), _y = yBaseValue()->value();
+ float _width = widthBaseValue()->value(), _height = heightBaseValue()->value();
if(bbox)
filterEffect->setSubRegion(FloatRect(_x * 100.f, _y * 100.f, _width * 100.f, _height * 100.f));
else
filterEffect->setSubRegion(FloatRect(_x, _y, _width, _height));
- filterEffect->setResult(String(result()->baseVal()).deprecatedString());
+ filterEffect->setResult(String(resultBaseValue()).deprecatedString());
}
// vim:ts=4:noet
namespace WebCore {
class KCanvasFilterEffect;
- class SVGAnimatedLength;
- class SVGAnimatedString;
+ class SVGLength;
class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement
{
virtual bool isFilterEffect() const { return true; }
// 'SVGFilterPrimitiveStandardAttributes' functions
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
- SVGAnimatedString *result() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual KCanvasFilterEffect *filterEffect() const = 0;
protected:
void setStandardAttributes(KCanvasFilterEffect *filterEffect) const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
- mutable RefPtr<SVGAnimatedString> m_result;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, Result, result)
};
} // namespace WebCore
#ifdef SVG_SUPPORT
#include "Attr.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
+#include "SVGPreserveAspectRatio.h"
+#include "SVGRect.h"
#include "SVGFitToViewBox.h"
#include "SVGNames.h"
#include "SVGPreserveAspectRatio.h"
namespace WebCore {
SVGFitToViewBox::SVGFitToViewBox()
+ : m_viewBox(new SVGRect(0))
+ , m_preserveAspectRatio(new SVGPreserveAspectRatio(0))
{
}
{
}
-SVGAnimatedRect* SVGFitToViewBox::viewBox() const
-{
- if (!m_viewBox) {
- //const SVGStyledElement *context = dynamic_cast<const SVGStyledElement *>(this);
- m_viewBox = new SVGAnimatedRect(0); // FIXME: 0 is a hack
- }
-
- return m_viewBox.get();
-}
-
-SVGAnimatedPreserveAspectRatio* SVGFitToViewBox::preserveAspectRatio() const
-{
- if (!m_preserveAspectRatio) {
- //const SVGStyledElement *context = dynamic_cast<const SVGStyledElement *>(this);
- m_preserveAspectRatio = new SVGAnimatedPreserveAspectRatio(0); // FIXME: 0 is a hack
- }
-
- return m_preserveAspectRatio.get();
-}
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, SVGRect*, Rect, rect, ViewBox, viewBox, SVGNames::viewBoxAttr.localName(), m_viewBox.get())
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
void SVGFitToViewBox::parseViewBox(StringImpl* str)
{
if (p < end) // nothing should come after the last, fourth number
goto bail_out;
- viewBox()->baseVal()->setX(x);
- viewBox()->baseVal()->setY(y);
- viewBox()->baseVal()->setWidth(w);
- viewBox()->baseVal()->setHeight(h);
+ viewBoxBaseValue()->setX(x);
+ viewBoxBaseValue()->setY(y);
+ viewBoxBaseValue()->setWidth(w);
+ viewBoxBaseValue()->setHeight(h);
return;
bail_out:;
SVGMatrix* SVGFitToViewBox::viewBoxToViewTransform(float viewWidth, float viewHeight) const
{
- SVGRect* viewBoxRect = viewBox()->baseVal();
+ SVGRect* viewBoxRect = viewBoxBaseValue();
if(viewBoxRect->width() == 0 || viewBoxRect->height() == 0)
return SVGSVGElement::createSVGMatrix();
- return preserveAspectRatio()->baseVal()->getCTM(viewBoxRect->x(),
+ return preserveAspectRatioBaseValue()->getCTM(viewBoxRect->x(),
viewBoxRect->y(), viewBoxRect->width(), viewBoxRect->height(),
0, 0, viewWidth, viewHeight);
}
parseViewBox(attr->value().impl());
return true;
} else if (attr->name() == SVGNames::preserveAspectRatioAttr) {
- preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(attr->value().impl());
+ preserveAspectRatioBaseValue()->parsePreserveAspectRatio(attr->value().impl());
return true;
}
#define KSVG_SVGFitToViewBoxImpl_H
#ifdef SVG_SUPPORT
+#include "SVGElement.h"
+
namespace WebCore {
class Attribute;
class StringImpl;
- class SVGAnimatedPreserveAspectRatio;
- class SVGAnimatedRect;
+ class SVGPreserveAspectRatio;
+ class SVGRect;
class SVGMatrix;
class SVGFitToViewBox {
virtual ~SVGFitToViewBox();
// 'SVGFitToViewBox' functions
- SVGAnimatedRect *viewBox() const;
- SVGAnimatedPreserveAspectRatio *preserveAspectRatio() const;
-
void parseViewBox(StringImpl *str);
SVGMatrix *viewBoxToViewTransform(float viewWidth, float viewHeight) const;
bool parseMappedAttribute(MappedAttribute *attr);
+ protected:
+ virtual const SVGElement* contextElement() const = 0;
+
private:
- mutable RefPtr<SVGAnimatedRect> m_viewBox;
- mutable RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGRect*, RefPtr<SVGRect>, ViewBox, viewBox)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGPreserveAspectRatio*, RefPtr<SVGPreserveAspectRatio>, PreserveAspectRatio, preserveAspectRatio)
};
} // namespace WebCore
#include "SVGNames.h"
#include "SVGHelper.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
#include "RenderForeignObject.h"
#include <wtf/Assertions.h>
namespace WebCore {
SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
}
{
}
-SVGAnimatedLength *SVGForeignObjectElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGForeignObjectElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGForeignObjectElement::width() const
-{
- return lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGForeignObjectElement::height() const
-{
- return lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr) {
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_WIDTH, value);
} else if (attr->name() == SVGNames::heightAttr) {
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_HEIGHT, value);
} else {
if (SVGTests::parseMappedAttribute(attr))
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGDocument;
class SVGForeignObjectElement : public SVGStyledTransformableElement,
virtual ~SVGForeignObjectElement();
virtual bool isValid() const { return SVGTests::isValid(); }
-
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
bool childShouldCreateRenderer(Node *child) const;
virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
};
} // namespace WebCore
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
+
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
};
class SVGDummyElement : public SVGGElement {
#include "Attr.h"
#include "Document.h"
#include "RenderView.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include "SVGRenderStyle.h"
using namespace WebCore;
-SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document *doc) : SVGStyledElement(tagName, doc), SVGURIReference(), SVGExternalResourcesRequired()
+SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document *doc)
+ : SVGStyledElement(tagName, doc)
+ , SVGURIReference()
+ , SVGExternalResourcesRequired()
+ , m_spreadMethod(0)
+ , m_gradientUnits(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ , m_gradientTransform(new SVGTransformList(this))
{
m_resource = 0;
}
delete m_resource;
}
-SVGAnimatedEnumeration *SVGGradientElement::gradientUnits() const
-{
- if (!m_gradientUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_gradientUnits, this);
- m_gradientUnits->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
- }
-
- return m_gradientUnits.get();
-}
-
-SVGAnimatedTransformList *SVGGradientElement::gradientTransform() const
-{
- return lazy_create<SVGAnimatedTransformList>(m_gradientTransform, this);
-}
-
-SVGAnimatedEnumeration *SVGGradientElement::spreadMethod() const
-{
- return lazy_create<SVGAnimatedEnumeration>(m_spreadMethod, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, GradientUnits, gradientUnits, SVGNames::gradientUnitsAttr.localName(), m_gradientUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, SVGTransformList*, TransformList, transformList, GradientTransform, gradientTransform, SVGNames::gradientTransformAttr.localName(), m_gradientTransform.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, SpreadMethod, spreadMethod, SVGNames::spreadMethodAttr.localName(), m_spreadMethod)
void SVGGradientElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::gradientUnitsAttr) {
if(value == "userSpaceOnUse")
- gradientUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setGradientUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if(value == "objectBoundingBox")
- gradientUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setGradientUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
} else if (attr->name() == SVGNames::gradientTransformAttr) {
- SVGTransformList *gradientTransforms = gradientTransform()->baseVal();
+ SVGTransformList *gradientTransforms = gradientTransformBaseValue();
SVGTransformable::parseTransformAttribute(gradientTransforms, attr->value());
} else if (attr->name() == SVGNames::spreadMethodAttr) {
if(value == "reflect")
- spreadMethod()->setBaseVal(SVG_SPREADMETHOD_REFLECT);
+ setSpreadMethodBaseValue(SVG_SPREADMETHOD_REFLECT);
else if(value == "repeat")
- spreadMethod()->setBaseVal(SVG_SPREADMETHOD_REPEAT);
+ setSpreadMethodBaseValue(SVG_SPREADMETHOD_REPEAT);
else if(value == "pad")
- spreadMethod()->setBaseVal(SVG_SPREADMETHOD_PAD);
+ setSpreadMethodBaseValue(SVG_SPREADMETHOD_PAD);
} else {
if (SVGURIReference::parseMappedAttribute(attr))
return;
SVGElement *element = svg_dynamic_cast(n);
if (element && element->isGradientStop()) {
SVGStopElement *stop = static_cast<SVGStopElement *>(element);
- float stopOffset = stop->offset()->baseVal();
+ float stopOffset = stop->offsetBaseValue();
RenderStyle *stopStyle = document()->styleSelector()->styleForElement(stop, gradientStyle);
Color c = stopStyle->svgStyle()->stopColor();
namespace WebCore {
class SVGGradientElement;
- class SVGAnimatedEnumeration;
- class SVGAnimatedTransformList;
+ class SVGTransformList;
class SVGGradientElement : public SVGStyledElement,
public SVGURIReference,
public SVGExternalResourcesRequired,
virtual ~SVGGradientElement();
// 'SVGGradientElement' functions
- SVGAnimatedEnumeration *gradientUnits() const;
- SVGAnimatedTransformList *gradientTransform() const;
- SVGAnimatedEnumeration *spreadMethod() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual void notifyAttributeChange() const;
void rebuildStops() const;
protected:
- mutable RefPtr<SVGAnimatedEnumeration> m_spreadMethod;
- mutable RefPtr<SVGAnimatedEnumeration> m_gradientUnits;
- mutable RefPtr<SVGAnimatedTransformList> m_gradientTransform;
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, SpreadMethod, spreadMethod)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, GradientUnits, gradientUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGTransformList*, RefPtr<SVGTransformList>, GradientTransform, gradientTransform)
mutable KRenderingPaintServerGradient *m_resource;
};
#include "Document.h"
#include "FrameView.h"
#include "RenderView.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedRect.h"
+#include "SVGLength.h"
+#include "SVGRect.h"
#include "SVGSVGElement.h"
#include "SVGStringList.h"
#include "ksvg.h"
if (viewportElement->isSVG()) {
const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement);
if (svg->hasAttribute(SVGNames::viewBoxAttr)) {
- width = svg->viewBox()->baseVal()->width();
- height = svg->viewBox()->baseVal()->height();
- } else if (svg->width()->baseVal()->unitType() == SVGLength::SVG_LENGTHTYPE_PERCENTAGE ||
- svg->height()->baseVal()->unitType() == SVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
+ width = svg->viewBoxBaseValue()->width();
+ height = svg->viewBoxBaseValue()->height();
+ } else if (svg->widthBaseValue()->unitType() == SVGLength::SVG_LENGTHTYPE_PERCENTAGE ||
+ svg->heightBaseValue()->unitType() == SVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
// TODO: Shouldn't w/h be multiplied with the percentage values?!
// AFAIK, this assumes width & height == 100%, Rob??
Document *doc = svg->document();
}
}
} else {
- width = svg->width()->baseVal()->value();
- height = svg->height()->baseVal()->value();
+ width = svg->widthBaseValue()->value();
+ height = svg->heightBaseValue()->value();
}
}
#include "CSSPropertyNames.h"
#include "KCanvasRenderingStyle.h"
#include "RenderSVGImage.h"
-#include "SVGAnimatedBoolean.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedString.h"
+#include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
#include "SVGDocument.h"
#include "SVGHelper.h"
#include "SVGNames.h"
, SVGLangSpace()
, SVGExternalResourcesRequired()
, SVGURIReference()
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_preserveAspectRatio(new SVGPreserveAspectRatio(this))
, m_imageLoader(this)
{
}
{
}
-SVGAnimatedLength *SVGImageElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGImageElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGImageElement::width() const
-{
- return lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGImageElement::height() const
-{
- return lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedPreserveAspectRatio *SVGImageElement::preserveAspectRatio() const
-{
- return lazy_create<SVGAnimatedPreserveAspectRatio>(m_preserveAspectRatio, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
void SVGImageElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::preserveAspectRatioAttr)
- preserveAspectRatio()->baseVal()->parsePreserveAspectRatio(value.impl());
+ preserveAspectRatioBaseValue()->parsePreserveAspectRatio(value.impl());
else if (attr->name() == SVGNames::widthAttr) {
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_WIDTH, value);
} else if (attr->name() == SVGNames::heightAttr) {
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_HEIGHT, value);
} else {
if (SVGTests::parseMappedAttribute(attr))
bool SVGImageElement::haveLoadedRequiredResources()
{
- return (!externalResourcesRequired()->baseVal() || m_imageLoader.imageComplete());
+ return (!externalResourcesRequiredBaseValue() || m_imageLoader.imageComplete());
}
void SVGImageElement::attach()
namespace WebCore
{
- class SVGAnimatedPreserveAspectRatio;
- class SVGAnimatedLength;
+ class SVGPreserveAspectRatio;
+ class SVGLength;
class SVGDocument;
class SVGImageElement : public SVGStyledTransformableElement,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGImageElement' functions
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
- SVGAnimatedPreserveAspectRatio *preserveAspectRatio() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual void attach();
protected:
virtual bool haveLoadedRequiredResources();
- private:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
- mutable RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+ private:
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGPreserveAspectRatio*, RefPtr<SVGPreserveAspectRatio>, PreserveAspectRatio, preserveAspectRatio)
SVGImageLoader m_imageLoader;
};
class MappedAttribute;
class StringImpl;
- class SVGAnimatedLength;
- class SVGAnimatedString;
+ class SVGLength;
class SVGLangSpace {
public:
#include "SVGLength.h"
#include "SVGElement.h"
#include "SVGSVGElement.h"
-#include "SVGAnimatedRect.h"
-#include "SVGAnimatedLength.h"
+#include "SVGRect.h"
+#include "SVGLength.h"
#include <math.h>
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGLineElement.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
using namespace WebCore;
SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_x1(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y1(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_x2(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y2(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
}
{
}
-SVGAnimatedLength *SVGLineElement::x1() const
-{
- return lazy_create<SVGAnimatedLength>(m_x1, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGLineElement::y1() const
-{
- return lazy_create<SVGAnimatedLength>(m_y1, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGLineElement::x2() const
-{
- return lazy_create<SVGAnimatedLength>(m_x2, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGLineElement::y2() const
-{
- return lazy_create<SVGAnimatedLength>(m_y2, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength*, Length, length, X1, x1, SVGNames::x1Attr.localName(), m_x1.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength*, Length, length, Y1, y1, SVGNames::y1Attr.localName(), m_y1.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength*, Length, length, X2, x2, SVGNames::x2Attr.localName(), m_x2.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength*, Length, length, Y2, y2, SVGNames::y2Attr.localName(), m_y2.get())
void SVGLineElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::x1Attr)
- x1()->baseVal()->setValueAsString(value.impl());
+ x1BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::y1Attr)
- y1()->baseVal()->setValueAsString(value.impl());
+ y1BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::x2Attr)
- x2()->baseVal()->setValueAsString(value.impl());
+ x2BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::y2Attr)
- y2()->baseVal()->setValueAsString(value.impl());
+ y2BaseValue()->setValueAsString(value.impl());
else
{
if(SVGTests::parseMappedAttribute(attr)) return;
Path SVGLineElement::toPathData() const
{
- float _x1 = x1()->baseVal()->value(), _y1 = y1()->baseVal()->value();
- float _x2 = x2()->baseVal()->value(), _y2 = y2()->baseVal()->value();
+ float _x1 = x1BaseValue()->value(), _y1 = y1BaseValue()->value();
+ float _x2 = x2BaseValue()->value(), _y2 = y2BaseValue()->value();
return Path::createLine(FloatPoint(_x1, _y1), FloatPoint(_x2, _y2));
}
const SVGStyledElement *SVGLineElement::pushAttributeContext(const SVGStyledElement *context)
{
// All attribute's contexts are equal (so just take the one from 'x1').
- const SVGStyledElement *restore = x1()->baseVal()->context();
+ const SVGStyledElement *restore = x1BaseValue()->context();
- x1()->baseVal()->setContext(context);
- y1()->baseVal()->setContext(context);
- x2()->baseVal()->setContext(context);
- y2()->baseVal()->setContext(context);
+ x1BaseValue()->setContext(context);
+ y1BaseValue()->setContext(context);
+ x2BaseValue()->setContext(context);
+ y2BaseValue()->setContext(context);
SVGStyledElement::pushAttributeContext(context);
return restore;
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGLineElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGLineElement' functions
- SVGAnimatedLength *x1() const;
- SVGAnimatedLength *y1() const;
- SVGAnimatedLength *x2() const;
- SVGAnimatedLength *y2() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x1;
- mutable RefPtr<SVGAnimatedLength> m_y1;
- mutable RefPtr<SVGAnimatedLength> m_x2;
- mutable RefPtr<SVGAnimatedLength> m_y2;
+
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X1, x1)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y1, y1)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X2, x2)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y2, y2)
};
} // namespace WebCore
#include "SVGMatrix.h"
#include "SVGTransform.h"
#include "SVGTransformList.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedEnumeration.h"
+#include "SVGLength.h"
#include "SVGLinearGradientElement.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
#include <kcanvas/KCanvasResources.h>
#include <kcanvas/device/KRenderingDevice.h>
using namespace WebCore;
-SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document *doc) : SVGGradientElement(tagName, doc)
+SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document *doc)
+ : SVGGradientElement(tagName, doc)
+ , m_x1(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y1(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_x2(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y2(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
+ // Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
+ m_x2->setValueAsString("100%");
}
SVGLinearGradientElement::~SVGLinearGradientElement()
{
}
-SVGAnimatedLength *SVGLinearGradientElement::x1() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- return lazy_create<SVGAnimatedLength>(m_x1, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGLinearGradientElement::y1() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- return lazy_create<SVGAnimatedLength>(m_y1, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGLinearGradientElement::x2() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
- if (!m_x2) {
- lazy_create<SVGAnimatedLength>(m_x2, this, LM_WIDTH, viewportElement());
- m_x2->baseVal()->setValue(1.0);
- }
-
- return m_x2.get();
-}
-
-SVGAnimatedLength *SVGLinearGradientElement::y2() const
-{
- // Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- return lazy_create<SVGAnimatedLength>(m_y2, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength*, Length, length, X1, x1, SVGNames::x1Attr.localName(), m_x1.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength*, Length, length, Y1, y1, SVGNames::y1Attr.localName(), m_y1.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength*, Length, length, X2, x2, SVGNames::x2Attr.localName(), m_x2.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength*, Length, length, Y2, y2, SVGNames::y2Attr.localName(), m_y2.get())
void SVGLinearGradientElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::x1Attr)
- x1()->baseVal()->setValueAsString(value.impl());
+ x1BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::y1Attr)
- y1()->baseVal()->setValueAsString(value.impl());
+ y1BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::x2Attr)
- x2()->baseVal()->setValueAsString(value.impl());
+ x2BaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::y2Attr)
- y2()->baseVal()->setValueAsString(value.impl());
+ y2BaseValue()->setValueAsString(value.impl());
else
SVGGradientElement::parseMappedAttribute(attr);
}
{
rebuildStops(); // rebuild stops before possibly importing them from any referenced gradient.
- bool bbox = (gradientUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ bool bbox = (gradientUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
- x1()->baseVal()->setBboxRelative(bbox);
- y1()->baseVal()->setBboxRelative(bbox);
- x2()->baseVal()->setBboxRelative(bbox);
- y2()->baseVal()->setBboxRelative(bbox);
+ x1BaseValue()->setBboxRelative(bbox);
+ y1BaseValue()->setBboxRelative(bbox);
+ x2BaseValue()->setBboxRelative(bbox);
+ y2BaseValue()->setBboxRelative(bbox);
- float _x1 = x1()->baseVal()->value(), _y1 = y1()->baseVal()->value();
- float _x2 = x2()->baseVal()->value(), _y2 = y2()->baseVal()->value();
+ float _x1 = x1BaseValue()->value(), _y1 = y1BaseValue()->value();
+ float _x2 = x2BaseValue()->value(), _y2 = y2BaseValue()->value();
KRenderingPaintServerLinearGradient *grad = static_cast<KRenderingPaintServerLinearGradient *>(_grad);
AffineTransform mat;
- if(gradientTransform()->baseVal()->numberOfItems() > 0)
- mat = gradientTransform()->baseVal()->consolidate()->matrix()->matrix();
+ if(gradientTransformBaseValue()->numberOfItems() > 0)
+ mat = gradientTransformBaseValue()->consolidate()->matrix()->matrix();
- DeprecatedString ref = String(href()->baseVal()).deprecatedString();
+ DeprecatedString ref = String(hrefBaseValue()).deprecatedString();
KRenderingPaintServer *pserver = getPaintServerById(document(), ref.mid(1));
if(pserver && (pserver->type() == PS_RADIAL_GRADIENT || pserver->type() == PS_LINEAR_GRADIENT))
}
else
{
- if(spreadMethod()->baseVal() == SVG_SPREADMETHOD_REFLECT)
+ if(spreadMethodBaseValue() == SVG_SPREADMETHOD_REFLECT)
grad->setGradientSpreadMethod(SPREADMETHOD_REFLECT);
- else if(spreadMethod()->baseVal() == SVG_SPREADMETHOD_REPEAT)
+ else if(spreadMethodBaseValue() == SVG_SPREADMETHOD_REPEAT)
grad->setGradientSpreadMethod(SPREADMETHOD_REPEAT);
else
grad->setGradientSpreadMethod(SPREADMETHOD_PAD);
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGLinearGradientElement : public SVGGradientElement
{
public:
virtual ~SVGLinearGradientElement();
// 'SVGLinearGradientElement' functions
- SVGAnimatedLength *x1() const;
- SVGAnimatedLength *y1() const;
- SVGAnimatedLength *x2() const;
- SVGAnimatedLength *y2() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
protected:
virtual void buildGradient(KRenderingPaintServerGradient *grad) const;
virtual KCPaintServerType gradientType() const { return PS_LINEAR_GRADIENT; }
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x1;
- mutable RefPtr<SVGAnimatedLength> m_y1;
- mutable RefPtr<SVGAnimatedLength> m_x2;
- mutable RefPtr<SVGAnimatedLength> m_y2;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X1, x1)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y1, y1)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X2, x2)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y2, y2)
};
} // namespace WebCore
#include "Attr.h"
#include "PlatformString.h"
#include "SVGAngle.h"
-#include "SVGAnimatedAngle.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedLength.h"
+#include "SVGAngle.h"
+#include "SVGLength.h"
#include "SVGFitToViewBox.h"
#include "SVGHelper.h"
#include "SVGMatrix.h"
namespace WebCore {
SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledElement(tagName, doc), SVGLangSpace(),
- SVGExternalResourcesRequired(), SVGFitToViewBox()
+ : SVGStyledElement(tagName, doc)
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , SVGFitToViewBox()
+ , m_refX(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_refY(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_markerWidth(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_markerHeight(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_markerUnits(SVG_MARKERUNITS_STROKEWIDTH)
+ , m_orientType(0)
+ , m_orientAngle(new SVGAngle(this))
{
m_marker = 0;
}
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::markerUnitsAttr) {
if (value == "userSpaceOnUse")
- markerUnits()->setBaseVal(SVG_MARKERUNITS_USERSPACEONUSE);
+ setMarkerUnitsBaseValue(SVG_MARKERUNITS_USERSPACEONUSE);
}
else if (attr->name() == SVGNames::refXAttr)
- refX()->baseVal()->setValueAsString(value.impl());
+ refXBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::refYAttr)
- refY()->baseVal()->setValueAsString(value.impl());
+ refYBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::markerWidthAttr)
- markerWidth()->baseVal()->setValueAsString(value.impl());
+ markerWidthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::markerHeightAttr)
- markerHeight()->baseVal()->setValueAsString(value.impl());
+ markerHeightBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::orientAttr)
{
if (value == "auto")
}
}
-SVGAnimatedLength *SVGMarkerElement::refX() const
-{
- return lazy_create<SVGAnimatedLength>(m_refX, static_cast<const SVGStyledElement *>(0), LM_WIDTH, this);
-}
-
-SVGAnimatedLength *SVGMarkerElement::refY() const
-{
- return lazy_create<SVGAnimatedLength>(m_refY, static_cast<const SVGStyledElement *>(0), LM_HEIGHT, this);
-}
-
-SVGAnimatedEnumeration *SVGMarkerElement::markerUnits() const
-{
- if (!m_markerUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_markerUnits, this);
- m_markerUnits->setBaseVal(SVG_MARKERUNITS_STROKEWIDTH);
- }
-
- return m_markerUnits.get();
-}
-
-SVGAnimatedLength *SVGMarkerElement::markerWidth() const
-{
- return lazy_create<SVGAnimatedLength>(m_markerWidth, static_cast<const SVGStyledElement *>(0), LM_WIDTH, this);
-}
-
-SVGAnimatedLength *SVGMarkerElement::markerHeight() const
-{
- return lazy_create<SVGAnimatedLength>(m_markerHeight, static_cast<const SVGStyledElement *>(0), LM_HEIGHT, this);
-}
-
-SVGAnimatedEnumeration *SVGMarkerElement::orientType() const
-{
- return lazy_create<SVGAnimatedEnumeration>(m_orientType, this);
-}
-
-SVGAnimatedAngle *SVGMarkerElement::orientAngle() const
-{
- return lazy_create<SVGAnimatedAngle>(m_orientAngle, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength*, Length, length, RefX, refX, SVGNames::refXAttr.localName(), m_refX.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength*, Length, length, RefY, refY, SVGNames::refYAttr.localName(), m_refY.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, MarkerUnits, markerUnits, SVGNames::markerUnitsAttr.localName(), m_markerUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength*, Length, length, MarkerWidth, markerWidth, SVGNames::markerWidthAttr.localName(), m_markerWidth.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength*, Length, length, MarkerHeight, markerHeight, SVGNames::markerHeightAttr.localName(), m_markerHeight.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, OrientType, orientType, "orientType", m_orientType)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGAngle*, Angle, angle, OrientAngle, orientAngle, "orientAngle", m_orientAngle.get())
void SVGMarkerElement::setOrientToAuto()
{
- orientType()->setBaseVal(SVG_MARKER_ORIENT_AUTO);
+ setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO);
}
void SVGMarkerElement::setOrientToAngle(SVGAngle *angle)
{
- orientType()->setBaseVal(SVG_MARKER_ORIENT_ANGLE);
- orientAngle()->setBaseVal(angle);
+ setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE);
+ setOrientAngleBaseValue(angle);
}
KCanvasMarker *SVGMarkerElement::canvasResource()
// Spec: If the attribute is not specified, the effect is as if a
// value of "0" were specified.
if(!m_orientType)
- {
- SVGAngle *angle = SVGSVGElement::createSVGAngle();
- angle->setValueAsString(String("0").impl());
- setOrientToAngle(angle);
- }
+ setOrientToAngle(SVGSVGElement::createSVGAngle());
- if(orientType()->baseVal() == SVG_MARKER_ORIENT_ANGLE)
- m_marker->setAngle(orientAngle()->baseVal()->value());
+ if(orientTypeBaseValue() == SVG_MARKER_ORIENT_ANGLE)
+ m_marker->setAngle(orientAngleBaseValue()->value());
else
m_marker->setAutoAngle();
- m_marker->setRef(refX()->baseVal()->value(), refY()->baseVal()->value());
+ m_marker->setRef(refXBaseValue()->value(), refYBaseValue()->value());
- m_marker->setUseStrokeWidth(markerUnits()->baseVal() == SVG_MARKERUNITS_STROKEWIDTH);
- double w = markerWidth()->baseVal()->value();
- double h = markerHeight()->baseVal()->value();
+ m_marker->setUseStrokeWidth(markerUnitsBaseValue() == SVG_MARKERUNITS_STROKEWIDTH);
+ double w = markerWidthBaseValue()->value();
+ double h = markerHeightBaseValue()->value();
RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(w, h);
m_marker->setScale(viewBox->matrix().m11(), viewBox->matrix().m22());
{
class Document;
class SVGAngle;
- class SVGAnimatedAngle;
- class SVGAnimatedLength;
- class SVGAnimatedEnumeration;
+ class SVGAngle;
+ class SVGLength;
class SVGMarkerElement : public SVGStyledElement,
public SVGLangSpace,
public SVGExternalResourcesRequired,
virtual ~SVGMarkerElement();
// 'SVGMarkerElement' functions
- SVGAnimatedLength *refX() const;
- SVGAnimatedLength *refY() const;
- SVGAnimatedEnumeration *markerUnits() const;
- SVGAnimatedLength *markerWidth() const;
- SVGAnimatedLength *markerHeight() const;
- SVGAnimatedEnumeration *orientType() const;
- SVGAnimatedAngle *orientAngle() const;
-
void setOrientToAuto();
void setOrientToAngle(SVGAngle *angle);
virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
virtual KCanvasMarker *canvasResource();
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_refX;
- mutable RefPtr<SVGAnimatedLength> m_refY;
- mutable RefPtr<SVGAnimatedLength> m_markerWidth;
- mutable RefPtr<SVGAnimatedLength> m_markerHeight;
- mutable RefPtr<SVGAnimatedEnumeration> m_markerUnits;
- mutable RefPtr<SVGAnimatedEnumeration> m_orientType;
- mutable RefPtr<SVGAnimatedAngle> m_orientAngle;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, RefX, refX)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, RefY, refY)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, MarkerWidth, markerWidth)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, MarkerHeight, markerHeight)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, MarkerUnits, markerUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, OrientType, orientType)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGAngle*, RefPtr<SVGAngle>, OrientAngle, orientAngle)
KCanvasMarker *m_marker;
};
#include "RenderSVGContainer.h"
#include "KCanvasImage.h"
#include "KRenderingDevice.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
#include "SVGHelper.h"
#include "SVGNames.h"
#include "SVGRenderStyle.h"
namespace WebCore {
-SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document *doc) : SVGStyledLocatableElement(tagName, doc), SVGURIReference(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), m_masker(0), m_dirty(true)
+SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document *doc)
+ : SVGStyledLocatableElement(tagName, doc)
+ , SVGURIReference()
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_masker(0)
+ , m_dirty(true)
{
}
delete m_masker;
}
-SVGAnimatedLength *SVGMaskElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGMaskElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGMaskElement::width() const
-{
- return lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGMaskElement::height() const
-{
- return lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
void SVGMaskElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
- IntSize newSize = IntSize(lroundf(width()->baseVal()->value()), lroundf(height()->baseVal()->value()));
+ IntSize newSize = IntSize(lroundf(widthBaseValue()->value()), lroundf(heightBaseValue()->value()));
if (!m_masker || !m_masker->mask() || (m_masker->mask()->size() != newSize))
m_dirty = true;
SVGStyledLocatableElement::attributeChanged(attr, preserveDecls);
{
const String& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr)
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::heightAttr)
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
else {
if (SVGURIReference::parseMappedAttribute(attr))
return;
return 0;
KCanvasImage *maskImage = static_cast<KCanvasImage *>(device->createResource(RS_IMAGE));
- IntSize size = IntSize(lroundf(width()->baseVal()->value()), lroundf(height()->baseVal()->value()));
+ IntSize size = IntSize(lroundf(widthBaseValue()->value()), lroundf(heightBaseValue()->value()));
maskImage->init(size);
KRenderingDeviceContext *patternContext = device->contextForImage(maskImage);
namespace WebCore
{
class Attribute;
- class SVGAnimatedLength;
+ class SVGLength;
class SVGMaskElement : public SVGStyledLocatableElement,
public SVGURIReference,
public SVGTests,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGMaskElement' functions
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
virtual void childrenChanged();
virtual void attributeChanged(Attribute* attr, bool preserveDecls);
virtual void parseMappedAttribute(MappedAttribute *attr);
protected:
KCanvasImage *drawMaskerContent();
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+
+ virtual const SVGElement* contextElement() const { return this; }
private:
KCanvasMasker *m_masker;
#include "SVGPathElement.h"
#include "SVGPathSegLineto.h"
#include "SVGPathSegMoveto.h"
-#include "SVGAnimatedNumber.h"
#include "SVGPathSegClosePath.h"
#include "SVGPathSegCurvetoCubic.h"
#include "SVGPathSegLinetoVertical.h"
namespace WebCore {
SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGPathParser()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , SVGPathParser()
+ , m_pathLength(0.0)
{
}
{
}
-SVGAnimatedNumber *SVGPathElement::pathLength() const
-{
- if(!m_pathLength)
- {
- lazy_create<SVGAnimatedNumber>(m_pathLength, this);
- m_pathLength->setBaseVal(0);
- }
-
- return m_pathLength.get();
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGPathElement, double, Number, number, PathLength, pathLength, SVGNames::pathLengthAttr.localName(), m_pathLength)
double SVGPathElement::getTotalLength()
{
class SVGPathSeg;
class SVGPathSegArcAbs;
class SVGPathSegArcRel;
- class SVGAnimatedNumber;
class SVGPathSegClosePath;
class SVGPathSegLinetoAbs;
class SVGPathSegLinetoRel;
virtual ~SVGPathElement();
virtual bool isValid() const { return SVGTests::isValid(); }
-
- SVGAnimatedNumber *pathLength() const;
double getTotalLength();
FloatPoint getPointAtLength(double distance);
unsigned long getPathSegAtLength(double distance);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual Path toPathData() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
mutable RefPtr<SVGPathSegList> m_pathSegList;
- mutable RefPtr<SVGAnimatedNumber> m_pathLength;
-
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, PathLength, pathLength)
virtual void svgMoveTo(double x1, double y1, bool closed, bool abs = true);
virtual void svgLineTo(double x1, double y1, bool abs = true);
virtual void svgLineToHorizontal(double x, bool abs = true);
#include "KCanvasRenderingStyle.h"
#include "KRenderingDevice.h"
#include "KRenderingPaintServerPattern.h"
-#include "SVGAnimatedEnumeration.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGLength.h"
+#include "SVGTransformList.h"
#include "SVGHelper.h"
#include "SVGMatrix.h"
#include "SVGNames.h"
namespace WebCore {
-SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document *doc) : SVGStyledLocatableElement(tagName, doc), SVGURIReference(), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired(), SVGFitToViewBox(), KCanvasResourceListener()
+SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document *doc)
+ : SVGStyledLocatableElement(tagName, doc)
+ , SVGURIReference()
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , SVGFitToViewBox()
+ , KCanvasResourceListener()
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_patternUnits(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ , m_patternContentUnits(SVG_UNIT_TYPE_USERSPACEONUSE)
+ , m_patternTransform(new SVGTransformList(this))
{
m_tile = 0;
m_paintServer = 0;
delete m_paintServer;
}
-SVGAnimatedEnumeration *SVGPatternElement::patternUnits() const
-{
- if (!m_patternUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_patternUnits, this);
- m_patternUnits->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
- }
-
- return m_patternUnits.get();
-}
-
-SVGAnimatedEnumeration *SVGPatternElement::patternContentUnits() const
-{
- if (!m_patternContentUnits) {
- lazy_create<SVGAnimatedEnumeration>(m_patternContentUnits, this);
- m_patternContentUnits->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
- }
-
- return m_patternContentUnits.get();
-}
-
-SVGAnimatedLength* SVGPatternElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength* SVGPatternElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength* SVGPatternElement::width() const
-{
- return lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength* SVGPatternElement::height() const
-{
- return lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedTransformList *SVGPatternElement::patternTransform() const
-{
- return lazy_create<SVGAnimatedTransformList>(m_patternTransform, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternUnits, patternUnits, SVGNames::patternUnitsAttr.localName(), m_patternUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternContentUnits, patternContentUnits, SVGNames::patternContentUnitsAttr.localName(), m_patternContentUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGTransformList*, TransformList, transformList, PatternTransform, patternTransform, SVGNames::patternTransformAttr.localName(), m_patternTransform.get())
void SVGPatternElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString &value = attr->value();
if (attr->name() == SVGNames::patternUnitsAttr) {
if (value == "userSpaceOnUse")
- patternUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setPatternUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if (value == "objectBoundingBox")
- patternUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setPatternUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
} else if (attr->name() == SVGNames::patternContentUnitsAttr) {
if (value == "userSpaceOnUse")
- patternContentUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setPatternContentUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if (value == "objectBoundingBox")
- patternContentUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setPatternContentUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
} else if (attr->name() == SVGNames::patternTransformAttr) {
- SVGTransformList *patternTransforms = patternTransform()->baseVal();
+ SVGTransformList *patternTransforms = patternTransformBaseValue();
SVGTransformable::parseTransformAttribute(patternTransforms, value);
} else if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr)
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::heightAttr)
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
else {
if (SVGURIReference::parseMappedAttribute(attr))
return;
const SVGStyledElement* SVGPatternElement::pushAttributeContext(const SVGStyledElement* context)
{
// All attribute's contexts are equal (so just take the one from 'x').
- const SVGStyledElement* restore = x()->baseVal()->context();
+ const SVGStyledElement* restore = xBaseValue()->context();
- x()->baseVal()->setContext(context);
- y()->baseVal()->setContext(context);
- width()->baseVal()->setContext(context);
- height()->baseVal()->setContext(context);
+ xBaseValue()->setContext(context);
+ yBaseValue()->setContext(context);
+ widthBaseValue()->setContext(context);
+ heightBaseValue()->setContext(context);
return restore;
}
notifyAttributeChange();
}
-void SVGPatternElement::fillAttributesFromReferencePattern(const SVGPatternElement* target, AffineTransform& patternTransformMatrix) const
+void SVGPatternElement::fillAttributesFromReferencePattern(const SVGPatternElement* target, AffineTransform& patternTransformMatrix)
{
- DeprecatedString ref = String(href()->baseVal()).deprecatedString();
+ DeprecatedString ref = String(hrefBaseValue()).deprecatedString();
KRenderingPaintServer *refServer = getPaintServerById(document(), ref.mid(1));
if (!refServer || refServer->type() != PS_PATTERN)
if (!hasAttribute(SVGNames::patternUnitsAttr)) {
const AtomicString& value = target->getAttribute(SVGNames::patternUnitsAttr);
if (value == "userSpaceOnUse")
- patternUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setPatternUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if (value == "objectBoundingBox")
- patternUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setPatternUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
if (!hasAttribute(SVGNames::patternContentUnitsAttr)) {
const AtomicString& value = target->getAttribute(SVGNames::patternContentUnitsAttr);
if (value == "userSpaceOnUse")
- patternContentUnits()->setBaseVal(SVG_UNIT_TYPE_USERSPACEONUSE);
+ setPatternContentUnitsBaseValue(SVG_UNIT_TYPE_USERSPACEONUSE);
else if (value == "objectBoundingBox")
- patternContentUnits()->setBaseVal(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ setPatternContentUnitsBaseValue(SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
if (!hasAttribute(SVGNames::patternTransformAttr))
patternTransformMatrix = refPattern->patternTransform();
}
-void SVGPatternElement::drawPatternContentIntoTile(const SVGPatternElement* target, const IntSize& newSize, AffineTransform patternTransformMatrix) const
+void SVGPatternElement::drawPatternContentIntoTile(const SVGPatternElement* target, const IntSize& newSize, AffineTransform patternTransformMatrix)
{
KRenderingDevice* device = renderingDevice();
SVGStyledElement* activeElement = static_cast<SVGStyledElement*>(m_paintServer->activeClient()->element());
- bool bbox = (patternUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ bool bbox = (patternUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
const SVGStyledElement* savedContext = 0;
if (bbox) {
- if (width()->baseVal()->unitType() != SVGLength::SVG_LENGTHTYPE_PERCENTAGE)
- width()->baseVal()->newValueSpecifiedUnits(SVGLength::SVG_LENGTHTYPE_PERCENTAGE, width()->baseVal()->value() * 100.);
- if (height()->baseVal()->unitType() != SVGLength::SVG_LENGTHTYPE_PERCENTAGE)
- height()->baseVal()->newValueSpecifiedUnits(SVGLength::SVG_LENGTHTYPE_PERCENTAGE, height()->baseVal()->value() * 100.);
+ if (widthBaseValue()->unitType() != SVGLength::SVG_LENGTHTYPE_PERCENTAGE)
+ widthBaseValue()->newValueSpecifiedUnits(SVGLength::SVG_LENGTHTYPE_PERCENTAGE, widthBaseValue()->value() * 100.);
+ if (heightBaseValue()->unitType() != SVGLength::SVG_LENGTHTYPE_PERCENTAGE)
+ heightBaseValue()->newValueSpecifiedUnits(SVGLength::SVG_LENGTHTYPE_PERCENTAGE, heightBaseValue()->value() * 100.);
if (activeElement)
savedContext = const_cast<SVGPatternElement* >(this)->pushAttributeContext(activeElement);
}
KRenderingDeviceContext* patternContext = device->contextForImage(m_tile);
device->pushContext(patternContext);
- FloatRect rect(x()->baseVal()->value(), y()->baseVal()->value(), width()->baseVal()->value(), height()->baseVal()->value());
+ FloatRect rect(xBaseValue()->value(), yBaseValue()->value(), widthBaseValue()->value(), heightBaseValue()->value());
m_paintServer->setBbox(rect);
m_paintServer->setPatternTransform(patternTransformMatrix);
m_paintServer->setTile(m_tile);
KCanvasMatrix savedMatrix = item->localTransform();
const SVGStyledElement* savedContext = 0;
- if (patternContentUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ if (patternContentUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
{
if (activeElement)
savedContext = e->pushAttributeContext(activeElement);
if (!m_paintServer || !m_paintServer->activeClient() || m_ignoreAttributeChanges)
return;
- IntSize newSize = IntSize(lroundf(width()->baseVal()->value()), lroundf(height()->baseVal()->value()));
+ IntSize newSize = IntSize(lroundf(widthBaseValue()->value()), lroundf(heightBaseValue()->value()));
if (m_tile && (m_tile->size() == newSize) || newSize.width() < 1 || newSize.height() < 1)
return;
const Node *test = this;
while(test && !test->hasChildNodes())
{
- DeprecatedString ref = String(target->href()->baseVal()).deprecatedString();
+ DeprecatedString ref = String(target->hrefBaseValue()).deprecatedString();
test = ownerDocument()->getElementById(String(ref.mid(1)).impl());
if (test && test->hasTagName(SVGNames::patternTag))
target = static_cast<const SVGPatternElement* >(test);
}
- unsigned short savedPatternUnits = patternUnits()->baseVal();
- unsigned short savedPatternContentUnits = patternContentUnits()->baseVal();
+ unsigned short savedPatternUnits = patternUnitsBaseValue();
+ unsigned short savedPatternContentUnits = patternContentUnitsBaseValue();
AffineTransform patternTransformMatrix;
- if (patternTransform()->baseVal()->numberOfItems() > 0)
- patternTransformMatrix = patternTransform()->baseVal()->consolidate()->matrix()->matrix();
+ if (patternTransformBaseValue()->numberOfItems() > 0)
+ patternTransformMatrix = patternTransformBaseValue()->consolidate()->matrix()->matrix();
- fillAttributesFromReferencePattern(target, patternTransformMatrix);
-
- drawPatternContentIntoTile(target, newSize, patternTransformMatrix);
-
- patternUnits()->setBaseVal(savedPatternUnits);
- patternContentUnits()->setBaseVal(savedPatternContentUnits);
+
+ SVGPatternElement *nonConstThis = const_cast<SVGPatternElement*>(this);
+
+ nonConstThis->fillAttributesFromReferencePattern(target, patternTransformMatrix);
+ nonConstThis->drawPatternContentIntoTile(target, newSize, patternTransformMatrix);
+ nonConstThis->setPatternUnitsBaseValue(savedPatternUnits);
+ nonConstThis->setPatternContentUnitsBaseValue(savedPatternContentUnits);
notifyClientsToRepaint();
SVGMatrix *mat = SVGSVGElement::createSVGMatrix();
if (mat)
{
- RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(width()->baseVal()->value(),
- height()->baseVal()->value());
+ RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(widthBaseValue()->value(),
+ heightBaseValue()->value());
mat->multiply(viewBox.get());
}
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGPatternElement;
- class SVGAnimatedEnumeration;
- class SVGAnimatedTransformList;
+ class SVGTransformList;
class SVGPatternElement : public SVGStyledLocatableElement,
public SVGURIReference,
public SVGTests,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGPatternElement' functions
- SVGAnimatedEnumeration *patternUnits() const;
- SVGAnimatedEnumeration *patternContentUnits() const;
- SVGAnimatedTransformList *patternTransform() const;
-
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context);
virtual SVGMatrix *getCTM() const;
protected:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
-
- mutable RefPtr<SVGAnimatedEnumeration> m_patternUnits;
- mutable RefPtr<SVGAnimatedEnumeration> m_patternContentUnits;
-
- mutable RefPtr<SVGAnimatedTransformList> m_patternTransform;
-
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, PatternUnits, patternUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(int, int, PatternContentUnits, patternContentUnits)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGTransformList*, RefPtr<SVGTransformList>, PatternTransform, patternTransform)
mutable KCanvasImage *m_tile;
mutable bool m_ignoreAttributeChanges;
mutable KRenderingPaintServerPattern *m_paintServer;
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
// notifyAttributeChange helpers:
- void fillAttributesFromReferencePattern(const SVGPatternElement *target, AffineTransform& patternTransformMatrix) const;
- void drawPatternContentIntoTile(const SVGPatternElement *target, const IntSize &newSize, AffineTransform patternTransformMatrix) const;
+ void fillAttributesFromReferencePattern(const SVGPatternElement *target, AffineTransform& patternTransformMatrix);
+ void drawPatternContentIntoTile(const SVGPatternElement *target, const IntSize &newSize, AffineTransform patternTransformMatrix);
void notifyClientsToRepaint() const;
};
virtual void notifyAttributeChange() const;
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
mutable RefPtr<SVGPointList> m_points;
#include "SVGTransform.h"
#include "SVGStopElement.h"
#include "SVGTransformList.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedNumber.h"
-#include "SVGAnimatedString.h"
-#include "SVGAnimatedEnumeration.h"
+#include "SVGLength.h"
#include "SVGRadialGradientElement.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
#include <kcanvas/device/KRenderingDevice.h>
#include <kcanvas/device/KRenderingPaintServerGradient.h>
namespace WebCore {
-SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document *doc) : SVGGradientElement(tagName, doc)
-{
-}
-
-SVGRadialGradientElement::~SVGRadialGradientElement()
-{
-}
-
-SVGAnimatedLength *SVGRadialGradientElement::cx() const
+SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document *doc)
+ : SVGGradientElement(tagName, doc)
+ , m_cx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_cy(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_r(new SVGLength(this, LM_OTHER, viewportElement()))
+ , m_fx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_fy(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
// Spec: If the attribute is not specified, the effect is as if a value of "50%" were specified.
- if (!m_cx) {
- lazy_create<SVGAnimatedLength>(m_cx, this, LM_WIDTH, viewportElement());
- m_cx->baseVal()->setValue(0.5);
- }
-
- return m_cx.get();
+ m_cx->setValueAsString("50%");
+ m_cy->setValueAsString("50%");
+ m_r->setValueAsString("50%");
}
-SVGAnimatedLength *SVGRadialGradientElement::cy() const
-{
- // Spec: If the attribute is not specified, the effect is as if a value of "50%" were specified.
- if (!m_cy) {
- lazy_create<SVGAnimatedLength>(m_cy, this, LM_HEIGHT, viewportElement());
- m_cy->baseVal()->setValue(0.5);
- }
-
- return m_cy.get();
-}
-
-SVGAnimatedLength *SVGRadialGradientElement::fx() const
-{
- return lazy_create<SVGAnimatedLength>(m_fx, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGRadialGradientElement::fy() const
+SVGRadialGradientElement::~SVGRadialGradientElement()
{
- return lazy_create<SVGAnimatedLength>(m_fy, this, LM_HEIGHT, viewportElement());
}
-SVGAnimatedLength *SVGRadialGradientElement::r() const
-{
- // Spec: If the attribute is not specified, the effect is as if a value of "50%" were specified.
- if (!m_r) {
- lazy_create<SVGAnimatedLength>(m_r, this, LM_OTHER, viewportElement());
- m_r->baseVal()->setValue(0.5);
- }
-
- return m_r.get();
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength*, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength*, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength*, Length, length, Fx, fx, SVGNames::fxAttr.localName(), m_fx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength*, Length, length, Fy, fy, SVGNames::fyAttr.localName(), m_fy.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength*, Length, length, R, r, SVGNames::rAttr.localName(), m_r.get())
void SVGRadialGradientElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::cxAttr)
- cx()->baseVal()->setValueAsString(value.impl());
+ cxBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::cyAttr)
- cy()->baseVal()->setValueAsString(value.impl());
+ cyBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::rAttr)
- r()->baseVal()->setValueAsString(value.impl());
+ rBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::fxAttr)
- fx()->baseVal()->setValueAsString(value.impl());
+ fxBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::fyAttr)
- fy()->baseVal()->setValueAsString(value.impl());
+ fyBaseValue()->setValueAsString(value.impl());
else
SVGGradientElement::parseMappedAttribute(attr);
}
{
rebuildStops(); // rebuild stops before possibly importing them from any referenced gradient.
- bool bbox = (gradientUnits()->baseVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ bool bbox = (gradientUnitsBaseValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
bool fxSet = hasAttribute(SVGNames::fxAttr);
bool fySet = hasAttribute(SVGNames::fyAttr);
- cx()->baseVal()->setBboxRelative(bbox);
- cy()->baseVal()->setBboxRelative(bbox);
- r()->baseVal()->setBboxRelative(bbox);
- fx()->baseVal()->setBboxRelative(bbox);
- fy()->baseVal()->setBboxRelative(bbox);
- float _cx = cx()->baseVal()->value(), _cy = cy()->baseVal()->value();
- float _r = r()->baseVal()->value();
- float _fx = fxSet ? fx()->baseVal()->value() : _cx;
- float _fy = fySet ? fy()->baseVal()->value() : _cy;
+ cxBaseValue()->setBboxRelative(bbox);
+ cyBaseValue()->setBboxRelative(bbox);
+ rBaseValue()->setBboxRelative(bbox);
+ fxBaseValue()->setBboxRelative(bbox);
+ fyBaseValue()->setBboxRelative(bbox);
+ float _cx = cxBaseValue()->value(), _cy = cyBaseValue()->value();
+ float _r = rBaseValue()->value();
+ float _fx = fxSet ? fxBaseValue()->value() : _cx;
+ float _fy = fySet ? fyBaseValue()->value() : _cy;
KRenderingPaintServerRadialGradient *grad = static_cast<KRenderingPaintServerRadialGradient *>(_grad);
AffineTransform mat;
- if(gradientTransform()->baseVal()->numberOfItems() > 0)
- mat = gradientTransform()->baseVal()->consolidate()->matrix()->matrix();
+ if(gradientTransformBaseValue()->numberOfItems() > 0)
+ mat = gradientTransformBaseValue()->consolidate()->matrix()->matrix();
- DeprecatedString ref = String(href()->baseVal()).deprecatedString();
+ DeprecatedString ref = String(hrefBaseValue()).deprecatedString();
KRenderingPaintServer *pserver = getPaintServerById(document(), ref.mid(1));
if(pserver && (pserver->type() == PS_RADIAL_GRADIENT || pserver->type() == PS_LINEAR_GRADIENT))
}
else
{
- if(spreadMethod()->baseVal() == SVG_SPREADMETHOD_REFLECT)
+ if(spreadMethodBaseValue() == SVG_SPREADMETHOD_REFLECT)
grad->setGradientSpreadMethod(SPREADMETHOD_REFLECT);
- else if(spreadMethod()->baseVal() == SVG_SPREADMETHOD_REPEAT)
+ else if(spreadMethodBaseValue() == SVG_SPREADMETHOD_REPEAT)
grad->setGradientSpreadMethod(SPREADMETHOD_REPEAT);
else
grad->setGradientSpreadMethod(SPREADMETHOD_PAD);
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGRadialGradientElement : public SVGGradientElement
{
public:
virtual ~SVGRadialGradientElement();
// 'SVGRadialGradientElement' functions
- SVGAnimatedLength *cx() const;
- SVGAnimatedLength *cy() const;
- SVGAnimatedLength *fx() const;
- SVGAnimatedLength *fy() const;
- SVGAnimatedLength *r() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
protected:
virtual void buildGradient(KRenderingPaintServerGradient *grad) const;
virtual KCPaintServerType gradientType() const { return PS_RADIAL_GRADIENT; }
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_cx;
- mutable RefPtr<SVGAnimatedLength> m_cy;
- mutable RefPtr<SVGAnimatedLength> m_r;
- mutable RefPtr<SVGAnimatedLength> m_fx;
- mutable RefPtr<SVGAnimatedLength> m_fy;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cx, cx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Cy, cy)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, R, r)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Fx, fx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Fy, fy)
};
} // namespace WebCore
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRectElement.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
#include "KCanvasRenderingStyle.h"
#include <kcanvas/device/KRenderingDevice.h>
namespace WebCore {
SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledTransformableElement(tagName, doc), SVGTests(), SVGLangSpace(), SVGExternalResourcesRequired()
+ : SVGStyledTransformableElement(tagName, doc)
+ , SVGTests()
+ , SVGLangSpace()
+ , SVGExternalResourcesRequired()
+ , m_x(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_y(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_width(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_height(new SVGLength(this, LM_HEIGHT, viewportElement()))
+ , m_rx(new SVGLength(this, LM_WIDTH, viewportElement()))
+ , m_ry(new SVGLength(this, LM_HEIGHT, viewportElement()))
{
}
{
}
-SVGAnimatedLength *SVGRectElement::x() const
-{
- return lazy_create<SVGAnimatedLength>(m_x, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGRectElement::y() const
-{
- return lazy_create<SVGAnimatedLength>(m_y, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGRectElement::width() const
-{
- return lazy_create<SVGAnimatedLength>(m_width, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGRectElement::height() const
-{
- return lazy_create<SVGAnimatedLength>(m_height, this, LM_HEIGHT, viewportElement());
-}
-
-SVGAnimatedLength *SVGRectElement::rx() const
-{
- return lazy_create<SVGAnimatedLength>(m_rx, this, LM_WIDTH, viewportElement());
-}
-
-SVGAnimatedLength *SVGRectElement::ry() const
-{
- return lazy_create<SVGAnimatedLength>(m_ry, this, LM_HEIGHT, viewportElement());
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, Rx, rx, SVGNames::rxAttr.localName(), m_rx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength*, Length, length, Ry, ry, SVGNames::ryAttr.localName(), m_ry.get())
void SVGRectElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::yAttr)
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::rxAttr)
- rx()->baseVal()->setValueAsString(value.impl());
+ rxBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::ryAttr)
- ry()->baseVal()->setValueAsString(value.impl());
+ ryBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::widthAttr)
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
else if (attr->name() == SVGNames::heightAttr)
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
else
{
if(SVGTests::parseMappedAttribute(attr)) return;
Path SVGRectElement::toPathData() const
{
- float _x = x()->baseVal()->value(), _y = y()->baseVal()->value();
- float _width = width()->baseVal()->value(), _height = height()->baseVal()->value();
+ float _x = xBaseValue()->value(), _y = yBaseValue()->value();
+ float _width = widthBaseValue()->value(), _height = heightBaseValue()->value();
bool hasRx = hasAttribute(String("rx").impl());
bool hasRy = hasAttribute(String("ry").impl());
if(hasRx || hasRy)
{
- float _rx = hasRx ? rx()->baseVal()->value() : ry()->baseVal()->value();
- float _ry = hasRy ? ry()->baseVal()->value() : rx()->baseVal()->value();
+ float _rx = hasRx ? rxBaseValue()->value() : ryBaseValue()->value();
+ float _ry = hasRy ? ryBaseValue()->value() : rxBaseValue()->value();
return Path::createRoundedRectangle(FloatRect(_x, _y, _width, _height), FloatSize(_rx, _ry));
}
const SVGStyledElement *SVGRectElement::pushAttributeContext(const SVGStyledElement *context)
{
// All attribute's contexts are equal (so just take the one from 'x').
- const SVGStyledElement *restore = x()->baseVal()->context();
+ const SVGStyledElement *restore = xBaseValue()->context();
- x()->baseVal()->setContext(context);
- y()->baseVal()->setContext(context);
- width()->baseVal()->setContext(context);
- height()->baseVal()->setContext(context);
+ xBaseValue()->setContext(context);
+ yBaseValue()->setContext(context);
+ widthBaseValue()->setContext(context);
+ heightBaseValue()->setContext(context);
SVGStyledElement::pushAttributeContext(context);
return restore;
namespace WebCore
{
- class SVGAnimatedLength;
+ class SVGLength;
class SVGRectElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGRectElement' functions
- SVGAnimatedLength *x() const;
- SVGAnimatedLength *y() const;
-
- SVGAnimatedLength *width() const;
- SVGAnimatedLength *height() const;
-
- SVGAnimatedLength *rx() const;
- SVGAnimatedLength *ry() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
virtual const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
- mutable RefPtr<SVGAnimatedLength> m_rx;
- mutable RefPtr<SVGAnimatedLength> m_ry;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Rx, rx)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Ry, ry)
};
} // namespace WebCore
#include "KCanvasRenderingStyle.h"
#include "KSVGTimeScheduler.h"
#include "SVGAngle.h"
-#include "SVGAnimatedLength.h"
-#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
+#include "SVGLength.h"
+#include "SVGPreserveAspectRatio.h"
+#include "SVGRect.h"
#include "SVGDocumentExtensions.h"
#include "SVGMatrix.h"
#include "SVGNumber.h"
, m_useCurrentView(false)
, m_timeScheduler(new TimeScheduler(doc))
{
-}
+ const SVGElement* viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
+ const SVGStyledElement* context = reinterpret_cast<const SVGStyledElement*>(ownerDocument()->documentElement() == this ? 0 : this);
-SVGSVGElement::~SVGSVGElement()
-{
- delete m_timeScheduler;
-}
+ m_x = new SVGLength(context, LM_WIDTH, viewport);
+ m_y = new SVGLength(context, LM_HEIGHT, viewport);
+ m_width = new SVGLength(context, LM_WIDTH, viewport);
+ m_height = new SVGLength(context, LM_HEIGHT, viewport);
-SVGAnimatedLength *SVGSVGElement::x() const
-{
- const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
- return lazy_create<SVGAnimatedLength>(m_x, (SVGStyledElement *)0, LM_WIDTH, viewport);
-}
-
-SVGAnimatedLength *SVGSVGElement::y() const
-{
- const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
- return lazy_create<SVGAnimatedLength>(m_y, (SVGStyledElement *)0, LM_HEIGHT, viewport);
+ m_width->setValueAsString("100%");
+ m_height->setValueAsString("100%");
}
-SVGAnimatedLength *SVGSVGElement::width() const
+SVGSVGElement::~SVGSVGElement()
{
- if (!m_width) {
- String temp("100%");
- const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
- lazy_create<SVGAnimatedLength>(m_width, (SVGStyledElement *)ownerDocument()->documentElement() == this ? 0 : this, LM_WIDTH, viewport);
- m_width->baseVal()->setValueAsString(temp.impl());
- }
-
- return m_width.get();
+ delete m_timeScheduler;
}
-SVGAnimatedLength *SVGSVGElement::height() const
-{
- if (!m_height) {
- String temp("100%");
- const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
- lazy_create<SVGAnimatedLength>(m_height, (SVGStyledElement *)ownerDocument()->documentElement() == this ? 0 : this, LM_HEIGHT, viewport);
- m_height->baseVal()->setValueAsString(temp.impl());
- }
-
- return m_height.get();
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength*, Length, length, X, x, SVGNames::xAttr.localName(), m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength*, Length, length, Y, y, SVGNames::yAttr.localName(), m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength*, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength*, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height.get())
AtomicString SVGSVGElement::contentScriptType() const
{
FloatRect SVGSVGElement::viewport() const
{
- double _x = x()->baseVal()->value();
- double _y = y()->baseVal()->value();
- double w = width()->baseVal()->value();
- double h = height()->baseVal()->value();
+ double _x = xBaseValue()->value();
+ double _y = yBaseValue()->value();
+ double w = widthBaseValue()->value();
+ double h = heightBaseValue()->value();
RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(w, h);
viewBox->matrix().map(_x, _y, &_x, &_y);
viewBox->matrix().map(w, h, &w, &h);
addSVGWindowEventListner(zoomEvent, attr);
}
if (attr->name() == SVGNames::xAttr) {
- x()->baseVal()->setValueAsString(value.impl());
+ xBaseValue()->setValueAsString(value.impl());
} else if (attr->name() == SVGNames::yAttr) {
- y()->baseVal()->setValueAsString(value.impl());
+ yBaseValue()->setValueAsString(value.impl());
} else if (attr->name() == SVGNames::widthAttr) {
- width()->baseVal()->setValueAsString(value.impl());
+ widthBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_WIDTH, value);
} else if (attr->name() == SVGNames::heightAttr) {
- height()->baseVal()->setValueAsString(value.impl());
+ heightBaseValue()->setValueAsString(value.impl());
addCSSProperty(attr, CSS_PROP_HEIGHT, value);
} else {
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGFitToViewBox::parseMappedAttribute(attr)) {
if (renderer())
- static_cast<RenderSVGContainer*>(renderer())->setViewBox(FloatRect(viewBox()->baseVal()->x(), viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height()));
+ static_cast<RenderSVGContainer*>(renderer())->setViewBox(FloatRect(viewBoxBaseValue()->x(), viewBoxBaseValue()->y(), viewBoxBaseValue()->width(), viewBoxBaseValue()->height()));
}
if (SVGZoomAndPan::parseMappedAttribute(attr))
return;
SVGMatrix *mat = createSVGMatrix();
if(mat)
{
- mat->translate(x()->baseVal()->value(), y()->baseVal()->value());
+ mat->translate(xBaseValue()->value(), yBaseValue()->value());
if(attributes()->getNamedItem(SVGNames::viewBoxAttr))
{
- RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value());
+ RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(widthBaseValue()->value(), heightBaseValue()->value());
mat->multiply(viewBox.get());
}
}
SVGMatrix *mat = SVGStyledLocatableElement::getScreenCTM();
if(mat)
{
- mat->translate(x()->baseVal()->value(), y()->baseVal()->value());
+ mat->translate(xBaseValue()->value(), yBaseValue()->value());
if(attributes()->getNamedItem(SVGNames::viewBoxAttr))
{
- RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value());
+ RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(widthBaseValue()->value(), heightBaseValue()->value());
mat->multiply(viewBox.get());
}
}
RenderSVGContainer *rootContainer = new (arena) RenderSVGContainer(this);
// FIXME: all this setup should be done after attributesChanged, not here.
- float _x = x()->baseVal()->value();
- float _y = y()->baseVal()->value();
- float _width = width()->baseVal()->value();
- float _height = height()->baseVal()->value();
+ float _x = xBaseValue()->value();
+ float _y = yBaseValue()->value();
+ float _width = widthBaseValue()->value();
+ float _height = heightBaseValue()->value();
rootContainer->setViewport(FloatRect(_x, _y, _width, _height));
- rootContainer->setViewBox(FloatRect(viewBox()->baseVal()->x(), viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height()));
- rootContainer->setAlign(KCAlign(preserveAspectRatio()->baseVal()->align() - 1));
- rootContainer->setSlice(preserveAspectRatio()->baseVal()->meetOrSlice() == SVG_MEETORSLICE_SLICE);
+ rootContainer->setViewBox(FloatRect(viewBoxBaseValue()->x(), viewBoxBaseValue()->y(), viewBoxBaseValue()->width(), viewBoxBaseValue()->height()));
+ rootContainer->setAlign(KCAlign(preserveAspectRatioBaseValue()->align() - 1));
+ rootContainer->setSlice(preserveAspectRatioBaseValue()->meetOrSlice() == SVG_MEETORSLICE_SLICE);
return rootContainer;
}
class SVGLength;
class SVGMatrix;
class SVGTransform;
- class SVGAnimatedLength;
+ class SVGLength;
class TimeScheduler;
class SVGSVGElement : public SVGStyledLocatableElement,
public SVGTests,
virtual bool isValid() const { return SVGTests::isValid(); }
// 'SVGSVGElement' functions
- SVGAnimatedLength* x() const;
- SVGAnimatedLength* y() const;
- SVGAnimatedLength* width() const;
- SVGAnimatedLength* height() const;
-
AtomicString contentScriptType() const;
void setContentScriptType(const AtomicString& type);
// 'virtual SVGZoomAndPan functions
virtual void setZoomAndPan(unsigned short zoomAndPan);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
void addSVGWindowEventListner(const AtomicString& eventType, const Attribute* attr);
- mutable RefPtr<SVGAnimatedLength> m_x;
- mutable RefPtr<SVGAnimatedLength> m_y;
- mutable RefPtr<SVGAnimatedLength> m_width;
- mutable RefPtr<SVGAnimatedLength> m_height;
-
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, X, x)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Y, y)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Width, width)
+ ANIMATED_PROPERTY_DECLARATIONS(SVGLength*, RefPtr<SVGLength>, Height, height)
bool m_useCurrentView;
TimeScheduler* m_timeScheduler;
};
static void executeScript(Document *document, StringImpl *jsCode);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
String m_type;
};
virtual void handleTimerEvent(double timePercentage);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
DeprecatedString m_savedTo;
};
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGStopElement.h"
-#include "SVGAnimatedNumber.h"
using namespace WebCore;
-SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document *doc) : SVGStyledElement(tagName, doc)
+SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document *doc)
+ : SVGStyledElement(tagName, doc)
+ , m_offset(0.0)
{
}
{
}
-SVGAnimatedNumber *SVGStopElement::offset() const
-{
- return lazy_create<SVGAnimatedNumber>(m_offset, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGStopElement, double, Number, number, Offset, offset, SVGNames::offsetAttr.localName(), m_offset)
void SVGStopElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::offsetAttr) {
if(value.endsWith("%"))
- offset()->setBaseVal(value.deprecatedString().left(value.length() - 1).toDouble() / 100.);
+ setOffsetBaseValue(value.deprecatedString().left(value.length() - 1).toDouble() / 100.);
else
- offset()->setBaseVal(value.deprecatedString().toDouble());
+ setOffsetBaseValue(value.deprecatedString().toDouble());
} else
SVGStyledElement::parseMappedAttribute(attr);
namespace WebCore
{
- class SVGAnimatedNumber;
class SVGStopElement : public SVGStyledElement
{
public:
virtual bool isGradientStop() const { return true; }
// 'SVGStoplement' functions
- SVGAnimatedNumber *offset() const;
-
virtual void parseMappedAttribute(MappedAttribute *attr);
private:
- mutable RefPtr<SVGAnimatedNumber> m_offset;
+ ANIMATED_PROPERTY_DECLARATIONS(double, double, Offset, offset)
};
} // namespace WebCore
class String;
class CSSValue;
class CSSStyleDeclaration;
- class SVGAnimatedString;
class SVGStylable {
public:
virtual ~SVGStylable();
// 'SVGStylable' functions
- virtual SVGAnimatedString* className() const = 0;
-
virtual CSSStyleDeclaration* style() = 0;
virtual CSSValue* getPresentationAttribute(StringImpl* name) = 0;
};
#include "SVGStyledElement.h"
#include "Attr.h"
+#include "HTMLNames.h"
#include "Document.h"
#include "KCanvasRenderingStyle.h"
#include "KRenderingDevice.h"
#include "PlatformString.h"
#include "RenderView.h"
#include "RenderPath.h"
-#include "SVGAnimatedString.h"
#include "SVGElement.h"
#include "SVGHelper.h"
#include "SVGMatrix.h"
{
}
-SVGAnimatedString* SVGStyledElement::className() const
-{
- return lazy_create(m_className, (SVGStyledElement*)0); // TODO: use notification context?
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGStyledElement, String, String, string, ClassName, className, HTMLNames::classAttr.localName(), m_className)
RenderObject* SVGStyledElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
virtual bool isStyled() const { return true; }
// 'SVGStylable' functions
- virtual SVGAnimatedString* className() const;
-
// These need to be implemented.
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
virtual Path toPathData() const { return Path(); }
private:
mutable RefPtr<CSSStyleDeclaration> m_pa;
- mutable RefPtr<SVGAnimatedString> m_className;
-
+ ANIMATED_PROPERTY_DECLARATIONS(String, String, ClassName, className)
// Optimized updating logic
bool m_updateVectorial : 1;
};
#include "SVGDocument.h"
#include "SVGStyledTransformableElement.h"
#include "SVGStyledElement.h"
-#include "SVGAnimatedTransformList.h"
+#include "SVGTransformList.h"
using namespace WebCore;
SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document *doc)
-: SVGStyledLocatableElement(tagName, doc), SVGTransformable()
+ : SVGStyledLocatableElement(tagName, doc)
+ , SVGTransformable()
+ , m_transform(new SVGTransformList(this))
{
}
{
}
-SVGAnimatedTransformList *SVGStyledTransformableElement::transform() const
-{
- return lazy_create<SVGAnimatedTransformList>(m_transform, this);
-}
+ANIMATED_PROPERTY_DEFINITIONS(SVGStyledTransformableElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr.localName(), m_transform.get())
SVGMatrix *SVGStyledTransformableElement::localMatrix() const
{
void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::transformAttr) {
- SVGTransformList *localTransforms = transform()->baseVal();
+ SVGTransformList *localTransforms = transformBaseValue();
localTransforms->clear();
SVGTransformable::parseTransformAttribute(localTransforms, attr->value());
class Attribute;
class Node;
class StringImpl;
- class SVGAnimatedTransformList;
+ class SVGTransformList;
class SVGMatrix;
class SVGTransformList;
virtual bool isStyledTransformable() const { return true; }
// 'SVGTransformable' functions
- virtual SVGAnimatedTransformList *transform() const;
virtual SVGMatrix *localMatrix() const;
// Derived from: 'SVGLocatable'
protected:
mutable RefPtr<SVGMatrix> m_localMatrix;
- mutable RefPtr<SVGAnimatedTransformList> m_transform;
+ ANIMATED_PROPERTY_DECLARATIONS(SVGTransformList*, RefPtr<SVGTransformList>, Transform, transform)
};
} // namespace WebCore
#include "SVGHelper.h"
#include "SVGTests.h"
#include "SVGSwitchElement.h"
-#include "SVGAnimatedLength.h"
+#include "SVGLength.h"
namespace WebCore {
virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
+
private:
mutable bool m_insideRenderSection;
};
virtual void parseMappedAttribute(MappedAttribute *attr);
virtual bool shouldAttachChild(Element *) const { return false; }
+
+ protected:
+ virtual const SVGElement* contextElement() const { return this; }
};
} // namespace WebCore
#include "SVGTRefElement.h"
#include "SVGNames.h"
#include "XLinkNames.h"
-#include "SVGAnimatedString.h"
#include "SVGDocument.h"
#include "RenderInline.h"
void SVGTRefElement::updateReferencedText()
{
- String targetId = SVGURIReference::getTarget(String(href()->baseVal()).deprecatedString());
+ String targetId = SVGURIReference::getTarget(String(hrefBaseValue()).deprecatedString());
Element *targetElement = ownerDocument()->getElementById(targetId.impl());
SVGElement *target = svg_dynamic_cast(targetElement);
if (target) {
virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
bool childShouldCreateRenderer(Node *child) const;
+ protected:
+ &nbs