diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/svg')
110 files changed, 1088 insertions, 761 deletions
diff --git a/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h b/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h index fc5946579b..0aefbac891 100644 --- a/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h +++ b/src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h @@ -29,10 +29,10 @@ namespace WebCore { struct LinearGradientAttributes : GradientAttributes { LinearGradientAttributes() - : m_x1(0.0) - , m_y1(0.0) - , m_x2(1.0) - , m_y2(0.0) + : m_x1() + , m_y1() + , m_x2(LengthModeWidth, "100%") + , m_y2() , m_x1Set(false) , m_y1Set(false) , m_x2Set(false) @@ -40,15 +40,15 @@ namespace WebCore { { } - double x1() const { return m_x1; } - double y1() const { return m_y1; } - double x2() const { return m_x2; } - double y2() const { return m_y2; } + SVGLength x1() const { return m_x1; } + SVGLength y1() const { return m_y1; } + SVGLength x2() const { return m_x2; } + SVGLength y2() const { return m_y2; } - void setX1(double value) { m_x1 = value; m_x1Set = true; } - void setY1(double value) { m_y1 = value; m_y1Set = true; } - void setX2(double value) { m_x2 = value; m_x2Set = true; } - void setY2(double value) { m_y2 = value; m_y2Set = true; } + void setX1(const SVGLength& value) { m_x1 = value; m_x1Set = true; } + void setY1(const SVGLength& value) { m_y1 = value; m_y1Set = true; } + void setX2(const SVGLength& value) { m_x2 = value; m_x2Set = true; } + void setY2(const SVGLength& value) { m_y2 = value; m_y2Set = true; } bool hasX1() const { return m_x1Set; } bool hasY1() const { return m_y1Set; } @@ -57,10 +57,10 @@ namespace WebCore { private: // Properties - double m_x1; - double m_y1; - double m_x2; - double m_y2; + SVGLength m_x1; + SVGLength m_y1; + SVGLength m_x2; + SVGLength m_y2; // Property states bool m_x1Set : 1; diff --git a/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h b/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h index 273cd297a1..76457215a6 100644 --- a/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h +++ b/src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h @@ -29,11 +29,11 @@ namespace WebCore { struct RadialGradientAttributes : GradientAttributes { RadialGradientAttributes() - : m_cx(0.5) - , m_cy(0.5) - , m_r(0.5) - , m_fx(0.0) - , m_fy(0.0) + : m_cx(LengthModeWidth, "50%") + , m_cy(LengthModeWidth, "50%") + , m_r(LengthModeWidth, "50%") + , m_fx() + , m_fy() , m_cxSet(false) , m_cySet(false) , m_rSet(false) @@ -42,17 +42,17 @@ namespace WebCore { { } - double cx() const { return m_cx; } - double cy() const { return m_cy; } - double r() const { return m_r; } - double fx() const { return m_fx; } - double fy() const { return m_fy; } + SVGLength cx() const { return m_cx; } + SVGLength cy() const { return m_cy; } + SVGLength r() const { return m_r; } + SVGLength fx() const { return m_fx; } + SVGLength fy() const { return m_fy; } - void setCx(double value) { m_cx = value; m_cxSet = true; } - void setCy(double value) { m_cy = value; m_cySet = true; } - void setR(double value) { m_r = value; m_rSet = true; } - void setFx(double value) { m_fx = value; m_fxSet = true; } - void setFy(double value) { m_fy = value; m_fySet = true; } + void setCx(const SVGLength& value) { m_cx = value; m_cxSet = true; } + void setCy(const SVGLength& value) { m_cy = value; m_cySet = true; } + void setR(const SVGLength& value) { m_r = value; m_rSet = true; } + void setFx(const SVGLength& value) { m_fx = value; m_fxSet = true; } + void setFy(const SVGLength& value) { m_fy = value; m_fySet = true; } bool hasCx() const { return m_cxSet; } bool hasCy() const { return m_cySet; } @@ -62,11 +62,11 @@ namespace WebCore { private: // Properties - double m_cx; - double m_cy; - double m_r; - double m_fx; - double m_fy; + SVGLength m_cx; + SVGLength m_cy; + SVGLength m_r; + SVGLength m_fx; + SVGLength m_fy; // Property states bool m_cxSet : 1; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp index 6bf7f91e9b..7cb7b3e917 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp @@ -33,6 +33,7 @@ #include "EventNames.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderTypes.h" #include "KeyboardEvent.h" #include "MappedAttribute.h" #include "MouseEvent.h" @@ -53,6 +54,8 @@ SVGAElement::SVGAElement(const QualifiedName& tagName, Document *doc) , SVGLangSpace() , SVGExternalResourcesRequired() , m_target(this, SVGNames::targetAttr) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } @@ -152,7 +155,7 @@ void SVGAElement::defaultEventHandler(Event* evt) } #endif if (document()->frame()) - document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, false, true); + document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, false, true, SendReferrer); } evt->setDefaultHandled(); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAElement.h b/src/3rdparty/webkit/WebCore/svg/SVGAElement.h index 8890ca4662..a3e59c5785 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGAElement.h @@ -3,8 +3,6 @@ 2004, 2005 Rob Buis <buis@kde.org> 2007 Eric Seidel <eric@webkit.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -60,11 +58,16 @@ namespace WebCore { virtual bool childShouldCreateRenderer(Node*) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGAElement, SVGNames::aTagString, SVGNames::targetAttrString, String, Target, target) + + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGAElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGAElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp b/src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp index 6ca45396d4..66062439ae 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp @@ -67,6 +67,7 @@ #include "SVGFELightElement.cpp" #include "SVGFEMergeElement.cpp" #include "SVGFEMergeNodeElement.cpp" +#include "SVGFEMorphologyElement.cpp" #include "SVGFEOffsetElement.cpp" #include "SVGFEPointLightElement.cpp" #include "SVGFESpecularLightingElement.cpp" @@ -149,3 +150,4 @@ #include "SVGViewSpec.cpp" #include "SVGZoomAndPan.cpp" #include "SVGZoomEvent.cpp" +#include "SynchronizablePropertyController.cpp" diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.cpp index d9da3f6386..f13edf582d 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.cpp @@ -35,6 +35,7 @@ namespace WebCore { SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document* doc) : SVGTextPositioningElement(tagName, doc) + , m_href(this, XLinkNames::hrefAttr) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.h b/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.h index 91c99e36a6..b5718808d2 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.h @@ -47,8 +47,9 @@ namespace WebCore { SVGGlyphElement* glyphElement() const; - protected: - virtual const SVGElement* contextElement() const { return this; } + private: + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGAltGlyphElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedProperty.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedProperty.h index 6803055580..984046fbe3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedProperty.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedProperty.h @@ -1,5 +1,6 @@ /* Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> + Copyright (C) Research In Motion Limited 2009. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -62,14 +63,16 @@ namespace WebCore { struct IsDerivedFromSVGElement; // Helper template used for synchronizing SVG <-> XML properties - template<typename OwnerElement, typename DecoratedType> - void synchronizeProperty(const OwnerElement* ownerElement, const QualifiedName& attributeName, DecoratedType baseValue); + template<typename OwnerType, typename DecoratedType, bool isDerivedFromSVGElement> + struct PropertySynchronizer; // Abstract base class class SVGAnimatedPropertyBase : public Noncopyable { public: virtual ~SVGAnimatedPropertyBase() { } virtual void synchronize() const = 0; + virtual void startAnimation() const = 0; + virtual void stopAnimation() = 0; }; template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -124,6 +127,7 @@ namespace WebCore { // Tear offs only used by bindings, never in internal code PassRefPtr<TearOff> animatedTearOff() const; + void registerProperty(); virtual void synchronize() const; void startAnimation() const; @@ -140,6 +144,10 @@ namespace WebCore { const AtomicString& m_attributeIdentifier; mutable SynchronizableTypeWrapper<StorableType> m_value; + +#ifndef NDEBUG + bool m_registered; +#endif }; // SVGAnimatedPropertyTearOff implementation @@ -186,8 +194,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeName.localName()) , m_value() +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -198,8 +210,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeIdentifier) , m_value() +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -211,8 +227,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeName.localName()) , m_value(arg1) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -225,8 +245,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeIdentifier) , m_value(arg1) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -239,8 +263,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeName.localName()) , m_value(arg1, arg2) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -254,8 +282,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeIdentifier) , m_value(arg1, arg2) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -269,8 +301,12 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeName.localName()) , m_value(arg1, arg2, arg3) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> @@ -285,20 +321,26 @@ namespace WebCore { , m_attributeName(attributeName) , m_attributeIdentifier(attributeIdentifier) , m_value(arg1, arg2, arg3) +#ifndef NDEBUG + , m_registered(false) +#endif { ASSERT(m_ownerType); + registerProperty(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> typename SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::DecoratedType SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::value() const { + ASSERT(m_registered); return m_value; } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::setValue(typename SVGAnimatedProperty::DecoratedType newValue) { + ASSERT(m_registered); m_value = newValue; ownerElement()->setSynchronizedSVGAttributes(false); } @@ -307,6 +349,7 @@ namespace WebCore { typename SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::DecoratedType SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::baseValue() const { + ASSERT(m_registered); const OwnerElement* ownerElement = this->ownerElement(); SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); if (extensions && extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier)) @@ -318,6 +361,7 @@ namespace WebCore { template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::setBaseValue(typename SVGAnimatedProperty::DecoratedType newValue) { + ASSERT(m_registered); const OwnerElement* ownerElement = this->ownerElement(); SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); if (extensions && extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier)) { @@ -334,25 +378,38 @@ namespace WebCore { PassRefPtr<typename SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::TearOff> SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::animatedTearOff() const { + ASSERT(m_registered); return lookupOrCreateWrapper<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName, TearOff, OwnerElement>(*this, ownerElement(), m_attributeName, m_attributeIdentifier); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> + void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::registerProperty() + { + ASSERT(!m_registered); + ownerElement()->propertyController().registerProperty(m_attributeName, this); + +#ifndef NDEBUG + m_registered = true; +#endif + } + + template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::synchronize() const { + ASSERT(m_registered); if (!m_value.needsSynchronization()) return; - synchronizeProperty<OwnerElement, DecoratedType>(ownerElement(), m_attributeName, baseValue()); + PropertySynchronizer<OwnerElement, DecoratedType, IsDerivedFromSVGElement<OwnerType>::value>::synchronize(ownerElement(), m_attributeName, baseValue()); m_value.setSynchronized(); } template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::startAnimation() const { + ASSERT(m_registered); const OwnerElement* ownerElement = this->ownerElement(); - SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); - if (extensions) { + if (SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions()) { ASSERT(!extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier)); extensions->setBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier, m_value); } @@ -361,12 +418,12 @@ namespace WebCore { template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::stopAnimation() { + ASSERT(m_registered); const OwnerElement* ownerElement = this->ownerElement(); - SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); - if (extensions) { + if (SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions()) { ASSERT(extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier)); setValue(extensions->baseValue<DecoratedType>(ownerElement, m_attributeIdentifier)); - extensions->removeBaseValue<AnimatedType>(ownerElement, m_attributeIdentifier); + extensions->removeBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier); } } @@ -406,39 +463,37 @@ namespace WebCore { static const bool value = true; }; - class SVGExternalResourcesRequired; - template<> - struct IsDerivedFromSVGElement<SVGExternalResourcesRequired> : Noncopyable { - static const bool value = false; - }; - - class SVGFitToViewBox; + class SVGViewSpec; template<> - struct IsDerivedFromSVGElement<SVGFitToViewBox> : Noncopyable { + struct IsDerivedFromSVGElement<SVGViewSpec> : Noncopyable { static const bool value = false; }; - class SVGURIReference; - template<> - struct IsDerivedFromSVGElement<SVGURIReference> : Noncopyable { - static const bool value = false; + // PropertySynchronizer implementation + template<typename OwnerElement, typename DecoratedType> + struct PropertySynchronizer<OwnerElement, DecoratedType, true> : Noncopyable { + static void synchronize(const OwnerElement* ownerElement, const QualifiedName& attributeName, DecoratedType baseValue) + { + AtomicString value(SVGAnimatedTypeValue<DecoratedType>::toString(baseValue)); + + NamedNodeMap* namedAttrMap = ownerElement->attributes(false); + Attribute* old = namedAttrMap->getAttributeItem(attributeName); + if (old && value.isNull()) + namedAttrMap->removeAttribute(old->name()); + else if (!old && !value.isNull()) + namedAttrMap->addAttribute(const_cast<OwnerElement*>(ownerElement)->createAttribute(attributeName, value)); + else if (old && !value.isNull()) + old->setValue(value); + } }; - // Central function handling the main SVG<->XML synchronization part. template<typename OwnerElement, typename DecoratedType> - void synchronizeProperty(const OwnerElement* ownerElement, const QualifiedName& attributeName, DecoratedType baseValue) - { - AtomicString value(SVGAnimatedTypeValue<DecoratedType>::toString(baseValue)); - - NamedNodeMap* namedAttrMap = ownerElement->attributes(false); - Attribute* old = namedAttrMap->getAttributeItem(attributeName); - if (old && value.isNull()) - namedAttrMap->removeAttribute(old->name()); - else if (!old && !value.isNull()) - namedAttrMap->addAttribute(const_cast<OwnerElement*>(ownerElement)->createAttribute(attributeName, value)); - else if (old && !value.isNull()) - old->setValue(value); - } + struct PropertySynchronizer<OwnerElement, DecoratedType, false> : Noncopyable { + static void synchronize(const OwnerElement*, const QualifiedName&, DecoratedType) + { + // no-op, for types not inheriting from Element, thus nothing to synchronize + } + }; // Helper macro used to register animated properties within SVG* classes #define ANIMATED_PROPERTY_DECLARATIONS(OwnerType, ElementTag, AttributeTag, AnimatedType, UpperProperty, LowerProperty) \ @@ -451,8 +506,7 @@ namespace WebCore { void set##UpperProperty(DecoratedTypeFor##UpperProperty type) { m_##LowerProperty.setValue(type); } \ DecoratedTypeFor##UpperProperty LowerProperty##BaseValue() const { return m_##LowerProperty.baseValue(); } \ void set##UpperProperty##BaseValue(DecoratedTypeFor##UpperProperty type) { m_##LowerProperty.setBaseValue(type); } \ - PassRefPtr<SVGAnimatedProperty##UpperProperty::TearOff> LowerProperty##Animated() const { return m_##LowerProperty.animatedTearOff(); } \ - void synchronize##UpperProperty() const { m_##LowerProperty.synchronize(); } + PassRefPtr<SVGAnimatedProperty##UpperProperty::TearOff> LowerProperty##Animated() const { return m_##LowerProperty.animatedTearOff(); } }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedTemplate.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedTemplate.h index 3f04c5bd8e..e7c49c157b 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedTemplate.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedTemplate.h @@ -158,7 +158,7 @@ namespace WebCore { if (!wrapper) { wrapper = Type::create(creator, element, attrName); - element->addSVGPropertySynchronizer(attrName, creator); + element->propertyController().setPropertyNeedsSynchronization(attrName); Type::wrapperCache()->set(key, wrapper.get()); } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp index cf945f858e..67e32e04d0 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp @@ -52,7 +52,8 @@ namespace WebCore { SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document* doc) : SVGSMILElement(tagName, doc) , SVGTests() - , SVGExternalResourcesRequired() + , SVGExternalResourcesRequired() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) , m_animationValid(false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h index 1835a8db7e..b0b091b72b 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h @@ -1,12 +1,10 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> Copyright (C) 2007 Eric Seidel <eric@webkit.org> Copyright (C) 2008 Apple Inc. All rights reserved. Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -66,8 +64,6 @@ namespace WebCore { static bool attributeIsCSS(const String& attributeName); protected: - virtual const SVGElement* contextElement() const { return this; } - enum CalcMode { CalcModeDiscrete, CalcModeLinear, CalcModePaced, CalcModeSpline }; CalcMode calcMode() const; @@ -109,6 +105,11 @@ namespace WebCore { float calculatePercentForSpline(float percent, unsigned splineIndex) const; protected: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGAnimationElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + bool m_animationValid; Vector<String> m_values; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.cpp index 0c48f5130e..23292991d6 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.cpp @@ -41,6 +41,7 @@ SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document* doc) , m_cx(this, SVGNames::cxAttr, LengthModeWidth) , m_cy(this, SVGNames::cyAttr, LengthModeHeight) , m_r(this, SVGNames::rAttr, LengthModeOther) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h b/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h index 598e51fa3a..69b015de9e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -47,13 +45,17 @@ namespace WebCore { virtual Path toPathData() const; protected: - virtual const SVGElement* contextElement() const { return this; } virtual bool hasRelativeValues() const; private: ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGNames::circleTagString, SVGNames::cxAttrString, SVGLength, Cx, cx) ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGNames::circleTagString, SVGNames::cyAttrString, SVGLength, Cy, cy) ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGNames::circleTagString, SVGNames::rAttrString, SVGLength, R, r) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.cpp index 691e4d5baa..bbeac910b8 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.cpp @@ -40,6 +40,7 @@ SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document* d , SVGLangSpace() , SVGExternalResourcesRequired() , m_clipPathUnits(this, SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h index 4043554f89..60791591ca 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -49,12 +47,14 @@ namespace WebCore { virtual SVGResource* canvasResource(); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGClipPathElement, SVGNames::clipPathTagString, SVGNames::clipPathUnitsAttrString, int, ClipPathUnits, clipPathUnits) + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGClipPathElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + RefPtr<SVGResourceClipper> m_clipper; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.cpp index 12e9e5da89..b282aa3c54 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.cpp @@ -40,6 +40,8 @@ SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document* doc) , SVGURIReference() , m_x(this, SVGNames::xAttr, LengthModeWidth) , m_y(this, SVGNames::yAttr, LengthModeHeight) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h b/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h index ddafb76de9..ee919a4762 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -50,13 +48,18 @@ namespace WebCore { virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGNames::cursorTagString, SVGNames::xAttrString, SVGLength, X, x) ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGNames::cursorTagString, SVGNames::yAttrString, SVGLength, Y, y) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + HashSet<SVGElement*> m_clients; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp index b084bb282d..c03c09b26e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp @@ -34,6 +34,7 @@ SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document* doc) , SVGTests() , SVGLangSpace() , SVGExternalResourcesRequired() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h b/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h index c4cac62660..4bb206e4f2 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -43,8 +41,11 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - protected: - virtual const SVGElement* contextElement() const { return this; } + private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGDefsElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp index 2169dd6032..a16493ada1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp @@ -3,6 +3,7 @@ 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> Copyright (C) 2008 Apple Inc. All rights reserved. Copyright (C) 2008 Alp Toker <alp@atoker.com> + Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -77,16 +78,6 @@ bool SVGElement::isSupported(StringImpl* feature, StringImpl* version) const return DOMImplementation::hasFeature(feature, version); } -String SVGElement::id() const -{ - return getAttribute(idAttr); -} - -void SVGElement::setId(const String& value, ExceptionCode&) -{ - setAttribute(idAttr, value); -} - String SVGElement::xmlbase() const { return getAttribute(XMLNames::baseAttr); @@ -243,7 +234,7 @@ void SVGElement::insertedIntoDocument() StyledElement::insertedIntoDocument(); SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); - String resourceId = SVGURIReference::getTarget(id()); + String resourceId = SVGURIReference::getTarget(getAttribute(idAttr)); if (extensions->isPendingResource(resourceId)) { std::auto_ptr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); if (clients->isEmpty()) @@ -279,10 +270,10 @@ void SVGElement::updateAnimatedSVGAttribute(const String& name) const m_synchronizingSVGAttributes = true; if (name.isEmpty()) { - invokeAllSVGPropertySynchronizers(); + m_propertyController.synchronizeAllProperties(); setSynchronizedSVGAttributes(true); } else - invokeSVGPropertySynchronizer(name); + m_propertyController.synchronizeProperty(name); m_synchronizingSVGAttributes = false; } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.h b/src/3rdparty/webkit/WebCore/svg/SVGElement.h index 3a17567050..b247a7472a 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.h @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "StyledElement.h" #include "SVGAnimatedProperty.h" +#include "SynchronizablePropertyController.h" namespace WebCore { @@ -41,8 +42,6 @@ namespace WebCore { static PassRefPtr<SVGElement> create(const QualifiedName&, Document*); virtual ~SVGElement(); - String id() const; - void setId(const String&, ExceptionCode&); String xmlbase() const; void setXmlbase(const String&, ExceptionCode&); @@ -79,14 +78,11 @@ namespace WebCore { HashSet<SVGElementInstance*> instancesForElement() const; - void addSVGPropertySynchronizer(const QualifiedName& attrName, const SVGAnimatedPropertyBase& base) const - { - m_svgPropertyMap.set(attrName.localName(), &base); - } - void setCursorElement(SVGCursorElement* cursorElement) { m_cursorElement = cursorElement; } void setCursorImageValue(CSSCursorImageValue* cursorImageValue) { m_cursorImageValue = cursorImageValue; } + SynchronizablePropertyController& propertyController() const { return m_propertyController; } + protected: SVGElement(const QualifiedName&, Document*); @@ -108,36 +104,13 @@ namespace WebCore { virtual void buildPendingResource() { } - // Inlined methods handling SVG property synchronization - void invokeSVGPropertySynchronizer(const String& name) const - { - if (m_svgPropertyMap.contains(name)) { - const SVGAnimatedPropertyBase* property = m_svgPropertyMap.get(name); - ASSERT(property); - - property->synchronize(); - } - } - - void invokeAllSVGPropertySynchronizers() const - { - HashMap<String, const SVGAnimatedPropertyBase*>::const_iterator it = m_svgPropertyMap.begin(); - const HashMap<String, const SVGAnimatedPropertyBase*>::const_iterator end = m_svgPropertyMap.end(); - for (; it != end; ++it) { - const SVGAnimatedPropertyBase* property = it->second; - ASSERT(property); - - property->synchronize(); - } - } - void mapInstanceToElement(SVGElementInstance*); void removeInstanceMapping(SVGElementInstance*); virtual bool haveLoadedRequiredResources(); ContainerNode* m_shadowParent; - mutable HashMap<String, const SVGAnimatedPropertyBase*> m_svgPropertyMap; + mutable SynchronizablePropertyController m_propertyController; SVGCursorElement* m_cursorElement; CSSCursorImageValue* m_cursorImageValue; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.idl b/src/3rdparty/webkit/WebCore/svg/SVGElement.idl index a1f331f96a..e4112c1fac 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.idl +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.idl @@ -25,7 +25,7 @@ module svg { interface [GenerateNativeConverter, Conditional=SVG] SVGElement : Element { - attribute [ConvertNullToNullString] DOMString id + attribute [ConvertNullToNullString, Reflect] DOMString id setter raises(DOMException); attribute [ConvertNullToNullString] DOMString xmlbase setter raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.cpp index 6d56ff82a0..4c67ff3e44 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.cpp @@ -42,6 +42,7 @@ SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document* doc , m_cy(this, SVGNames::cyAttr, LengthModeHeight) , m_rx(this, SVGNames::rxAttr, LengthModeWidth) , m_ry(this, SVGNames::ryAttr, LengthModeHeight) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.h b/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.h index 8c7d3a1269..5b54fd5949 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -47,7 +45,6 @@ namespace WebCore { virtual Path toPathData() const; protected: - virtual const SVGElement* contextElement() const { return this; } virtual bool hasRelativeValues() const; private: @@ -55,6 +52,11 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGNames::ellipseTagString, SVGNames::cyAttrString, SVGLength, Cy, cy) ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGNames::ellipseTagString, SVGNames::rxAttrString, SVGLength, Rx, rx) ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGNames::ellipseTagString, SVGNames::ryAttrString, SVGLength, Ry, ry) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.cpp b/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.cpp index 640f92e5b3..201ecbf920 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.cpp @@ -35,7 +35,6 @@ namespace WebCore { char SVGExternalResourcesRequiredIdentifier[] = "SVGExternalResourcesRequired"; SVGExternalResourcesRequired::SVGExternalResourcesRequired() - : m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.h b/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.h index e491e4b86b..f088c82684 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -32,16 +30,11 @@ namespace WebCore { extern char SVGExternalResourcesRequiredIdentifier[]; class MappedAttribute; - // FIXME: This is wrong for several reasons: - // 1. externalResourcesRequired is not animateable according to SVG 1.1 section 5.9 - // 2. externalResourcesRequired should just be part of SVGElement, and default to "false" for all elements - /* - SPEC: Note that the SVG DOM - defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the - SVG language definition says that externalResourcesRequired is not animated. Because the SVG - language definition states that externalResourcesRequired cannot be animated, the animVal will - always be the same as the baseVal. - */ + // Notes on a SVG 1.1 spec discrepancy: + // The SVG DOM defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the + // SVG language definition says that externalResourcesRequired is not animated. Because the SVG language definition + // states that externalResourcesRequired cannot be animated, the animVal will always be the same as the baseVal. + // FIXME: When implementing animVal support, make sure that animVal==baseVal for externalResourcesRequired class SVGExternalResourcesRequired { public: SVGExternalResourcesRequired(); @@ -50,12 +43,8 @@ namespace WebCore { bool parseMappedAttribute(MappedAttribute*); bool isKnownAttribute(const QualifiedName&); - virtual const SVGElement* contextElement() const = 0; - - private: - ANIMATED_PROPERTY_DECLARATIONS(SVGExternalResourcesRequired, SVGExternalResourcesRequiredIdentifier, - SVGNames::externalResourcesRequiredAttrString, bool, - ExternalResourcesRequired, externalResourcesRequired) + protected: + virtual void setExternalResourcesRequiredBaseValue(SVGAnimatedTypeValue<bool>::DecoratedType type) = 0; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.idl b/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.idl index 97a13fc5f7..d3179979e3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.idl +++ b/src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.idl @@ -38,7 +38,7 @@ module svg { readonly attribute SVGAnimatedString in1; readonly attribute SVGAnimatedString in2; - readonly attribute SVGAnimatedEnumeration _operator; + readonly attribute SVGAnimatedEnumeration operator; readonly attribute SVGAnimatedNumber k1; readonly attribute SVGAnimatedNumber k2; readonly attribute SVGAnimatedNumber k3; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp index ae5ce94dc1..3d807994cc 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp @@ -34,7 +34,6 @@ namespace WebCore { SVGFEFloodElement::SVGFEFloodElement(const QualifiedName& tagName, Document* doc) : SVGFilterPrimitiveStandardAttributes(tagName, doc) - , m_in1(this, SVGNames::inAttr) { } @@ -42,28 +41,14 @@ SVGFEFloodElement::~SVGFEFloodElement() { } -void SVGFEFloodElement::parseMappedAttribute(MappedAttribute* attr) -{ - const String& value = attr->value(); - if (attr->name() == SVGNames::inAttr) - setIn1BaseValue(value); - else - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); -} - bool SVGFEFloodElement::build(SVGResourceFilter* filterResource) { - FilterEffect* input = filterResource->builder()->getEffectById(in1()); - - if (!input) - return false; - RefPtr<RenderStyle> filterStyle = styleForRenderer(); Color color = filterStyle->svgStyle()->floodColor(); float opacity = filterStyle->svgStyle()->floodOpacity(); - RefPtr<FilterEffect> effect = FEFlood::create(input, color, opacity); + RefPtr<FilterEffect> effect = FEFlood::create(color, opacity); filterResource->addFilterEffect(this, effect.release()); return true; @@ -71,6 +56,6 @@ bool SVGFEFloodElement::build(SVGResourceFilter* filterResource) } -#endif // ENABLE(SVG) +#endif // ENABLE(SVG) && ENABLE(FILTERS) // vim:ts=4:noet diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h index ca4e18b82e..e83fc94a29 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h @@ -33,14 +33,10 @@ namespace WebCore { SVGFEFloodElement(const QualifiedName&, Document*); virtual ~SVGFEFloodElement(); - virtual void parseMappedAttribute(MappedAttribute*); virtual bool build(SVGResourceFilter*); - - private: - ANIMATED_PROPERTY_DECLARATIONS(SVGFEFloodElement, SVGNames::feFloodTagString, SVGNames::inAttrString, String, In1, in1) }; } // namespace WebCore -#endif // ENABLE(SVG) +#endif // ENABLE(SVG) && ENABLE(FILTERS) #endif diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.idl b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.idl index 814bbdfa5d..b3c3180024 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.idl +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.idl @@ -27,8 +27,5 @@ module svg { interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEFloodElement : SVGElement, SVGFilterPrimitiveStandardAttributes { - - readonly attribute SVGAnimatedString in1; - }; } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.h index 187c2129cc..c9bb61310b 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.h @@ -24,7 +24,7 @@ #define SVGFEGaussianBlurElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEGaussianBlur.h" +#include "FEGaussianBlur.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp index 8122960479..269d6b2e38 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp @@ -43,6 +43,8 @@ SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document* doc , SVGLangSpace() , SVGExternalResourcesRequired() , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.h index 67f3bd5e7d..7c6d89bad4 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -49,12 +47,17 @@ namespace WebCore { virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; virtual bool build(SVGResourceFilter*); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGNames::feImageTagString, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + CachedResourceHandle<CachedImage> m_cachedImage; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFELightElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFELightElement.h index f6e79fb1aa..92947a1f00 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFELightElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFELightElement.h @@ -39,9 +39,6 @@ namespace WebCore { virtual LightSource* lightSource() const = 0; virtual void parseMappedAttribute(MappedAttribute*); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGFELightElement, SVGFELightElementIdentifier, SVGNames::azimuthAttrString, float, Azimuth, azimuth) ANIMATED_PROPERTY_DECLARATIONS(SVGFELightElement, SVGFELightElementIdentifier, SVGNames::elevationAttrString, float, Elevation, elevation) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp index cb3a781716..8f4eed95c7 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp @@ -45,6 +45,8 @@ bool SVGFEMergeElement::build(SVGResourceFilter* filterResource) for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { if (n->hasTagName(SVGNames::feMergeNodeTag)) { FilterEffect* mergeEffect = filterResource->builder()->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1()); + if (!mergeEffect) + return false; mergeInputs.append(mergeEffect); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.h index 4633f98be9..cdec8d2152 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -36,9 +34,6 @@ namespace WebCore { virtual void parseMappedAttribute(MappedAttribute*); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGFEMergeNodeElement, SVGNames::feMergeNodeTagString, SVGNames::inAttrString, String, In1, in1) }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.cpp new file mode 100644 index 0000000000..4a06188f52 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.cpp @@ -0,0 +1,88 @@ +/* + Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGFEMorphologyElement.h" + +#include "MappedAttribute.h" +#include "SVGNames.h" +#include "SVGParserUtilities.h" +#include "SVGResourceFilter.h" + +namespace WebCore { + +char SVGRadiusXAttrIdentifier[] = "SVGRadiusXAttr"; +char SVGRadiusYAttrIdentifier[] = "SVGRadiusYAttr"; + +SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document* document) + : SVGFilterPrimitiveStandardAttributes(tagName, document) + , m_in1(this, SVGNames::inAttr) + , m__operator(this, SVGNames::operatorAttr, FEMORPHOLOGY_OPERATOR_ERODE) + , m_radiusX(this, SVGNames::radiusAttr) + , m_radiusY(this, SVGNames::radiusAttr) +{ +} + +SVGFEMorphologyElement::~SVGFEMorphologyElement() +{ +} + +void SVGFEMorphologyElement::setRadius(float, float) +{ + // FIXME: Needs an implementation. +} + +void SVGFEMorphologyElement::parseMappedAttribute(MappedAttribute* attr) +{ + const String& value = attr->value(); + if (attr->name() == SVGNames::operatorAttr) { + if (value == "erode") + set_operatorBaseValue(FEMORPHOLOGY_OPERATOR_ERODE); + else if (value == "dilate") + set_operatorBaseValue(FEMORPHOLOGY_OPERATOR_DILATE); + } else if (attr->name() == SVGNames::inAttr) + setIn1BaseValue(value); + else if (attr->name() == SVGNames::radiusAttr) { + float x, y; + if (parseNumberOptionalNumber(value, x, y)) { + setRadiusXBaseValue(x); + setRadiusYBaseValue(y); + } + } else + SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); +} + +bool SVGFEMorphologyElement::build(SVGResourceFilter* filterResource) +{ + FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); + + if (!input1) + return false; + + RefPtr<FilterEffect> effect = FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), radiusX(), radiusY()); + filterResource->addFilterEffect(this, effect.release()); + + return true; +} + +} //namespace WebCore + +#endif // ENABLE(SVG) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.h new file mode 100644 index 0000000000..6c1aec1e04 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SVGFEMorphologyElement_h +#define SVGFEMorphologyElement_h + +#if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGFEMorphology.h" +#include "SVGFilterPrimitiveStandardAttributes.h" + +namespace WebCore { + + extern char SVGRadiusXAttrIdentifier[]; + extern char SVGRadiusYAttrIdentifier[]; + + class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes { + public: + SVGFEMorphologyElement(const QualifiedName&, Document*); + virtual ~SVGFEMorphologyElement(); + + void setRadius(float radiusX, float radiusY); + + virtual void parseMappedAttribute(MappedAttribute*); + virtual bool build(SVGResourceFilter*); + + private: + ANIMATED_PROPERTY_DECLARATIONS(SVGFEMorphologyElement, SVGNames::feMorphologyTagString, SVGNames::inAttrString, String, In1, in1) + ANIMATED_PROPERTY_DECLARATIONS(SVGFEMorphologyElement, SVGNames::feMorphologyTagString, SVGNames::operatorAttrString, int, _operator, _operator) + ANIMATED_PROPERTY_DECLARATIONS(SVGFEMorphologyElement, SVGNames::feMorphologyTagString, SVGRadiusXAttrIdentifier, float, RadiusX, radiusX) + ANIMATED_PROPERTY_DECLARATIONS(SVGFEMorphologyElement, SVGNames::feMorphologyTagString, SVGRadiusYAttrIdentifier, float, RadiusY, radiusY) + }; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.idl b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.idl new file mode 100644 index 0000000000..cce0e365a8 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module svg { + + interface [Conditional=SVG&FILTERS, GenerateConstructor] SVGFEMorphologyElement : SVGElement, + SVGFilterPrimitiveStandardAttributes { + // Morphology Operators + const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; + const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; + const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; + + readonly attribute SVGAnimatedString in1; + readonly attribute SVGAnimatedEnumeration operator; + readonly attribute SVGAnimatedNumber radiusX; + readonly attribute SVGAnimatedNumber radiusY; + + void setRadius(in float radiusX, in float radiusY); + }; + +} diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.cpp index 7703b6f8fa..db461796bd 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.cpp @@ -2,6 +2,7 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + Copyright (C) 2009 Dirk Schulze <krit@webkit.org> This file is part of the KDE project @@ -54,6 +55,8 @@ SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document* doc) , m_height(this, SVGNames::heightAttr, LengthModeHeight, "120%") , m_filterResX(this, SVGNames::filterResAttr) , m_filterResY(this, SVGNames::filterResAttr) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. @@ -100,39 +103,36 @@ void SVGFilterElement::parseMappedAttribute(MappedAttribute* attr) } } -SVGResource* SVGFilterElement::canvasResource() +void SVGFilterElement::buildFilter(const FloatRect& targetRect) const { - if (!attached()) - return 0; - - if (!m_filter) - m_filter = new SVGResourceFilter(); - bool filterBBoxMode = filterUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; - m_filter->setFilterBoundingBoxMode(filterBBoxMode); - - float _x, _y, _width, _height; - - if (filterBBoxMode) { - _x = x().valueAsPercentage(); - _y = y().valueAsPercentage(); - _width = width().valueAsPercentage(); - _height = height().valueAsPercentage(); - } else { - m_filter->setXBoundingBoxMode(x().unitType() == LengthTypePercentage); - m_filter->setYBoundingBoxMode(y().unitType() == LengthTypePercentage); - - _x = x().value(this); - _y = y().value(this); - _width = width().value(this); - _height = height().value(this); - } - - m_filter->setFilterRect(FloatRect(_x, _y, _width, _height)); - bool primitiveBBoxMode = primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; + + FloatRect filterBBox; + if (filterBBoxMode) + filterBBox = FloatRect(x().valueAsPercentage(), + y().valueAsPercentage(), + width().valueAsPercentage(), + height().valueAsPercentage()); + else + filterBBox = FloatRect(x().value(this), + y().value(this), + width().value(this), + height().value(this)); + + FloatRect filterRect = filterBBox; + if (filterBBoxMode) + filterRect = FloatRect(targetRect.x() + filterRect.x() * targetRect.width(), + targetRect.y() + filterRect.y() * targetRect.height(), + filterRect.width() * targetRect.width(), + filterRect.height() * targetRect.height()); + + m_filter->setFilterBoundingBox(filterRect); + m_filter->setFilterRect(filterBBox); m_filter->setEffectBoundingBoxMode(primitiveBBoxMode); + m_filter->setFilterBoundingBoxMode(filterBBoxMode); + // Add effects to the filter m_filter->builder()->clearEffects(); for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { SVGElement* element = 0; @@ -147,12 +147,18 @@ SVGResource* SVGFilterElement::canvasResource() } } } +} +SVGResource* SVGFilterElement::canvasResource() +{ + if (!attached()) + return 0; + + if (!m_filter) + m_filter = SVGResourceFilter::create(this); return m_filter.get(); } } -#endif // ENABLE(SVG) - -// vim:ts=4:noet +#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h index 541ec14ac4..836c689364 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h @@ -3,8 +3,6 @@ Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -51,9 +49,6 @@ namespace WebCore { virtual void parseMappedAttribute(MappedAttribute*); virtual bool rendererIsNeeded(RenderStyle*) { return false; } - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGNames::filterTagString, SVGNames::filterUnitsAttrString, int, FilterUnits, filterUnits) ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGNames::filterTagString, SVGNames::primitiveUnitsAttrString, int, PrimitiveUnits, primitiveUnits) @@ -64,7 +59,19 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGNames::filterTagString, SVGFilterResXIdentifier, long, FilterResX, filterResX) ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGNames::filterTagString, SVGFilterResYIdentifier, long, FilterResY, filterResY) - RefPtr<SVGResourceFilter> m_filter; + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + mutable RefPtr<SVGResourceFilter> m_filter; + + private: + friend class SVGResourceFilter; + void buildFilter(const FloatRect& targetRect) const; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index 3eeb62500c..67c8bff5f9 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -1,8 +1,7 @@ /* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - - This file is part of the KDE project + 2009 Dirk Schulze <krit@webkit.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -77,8 +76,6 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilt ASSERT(resourceFilter); - float _x, _y, _width, _height; - if (this->hasAttribute(SVGNames::xAttr)) filterEffect->setHasX(true); if (this->hasAttribute(SVGNames::yAttr)) @@ -88,47 +85,19 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilt if (this->hasAttribute(SVGNames::heightAttr)) filterEffect->setHasHeight(true); - if (resourceFilter->effectBoundingBoxMode()) { - _x = x().valueAsPercentage(); - _y = y().valueAsPercentage(); - _width = width().valueAsPercentage(); - _height = height().valueAsPercentage(); - } else { - // We need to resolve any percentages in filter rect space. - if (x().unitType() == LengthTypePercentage) { - filterEffect->setXBoundingBoxMode(true); - _x = x().valueAsPercentage(); - } else { - filterEffect->setXBoundingBoxMode(false); - _x = x().value(this); - } - - if (y().unitType() == LengthTypePercentage) { - filterEffect->setYBoundingBoxMode(true); - _y = y().valueAsPercentage(); - } else { - filterEffect->setYBoundingBoxMode(false); - _y = y().value(this); - } - - if (width().unitType() == LengthTypePercentage) { - filterEffect->setWidthBoundingBoxMode(true); - _width = width().valueAsPercentage(); - } else { - filterEffect->setWidthBoundingBoxMode(false); - _width = width().value(this); - } - - if (height().unitType() == LengthTypePercentage) { - filterEffect->setHeightBoundingBoxMode(true); - _height = height().valueAsPercentage(); - } else { - filterEffect->setHeightBoundingBoxMode(false); - _height = height().value(this); - } - } - - filterEffect->setSubRegion(FloatRect(_x, _y, _width, _height)); + FloatRect effectBBox; + if (resourceFilter->effectBoundingBoxMode()) + effectBBox = FloatRect(x().valueAsPercentage(), + y().valueAsPercentage(), + width().valueAsPercentage(), + height().valueAsPercentage()); + else + effectBBox = FloatRect(x().value(this), + y().value(this), + width().value(this), + height().value(this)); + + filterEffect->setSubRegion(effectBBox); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index 3cdbb3795c..cb8ec1c1e3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -50,7 +48,6 @@ namespace WebCore { protected: friend class SVGResourceFilter; void setStandardAttributes(SVGResourceFilter*, FilterEffect*) const; - virtual const SVGElement* contextElement() const { return this; } private: ANIMATED_PROPERTY_DECLARATIONS(SVGFilterPrimitiveStandardAttributes, SVGFilterPrimitiveStandardAttributesIdentifier, SVGNames::xAttrString, SVGLength, X, x) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp index 847038c0ca..c566a8f89e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -25,6 +23,7 @@ #if ENABLE(SVG) #include "SVGFitToViewBox.h" +#include "Attr.h" #include "Document.h" #include "FloatRect.h" #include "MappedAttribute.h" @@ -39,8 +38,6 @@ namespace WebCore { char SVGFitToViewBoxIdentifier[] = "SVGFitToViewBox"; SVGFitToViewBox::SVGFitToViewBox() - : m_viewBox(this, SVGNames::viewBoxAttr) - , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) { } @@ -48,9 +45,8 @@ SVGFitToViewBox::~SVGFitToViewBox() { } -bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate) +bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate) { - Document* doc = contextElement()->document(); String str(c, end - c); skipOptionalSpaces(c, end); @@ -81,24 +77,22 @@ bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x, return true; } -TransformationMatrix SVGFitToViewBox::viewBoxToViewTransform(float viewWidth, float viewHeight) const +TransformationMatrix SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBoxRect, SVGPreserveAspectRatio* preserveAspectRatio, float viewWidth, float viewHeight) { - FloatRect viewBoxRect = viewBox(); + ASSERT(preserveAspectRatio); if (!viewBoxRect.width() || !viewBoxRect.height()) return TransformationMatrix(); - return preserveAspectRatio()->getCTM(viewBoxRect.x(), - viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), - 0, 0, viewWidth, viewHeight); + return preserveAspectRatio->getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 0, 0, viewWidth, viewHeight); } -bool SVGFitToViewBox::parseMappedAttribute(MappedAttribute* attr) +bool SVGFitToViewBox::parseMappedAttribute(Document* document, MappedAttribute* attr) { if (attr->name() == SVGNames::viewBoxAttr) { float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f; const UChar* c = attr->value().characters(); const UChar* end = c + attr->value().length(); - if (parseViewBox(c, end, x, y, w, h)) + if (parseViewBox(document, c, end, x, y, w, h)) setViewBoxBaseValue(FloatRect(x, y, w, h)); return true; } else if (attr->name() == SVGNames::preserveAspectRatioAttr) { diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h index ac03df4bbe..503a0ef064 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -38,17 +36,17 @@ namespace WebCore { SVGFitToViewBox(); virtual ~SVGFitToViewBox(); - bool parseViewBox(const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true); - virtual TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const; + bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true); + static TransformationMatrix viewBoxToViewTransform(const FloatRect& viewBoxRect, SVGPreserveAspectRatio*, float viewWidth, float viewHeight); - bool parseMappedAttribute(MappedAttribute*); + bool parseMappedAttribute(Document*, MappedAttribute*); bool isKnownAttribute(const QualifiedName&); - virtual const SVGElement* contextElement() const = 0; + protected: + virtual SVGAnimatedTypeValue<FloatRect>::DecoratedType viewBoxBaseValue() const = 0; + virtual void setViewBoxBaseValue(SVGAnimatedTypeValue<FloatRect>::DecoratedType type) = 0; - private: - ANIMATED_PROPERTY_DECLARATIONS(SVGFitToViewBox, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) - ANIMATED_PROPERTY_DECLARATIONS(SVGFitToViewBox, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + virtual SVGAnimatedTypeValue<SVGPreserveAspectRatio>::DecoratedType preserveAspectRatioBaseValue() const = 0; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp index 98321f44cf..7d62b8ccfa 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp @@ -39,7 +39,8 @@ namespace WebCore { using namespace SVGNames; SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document* doc) - : SVGStyledElement(tagName, doc) + : SVGStyledElement(tagName, doc) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) , m_isGlyphCacheValid(false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFontElement.h b/src/3rdparty/webkit/WebCore/svg/SVGFontElement.h index 42468dad91..1fc51367ec 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFontElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGFontElement.h @@ -47,10 +47,12 @@ namespace WebCore { SVGMissingGlyphElement* firstMissingGlyphElement() const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGFontElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + void ensureGlyphCache() const; typedef Vector<SVGHorizontalKerningPair> KerningPairVector; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp index 5cfca8ae04..1e75741456 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp @@ -43,6 +43,8 @@ SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, D , m_y(this, SVGNames::yAttr, LengthModeHeight) , m_width(this, SVGNames::widthAttr, LengthModeWidth) , m_height(this, SVGNames::heightAttr, LengthModeHeight) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.h b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.h index 14dbe6879b..1848e2ba7e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.h @@ -1,8 +1,6 @@ /* Copyright (C) 2006 Apple Computer, Inc. - This file is part of the WebKit project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -48,14 +46,19 @@ namespace WebCore { bool childShouldCreateRenderer(Node*) const; virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGNames::foreignObjectTagString, SVGNames::xAttrString, SVGLength, X, x) ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGNames::foreignObjectTagString, SVGNames::yAttrString, SVGLength, Y, y) ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGNames::foreignObjectTagString, SVGNames::widthAttrString, SVGLength, Width, width) ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGNames::foreignObjectTagString, SVGNames::heightAttrString, SVGLength, Height, height) + + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp index 2b50d74435..241f2645e2 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp @@ -34,6 +34,7 @@ SVGGElement::SVGGElement(const QualifiedName& tagName, Document* doc) , SVGTests() , SVGLangSpace() , SVGExternalResourcesRequired() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGGElement.h b/src/3rdparty/webkit/WebCore/svg/SVGGElement.h index 8e3b368544..9cfb5a3637 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGGElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGGElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -47,10 +45,12 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGGElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + friend class SVGUseElement; TransformationMatrix localMatrix() const; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.cpp index 80342869b9..93e2cb4ca0 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.cpp @@ -48,6 +48,8 @@ SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* d , m_spreadMethod(this, SVGNames::spreadMethodAttr) , m_gradientUnits(this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_gradientTransform(this, SVGNames::gradientTransformAttr, SVGTransformList::create(SVGNames::gradientTransformAttr)) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.h b/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.h index 2027258944..8413597126 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGGradientElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -60,12 +58,18 @@ namespace WebCore { Vector<SVGGradientStop> buildStops() const; mutable RefPtr<SVGPaintServerGradient> m_resource; - virtual const SVGElement* contextElement() const { return this; } - protected: ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGGradientElementIdentifier, SVGNames::spreadMethodAttrString, int, SpreadMethod, spreadMethod) ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGGradientElementIdentifier, SVGNames::gradientUnitsAttrString, int, GradientUnits, gradientUnits) ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGGradientElementIdentifier, SVGNames::gradientTransformAttrString, SVGTransformList, GradientTransform, gradientTransform) + + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGImageElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGImageElement.cpp index 299828f16d..e29846c095 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGImageElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGImageElement.cpp @@ -45,7 +45,9 @@ SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document* doc) , m_y(this, SVGNames::yAttr, LengthModeHeight) , m_width(this, SVGNames::widthAttr, LengthModeWidth) , m_height(this, SVGNames::heightAttr, LengthModeHeight) - , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) , m_imageLoader(this) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGImageElement.h b/src/3rdparty/webkit/WebCore/svg/SVGImageElement.h index 1d242b556b..1bdcdbac89 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGImageElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGImageElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -61,7 +59,6 @@ namespace WebCore { protected: virtual bool haveLoadedRequiredResources(); virtual bool hasRelativeValues() const; - virtual const SVGElement* contextElement() const { return this; } private: ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGNames::imageTagString, SVGNames::xAttrString, SVGLength, X, x) @@ -70,6 +67,14 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGNames::imageTagString, SVGNames::heightAttrString, SVGLength, Height, height) ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGNames::imageTagString, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + SVGImageLoader m_imageLoader; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp index cb31178ccb..4f7b7e5f1b 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp @@ -42,6 +42,7 @@ SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document* doc) , m_y1(this, SVGNames::y1Attr, LengthModeHeight) , m_x2(this, SVGNames::x2Attr, LengthModeWidth) , m_y2(this, SVGNames::y2Attr, LengthModeHeight) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.h b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.h index 2d89f5c9e1..a24e009cb8 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGLineElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGLineElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -51,7 +49,6 @@ namespace WebCore { virtual bool supportsMarkers() const { return true; } protected: - virtual const SVGElement* contextElement() const { return this; } virtual bool hasRelativeValues() const; private: @@ -59,6 +56,11 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGNames::lineTagString, SVGNames::y1AttrString, SVGLength, Y1, y1) ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGNames::lineTagString, SVGNames::x2AttrString, SVGLength, X2, x2) ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGNames::lineTagString, SVGNames::y2AttrString, SVGLength, Y2, y2) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.cpp index 9927a506c9..f5c8ceeeb3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.cpp @@ -84,8 +84,15 @@ void SVGLinearGradientElement::buildGradient() const RefPtr<SVGPaintServerLinearGradient> linearGradient = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(m_resource); - FloatPoint startPoint = FloatPoint::narrowPrecision(attributes.x1(), attributes.y1()); - FloatPoint endPoint = FloatPoint::narrowPrecision(attributes.x2(), attributes.y2()); + FloatPoint startPoint; + FloatPoint endPoint; + if (attributes.boundingBoxMode()) { + startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage()); + endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage()); + } else { + startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this)); + endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this)); + } RefPtr<Gradient> gradient = Gradient::create(startPoint, endPoint); gradient->setSpreadMethod(attributes.spreadMethod()); @@ -142,16 +149,16 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c const SVGLinearGradientElement* linear = static_cast<const SVGLinearGradientElement*>(current); if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr)) - attributes.setX1(linear->x1().valueAsPercentage()); + attributes.setX1(linear->x1()); if (!attributes.hasY1() && current->hasAttribute(SVGNames::y1Attr)) - attributes.setY1(linear->y1().valueAsPercentage()); + attributes.setY1(linear->y1()); if (!attributes.hasX2() && current->hasAttribute(SVGNames::x2Attr)) - attributes.setX2(linear->x2().valueAsPercentage()); + attributes.setX2(linear->x2()); if (!attributes.hasY2() && current->hasAttribute(SVGNames::y2Attr)) - attributes.setY2(linear->y2().valueAsPercentage()); + attributes.setY2(linear->y2()); } processedGradients.add(current); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.cpp index b3214ed97d..b8c862acad 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.cpp @@ -31,6 +31,8 @@ namespace WebCore { SVGMPathElement::SVGMPathElement(const QualifiedName& qname, Document* doc) : SVGElement(qname, doc) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } @@ -47,7 +49,7 @@ void SVGMPathElement::parseMappedAttribute(MappedAttribute* attr) SVGPathElement* SVGMPathElement::pathElement() { - Element* target = document()->getElementById(getTarget(SVGURIReference::href())); + Element* target = document()->getElementById(getTarget(href())); if (target && target->hasTagName(SVGNames::pathTag)) return static_cast<SVGPathElement*>(target); return 0; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h index 988ceadeab..ded6cdf830 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h @@ -1,28 +1,26 @@ /* - Copyright (C) 2007 Eric Seidel <eric@webkit.org> - - This file is part of the WebKit project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - */ + Copyright (C) 2007 Eric Seidel <eric@webkit.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ #ifndef SVGMPathElement_h #define SVGMPathElement_h -#if ENABLE(SVG) +#if ENABLE(SVG) #include "SVGURIReference.h" #include "SVGExternalResourcesRequired.h" @@ -31,8 +29,8 @@ namespace WebCore { class SVGPathElement; class SVGMPathElement : public SVGElement, - SVGURIReference, - SVGExternalResourcesRequired { + public SVGURIReference, + public SVGExternalResourcesRequired { public: SVGMPathElement(const QualifiedName&, Document*); virtual ~SVGMPathElement(); @@ -41,13 +39,17 @@ namespace WebCore { SVGPathElement* pathElement(); - protected: - virtual const SVGElement* contextElement() const { return this; } + private: + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGMPathElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGMPathElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore #endif // ENABLE(SVG) #endif // SVGMPathElement_h - -// vim:ts=4:noet diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.cpp index b09e718fe0..2e9692609e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.cpp @@ -50,6 +50,9 @@ SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* doc) , m_markerUnits(this, SVGNames::markerUnitsAttr, SVG_MARKERUNITS_STROKEWIDTH) , m_orientType(this, SVGNames::orientAttr, SVG_MARKER_ORIENT_ANGLE) , m_orientAngle(this, SVGNames::orientAttr, SVGAngle::create()) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) { // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified. } @@ -63,6 +66,11 @@ SVGMarkerElement::~SVGMarkerElement() detach(); } +TransformationMatrix SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const +{ + return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight); +} + void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr) { if (attr->name() == SVGNames::markerUnitsAttr) { @@ -94,7 +102,7 @@ void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(attr)) + if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) return; SVGStyledElement::parseMappedAttribute(attr); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h b/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h index e2e3493332..7e08a96f13 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h @@ -58,6 +58,8 @@ namespace WebCore { SVGMarkerElement(const QualifiedName&, Document*); virtual ~SVGMarkerElement(); + TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const; + void setOrientToAuto(); void setOrientToAngle(PassRefPtr<SVGAngle>); @@ -68,9 +70,6 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual SVGResource* canvasResource(); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGNames::markerTagString, SVGNames::refXAttrString, SVGLength, RefX, refX) ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGNames::markerTagString, SVGNames::refYAttrString, SVGLength, RefY, refY) @@ -80,6 +79,15 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGNames::markerTagString, SVGOrientTypeAttrIdentifier, int, OrientType, orientType) ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGNames::markerTagString, SVGOrientAngleAttrIdentifier, SVGAngle, OrientAngle, orientAngle) + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + // SVGFitToViewBox + ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + RefPtr<SVGResourceMarker> m_marker; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp index 6b75527617..127f6f42eb 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp @@ -55,6 +55,8 @@ SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* doc) , m_y(this, SVGNames::yAttr, LengthModeHeight, "-10%") , m_width(this, SVGNames::widthAttr, LengthModeWidth, "120%") , m_height(this, SVGNames::heightAttr, LengthModeHeight, "120%") + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. @@ -128,45 +130,45 @@ void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, N PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetRect, FloatRect& maskDestRect) const { // Determine specified mask size - float xValue; - float yValue; - float widthValue; - float heightValue; - - if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - xValue = x().valueAsPercentage() * targetRect.width(); - yValue = y().valueAsPercentage() * targetRect.height(); - widthValue = width().valueAsPercentage() * targetRect.width(); - heightValue = height().valueAsPercentage() * targetRect.height(); - } else { - xValue = x().value(this); - yValue = y().value(this); - widthValue = width().value(this); - heightValue = height().value(this); - } - - IntSize imageSize(lroundf(widthValue), lroundf(heightValue)); + if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + maskDestRect = FloatRect(x().valueAsPercentage() * targetRect.width(), + y().valueAsPercentage() * targetRect.height(), + width().valueAsPercentage() * targetRect.width(), + height().valueAsPercentage() * targetRect.height()); + else + maskDestRect = FloatRect(x().value(this), + y().value(this), + width().value(this), + height().value(this)); + + IntSize imageSize(lroundf(maskDestRect.width()), lroundf(maskDestRect.height())); clampImageBufferSizeToViewport(document()->view(), imageSize); - if (imageSize.width() < static_cast<int>(widthValue)) - widthValue = imageSize.width(); + if (imageSize.width() < static_cast<int>(maskDestRect.width())) + maskDestRect.setWidth(imageSize.width()); - if (imageSize.height() < static_cast<int>(heightValue)) - heightValue = imageSize.height(); + if (imageSize.height() < static_cast<int>(maskDestRect.height())) + maskDestRect.setHeight(imageSize.height()); - OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(imageSize); + // FIXME: This changes color space to linearRGB, the default color space + // for masking operations in SVG. We need a switch for the other color-space + // attribute values sRGB, inherit and auto. + OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(imageSize, LinearRGB); if (!maskImage) return 0; - maskDestRect = FloatRect(xValue, yValue, widthValue, heightValue); + FloatPoint maskContextLocation = maskDestRect.location(); if (maskUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) maskDestRect.move(targetRect.x(), targetRect.y()); + if (maskContentUnits() != SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) + maskContextLocation.move(targetRect.x(), targetRect.y()); + GraphicsContext* maskImageContext = maskImage->context(); ASSERT(maskImageContext); maskImageContext->save(); - maskImageContext->translate(-xValue, -yValue); + maskImageContext->translate(-maskContextLocation.x(), -maskContextLocation.y()); if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { maskImageContext->save(); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h b/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h index f2b7ae5627..362c7301bc 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h @@ -1,8 +1,6 @@ /* Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -54,9 +52,6 @@ namespace WebCore { PassOwnPtr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGNames::maskTagString, SVGNames::maskUnitsAttrString, int, MaskUnits, maskUnits) ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGNames::maskTagString, SVGNames::maskContentUnitsAttrString, int, MaskContentUnits, maskContentUnits) @@ -65,6 +60,14 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGNames::maskTagString, SVGNames::widthAttrString, SVGLength, Width, width) ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGNames::maskTagString, SVGNames::heightAttrString, SVGLength, Height, height) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + RefPtr<SVGResourceMasker> m_masker; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp index 172cac17c5..70799298bd 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp @@ -50,6 +50,7 @@ SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document* doc) , SVGLangSpace() , SVGExternalResourcesRequired() , m_pathLength(this, SVGNames::pathLengthAttr, 0.0f) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h index 362a85baae..7ea010bd96 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGPathElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -99,13 +97,15 @@ namespace WebCore { virtual bool supportsMarkers() const { return true; } - protected: - virtual const SVGElement* contextElement() const { return this; } - private: mutable RefPtr<SVGPathSegList> m_pathSegList; ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, SVGNames::pathTagString, SVGNames::pathLengthAttrString, float, PathLength, pathLength) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.cpp index befca85612..34b7db4397 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.cpp @@ -64,6 +64,10 @@ SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document* doc , m_patternUnits(this, SVGNames::patternUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_patternContentUnits(this, SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) , m_patternTransform(this, SVGNames::patternTransformAttr, SVGTransformList::create(SVGNames::patternTransformAttr)) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) { } @@ -110,7 +114,7 @@ void SVGPatternElement::parseMappedAttribute(MappedAttribute* attr) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(attr)) + if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) return; SVGStyledElement::parseMappedAttribute(attr); @@ -195,7 +199,7 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const } } - TransformationMatrix viewBoxCTM = viewBoxToViewTransform(patternBoundaries.width(), patternBoundaries.height()); + TransformationMatrix viewBoxCTM = viewBoxToViewTransform(viewBox(), preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); FloatRect patternBoundariesIncludingOverflow = patternBoundaries; // Apply objectBoundingBoxMode fixup for patternContentUnits, if viewBox is not set. diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.h b/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.h index 2e6399ccca..6a679afbd5 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGPatternElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -58,9 +56,6 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual SVGResource* canvasResource(); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::xAttrString, SVGLength, X, x) ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::yAttrString, SVGLength, Y, y) @@ -70,6 +65,18 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::patternContentUnitsAttrString, int, PatternContentUnits, patternContentUnits) ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::patternTransformAttrString, SVGTransformList, PatternTransform, patternTransform) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + // SVGPatternElement + ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + mutable RefPtr<SVGPaintServerPattern> m_resource; private: diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp index db39c52164..62e53a330c 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp @@ -42,6 +42,7 @@ SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* doc) , SVGLangSpace() , SVGExternalResourcesRequired() , SVGAnimatedPoints() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } @@ -117,7 +118,7 @@ void SVGPolyElement::updateAnimatedSVGAttribute(const String& name) const if (name == SVGNames::pointsAttr.localName()) { m_synchronizingSVGAttributes = true; - synchronizeProperty<SVGPolyElement, SVGPointList*>(this, SVGNames::pointsAttr, m_points.get()); + PropertySynchronizer<SVGPolyElement, SVGPointList*, true>::synchronize(this, SVGNames::pointsAttr, m_points.get()); setSynchronizedSVGAttributes(true); m_synchronizingSVGAttributes = false; return; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h b/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h index 8dd16cd1bc..2ffd150705 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -54,10 +52,12 @@ namespace WebCore { virtual void updateAnimatedSVGAttribute(const String&) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGPolyElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + mutable RefPtr<SVGPointList> m_points; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.cpp index 23a8579846..a9b5cff5f1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.cpp @@ -92,29 +92,39 @@ void SVGRadialGradientElement::buildGradient() const RefPtr<SVGPaintServerRadialGradient> radialGradient = WTF::static_pointer_cast<SVGPaintServerRadialGradient>(m_resource); - double adjustedFocusX = attributes.fx(); - double adjustedFocusY = attributes.fy(); + FloatPoint focalPoint; + FloatPoint centerPoint; + float radius; + if (attributes.boundingBoxMode()) { + focalPoint = FloatPoint(attributes.fx().valueAsPercentage(), attributes.fy().valueAsPercentage()); + centerPoint = FloatPoint(attributes.cx().valueAsPercentage(), attributes.cy().valueAsPercentage()); + radius = attributes.r().valueAsPercentage(); + } else { + focalPoint = FloatPoint(attributes.fx().value(this), attributes.fy().value(this)); + centerPoint = FloatPoint(attributes.cx().value(this), attributes.cy().value(this)); + radius = attributes.r().value(this); + } + + float adjustedFocusX = focalPoint.x(); + float adjustedFocusY = focalPoint.y(); - double fdx = attributes.fx() - attributes.cx(); - double fdy = attributes.fy() - attributes.cy(); + float fdx = focalPoint.x() - centerPoint.x(); + float fdy = focalPoint.y() - centerPoint.y(); // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and // r, set (fx, fy) to the point of intersection of the line through // (fx, fy) and the circle. - if (sqrt(fdx * fdx + fdy * fdy) > attributes.r()) { - double angle = atan2(attributes.fy() * 100.0, attributes.fx() * 100.0); - adjustedFocusX = cos(angle) * attributes.r(); - adjustedFocusY = sin(angle) * attributes.r(); + if (sqrt(fdx * fdx + fdy * fdy) > radius) { + float angle = atan2f(focalPoint.y() * 100.0f, focalPoint.x() * 100.0f); + adjustedFocusX = cosf(angle) * radius; + adjustedFocusY = sinf(angle) * radius; } - FloatPoint focalPoint = FloatPoint::narrowPrecision(attributes.fx(), attributes.fy()); - FloatPoint centerPoint = FloatPoint::narrowPrecision(attributes.cx(), attributes.cy()); - RefPtr<Gradient> gradient = Gradient::create( - FloatPoint::narrowPrecision(adjustedFocusX, adjustedFocusY), + FloatPoint(adjustedFocusX, adjustedFocusY), 0.f, // SVG does not support a "focus radius" centerPoint, - narrowPrecisionToFloat(attributes.r())); + radius); gradient->setSpreadMethod(attributes.spreadMethod()); Vector<SVGGradientStop> stops = attributes.stops(); @@ -134,7 +144,7 @@ void SVGRadialGradientElement::buildGradient() const radialGradient->setGradientTransform(attributes.gradientTransform()); radialGradient->setGradientCenter(centerPoint); radialGradient->setGradientFocal(focalPoint); - radialGradient->setGradientRadius(narrowPrecisionToFloat(attributes.r())); + radialGradient->setGradientRadius(radius); radialGradient->setGradientStops(attributes.stops()); } @@ -166,19 +176,19 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c const SVGRadialGradientElement* radial = static_cast<const SVGRadialGradientElement*>(current); if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr)) - attributes.setCx(radial->cx().valueAsPercentage()); + attributes.setCx(radial->cx()); if (!attributes.hasCy() && current->hasAttribute(SVGNames::cyAttr)) - attributes.setCy(radial->cy().valueAsPercentage()); + attributes.setCy(radial->cy()); if (!attributes.hasR() && current->hasAttribute(SVGNames::rAttr)) - attributes.setR(radial->r().valueAsPercentage()); + attributes.setR(radial->r()); if (!attributes.hasFx() && current->hasAttribute(SVGNames::fxAttr)) - attributes.setFx(radial->fx().valueAsPercentage()); + attributes.setFx(radial->fx()); if (!attributes.hasFy() && current->hasAttribute(SVGNames::fyAttr)) - attributes.setFy(radial->fy().valueAsPercentage()); + attributes.setFy(radial->fy()); } processedGradients.add(current); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp index bfb62056e8..966976a1a8 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp @@ -43,6 +43,7 @@ SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document *doc) , m_height(this, SVGNames::heightAttr, LengthModeHeight) , m_rx(this, SVGNames::rxAttr, LengthModeWidth) , m_ry(this, SVGNames::ryAttr, LengthModeHeight) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGRectElement.h b/src/3rdparty/webkit/WebCore/svg/SVGRectElement.h index 2937c23e67..a4d859efc3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGRectElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGRectElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -47,7 +45,6 @@ namespace WebCore { virtual Path toPathData() const; protected: - virtual const SVGElement* contextElement() const { return this; } virtual bool hasRelativeValues() const; private: @@ -57,6 +54,11 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGNames::rectTagString, SVGNames::heightAttrString, SVGLength, Height, height) ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGNames::rectTagString, SVGNames::rxAttrString, SVGLength, Rx, rx) ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGNames::rectTagString, SVGNames::ryAttrString, SVGLength, Ry, ry) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp index 29e72b8671..2d5008b6d5 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp @@ -66,7 +66,10 @@ SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc) , m_x(this, SVGNames::xAttr, LengthModeWidth) , m_y(this, SVGNames::yAttr, LengthModeHeight) , m_width(this, SVGNames::widthAttr, LengthModeWidth, "100%") - , m_height(this, SVGNames::heightAttr, LengthModeHeight, "100%") + , m_height(this, SVGNames::heightAttr, LengthModeHeight, "100%") + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) , m_useCurrentView(false) , m_timeContainer(SMILTimeContainer::create(this)) , m_viewSpec(0) @@ -261,7 +264,7 @@ void SVGSVGElement::parseMappedAttribute(MappedAttribute* attr) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(attr)) + if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) return; if (SVGZoomAndPan::parseMappedAttribute(attr)) return; @@ -513,13 +516,8 @@ TransformationMatrix SVGSVGElement::viewBoxToViewTransform(float viewWidth, floa viewBoxRect = currentView()->viewBox(); } else viewBoxRect = viewBox(); - if (!viewBoxRect.width() || !viewBoxRect.height()) - return TransformationMatrix(); - - TransformationMatrix ctm = preserveAspectRatio()->getCTM(viewBoxRect.x(), - viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), - 0, 0, viewWidth, viewHeight); + TransformationMatrix ctm = SVGFitToViewBox::viewBoxToViewTransform(viewBoxRect, preserveAspectRatio(), viewWidth, viewHeight); if (useCurrentView() && currentView()) return currentView()->transform()->concatenate().matrix() * ctm; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h index 223ebf6252..f30e8f6832 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -128,13 +126,11 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); - virtual TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const; + TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const; void inheritViewAttributes(SVGViewElement*); protected: - virtual const SVGElement* contextElement() const { return this; } - friend class RenderSVGRoot; friend class RenderSVGViewportContainer; @@ -148,6 +144,15 @@ namespace WebCore { ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGNames::svgTagString, SVGNames::widthAttrString, SVGLength, Width, width) ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGNames::svgTagString, SVGNames::heightAttrString, SVGLength, Height, height) + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + // SVGFitToViewBox + ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + virtual void documentWillBecomeInactive(); virtual void documentDidBecomeActive(); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp index 587542c493..c2f4a6eae9 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp @@ -37,6 +37,8 @@ SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* doc, : SVGElement(tagName, doc) , SVGURIReference() , SVGExternalResourcesRequired() + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) , m_data(this, this) { m_data.setCreatedByParser(createdByParser); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h index f2efc8e1dc..699c535fe5 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -60,7 +58,6 @@ namespace WebCore { virtual bool shouldExecuteAsJavaScript() const { return false; } protected: - virtual const SVGElement* contextElement() const { return this; } virtual bool haveLoadedRequiredResources(); virtual String sourceAttributeValue() const; @@ -73,6 +70,15 @@ namespace WebCore { virtual void dispatchErrorEvent(); private: + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGScriptElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGScriptElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + private: ScriptElementData m_data; String m_type; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp index 98b6459ba1..6960519a5c 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp @@ -245,20 +245,23 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na if (!mappedAttributes()) return 0; - Attribute* attr = mappedAttributes()->getAttributeItem(QualifiedName(nullAtom, name, nullAtom)); + QualifiedName attributeName(nullAtom, name, nullAtom); + Attribute* attr = mappedAttributes()->getAttributeItem(attributeName); if (!attr || !attr->isMappedAttribute() || !attr->style()) return 0; MappedAttribute* cssSVGAttr = static_cast<MappedAttribute*>(attr); - - // FIXME: Is it possible that the style will not be shared at the time this - // is called, but a later addition to the DOM will make it shared? - if (!cssSVGAttr->style()->hasOneRef()) { + // This function returns a pointer to a CSSValue which can be mutated from JavaScript. + // If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration + // as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration + // before returning so that any modifications to the CSSValue will not affect other attributes. + MappedAttributeEntry entry; + mapToEntry(attributeName, entry); + if (getMappedAttributeDecl(entry, cssSVGAttr) == cssSVGAttr->decl()) { cssSVGAttr->setDecl(0); int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(cssSVGAttr->name()); addCSSProperty(cssSVGAttr, propId, cssSVGAttr->value()); } - return cssSVGAttr->style()->getPropertyCSSValue(name); } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.cpp index 2867d002f7..a07b2a7ff3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.cpp @@ -34,6 +34,7 @@ SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document* doc) , SVGTests() , SVGLangSpace() , SVGExternalResourcesRequired() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h index a2be835f5d..f5e9a0d19d 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -22,8 +20,8 @@ #ifndef SVGSwitchElement_h #define SVGSwitchElement_h -#if ENABLE(SVG) +#if ENABLE(SVG) #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -44,16 +42,14 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: - mutable bool m_insideRenderSection; + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGSwitchElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore #endif // ENABLE(SVG) #endif - -// vim:ts=4:noet diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.cpp index 073a13d950..4155b0c2d1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.cpp @@ -34,6 +34,9 @@ SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document* doc) , SVGLangSpace() , SVGExternalResourcesRequired() , SVGFitToViewBox() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) { } @@ -47,7 +50,7 @@ void SVGSymbolElement::parseMappedAttribute(MappedAttribute* attr) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(attr)) + if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) return; SVGStyledElement::parseMappedAttribute(attr); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h b/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h index a6ccbce201..5c682027e2 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -22,8 +20,8 @@ #ifndef SVGSymbolElement_h #define SVGSymbolElement_h -#if ENABLE(SVG) +#if ENABLE(SVG) #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" @@ -44,8 +42,15 @@ namespace WebCore { virtual bool rendererIsNeeded(RenderStyle*) { return false; } - protected: - virtual const SVGElement* contextElement() const { return this; } + private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGSymbolElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + // SVGFitToViewBox + ANIMATED_PROPERTY_DECLARATIONS(SVGSymbolElement, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGSymbolElement, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp index 872e7c87ce..5b8640a7c8 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp @@ -35,6 +35,7 @@ namespace WebCore { SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document* doc) : SVGTextPositioningElement(tagName, doc) , SVGURIReference() + , m_href(this, XLinkNames::hrefAttr) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h b/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h index 88eeef1c71..71d40a0514 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -40,11 +38,11 @@ namespace WebCore { virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); bool childShouldCreateRenderer(Node*) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: void updateReferencedText(); + + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGTRefElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.cpp index 86009c1150..933430413e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.cpp @@ -52,6 +52,7 @@ SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum , SVGExternalResourcesRequired() , m_textLength(this, SVGNames::textLengthAttr, LengthModeOther) , m_lengthAdjust(this, SVGNames::lengthAdjustAttr, LENGTHADJUST_SPACING) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.h b/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.h index 9933b2c6d7..9b2c938292 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -66,12 +64,14 @@ namespace WebCore { bool isKnownAttribute(const QualifiedName&); - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGTextContentElement, SVGTextContentElementIdentifier, SVGNames::textLengthAttrString, SVGLength, TextLength, textLength) ANIMATED_PROPERTY_DECLARATIONS(SVGTextContentElement, SVGTextContentElementIdentifier, SVGNames::lengthAdjustAttrString, int, LengthAdjust, lengthAdjust) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGTextContentElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp index 54a4aa2924..ebbb628515 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp @@ -41,6 +41,7 @@ SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document* d , m_startOffset(this, SVGNames::startOffsetAttr, LengthModeOther) , m_method(this, SVGNames::methodAttr, SVG_TEXTPATH_METHODTYPE_ALIGN) , m_spacing(this, SVGNames::spacingAttr, SVG_TEXTPATH_SPACINGTYPE_EXACT) + , m_href(this, XLinkNames::hrefAttr) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h index 4e8899a3cd..1bfcc8b140 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h @@ -1,8 +1,6 @@ /* Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -64,13 +62,13 @@ namespace WebCore { bool childShouldCreateRenderer(Node*) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, SVGNames::textPathTagString, SVGNames::startOffsetAttrString, SVGLength, StartOffset, startOffset) ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, SVGNames::textPathTagString, SVGNames::methodAttrString, int, Method, method) ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, SVGNames::textPathTagString, SVGNames::spacingAttrString, int, Spacing, spacing) + + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGURIReference.cpp b/src/3rdparty/webkit/WebCore/svg/SVGURIReference.cpp index 8871229675..24febc3142 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGURIReference.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGURIReference.cpp @@ -30,7 +30,6 @@ namespace WebCore { char SVGURIReferenceIdentifier[] = "SVGURIReference"; SVGURIReference::SVGURIReference() - : m_href(this, XLinkNames::hrefAttr) { } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGURIReference.h b/src/3rdparty/webkit/WebCore/svg/SVGURIReference.h index 35ac640886..812fb594f1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGURIReference.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGURIReference.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> + Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> This file is part of the KDE project @@ -42,10 +42,8 @@ namespace WebCore { static String getTarget(const String& url); - virtual const SVGElement* contextElement() const = 0; - - private: - ANIMATED_PROPERTY_DECLARATIONS(SVGURIReference, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + protected: + virtual void setHrefBaseValue(SVGAnimatedTypeValue<String>::DecoratedType type) = 0; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp index 0c2abe09ab..42517bdbff 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp @@ -65,6 +65,8 @@ SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* doc) , m_y(this, SVGNames::yAttr, LengthModeHeight) , m_width(this, SVGNames::widthAttr, LengthModeWidth) , m_height(this, SVGNames::heightAttr, LengthModeHeight) + , m_href(this, XLinkNames::hrefAttr) + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) { } @@ -482,13 +484,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta targetInstance->appendChild(instancePtr.get()); // Enter recursion, appending new instance tree nodes to the "instance" object. - if (element->hasChildNodes()) - buildInstanceTree(element, instancePtr.get(), foundProblem); - - // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced - // object, the instance tree will contain recursive expansion of the indirect references to form a complete tree. - if (element->hasTagName(SVGNames::useTag)) - handleDeepUseReferencing(static_cast<SVGUseElement*>(element), instancePtr.get(), foundProblem); + buildInstanceTree(element, instancePtr.get(), foundProblem); } // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced diff --git a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.h b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.h index 1e5b81c10f..45ca783f6a 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -68,15 +66,20 @@ namespace WebCore { static void removeDisallowedElementsFromSubtree(Node* element); SVGElementInstance* instanceForShadowTreeElement(Node* element) const; - protected: - virtual const SVGElement* contextElement() const { return this; } - private: ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::xAttrString, SVGLength, X, x) ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::yAttrString, SVGLength, Y, y) ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::widthAttrString, SVGLength, Width, width) ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::heightAttrString, SVGLength, Height, height) + // SVGURIReference + ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGURIReferenceIdentifier, XLinkNames::hrefAttrString, String, Href, href) + + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + private: // Instance tree handling void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp index 61cb397536..af1d1fe97d 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp @@ -40,6 +40,9 @@ SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* doc) , SVGExternalResourcesRequired() , SVGFitToViewBox() , SVGZoomAndPan() + , m_externalResourcesRequired(this, SVGNames::externalResourcesRequiredAttr, false) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) { } @@ -61,7 +64,7 @@ void SVGViewElement::parseMappedAttribute(MappedAttribute* attr) viewTarget()->reset(attr->value()); else { if (SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGFitToViewBox::parseMappedAttribute(attr) + || SVGFitToViewBox::parseMappedAttribute(document(), attr) || SVGZoomAndPan::parseMappedAttribute(attr)) return; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGViewElement.h b/src/3rdparty/webkit/WebCore/svg/SVGViewElement.h index 840dea9b5d..33d0ae35c1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGViewElement.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGViewElement.h @@ -2,8 +2,6 @@ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -46,10 +44,16 @@ namespace WebCore { virtual bool rendererIsNeeded(RenderStyle*) { return false; } - protected: - virtual const SVGElement* contextElement() const { return this; } - private: + // SVGExternalResourcesRequired + ANIMATED_PROPERTY_DECLARATIONS(SVGViewElement, SVGExternalResourcesRequiredIdentifier, + SVGNames::externalResourcesRequiredAttrString, bool, + ExternalResourcesRequired, externalResourcesRequired) + + // SVGFitToViewBox + ANIMATED_PROPERTY_DECLARATIONS(SVGViewElement, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGViewElement, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + mutable RefPtr<SVGStringList> m_viewTarget; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp index b12b1c27f3..e6ded33b5e 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp @@ -1,8 +1,6 @@ /* Copyright (C) 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -36,8 +34,10 @@ namespace WebCore { SVGViewSpec::SVGViewSpec(const SVGSVGElement* contextElement) : SVGFitToViewBox() , SVGZoomAndPan() - , m_transform(SVGTransformList::create(SVGNames::transformAttr)) , m_contextElement(contextElement) + , m_viewBox(this, SVGNames::viewBoxAttr) + , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) + , m_transform(SVGTransformList::create(SVGNames::transformAttr)) { } @@ -55,7 +55,7 @@ void SVGViewSpec::setViewBoxString(const String& viewBox) float x, y, w, h; const UChar* c = viewBox.characters(); const UChar* end = c + viewBox.length(); - if (!parseViewBox(c, end, x, y, w, h, false)) + if (!parseViewBox(m_contextElement->document(), c, end, x, y, w, h, false)) return; setViewBoxBaseValue(FloatRect(x, y, w, h)); } @@ -74,12 +74,7 @@ void SVGViewSpec::setViewTargetString(const String& viewTargetString) SVGElement* SVGViewSpec::viewTarget() const { - return static_cast<SVGElement*>(m_contextElement->ownerDocument()->getElementById(m_viewTargetString)); -} - -const SVGElement* SVGViewSpec::contextElement() const -{ - return m_contextElement; + return static_cast<SVGElement*>(m_contextElement->document()->getElementById(m_viewTargetString)); } static const UChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'}; @@ -111,7 +106,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) return false; currViewSpec++; float x, y, w, h; - if (!parseViewBox(currViewSpec, end, x, y, w, h, false)) + if (!parseViewBox(m_contextElement->document(), currViewSpec, end, x, y, w, h, false)) return false; setViewBoxBaseValue(FloatRect(x, y, w, h)); if (currViewSpec >= end || *currViewSpec != ')') diff --git a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h index 8624089314..090b7ae8b3 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h +++ b/src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h @@ -1,8 +1,6 @@ /* Copyright (C) 2007 Rob Buis <buis@kde.org> - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -53,11 +51,16 @@ namespace WebCore { String viewTargetString() const { return m_viewTargetString; } SVGElement* viewTarget() const; - virtual const SVGElement* contextElement() const; + const SVGSVGElement* contextElement() const { return m_contextElement; } private: - mutable RefPtr<SVGTransformList> m_transform; const SVGSVGElement* m_contextElement; + + // SVGFitToViewBox + ANIMATED_PROPERTY_DECLARATIONS(SVGViewSpec, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) + ANIMATED_PROPERTY_DECLARATIONS(SVGViewSpec, SVGFitToViewBoxIdentifier, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + + mutable RefPtr<SVGTransformList> m_transform; String m_viewTargetString; }; diff --git a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp new file mode 100644 index 0000000000..be8ab78494 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp @@ -0,0 +1,145 @@ +/* + Copyright (C) Research In Motion Limited 2009. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if ENABLE(SVG) +#include "SynchronizablePropertyController.h" + +#include "NamedNodeMap.h" +#include "Node.h" +#include "SVGAnimatedProperty.h" + +namespace WebCore { + +void SynchronizableProperties::addProperty(SVGAnimatedPropertyBase* base) +{ + m_bases.add(base); +} + +void SynchronizableProperties::synchronize() +{ + ASSERT(!m_bases.isEmpty()); + if (m_shouldSynchronize) { + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->synchronize(); + } + } +} + +void SynchronizableProperties::startAnimation() +{ + ASSERT(!m_bases.isEmpty()); + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->startAnimation(); + } +} + +void SynchronizableProperties::stopAnimation() +{ + ASSERT(!m_bases.isEmpty()); + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->stopAnimation(); + } +} + +SynchronizablePropertyController::SynchronizablePropertyController() +{ +} + +void SynchronizablePropertyController::registerProperty(const QualifiedName& attrName, SVGAnimatedPropertyBase* base) +{ + // 'attrName' is ambigious. For instance in SVGMarkerElement both 'orientType' / 'orientAngle' + // SVG DOM objects are synchronized with the 'orient' attribute. This why we need a HashSet. + PropertyMap::iterator it = m_map.find(attrName.localName()); + if (it == m_map.end()) { + SynchronizableProperties properties; + properties.addProperty(base); + m_map.set(attrName.localName(), properties); + return; + } + + it->second.addProperty(base); +} + +void SynchronizablePropertyController::setPropertyNeedsSynchronization(const QualifiedName& attrName) +{ + PropertyMap::iterator itProp = m_map.find(attrName.localName()); + ASSERT(itProp != m_map.end()); + + itProp->second.setNeedsSynchronization(); +} + +void SynchronizablePropertyController::synchronizeProperty(const String& name) +{ + PropertyMap::iterator itProp = m_map.find(name); + if (itProp == m_map.end()) + return; + + itProp->second.synchronize(); +} + +void SynchronizablePropertyController::synchronizeAllProperties() +{ + if (m_map.isEmpty()) + return; + + PropertyMap::iterator itProp = m_map.begin(); + PropertyMap::iterator endProp = m_map.end(); + + for (; itProp != endProp; ++itProp) + itProp->second.synchronize(); +} + +void SynchronizablePropertyController::startAnimation(const String& name) +{ + PropertyMap::iterator itProp = m_map.find(name); + if (itProp == m_map.end()) + return; + + itProp->second.startAnimation(); +} + +void SynchronizablePropertyController::stopAnimation(const String& name) +{ + PropertyMap::iterator itProp = m_map.find(name); + if (itProp == m_map.end()) + return; + + itProp->second.stopAnimation(); +} + +} + +#endif // ENABLE(SVG) diff --git a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h new file mode 100644 index 0000000000..1ec50265d1 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h @@ -0,0 +1,84 @@ +/* + Copyright (C) Research In Motion Limited 2009. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SynchronizablePropertyController_h +#define SynchronizablePropertyController_h + +#if ENABLE(SVG) +#include "StringHash.h" +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class QualifiedName; +class SVGAnimatedPropertyBase; + +class SynchronizableProperties { +public: + SynchronizableProperties() + : m_shouldSynchronize(false) + { + } + + void setNeedsSynchronization() + { + m_shouldSynchronize = true; + } + + void addProperty(SVGAnimatedPropertyBase*); + void synchronize(); + void startAnimation(); + void stopAnimation(); + +private: + typedef HashSet<SVGAnimatedPropertyBase*> BaseSet; + + BaseSet m_bases; + bool m_shouldSynchronize; +}; + +// Helper class used exclusively by SVGElement to keep track of all animatable properties within a SVGElement, +// and wheter they are supposed to be synchronized or not (depending wheter AnimatedPropertyTearOff's have been created) +class SynchronizablePropertyController : public Noncopyable { +public: + void registerProperty(const QualifiedName&, SVGAnimatedPropertyBase*); + void setPropertyNeedsSynchronization(const QualifiedName&); + + void synchronizeProperty(const String&); + void synchronizeAllProperties(); + + void startAnimation(const String&); + void stopAnimation(const String&); + +private: + friend class SVGElement; + SynchronizablePropertyController(); + +private: + typedef HashMap<String, SynchronizableProperties> PropertyMap; + + PropertyMap m_map; +}; + +}; + +#endif // ENABLE(SVG) +#endif // SynchronizablePropertyController_h diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp index bb68b82c93..0a506f85f5 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp +++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp @@ -239,14 +239,13 @@ bool SVGImage::dataChanged(bool allDataReceived) static DragClient* dummyDragClient = 0; #endif static InspectorClient* dummyInspectorClient = new EmptyInspectorClient; - static PluginHalterClient* dummyPluginHalterClient = new EmptyPluginHalterClient; m_chromeClient.set(new SVGImageChromeClient(this)); // FIXME: If this SVG ends up loading itself, we might leak the world. - // THe comment said that the Cache code does not know about CachedImages + // The comment said that the Cache code does not know about CachedImages // holding Frames and won't know to break the cycle. But - m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, dummyPluginHalterClient)); + m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0)); m_page->settings()->setJavaScriptEnabled(false); m_page->settings()->setPluginsEnabled(false); @@ -256,7 +255,7 @@ bool SVGImage::dataChanged(bool allDataReceived) ResourceRequest fakeRequest(KURL(ParsedURLString, "")); FrameLoader* loader = frame->loader(); loader->load(fakeRequest, false); // Make sure the DocumentLoader is created - loader->cancelContentPolicyCheck(); // cancel any policy checks + loader->policyChecker()->cancelCheck(); // cancel any policy checks loader->commitProvisionalLoad(0); loader->setResponseMIMEType("image/svg+xml"); loader->begin(KURL()); // create the empty document diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.cpp index 4a4bdd5ccc..973743c1f2 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.cpp +++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.cpp @@ -31,52 +31,44 @@ #include "PlatformString.h" #include "SVGFilter.h" #include "SVGFilterBuilder.h" +#include "SVGFilterElement.h" #include "SVGRenderTreeAsText.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { -SVGResourceFilter::SVGResourceFilter() - : m_filterBBoxMode(false) +SVGResourceFilter::SVGResourceFilter(const SVGFilterElement* ownerElement) + : SVGResource() + , m_ownerElement(ownerElement) + , m_filterBBoxMode(false) , m_effectBBoxMode(false) - , m_xBBoxMode(false) - , m_yBBoxMode(false) , m_savedContext(0) , m_sourceGraphicBuffer(0) { m_filterBuilder.set(new SVGFilterBuilder()); } -void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect) +SVGResourceFilter::~SVGResourceFilter() { - effectAttributes->setStandardAttributes(this, effect.get()); - builder()->add(effectAttributes->result(), effect); } -FloatRect SVGResourceFilter::filterBBoxForItemBBox(const FloatRect& itemBBox) const +void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect) { - FloatRect filterBBox = filterRect(); - - if (filterBoundingBoxMode()) - filterBBox = FloatRect(itemBBox.x() + filterBBox.x() * itemBBox.width(), - itemBBox.y() + filterBBox.y() * itemBBox.height(), - filterBBox.width() * itemBBox.width(), - filterBBox.height() * itemBBox.height()); - - return filterBBox; + effectAttributes->setStandardAttributes(this, effect.get()); + builder()->add(effectAttributes->result(), effect); } void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const RenderObject* object) { - m_itemBBox = object->objectBoundingBox(); - m_filterBBox = filterBBoxForItemBBox(m_itemBBox); + FloatRect targetRect = object->objectBoundingBox(); + m_ownerElement->buildFilter(targetRect); // clip sourceImage to filterRegion - FloatRect clippedSourceRect = m_itemBBox; + FloatRect clippedSourceRect = targetRect; clippedSourceRect.intersect(m_filterBBox); // prepare Filters - m_filter = SVGFilter::create(m_itemBBox, m_filterBBox, m_effectBBoxMode, m_filterBBoxMode); + m_filter = SVGFilter::create(targetRect, m_filterBBox, m_effectBBoxMode); FilterEffect* lastEffect = m_filterBuilder->lastEffect(); if (lastEffect) @@ -91,8 +83,8 @@ void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const RenderObj return; GraphicsContext* sourceGraphicContext = sourceGraphic->context(); - sourceGraphicContext->translate(-m_itemBBox.x(), -m_itemBBox.y()); - sourceGraphicContext->clearRect(FloatRect(FloatPoint(), m_itemBBox.size())); + sourceGraphicContext->translate(-targetRect.x(), -targetRect.y()); + sourceGraphicContext->clearRect(FloatRect(FloatPoint(), targetRect.size())); m_sourceGraphicBuffer.set(sourceGraphic.release()); m_savedContext = context; diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.h b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.h index ee1efca482..86b11fe5b4 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.h +++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.h @@ -43,11 +43,13 @@ class Filter; class FilterEffect; class GraphicsContext; class SVGFilterBuilder; +class SVGFilterElement; class SVGFilterPrimitiveStandardAttributes; class SVGResourceFilter : public SVGResource { public: - SVGResourceFilter(); + static PassRefPtr<SVGResourceFilter> create(const SVGFilterElement* ownerElement) { return adoptRef(new SVGResourceFilter(ownerElement)); } + virtual ~SVGResourceFilter(); virtual SVGResourceType resourceType() const { return FilterResourceType; } @@ -57,44 +59,31 @@ public: bool effectBoundingBoxMode() const { return m_effectBBoxMode; } void setEffectBoundingBoxMode(bool bboxMode) { m_effectBBoxMode = bboxMode; } - bool xBoundingBoxMode() const { return m_xBBoxMode; } - void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; } - - bool yBoundingBoxMode() const { return m_yBBoxMode; } - void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; } - FloatRect filterRect() const { return m_filterRect; } void setFilterRect(const FloatRect& rect) { m_filterRect = rect; } FloatRect filterBoundingBox() { return m_filterBBox; } void setFilterBoundingBox(const FloatRect& rect) { m_filterBBox = rect; } - FloatRect itemBoundingBox() { return m_itemBBox; } - void setItemBoundingBox(const FloatRect& rect) { m_itemBBox = rect; } - - FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const; - - virtual TextStream& externalRepresentation(TextStream&) const; - void prepareFilter(GraphicsContext*&, const RenderObject*); void applyFilter(GraphicsContext*&, const RenderObject*); void addFilterEffect(SVGFilterPrimitiveStandardAttributes*, PassRefPtr<FilterEffect>); SVGFilterBuilder* builder() { return m_filterBuilder.get(); } + + virtual TextStream& externalRepresentation(TextStream&) const; private: + SVGResourceFilter(const SVGFilterElement*); + + const SVGFilterElement* m_ownerElement; bool m_filterBBoxMode : 1; bool m_effectBBoxMode : 1; - bool m_xBBoxMode : 1; - bool m_yBBoxMode : 1; - FloatRect m_filterRect; - FloatRect m_filterBBox; - FloatRect m_itemBBox; OwnPtr<SVGFilterBuilder> m_filterBuilder; GraphicsContext* m_savedContext; diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.cpp index 3f4a6d7b26..668209fa6f 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.cpp +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.cpp @@ -31,17 +31,16 @@ namespace WebCore { -FEFlood::FEFlood(FilterEffect* in, const Color& floodColor, const float& floodOpacity) +FEFlood::FEFlood(const Color& floodColor, const float& floodOpacity) : FilterEffect() - , m_in(in) , m_floodColor(floodColor) , m_floodOpacity(floodOpacity) { } -PassRefPtr<FEFlood> FEFlood::create(FilterEffect* in, const Color& floodColor, const float& floodOpacity) +PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float& floodOpacity) { - return adoptRef(new FEFlood(in, floodColor, floodOpacity)); + return adoptRef(new FEFlood(floodColor, floodOpacity)); } Color FEFlood::floodColor() const diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.h b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.h index 21985db567..91795dd37d 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.h +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.h @@ -31,7 +31,7 @@ namespace WebCore { class FEFlood : public FilterEffect { public: - static PassRefPtr<FEFlood> create(FilterEffect*, const Color&, const float&); + static PassRefPtr<FEFlood> create(const Color&, const float&); Color floodColor() const; void setFloodColor(const Color &); @@ -44,9 +44,8 @@ namespace WebCore { TextStream& externalRepresentation(TextStream& ts) const; private: - FEFlood(FilterEffect*, const Color&, const float&); + FEFlood(const Color&, const float&); - RefPtr<FilterEffect> m_in; Color m_floodColor; float m_floodOpacity; }; diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp deleted file mode 100644 index 601c39ec77..0000000000 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFEGaussianBlur.h" -#include "SVGRenderTreeAsText.h" -#include "Filter.h" - -namespace WebCore { - -FEGaussianBlur::FEGaussianBlur(FilterEffect* in, const float& x, const float& y) - : FilterEffect() - , m_in(in) - , m_x(x) - , m_y(y) -{ -} - -PassRefPtr<FEGaussianBlur> FEGaussianBlur::create(FilterEffect* in, const float& x, const float& y) -{ - return adoptRef(new FEGaussianBlur(in, x, y)); -} - -float FEGaussianBlur::stdDeviationX() const -{ - return m_x; -} - -void FEGaussianBlur::setStdDeviationX(float x) -{ - m_x = x; -} - -float FEGaussianBlur::stdDeviationY() const -{ - return m_y; -} - -void FEGaussianBlur::setStdDeviationY(float y) -{ - m_y = y; -} - -void FEGaussianBlur::apply(Filter*) -{ -} - -void FEGaussianBlur::dump() -{ -} - -TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts) const -{ - ts << "[type=GAUSSIAN-BLUR] "; - FilterEffect::externalRepresentation(ts); - ts << " [std dev. x=" << stdDeviationX() << " y=" << stdDeviationY() << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h deleted file mode 100644 index 69f1cc5174..0000000000 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric@webkit.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEGaussianBlur_h -#define SVGFEGaussianBlur_h - -#if ENABLE(SVG) && ENABLE(FILTERS) -#include "FilterEffect.h" -#include "Filter.h" - -namespace WebCore { - - class FEGaussianBlur : public FilterEffect { - public: - static PassRefPtr<FEGaussianBlur> create(FilterEffect*, const float&, const float&); - - float stdDeviationX() const; - void setStdDeviationX(float); - - float stdDeviationY() const; - void setStdDeviationY(float); - - virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); } - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEGaussianBlur(FilterEffect*, const float&, const float&); - - RefPtr<FilterEffect> m_in; - float m_x; - float m_y; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(FILTERS) - -#endif // SVGFEGaussianBlur_h diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.cpp index 37677347fa..f7fc5d8070 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.cpp +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.cpp @@ -28,7 +28,7 @@ namespace WebCore { -FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, const float& radiusX, const float& radiusY) +FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY) : FilterEffect() , m_in(in) , m_type(type) @@ -37,7 +37,7 @@ FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, const { } -PassRefPtr<FEMorphology> FEMorphology::create(FilterEffect* in, MorphologyOperatorType type, const float& radiusX, const float& radiusY) +PassRefPtr<FEMorphology> FEMorphology::create(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY) { return adoptRef(new FEMorphology(in, type, radiusX, radiusY)); } @@ -88,8 +88,8 @@ static TextStream& operator<<(TextStream& ts, MorphologyOperatorType t) ts << "UNKNOWN"; break; case FEMORPHOLOGY_OPERATOR_ERODE: ts << "ERODE"; break; - case FEMORPHOLOGY_OPERATOR_DIALATE: - ts << "DIALATE"; break; + case FEMORPHOLOGY_OPERATOR_DILATE: + ts << "DILATE"; break; } return ts; } diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.h b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.h index bdc2b9be27..6a321c8416 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.h +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.h @@ -31,12 +31,12 @@ namespace WebCore { enum MorphologyOperatorType { FEMORPHOLOGY_OPERATOR_UNKNOWN = 0, FEMORPHOLOGY_OPERATOR_ERODE = 1, - FEMORPHOLOGY_OPERATOR_DIALATE = 2 + FEMORPHOLOGY_OPERATOR_DILATE = 2 }; class FEMorphology : public FilterEffect { public: - PassRefPtr<FEMorphology> create(FilterEffect*, MorphologyOperatorType, const float&, const float&); + static PassRefPtr<FEMorphology> create(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY); MorphologyOperatorType morphologyOperator() const; void setMorphologyOperator(MorphologyOperatorType); @@ -52,7 +52,7 @@ namespace WebCore { TextStream& externalRepresentation(TextStream& ts) const; private: - FEMorphology(FilterEffect*, MorphologyOperatorType, const float&, const float&); + FEMorphology(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY); RefPtr<FilterEffect> m_in; MorphologyOperatorType m_type; diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.cpp index c892ee9a85..6bfcf39436 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.cpp +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.cpp @@ -24,12 +24,11 @@ namespace WebCore { -SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode) +SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode) : Filter() , m_itemBox(itemBox) , m_filterRect(filterRect) , m_effectBBoxMode(effectBBoxMode) - , m_filterBBoxMode(filterBBoxMode) { } @@ -37,7 +36,6 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect) { FloatRect subRegionBBox = effect->subRegion(); FloatRect useBBox = effect->unionOfChildEffectSubregions(); - FloatRect newSubRegion = subRegionBBox; if (m_effectBBoxMode) { @@ -55,17 +53,17 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect) if (effect->hasHeight()) newSubRegion.setHeight(subRegionBBox.height() * m_itemBox.height()); } else { - if (effect->xBoundingBoxMode()) - newSubRegion.setX(useBBox.x() + subRegionBBox.x() * useBBox.width()); + if (!effect->hasX()) + newSubRegion.setX(useBBox.x()); - if (effect->yBoundingBoxMode()) - newSubRegion.setY(useBBox.y() + subRegionBBox.y() * useBBox.height()); + if (!effect->hasY()) + newSubRegion.setY(useBBox.y()); - if (effect->widthBoundingBoxMode()) - newSubRegion.setWidth(subRegionBBox.width() * useBBox.width()); + if (!effect->hasWidth()) + newSubRegion.setWidth(useBBox.width()); - if (effect->heightBoundingBoxMode()) - newSubRegion.setHeight(subRegionBBox.height() * useBBox.height()); + if (!effect->hasHeight()) + newSubRegion.setHeight(useBBox.height()); } // clip every filter effect to the filter region @@ -74,9 +72,9 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect) effect->setSubRegion(newSubRegion); } -PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode) +PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode) { - return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode, filterBBoxMode)); + return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode)); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.h b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.h index d6e5f77dd3..f23d1ea999 100644 --- a/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.h +++ b/src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.h @@ -33,7 +33,7 @@ namespace WebCore { class SVGFilter : public Filter { public: - static PassRefPtr<SVGFilter> create(const FloatRect&, const FloatRect&, bool, bool); + static PassRefPtr<SVGFilter> create(const FloatRect&, const FloatRect&, bool); bool effectBoundingBoxMode() { return m_effectBBoxMode; } @@ -42,12 +42,11 @@ namespace WebCore { void calculateEffectSubRegion(FilterEffect*); private: - SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool itemBBoxMode, bool filterBBoxMode); + SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode); FloatRect m_itemBox; FloatRect m_filterRect; bool m_effectBBoxMode; - bool m_filterBBoxMode; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/svg/svgtags.in b/src/3rdparty/webkit/WebCore/svg/svgtags.in index 471c77bfe7..30a0e4cfd5 100644 --- a/src/3rdparty/webkit/WebCore/svg/svgtags.in +++ b/src/3rdparty/webkit/WebCore/svg/svgtags.in @@ -47,9 +47,7 @@ feGaussianBlur createWithNew feImage createWithNew feMerge createWithNew feMergeNode createWithNew -#if 0 feMorphology createWithNew -#endif feOffset createWithNew fePointLight createWithNew feSpecularLighting createWithNew |