summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-04 16:37:58 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-04 16:37:58 (GMT)
commitbc5ff9a1fc9982d8669324fde2103dd447486860 (patch)
treec6d2dec1e4a083e7128a3e6bd4fdb5be28290da6 /src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp
parent9a88c8808f8e084e77ee22f907366250f3a0ad2a (diff)
parent56b8d24c337d30c6bcdda101fbc664c4fd6d642d (diff)
downloadQt-bc5ff9a1fc9982d8669324fde2103dd447486860.zip
Qt-bc5ff9a1fc9982d8669324fde2103dd447486860.tar.gz
Qt-bc5ff9a1fc9982d8669324fde2103dd447486860.tar.bz2
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp128
1 files changed, 55 insertions, 73 deletions
diff --git a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp
index e969514..be8ab78 100644
--- a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp
@@ -28,6 +28,52 @@
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()
{
}
@@ -36,20 +82,15 @@ void SynchronizablePropertyController::registerProperty(const QualifiedName& att
{
// '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);
+ SynchronizableProperties properties;
+ properties.addProperty(base);
m_map.set(attrName.localName(), properties);
return;
}
- Properties& properties = it->second;
- ASSERT(!properties.isEmpty());
-
- properties.add(property);
+ it->second.addProperty(base);
}
void SynchronizablePropertyController::setPropertyNeedsSynchronization(const QualifiedName& attrName)
@@ -57,17 +98,7 @@ void SynchronizablePropertyController::setPropertyNeedsSynchronization(const Qua
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;
- }
+ itProp->second.setNeedsSynchronization();
}
void SynchronizablePropertyController::synchronizeProperty(const String& name)
@@ -76,21 +107,7 @@ void SynchronizablePropertyController::synchronizeProperty(const String& 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();
- }
+ itProp->second.synchronize();
}
void SynchronizablePropertyController::synchronizeAllProperties()
@@ -101,23 +118,8 @@ void SynchronizablePropertyController::synchronizeAllProperties()
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();
- }
- }
+ for (; itProp != endProp; ++itProp)
+ itProp->second.synchronize();
}
void SynchronizablePropertyController::startAnimation(const String& name)
@@ -126,17 +128,7 @@ void SynchronizablePropertyController::startAnimation(const String& 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();
- }
+ itProp->second.startAnimation();
}
void SynchronizablePropertyController::stopAnimation(const String& name)
@@ -145,17 +137,7 @@ void SynchronizablePropertyController::stopAnimation(const String& 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();
- }
+ itProp->second.stopAnimation();
}
}