Index: Source/core/html/forms/FormController.cpp |
diff --git a/Source/core/html/forms/FormController.cpp b/Source/core/html/forms/FormController.cpp |
index 67131c9cafb3a3a93deab850419cec49b84dbffb..d0bf3632ae5c22ccbcd335a88ccf0603b347d0db 100644 |
--- a/Source/core/html/forms/FormController.cpp |
+++ b/Source/core/html/forms/FormController.cpp |
@@ -229,13 +229,13 @@ PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& sta |
void SavedFormState::serializeTo(Vector<String>& stateVector) const |
{ |
stateVector.append(String::number(m_controlStateCount)); |
- for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { |
- const FormElementKey& key = it->key; |
- const Deque<FormControlState>& queue = it->value; |
- for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { |
+ for (const auto& formControl : m_stateForNewFormElements) { |
+ const FormElementKey& key = formControl.key; |
+ const Deque<FormControlState>& queue = formControl.value; |
+ for (const auto& queIterator : queue) { |
stateVector.append(key.name()); |
stateVector.append(key.type()); |
- queIterator->serializeTo(stateVector); |
+ queIterator.serializeTo(stateVector); |
Mike West
2014/11/04 15:25:52
Nit: This isn't an iterator anymore. It's a FormCo
Mike West
2014/11/04 15:25:52
This isn't a queIterator anymore, it's a FormContr
riju_
2014/11/04 17:50:53
Done.
|
} |
} |
} |
@@ -272,13 +272,13 @@ FormControlState SavedFormState::takeControlState(const AtomicString& name, cons |
Vector<String> SavedFormState::getReferencedFilePaths() const |
{ |
Vector<String> toReturn; |
- for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { |
- const FormElementKey& key = it->key; |
+ for (const auto& formControl : m_stateForNewFormElements) { |
+ const FormElementKey& key = formControl.key; |
if (!equal(key.type(), "file", 4)) |
continue; |
- const Deque<FormControlState>& queue = it->value; |
- for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { |
- const Vector<FileChooserFileInfo>& selectedFiles = HTMLInputElement::filesFromFileInputFormControlState(*queIterator); |
+ const Deque<FormControlState>& queue = formControl.value; |
+ for (const auto& queIterator : queue) { |
Mike West
2014/11/04 15:25:52
Ditto.
riju_
2014/11/04 17:50:53
Done.
|
+ const Vector<FileChooserFileInfo>& selectedFiles = HTMLInputElement::filesFromFileInputFormControlState(queIterator); |
for (size_t i = 0; i < selectedFiles.size(); ++i) |
toReturn.append(selectedFiles[i].path); |
} |
@@ -421,8 +421,8 @@ Vector<String> DocumentState::toStateVector() |
{ |
OwnPtrWillBeRawPtr<FormKeyGenerator> keyGenerator = FormKeyGenerator::create(); |
OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap); |
- for (FormElementListHashSet::const_iterator it = m_formControls.begin(); it != m_formControls.end(); ++it) { |
- HTMLFormControlElementWithState* control = it->get(); |
+ for (const auto& formControl : m_formControls) { |
+ HTMLFormControlElementWithState* control = formControl.get(); |
ASSERT(control->inDocument()); |
if (!control->shouldSaveAndRestoreFormControlState()) |
continue; |
@@ -435,9 +435,9 @@ Vector<String> DocumentState::toStateVector() |
Vector<String> stateVector; |
stateVector.reserveInitialCapacity(m_formControls.size() * 4); |
stateVector.append(formStateSignature()); |
- for (SavedFormStateMap::const_iterator it = stateMap->begin(); it != stateMap->end(); ++it) { |
- stateVector.append(it->key); |
- it->value->serializeTo(stateVector); |
+ for (const auto& savedFormState : *stateMap) { |
+ stateVector.append(savedFormState.key); |
+ savedFormState.value->serializeTo(stateVector); |
} |
bool hasOnlySignature = stateVector.size() == 1; |
if (hasOnlySignature) |
@@ -532,10 +532,10 @@ void FormController::restoreControlStateFor(HTMLFormControlElementWithState& con |
void FormController::restoreControlStateIn(HTMLFormElement& form) |
{ |
const FormAssociatedElement::List& elements = form.associatedElements(); |
- for (size_t i = 0; i < elements.size(); ++i) { |
- if (!elements[i]->isFormControlElementWithState()) |
+ for (const auto& element : elements) { |
+ if (!element->isFormControlElementWithState()) |
continue; |
- HTMLFormControlElementWithState* control = toHTMLFormControlElementWithState(elements[i]); |
+ HTMLFormControlElementWithState* control = toHTMLFormControlElementWithState(element); |
if (!control->shouldSaveAndRestoreFormControlState()) |
continue; |
if (ownerFormForState(*control) != &form) |
@@ -551,8 +551,8 @@ Vector<String> FormController::getReferencedFilePaths(const Vector<String>& stat |
Vector<String> toReturn; |
SavedFormStateMap map; |
formStatesFromStateVector(stateVector, map); |
- for (SavedFormStateMap::const_iterator it = map.begin(); it != map.end(); ++it) |
- toReturn.appendVector(it->value->getReferencedFilePaths()); |
+ for (const auto& savedFormState : map) |
+ toReturn.appendVector(savedFormState.value->getReferencedFilePaths()); |
return toReturn; |
} |