[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
zimmermann at webkit.org
zimmermann at webkit.org
Thu Oct 29 20:46:59 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 53fd82eadfcb495150eae927d47a6c78409b5f7f
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 17 22:52:54 2009 +0000
2009-10-17 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by George Staikos.
Cleanup SVGElement code, preparing for animVal support
https://bugs.webkit.org/show_bug.cgi?id=30466
Add new SynchronizablePropertyController and move the code for SVG property <-> XML attribute synchronization
from SVGElement. This is a further preparation for animVal support, where SynchronizablePropertyController will
be used to control the start/end state of an animated property.
We're currently tracking animated properties that need synchronization, generalize this concept and use
it to track their creation (bound to certain SVG*Element classes) as well as a flag determing the need
of synchronization (no SVG DOM object wrappers, no synchronization needed).
No change in functionality, thus no tests.
* GNUmakefile.am: Add 'SynchronizablePropertyController.cpp/h' to build
* WebCore.gypi: Ditto.
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* svg/SVGAllInOne.cpp: Ditto.
* svg/SVGAnimatedProperty.h: Add registerProperty() function
(WebCore::::SVGAnimatedProperty): Call registerProperty() function
(WebCore::::registerProperty): Add new registerProperty() function, announcing new properties to SynchronizablePropertyController.
* svg/SVGAnimatedTemplate.h: Use propertyController() method, to access the new functions moved from SVGElement.
(WebCore::lookupOrCreateWrapper):
* svg/SVGElement.cpp: Adapt to code moving to SynchronizablePropertyController.
(WebCore::SVGElement::updateAnimatedSVGAttribute):
* svg/SVGElement.h: Move handling SVG property synchronization to SynchronizablePropertyController.
(WebCore::SVGElement::propertyController): Expose reference to SynchronizablePropertyController object.
* svg/SVGViewSpec.cpp: Reorder initialization order of contextElement, leading to possible crashes.
(WebCore::SVGViewSpec::SVGViewSpec):
(WebCore::SVGViewSpec::viewTarget):
* svg/SVGViewSpec.h: Ditto.
(WebCore::SVGViewSpec::contextElement):
* svg/SynchronizablePropertyController.cpp: Added.
(WebCore::SynchronizablePropertyController::SynchronizablePropertyController):
(WebCore::SynchronizablePropertyController::registerProperty):
(WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization):
(WebCore::SynchronizablePropertyController::synchronizeProperty):
(WebCore::SynchronizablePropertyController::synchronizeAllProperties):
(WebCore::SynchronizablePropertyController::startAnimation):
(WebCore::SynchronizablePropertyController::stopAnimation):
* svg/SynchronizablePropertyController.h: Added.
(WebCore::SynchronizableProperty::SynchronizableProperty):
(WebCore::SynchronizableProperty::isHashTableDeletedValue):
(WebCore::SynchronizableProperty::operator==):
(WebCore::SynchronizablePropertyHash::hash):
(WebCore::SynchronizablePropertyHash::equal):
(WebCore::SynchronizablePropertyHashTraits::constructDeletedValue):
(WebCore::SynchronizablePropertyHashTraits::isDeletedValue):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49745 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0aa2ad8..5890701 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,57 @@
+2009-10-17 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by George Staikos.
+
+ Cleanup SVGElement code, preparing for animVal support
+ https://bugs.webkit.org/show_bug.cgi?id=30466
+
+ Add new SynchronizablePropertyController and move the code for SVG property <-> XML attribute synchronization
+ from SVGElement. This is a further preparation for animVal support, where SynchronizablePropertyController will
+ be used to control the start/end state of an animated property.
+
+ We're currently tracking animated properties that need synchronization, generalize this concept and use
+ it to track their creation (bound to certain SVG*Element classes) as well as a flag determing the need
+ of synchronization (no SVG DOM object wrappers, no synchronization needed).
+
+ No change in functionality, thus no tests.
+
+ * GNUmakefile.am: Add 'SynchronizablePropertyController.cpp/h' to build
+ * WebCore.gypi: Ditto.
+ * WebCore.pro: Ditto.
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * svg/SVGAllInOne.cpp: Ditto.
+ * svg/SVGAnimatedProperty.h: Add registerProperty() function
+ (WebCore::::SVGAnimatedProperty): Call registerProperty() function
+ (WebCore::::registerProperty): Add new registerProperty() function, announcing new properties to SynchronizablePropertyController.
+ * svg/SVGAnimatedTemplate.h: Use propertyController() method, to access the new functions moved from SVGElement.
+ (WebCore::lookupOrCreateWrapper):
+ * svg/SVGElement.cpp: Adapt to code moving to SynchronizablePropertyController.
+ (WebCore::SVGElement::updateAnimatedSVGAttribute):
+ * svg/SVGElement.h: Move handling SVG property synchronization to SynchronizablePropertyController.
+ (WebCore::SVGElement::propertyController): Expose reference to SynchronizablePropertyController object.
+ * svg/SVGViewSpec.cpp: Reorder initialization order of contextElement, leading to possible crashes.
+ (WebCore::SVGViewSpec::SVGViewSpec):
+ (WebCore::SVGViewSpec::viewTarget):
+ * svg/SVGViewSpec.h: Ditto.
+ (WebCore::SVGViewSpec::contextElement):
+ * svg/SynchronizablePropertyController.cpp: Added.
+ (WebCore::SynchronizablePropertyController::SynchronizablePropertyController):
+ (WebCore::SynchronizablePropertyController::registerProperty):
+ (WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization):
+ (WebCore::SynchronizablePropertyController::synchronizeProperty):
+ (WebCore::SynchronizablePropertyController::synchronizeAllProperties):
+ (WebCore::SynchronizablePropertyController::startAnimation):
+ (WebCore::SynchronizablePropertyController::stopAnimation):
+ * svg/SynchronizablePropertyController.h: Added.
+ (WebCore::SynchronizableProperty::SynchronizableProperty):
+ (WebCore::SynchronizableProperty::isHashTableDeletedValue):
+ (WebCore::SynchronizableProperty::operator==):
+ (WebCore::SynchronizablePropertyHash::hash):
+ (WebCore::SynchronizablePropertyHash::equal):
+ (WebCore::SynchronizablePropertyHashTraits::constructDeletedValue):
+ (WebCore::SynchronizablePropertyHashTraits::isDeletedValue):
+
2009-10-17 Joanmarie Diggs <joanmarie.diggs at gmail.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index bc69ca0..f12c811 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3154,6 +3154,8 @@ webcore_sources += \
WebCore/svg/SVGZoomAndPan.h \
WebCore/svg/SVGZoomEvent.cpp \
WebCore/svg/SVGZoomEvent.h \
+ WebCore/svg/SynchronizablePropertyController.cpp \
+ WebCore/svg/SynchronizablePropertyController.h \
WebCore/svg/SynchronizableTypeWrapper.h \
WebCore/svg/animation/SMILTime.cpp \
WebCore/svg/animation/SMILTime.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index afe422f..9542a00 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3479,6 +3479,8 @@
'svg/SVGZoomAndPan.h',
'svg/SVGZoomEvent.cpp',
'svg/SVGZoomEvent.h',
+ 'svg/SynchronizablePropertyController.cpp',
+ 'svg/SynchronizablePropertyController.h',
'svg/SynchronizableTypeWrapper.h',
'websockets/WebSocket.cpp',
'websockets/WebSocket.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 31a1931..5ed5b70 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2253,6 +2253,7 @@ HEADERS += \
svg/SVGViewSpec.h \
svg/SVGZoomAndPan.h \
svg/SVGZoomEvent.h \
+ svg/SynchronizablePropertyController.h \
wml/WMLAccessElement.h \
wml/WMLAElement.h \
wml/WMLAnchorElement.h \
@@ -3008,6 +3009,7 @@ contains(DEFINES, ENABLE_SVG=1) {
svg/SVGViewElement.cpp \
svg/SVGViewSpec.cpp \
svg/SVGZoomAndPan.cpp \
+ svg/SynchronizablePropertyController.cpp \
svg/animation/SMILTime.cpp \
svg/animation/SMILTimeContainer.cpp \
svg/animation/SVGSMILElement.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index f09f6ef..7867185 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -34270,6 +34270,10 @@
RelativePath="..\svg\SVGZoomEvent.h"
>
</File>
+ <File
+ RelativePath="..\svg\SynchronizablePropertyController.h"
+ >
+ </File>
<Filter
Name="animation"
>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 913f766..5d20430 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -90,6 +90,10 @@
087281580F26B9B600AFC596 /* OptionGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087281540F26B9B600AFC596 /* OptionGroupElement.h */; };
08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; };
08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; };
+ 0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; };
+ 0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */; };
+ 0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; };
+ 0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; };
087FFA0F0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */; };
087FFA100EFF3ED3009DBD88 /* WMLInsertedLegendElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */; };
08807B760ED709AB003F6975 /* WMLGoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08807B6A0ED709AB003F6975 /* WMLGoElement.cpp */; };
@@ -5250,6 +5254,10 @@
087281540F26B9B600AFC596 /* OptionGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionGroupElement.h; sourceTree = "<group>"; };
08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLOnEventElement.cpp; sourceTree = "<group>"; };
08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLOnEventElement.h; sourceTree = "<group>"; };
+ 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; };
+ 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronizablePropertyController.cpp; sourceTree = "<group>"; };
+ 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronizablePropertyController.h; sourceTree = "<group>"; };
+ 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronizableTypeWrapper.h; sourceTree = "<group>"; };
087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLInsertedLegendElement.cpp; sourceTree = "<group>"; };
087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLInsertedLegendElement.h; sourceTree = "<group>"; };
08807B6A0ED709AB003F6975 /* WMLGoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLGoElement.cpp; sourceTree = "<group>"; };
@@ -13484,6 +13492,7 @@
B22277F20D00BF1F0071B782 /* SVGAnimatedPoints.h */,
B22277F30D00BF1F0071B782 /* SVGAnimatedPoints.idl */,
B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */,
+ 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */,
B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
B22277F60D00BF1F0071B782 /* SVGAnimatedString.idl */,
B22277F70D00BF1F0071B782 /* SVGAnimatedTemplate.h */,
@@ -13872,6 +13881,9 @@
B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */,
B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */,
B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */,
+ 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */,
+ 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */,
+ 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */,
B28C6A260D00C44800334AA4 /* xlinkattrs.in */,
);
path = svg;
@@ -17687,6 +17699,7 @@
B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
B22279850D00BF220071B782 /* SVGAnimatedPathData.h in Headers */,
B22279880D00BF220071B782 /* SVGAnimatedPoints.h in Headers */,
+ 0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */,
B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */,
B22279900D00BF220071B782 /* SVGAnimateElement.h in Headers */,
B22279930D00BF220071B782 /* SVGAnimateMotionElement.h in Headers */,
@@ -17860,6 +17873,8 @@
B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */,
B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
+ 0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */,
+ 0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */,
93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */,
A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */,
BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
@@ -20023,6 +20038,7 @@
B2227AF20D00BF220071B782 /* SVGViewSpec.cpp in Sources */,
B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
+ 0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */,
6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */,
BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */,
6550B6A5099DF0270090D781 /* Text.cpp in Sources */,
diff --git a/WebCore/svg/SVGAllInOne.cpp b/WebCore/svg/SVGAllInOne.cpp
index b54220a..6606243 100644
--- a/WebCore/svg/SVGAllInOne.cpp
+++ b/WebCore/svg/SVGAllInOne.cpp
@@ -150,3 +150,4 @@
#include "SVGViewSpec.cpp"
#include "SVGZoomAndPan.cpp"
#include "SVGZoomEvent.cpp"
+#include "SynchronizablePropertyController.cpp"
diff --git a/WebCore/svg/SVGAnimatedProperty.h b/WebCore/svg/SVGAnimatedProperty.h
index 3701c62..984046f 100644
--- a/WebCore/svg/SVGAnimatedProperty.h
+++ b/WebCore/svg/SVGAnimatedProperty.h
@@ -71,6 +71,8 @@ namespace WebCore {
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>
@@ -125,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;
@@ -141,6 +144,10 @@ namespace WebCore {
const AtomicString& m_attributeIdentifier;
mutable SynchronizableTypeWrapper<StorableType> m_value;
+
+#ifndef NDEBUG
+ bool m_registered;
+#endif
};
// SVGAnimatedPropertyTearOff implementation
@@ -187,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>
@@ -199,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>
@@ -212,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>
@@ -226,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>
@@ -240,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>
@@ -255,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>
@@ -270,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>
@@ -286,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);
}
@@ -308,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))
@@ -319,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)) {
@@ -335,12 +378,25 @@ 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;
@@ -351,6 +407,7 @@ namespace WebCore {
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();
if (SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions()) {
ASSERT(!extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier));
@@ -361,11 +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();
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);
}
}
diff --git a/WebCore/svg/SVGAnimatedTemplate.h b/WebCore/svg/SVGAnimatedTemplate.h
index 3f04c5b..e7c49c1 100644
--- a/WebCore/svg/SVGAnimatedTemplate.h
+++ b/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/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index 6a4caae..27e8c04 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -270,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/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 45210d8..b247a74 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -25,6 +25,7 @@
#if ENABLE(SVG)
#include "StyledElement.h"
#include "SVGAnimatedProperty.h"
+#include "SynchronizablePropertyController.h"
namespace WebCore {
@@ -77,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*);
@@ -106,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/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp
index f32514c..e6ded33 100644
--- a/WebCore/svg/SVGViewSpec.cpp
+++ b/WebCore/svg/SVGViewSpec.cpp
@@ -34,10 +34,10 @@ namespace WebCore {
SVGViewSpec::SVGViewSpec(const SVGSVGElement* contextElement)
: SVGFitToViewBox()
, SVGZoomAndPan()
+ , m_contextElement(contextElement)
, m_viewBox(this, SVGNames::viewBoxAttr)
, m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())
, m_transform(SVGTransformList::create(SVGNames::transformAttr))
- , m_contextElement(contextElement)
{
}
@@ -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'};
diff --git a/WebCore/svg/SVGViewSpec.h b/WebCore/svg/SVGViewSpec.h
index 211849a..090b7ae 100644
--- a/WebCore/svg/SVGViewSpec.h
+++ b/WebCore/svg/SVGViewSpec.h
@@ -51,15 +51,16 @@ namespace WebCore {
String viewTargetString() const { return m_viewTargetString; }
SVGElement* viewTarget() const;
- const SVGElement* contextElement() const;
+ const SVGSVGElement* contextElement() const { return m_contextElement; }
private:
+ 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;
- const SVGSVGElement* m_contextElement;
String m_viewTargetString;
};
diff --git a/WebCore/svg/SynchronizablePropertyController.cpp b/WebCore/svg/SynchronizablePropertyController.cpp
new file mode 100644
index 0000000..e969514
--- /dev/null
+++ b/WebCore/svg/SynchronizablePropertyController.cpp
@@ -0,0 +1,163 @@
+/*
+ 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 {
+
+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.
+ SynchronizableProperty property(base);
+
+ PropertyMap::iterator it = m_map.find(attrName.localName());
+ if (it == m_map.end()) {
+ Properties properties;
+ properties.add(property);
+ m_map.set(attrName.localName(), properties);
+ return;
+ }
+
+ Properties& properties = it->second;
+ ASSERT(!properties.isEmpty());
+
+ properties.add(property);
+}
+
+void SynchronizablePropertyController::setPropertyNeedsSynchronization(const QualifiedName& attrName)
+{
+ PropertyMap::iterator itProp = m_map.find(attrName.localName());
+ ASSERT(itProp != m_map.end());
+
+ Properties& properties = itProp->second;
+ ASSERT(!properties.isEmpty());
+
+ Properties::iterator it = properties.begin();
+ Properties::iterator end = properties.end();
+
+ for (; it != end; ++it) {
+ SynchronizableProperty& property = *it;
+ ASSERT(property.base);
+ property.shouldSynchronize = true;
+ }
+}
+
+void SynchronizablePropertyController::synchronizeProperty(const String& name)
+{
+ PropertyMap::iterator itProp = m_map.find(name);
+ if (itProp == m_map.end())
+ return;
+
+ Properties& properties = itProp->second;
+ ASSERT(!properties.isEmpty());
+
+ Properties::iterator it = properties.begin();
+ Properties::iterator end = properties.end();
+
+ for (; it != end; ++it) {
+ SynchronizableProperty& property = *it;
+ ASSERT(property.base);
+
+ if (!property.shouldSynchronize)
+ continue;
+
+ property.base->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) {
+ Properties& properties = itProp->second;
+ ASSERT(!properties.isEmpty());
+
+ Properties::iterator it = properties.begin();
+ Properties::iterator end = properties.end();
+
+ for (; it != end; ++it) {
+ SynchronizableProperty& property = *it;
+ ASSERT(property.base);
+
+ if (!property.shouldSynchronize)
+ continue;
+
+ property.base->synchronize();
+ }
+ }
+}
+
+void SynchronizablePropertyController::startAnimation(const String& name)
+{
+ PropertyMap::iterator itProp = m_map.find(name);
+ if (itProp == m_map.end())
+ return;
+
+ Properties& properties = itProp->second;
+ ASSERT(!properties.isEmpty());
+
+ Properties::iterator it = properties.begin();
+ Properties::iterator end = properties.end();
+
+ for (; it != end; ++it) {
+ SynchronizableProperty& property = *it;
+ ASSERT(property.base);
+ property.base->startAnimation();
+ }
+}
+
+void SynchronizablePropertyController::stopAnimation(const String& name)
+{
+ PropertyMap::iterator itProp = m_map.find(name);
+ if (itProp == m_map.end())
+ return;
+
+ Properties& properties = itProp->second;
+ ASSERT(!properties.isEmpty());
+
+ Properties::iterator it = properties.begin();
+ Properties::iterator end = properties.end();
+
+ for (; it != end; ++it) {
+ SynchronizableProperty& property = *it;
+ ASSERT(property.base);
+ property.base->stopAnimation();
+ }
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SynchronizablePropertyController.h b/WebCore/svg/SynchronizablePropertyController.h
new file mode 100644
index 0000000..b7f101b
--- /dev/null
+++ b/WebCore/svg/SynchronizablePropertyController.h
@@ -0,0 +1,122 @@
+/*
+ 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;
+
+struct SynchronizableProperty {
+ SynchronizableProperty()
+ : base(0)
+ , shouldSynchronize(false)
+ {
+ }
+
+ explicit SynchronizableProperty(SVGAnimatedPropertyBase* _base)
+ : base(_base)
+ , shouldSynchronize(false)
+ {
+ }
+
+ explicit SynchronizableProperty(WTF::HashTableDeletedValueType)
+ : base(reinterpret_cast<SVGAnimatedPropertyBase*>(-1))
+ , shouldSynchronize(false)
+ {
+ }
+
+ bool isHashTableDeletedValue() const
+ {
+ return base == reinterpret_cast<SVGAnimatedPropertyBase*>(-1);
+ }
+
+ bool operator==(const SynchronizableProperty& other) const
+ {
+ return base == other.base && shouldSynchronize == other.shouldSynchronize;
+ }
+
+ SVGAnimatedPropertyBase* base;
+ bool shouldSynchronize;
+};
+
+struct SynchronizablePropertyHash {
+ static unsigned hash(const SynchronizableProperty& key)
+ {
+ return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(SynchronizableProperty) / sizeof(UChar));
+ }
+
+ static bool equal(const SynchronizableProperty& a, const SynchronizableProperty& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct SynchronizablePropertyHashTraits : WTF::GenericHashTraits<SynchronizableProperty> {
+ static const bool emptyValueIsZero = true;
+
+ static void constructDeletedValue(SynchronizableProperty& slot)
+ {
+ new (&slot) SynchronizableProperty(WTF::HashTableDeletedValue);
+ }
+
+ static bool isDeletedValue(const SynchronizableProperty& value)
+ {
+ return value.isHashTableDeletedValue();
+ }
+};
+
+// 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 HashSet<SynchronizableProperty, SynchronizablePropertyHash, SynchronizablePropertyHashTraits> Properties;
+ typedef HashMap<String, Properties> PropertyMap;
+
+ PropertyMap m_map;
+};
+
+};
+
+#endif // ENABLE(SVG)
+#endif // SynchronizablePropertyController_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list