Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2582)

Unified Diff: Source/core/svg/SVGEnumeration.cpp

Issue 1143523002: Refactoring Iterator used on SVGEnumeration. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: for-each Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGEnumeration.cpp
diff --git a/Source/core/svg/SVGEnumeration.cpp b/Source/core/svg/SVGEnumeration.cpp
index c385130acf4ebfb20acc32ba2a5cb4c1a2290906..d1a0ff975cd07e9c45310d1f17c0b6425e15b427 100644
--- a/Source/core/svg/SVGEnumeration.cpp
+++ b/Source/core/svg/SVGEnumeration.cpp
@@ -59,11 +59,9 @@ PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGEnumerationBase::cloneForAnimation(co
String SVGEnumerationBase::valueAsString() const
{
- StringEntries::const_iterator it = m_entries.begin();
- StringEntries::const_iterator itEnd = m_entries.end();
- for (; it != itEnd; ++it) {
- if (m_value == it->first)
- return it->second;
+ for (const auto& entry : m_entries) {
+ if (m_value == entry.first)
+ return entry.second;
}
ASSERT(m_value < maxInternalEnumValue());
@@ -88,13 +86,11 @@ void SVGEnumerationBase::setValue(unsigned short value, ExceptionState& exceptio
void SVGEnumerationBase::setValueAsString(const String& string, ExceptionState& exceptionState)
{
- StringEntries::const_iterator it = m_entries.begin();
- StringEntries::const_iterator itEnd = m_entries.end();
- for (; it != itEnd; ++it) {
- if (string == it->second) {
+ for (const auto& entry : m_entries) {
+ if (string == entry.second) {
// 0 corresponds to _UNKNOWN enumeration values, and should not be settable.
- ASSERT(it->first);
- m_value = it->first;
+ ASSERT(entry.first);
+ m_value = entry.first;
notifyChange();
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698