Diff
Modified: trunk/Source/WebCore/ChangeLog (184717 => 184718)
--- trunk/Source/WebCore/ChangeLog 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/ChangeLog 2015-05-21 17:34:09 UTC (rev 184718)
@@ -1,3 +1,62 @@
+2015-05-21 Hunseop Jeong <hs85.je...@samsung.com>
+
+ Use modern for-loops in WebCore/svg.
+ https://bugs.webkit.org/show_bug.cgi?id=145209
+
+ Reviewed by Darin Adler.
+
+ No new tests, no new tests.
+
+ * svg/SVGAnimateElementBase.cpp:
+ (WebCore::propertyTypesAreConsistent):
+ * svg/SVGAnimatedPath.cpp:
+ (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
+ * svg/SVGAnimatedTypeAnimator.h:
+ (WebCore::SVGAnimatedTypeAnimator::executeAction):
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::SVGAnimationElement::parseAttribute):
+ * svg/SVGCursorElement.cpp:
+ (WebCore::SVGCursorElement::~SVGCursorElement):
+ * svg/SVGDocumentExtensions.cpp:
+ (WebCore::SVGDocumentExtensions::pauseAnimations):
+ (WebCore::SVGDocumentExtensions::unpauseAnimations):
+ (WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements):
+ (WebCore::SVGDocumentExtensions::isElementWithPendingResources):
+ (WebCore::SVGDocumentExtensions::removeElementFromPendingResources):
+ (WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement):
+ * svg/SVGElement.cpp:
+ (WebCore::populateAttributeNameToCSSPropertyIDMap):
+ (WebCore::populateAttributeNameToAnimatedPropertyTypeMap):
+ (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
+ (WebCore::hasLoadListener):
+ * svg/SVGFontData.cpp:
+ (WebCore::SVGFontData::applySVGGlyphSelection):
+ * svg/SVGFontElement.cpp:
+ (WebCore::SVGFontElement::registerLigaturesInGlyphCache):
+ (WebCore::SVGKerningMap::insert):
+ (WebCore::stringMatchesUnicodeRange):
+ * svg/SVGPathByteStream.h:
+ (WebCore::SVGPathByteStream::append):
+ * svg/animation/SMILTimeContainer.cpp:
+ (WebCore::SMILTimeContainer::setElapsed):
+ (WebCore::SMILTimeContainer::updateAnimations):
+ * svg/animation/SVGSMILElement.cpp:
+ (WebCore::SVGSMILElement::parseBeginOrEnd):
+ (WebCore::SVGSMILElement::connectConditions):
+ (WebCore::SVGSMILElement::disconnectConditions):
+ (WebCore::SVGSMILElement::notifyDependentsIntervalChanged):
+ (WebCore::SVGSMILElement::createInstanceTimesFromSyncbase):
+ * svg/graphics/filters/SVGFilterBuilder.cpp:
+ (WebCore::SVGFilterBuilder::clearResultsRecursive):
+ * svg/graphics/filters/SVGFilterBuilder.h:
+ (WebCore::SVGFilterBuilder::addBuiltinEffects):
+ * svg/properties/SVGAnimatedProperty.cpp:
+ (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
+ * svg/properties/SVGListProperty.h:
+ (WebCore::SVGListProperty::detachListWrappersAndResize):
+ * svg/properties/SVGPathSegListPropertyTearOff.cpp:
+ (WebCore::SVGPathSegListPropertyTearOff::clearContextAndRoles):
+
2015-05-21 Gyuyoung Kim <gyuyoung....@webkit.org>
Purge PassRefPtr in WebCore/Modules
Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -171,12 +171,11 @@
#ifndef NDEBUG
static inline bool propertyTypesAreConsistent(AnimatedPropertyType expectedPropertyType, const SVGElementAnimatedPropertyList& animatedTypes)
{
- SVGElementAnimatedPropertyList::const_iterator end = animatedTypes.end();
- for (SVGElementAnimatedPropertyList::const_iterator it = animatedTypes.begin(); it != end; ++it) {
- for (size_t i = 0; i < it->properties.size(); ++i) {
- if (expectedPropertyType != it->properties[i]->animatedPropertyType()) {
+ for (auto& type : animatedTypes) {
+ for (auto& property : type.properties()) {
+ if (expectedPropertyType != property->animatedPropertyType()) {
// This is the only allowed inconsistency. SVGAnimatedAngleAnimator handles both SVGAnimatedAngle & SVGAnimatedEnumeration for markers orient attribute.
- if (expectedPropertyType == AnimatedAngle && it->properties[i]->animatedPropertyType() == AnimatedEnumeration)
+ if (expectedPropertyType == AnimatedAngle && property->animatedPropertyType() == AnimatedEnumeration)
return true;
return false;
}
Modified: trunk/Source/WebCore/svg/SVGAnimatedPath.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGAnimatedPath.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGAnimatedPath.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -50,15 +50,13 @@
Vector<RefPtr<SVGAnimatedPathSegListPropertyTearOff>> result;
- SVGElementAnimatedPropertyList::const_iterator end = animatedTypes.end();
- for (SVGElementAnimatedPropertyList::const_iterator it = animatedTypes.begin(); it != end; ++it)
- result.append(castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(it->properties[0].get()));
+ for (auto& type : animatedTypes)
+ result.append(castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(type.properties[0].get()));
SVGElement::InstanceUpdateBlocker blocker(*property->contextElement());
- size_t resultSize = result.size();
- for (size_t i = 0; i < resultSize; ++i)
- result[i]->animationStarted(byteStream.get(), &baseValue);
+ for (auto& segment : result)
+ segment->animationStarted(byteStream.get(), &baseValue);
return SVGAnimatedType::createPath(WTF::move(byteStream));
}
Modified: trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h 2015-05-21 17:34:09 UTC (rev 184718)
@@ -191,10 +191,9 @@
// FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
- SVGElementAnimatedPropertyList::const_iterator end = animatedTypes.end();
- for (SVGElementAnimatedPropertyList::const_iterator it = animatedTypes.begin(); it != end; ++it) {
- ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < it->properties.size());
- AnimValType* property = castAnimatedPropertyToActualType<AnimValType>(it->properties[whichProperty].get());
+ for (auto& animatedType : animatedTypes) {
+ ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
+ AnimValType* property = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
switch (action) {
case StartAnimationAction:
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -167,8 +167,8 @@
// and white space before and after semicolon separators, is allowed and will be ignored.
// http://www.w3.org/TR/SVG11/animate.html#ValuesAttribute
value.string().split(';', m_values);
- for (unsigned i = 0; i < m_values.size(); ++i)
- m_values[i] = m_values[i].stripWhiteSpace();
+ for (auto& value : m_values)
+ value = value.stripWhiteSpace();
updateAnimationMode();
return;
Modified: trunk/Source/WebCore/svg/SVGCursorElement.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGCursorElement.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGCursorElement.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -58,9 +58,8 @@
SVGCursorElement::~SVGCursorElement()
{
- HashSet<SVGElement*>::iterator end = m_clients.end();
- for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it)
- (*it)->cursorElementRemoved();
+ for (auto& client : m_clients)
+ client->cursorElementRemoved();
}
bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName)
Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -101,16 +101,14 @@
void SVGDocumentExtensions::pauseAnimations()
{
- auto end = m_timeContainers.end();
- for (auto it = m_timeContainers.begin(); it != end; ++it)
- (*it)->pauseAnimations();
+ for (auto& container : m_timeContainers)
+ container->pauseAnimations();
}
void SVGDocumentExtensions::unpauseAnimations()
{
- auto end = m_timeContainers.end();
- for (auto it = m_timeContainers.begin(); it != end; ++it)
- (*it)->unpauseAnimations();
+ for (auto& container : m_timeContainers)
+ container->unpauseAnimations();
}
void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
@@ -118,12 +116,10 @@
Vector<RefPtr<SVGSVGElement>> timeContainers;
timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end());
- auto end = timeContainers.end();
- for (auto it = timeContainers.begin(); it != end; ++it) {
- SVGSVGElement* outerSVG = (*it).get();
- if (!outerSVG->isOutermostSVGSVGElement())
+ for (auto& container : m_timeContainers) {
+ if (!container->isOutermostSVGSVGElement())
continue;
- outerSVG->sendSVGLoadEventIfPossible();
+ container->sendSVGLoadEventIfPossible();
}
}
@@ -171,9 +167,7 @@
// This algorithm takes time proportional to the number of pending resources and need not.
// If performance becomes an issue we can keep a counted set of elements and answer the question efficiently.
ASSERT(element);
- auto end = m_pendingResources.end();
- for (auto it = m_pendingResources.begin(); it != end; ++it) {
- PendingElements* elements = it->value.get();
+ for (auto& elements : m_pendingResources.values()) {
ASSERT(elements);
if (elements->contains(element))
@@ -205,43 +199,39 @@
// Remove the element from pending resources.
if (!m_pendingResources.isEmpty() && element->hasPendingResources()) {
Vector<AtomicString> toBeRemoved;
- auto end = m_pendingResources.end();
- for (auto it = m_pendingResources.begin(); it != end; ++it) {
- PendingElements* elements = it->value.get();
+ for (auto& resource : m_pendingResources) {
+ PendingElements* elements = resource.value.get();
ASSERT(elements);
ASSERT(!elements->isEmpty());
elements->remove(element);
if (elements->isEmpty())
- toBeRemoved.append(it->key);
+ toBeRemoved.append(resource.key);
}
clearHasPendingResourcesIfPossible(element);
// We use the removePendingResource function here because it deals with set lifetime correctly.
- auto vectorEnd = toBeRemoved.end();
- for (auto it = toBeRemoved.begin(); it != vectorEnd; ++it)
- removePendingResource(*it);
+ for (auto& resource : toBeRemoved)
+ removePendingResource(resource);
}
// Remove the element from pending resources that were scheduled for removal.
if (!m_pendingResourcesForRemoval.isEmpty()) {
Vector<AtomicString> toBeRemoved;
- auto end = m_pendingResourcesForRemoval.end();
- for (auto it = m_pendingResourcesForRemoval.begin(); it != end; ++it) {
- PendingElements* elements = it->value.get();
+ for (auto& resource : m_pendingResourcesForRemoval) {
+ PendingElements* elements = resource.value.get();
ASSERT(elements);
ASSERT(!elements->isEmpty());
elements->remove(element);
if (elements->isEmpty())
- toBeRemoved.append(it->key);
+ toBeRemoved.append(resource.key);
}
// We use the removePendingResourceForRemoval function here because it deals with set lifetime correctly.
- auto vectorEnd = toBeRemoved.end();
- for (auto it = toBeRemoved.begin(); it != vectorEnd; ++it)
- removePendingResourceForRemoval(*it);
+ for (auto& resource : toBeRemoved)
+ removePendingResourceForRemoval(resource);
}
}
@@ -317,18 +307,16 @@
{
Vector<SVGElement*> toBeRemoved;
- auto end = m_elementDependencies.end();
- for (auto it = m_elementDependencies.begin(); it != end; ++it) {
- SVGElement* referencedElement = it->key;
- HashSet<SVGElement*>& referencingElements = *it->value;
+ for (auto& dependency : m_elementDependencies) {
+ SVGElement* referencedElement = dependency.key;
+ HashSet<SVGElement*>& referencingElements = *dependency.value;
referencingElements.remove(referencingElement);
if (referencingElements.isEmpty())
toBeRemoved.append(referencedElement);
}
- auto vectorEnd = toBeRemoved.end();
- for (auto it = toBeRemoved.begin(); it != vectorEnd; ++it)
- m_elementDependencies.remove(*it);
+ for (auto& element : toBeRemoved)
+ m_elementDependencies.remove(element);
}
void SVGDocumentExtensions::rebuildElements()
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -150,8 +150,8 @@
&yAttr,
};
- for (unsigned i = 0; i < WTF_ARRAY_LENGTH(attributeNames); ++i) {
- const AtomicString& localName = attributeNames[i]->localName();
+ for (auto& name : attributeNames) {
+ const AtomicString& localName = name->localName();
map.add(localName.impl(), cssPropertyID(localName));
}
@@ -229,8 +229,8 @@
{ word_spacingAttr, AnimatedLength },
};
- for (unsigned i = 0; i < WTF_ARRAY_LENGTH(table); ++i)
- map.add(table[i].attributeName.impl(), table[i].type);
+ for (auto& entry : table)
+ map.add(entry.attributeName.impl(), entry.type);
}
static inline HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& attributeNameToAnimatedPropertyTypeMap()
@@ -263,8 +263,8 @@
{ yAttr, AnimatedLength },
};
- for (unsigned i = 0; i < WTF_ARRAY_LENGTH(table); ++i)
- map.add(table[i].attributeName.impl(), table[i].type);
+ for (auto& entry : table)
+ map.add(entry.attributeName.impl(), entry.type);
}
static inline HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap()
@@ -639,8 +639,8 @@
for (element = element->parentOrShadowHostElement(); element; element = element->parentOrShadowHostElement()) {
const EventListenerVector& entry = element->getEventListeners(eventNames().loadEvent);
- for (size_t i = 0; i < entry.size(); ++i) {
- if (entry[i].useCapture)
+ for (auto& listener : entry) {
+ if (listener.useCapture)
return true;
}
}
Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGFontData.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -161,19 +161,17 @@
}
Vector<SVGGlyph> glyphs;
- size_t altGlyphNamesSize = altGlyphNames.size();
- if (altGlyphNamesSize) {
- for (size_t index = 0; index < altGlyphNamesSize; ++index)
- associatedFontElement->collectGlyphsForGlyphName(altGlyphNames[index], glyphs);
+ if (!altGlyphNames.isEmpty()) {
+ for (auto& name : altGlyphNames)
+ associatedFontElement->collectGlyphsForGlyphName(name, glyphs);
// Assign the unicodeStringLength now that its known.
- size_t glyphsSize = glyphs.size();
- for (size_t i = 0; i < glyphsSize; ++i)
- glyphs[i].unicodeStringLength = run.length();
+ for (auto& glyph : glyphs)
+ glyph.unicodeStringLength = run.length();
// Do not check alt glyphs for compatibility. Just return the first one.
// Later code will fail if we do not do this and the glyph is incompatible.
- if (glyphsSize) {
+ if (!glyphs.isEmpty()) {
SVGGlyph& svgGlyph = glyphs[0];
iterator.setLastGlyphName(svgGlyph.glyphName);
glyphData.glyph = svgGlyph.tableEntry;
@@ -191,16 +189,14 @@
associatedFontElement->collectGlyphsForString(remainingTextInRun, glyphs);
}
- size_t glyphsSize = glyphs.size();
- for (size_t i = 0; i < glyphsSize; ++i) {
- SVGGlyph& svgGlyph = glyphs[i];
- if (svgGlyph.isPartOfLigature)
+ for (auto& glyph : glyphs) {
+ if (glyph.isPartOfLigature)
continue;
- if (!isCompatibleGlyph(svgGlyph, isVerticalText, language, arabicForms, currentCharacter, currentCharacter + svgGlyph.unicodeStringLength))
+ if (!isCompatibleGlyph(glyph, isVerticalText, language, arabicForms, currentCharacter, currentCharacter + glyph.unicodeStringLength))
continue;
- iterator.setLastGlyphName(svgGlyph.glyphName);
- glyphData.glyph = svgGlyph.tableEntry;
- advanceLength = svgGlyph.unicodeStringLength;
+ iterator.setLastGlyphName(glyph.glyphName);
+ glyphData.glyph = glyph.tableEntry;
+ advanceLength = glyph.unicodeStringLength;
return true;
}
Modified: trunk/Source/WebCore/svg/SVGFontElement.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGFontElement.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGFontElement.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -86,10 +86,7 @@
// will not be able to find a glyph for "f", but handles the fallback
// character substitution properly through glyphDataForCharacter().
Vector<SVGGlyph> glyphs;
- size_t ligaturesSize = ligatures.size();
- for (size_t i = 0; i < ligaturesSize; ++i) {
- const String& unicode = ligatures[i];
-
+ for (auto& unicode : ligatures) {
unsigned unicodeLength = unicode.length();
ASSERT(unicodeLength > 1);
@@ -174,27 +171,23 @@
svgKerning.unicodeName2 = kerningPair.unicodeName2;
svgKerning.glyphName2 = kerningPair.glyphName2;
- HashSet<String>::const_iterator uIt = kerningPair.unicodeName1.begin();
- const HashSet<String>::const_iterator uEnd = kerningPair.unicodeName1.end();
- for (; uIt != uEnd; ++uIt) {
- if (unicodeMap.contains(*uIt))
- unicodeMap.get(*uIt)->append(svgKerning);
+ for (auto& name : kerningPair.unicodeName1) {
+ if (unicodeMap.contains(name))
+ unicodeMap.get(name)->append(svgKerning);
else {
auto newVector = std::make_unique<SVGKerningVector>();
newVector->append(svgKerning);
- unicodeMap.add(*uIt, WTF::move(newVector));
+ unicodeMap.add(name, WTF::move(newVector));
}
}
- HashSet<String>::const_iterator gIt = kerningPair.glyphName1.begin();
- const HashSet<String>::const_iterator gEnd = kerningPair.glyphName1.end();
- for (; gIt != gEnd; ++gIt) {
- if (glyphMap.contains(*gIt))
- glyphMap.get(*gIt)->append(svgKerning);
+ for (auto& name : kerningPair.glyphName1) {
+ if (glyphMap.contains(name))
+ glyphMap.get(name)->append(svgKerning);
else {
auto newVector = std::make_unique<SVGKerningVector>();
newVector->append(svgKerning);
- glyphMap.add(*gIt, WTF::move(newVector));
+ glyphMap.add(name, WTF::move(newVector));
}
}
@@ -209,9 +202,8 @@
if (!ranges.isEmpty()) {
UChar firstChar = unicodeString[0];
- const UnicodeRanges::const_iterator end = ranges.end();
- for (UnicodeRanges::const_iterator it = ranges.begin(); it != end; ++it) {
- if (firstChar >= it->first && firstChar <= it->second)
+ for (auto& range : ranges) {
+ if (firstChar >= range.first && firstChar <= range.second)
return true;
}
}
Modified: trunk/Source/WebCore/svg/SVGPathByteStream.h (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGPathByteStream.h 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGPathByteStream.h 2015-05-21 17:34:09 UTC (rev 184718)
@@ -58,10 +58,10 @@
DataIterator begin() { return m_data.begin(); }
DataIterator end() { return m_data.end(); }
void append(unsigned char byte) { m_data.append(byte); }
- void append(SVGPathByteStream* other)
+ void append(SVGPathByteStream& other)
{
- for (DataIterator it = other->begin(); it != other->end(); ++it)
- append(*it);
+ for (auto stream : other)
+ append(stream);
}
void clear() { m_data.clear(); }
bool isEmpty() const { return !m_data.size(); }
Modified: trunk/Source/WebCore/svg/SVGPathUtilities.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/SVGPathUtilities.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/SVGPathUtilities.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -155,7 +155,7 @@
parser->cleanup();
if (ok)
- result->append(appendedByteStream.get());
+ result->append(*appendedByteStream);
return ok;
}
Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -187,11 +187,9 @@
#ifndef NDEBUG
m_preventScheduledAnimationsChanges = true;
#endif
- for (auto& it : m_scheduledAnimations) {
- AnimationsVector* scheduled = it.value.get();
- unsigned size = scheduled->size();
- for (unsigned n = 0; n < size; n++)
- scheduled->at(n)->reset();
+ for (auto& animation : m_scheduledAnimations.values()) {
+ for (auto& element : *animation)
+ element->reset();
}
#ifndef NDEBUG
m_preventScheduledAnimationsChanges = false;
@@ -274,9 +272,7 @@
sortByPriority(*scheduled, elapsed);
SVGSMILElement* resultElement = 0;
- unsigned size = scheduled->size();
- for (unsigned n = 0; n < size; n++) {
- SVGSMILElement* animation = scheduled->at(n);
+ for (auto& animation : *scheduled) {
ASSERT(animation->timeContainer() == this);
ASSERT(animation->targetElement());
ASSERT(animation->hasValidAttributeName());
@@ -301,8 +297,7 @@
animationsToApply.append(resultElement);
}
- unsigned animationsToApplySize = animationsToApply.size();
- if (!animationsToApplySize) {
+ if (animationsToApply.isEmpty()) {
#ifndef NDEBUG
m_preventScheduledAnimationsChanges = false;
#endif
@@ -311,8 +306,8 @@
}
// Apply results to target elements.
- for (unsigned i = 0; i < animationsToApplySize; ++i)
- animationsToApply[i]->applyResultsToTarget();
+ for (auto& animation : animationsToApply)
+ animation->applyResultsToTarget();
#ifndef NDEBUG
m_preventScheduledAnimationsChanges = false;
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -421,14 +421,14 @@
if (beginOrEnd == End)
m_hasEndEventConditions = false;
HashSet<double> existing;
- for (unsigned n = 0; n < timeList.size(); ++n)
- existing.add(timeList[n].time().value());
+ for (auto& time : timeList)
+ existing.add(time.time().value());
Vector<String> splitString;
parseString.split(';', splitString);
- for (unsigned n = 0; n < splitString.size(); ++n) {
- SMILTime value = parseClockValue(splitString[n]);
+ for (auto& string : splitString) {
+ SMILTime value = parseClockValue(string);
if (value.isUnresolved())
- parseCondition(splitString[n], beginOrEnd);
+ parseCondition(string, beginOrEnd);
else if (!existing.contains(value.value()))
timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::ParserOrigin));
}
@@ -518,8 +518,7 @@
if (m_conditionsConnected)
disconnectConditions();
m_conditionsConnected = true;
- for (unsigned n = 0; n < m_conditions.size(); ++n) {
- Condition& condition = m_conditions[n];
+ for (auto& condition : m_conditions) {
if (condition.m_type == Condition::EventBase) {
ASSERT(!condition.m_syncbase);
Element* eventBase = eventBaseFor(condition);
@@ -547,8 +546,7 @@
if (!m_conditionsConnected)
return;
m_conditionsConnected = false;
- for (unsigned n = 0; n < m_conditions.size(); ++n) {
- Condition& condition = m_conditions[n];
+ for (auto& condition : m_conditions) {
if (condition.m_type == Condition::EventBase) {
ASSERT(!condition.m_syncbase);
if (!condition.m_eventListener)
@@ -1126,9 +1124,7 @@
return;
loopBreaker.add(this);
- TimeDependentSet::iterator end = m_timeDependents.end();
- for (TimeDependentSet::iterator it = m_timeDependents.begin(); it != end; ++it) {
- SVGSMILElement* dependent = *it;
+ for (auto& dependent : m_timeDependents) {
dependent->createInstanceTimesFromSyncbase(this, newOrExisting);
}
@@ -1139,8 +1135,7 @@
{
// FIXME: To be really correct, this should handle updating exising interval by changing
// the associated times instead of creating new ones.
- for (unsigned n = 0; n < m_conditions.size(); ++n) {
- Condition& condition = m_conditions[n];
+ for (auto& condition : m_conditions) {
if (condition.m_type == Condition::Syncbase && condition.m_syncbase == syncbase) {
ASSERT(condition.m_name == "begin" || condition.m_name == "end");
// No nested time containers in SVG, no need for crazy time space conversions. Phew!
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -95,10 +95,8 @@
effect->clearResult();
- HashSet<FilterEffect*>& effectReferences = this->effectReferences(effect);
- HashSet<FilterEffect*>::iterator end = effectReferences.end();
- for (HashSet<FilterEffect*>::iterator it = effectReferences.begin(); it != end; ++it)
- clearResultsRecursive(*it);
+ for (auto& reference : effectReferences(effect))
+ clearResultsRecursive(reference);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h (184717 => 184718)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h 2015-05-21 17:34:09 UTC (rev 184718)
@@ -62,9 +62,8 @@
private:
inline void addBuiltinEffects()
{
- HashMap<AtomicString, RefPtr<FilterEffect>>::iterator end = m_builtinEffects.end();
- for (HashMap<AtomicString, RefPtr<FilterEffect>>::iterator iterator = m_builtinEffects.begin(); iterator != end; ++iterator)
- m_effectReferences.add(iterator->value, FilterEffectSet());
+ for (auto& effect : m_builtinEffects.values())
+ m_effectReferences.add(effect, FilterEffectSet());
}
HashMap<AtomicString, RefPtr<FilterEffect>> m_builtinEffects;
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -37,10 +37,9 @@
SVGAnimatedProperty::~SVGAnimatedProperty()
{
// Remove wrapper from cache.
- Cache& cache = *animatedPropertyCache();
- for (auto it = cache.begin(), end = cache.end(); it != end; ++it) {
- if (it->value == this) {
- cache.remove(it);
+ for (auto& cache : *animatedPropertyCache()) {
+ if (cache.value == this) {
+ animatedPropertyCache()->remove(cache.key);
break;
}
}
Modified: trunk/Source/WebCore/svg/properties/SVGListProperty.h (184717 => 184718)
--- trunk/Source/WebCore/svg/properties/SVGListProperty.h 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/properties/SVGListProperty.h 2015-05-21 17:34:09 UTC (rev 184718)
@@ -62,9 +62,8 @@
{
// See SVGPropertyTearOff::detachWrapper() for an explanation about what's happening here.
ASSERT(wrappers);
- unsigned size = wrappers->size();
- for (unsigned i = 0; i < size; ++i) {
- if (ListItemTearOff* item = wrappers->at(i).get())
+ for (auto& item : *wrappers) {
+ if (item)
item->detachWrapper();
}
Modified: trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp (184717 => 184718)
--- trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp 2015-05-21 17:27:47 UTC (rev 184717)
+++ trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp 2015-05-21 17:34:09 UTC (rev 184718)
@@ -30,9 +30,7 @@
void SVGPathSegListPropertyTearOff::clearContextAndRoles()
{
ASSERT(m_values);
- unsigned size = m_values->size();
- for (unsigned i = 0; i < size; ++i) {
- ListItemType item = m_values->at(i);
+ for (auto& item : *m_values) {
static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(0, PathSegUndefinedRole);
}
}