OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (m_stateForNewFormElements.isEmpty()) | 273 if (m_stateForNewFormElements.isEmpty()) |
274 return FormControlState(); | 274 return FormControlState(); |
275 FormElementStateMap::iterator it = | 275 FormElementStateMap::iterator it = |
276 m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl())); | 276 m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl())); |
277 if (it == m_stateForNewFormElements.end()) | 277 if (it == m_stateForNewFormElements.end()) |
278 return FormControlState(); | 278 return FormControlState(); |
279 DCHECK_GT(it->value.size(), 0u); | 279 DCHECK_GT(it->value.size(), 0u); |
280 FormControlState state = it->value.takeFirst(); | 280 FormControlState state = it->value.takeFirst(); |
281 m_controlStateCount--; | 281 m_controlStateCount--; |
282 if (!it->value.size()) | 282 if (!it->value.size()) |
283 m_stateForNewFormElements.remove(it); | 283 m_stateForNewFormElements.erase(it); |
284 return state; | 284 return state; |
285 } | 285 } |
286 | 286 |
287 Vector<String> SavedFormState::getReferencedFilePaths() const { | 287 Vector<String> SavedFormState::getReferencedFilePaths() const { |
288 Vector<String> toReturn; | 288 Vector<String> toReturn; |
289 for (const auto& formControl : m_stateForNewFormElements) { | 289 for (const auto& formControl : m_stateForNewFormElements) { |
290 const FormElementKey& key = formControl.key; | 290 const FormElementKey& key = formControl.key; |
291 if (!equal(key.type(), "file", 4)) | 291 if (!equal(key.type(), "file", 4)) |
292 continue; | 292 continue; |
293 const Deque<FormControlState>& queue = formControl.value; | 293 const Deque<FormControlState>& queue = formControl.value; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return FormControlState(); | 482 return FormControlState(); |
483 if (!m_formKeyGenerator) | 483 if (!m_formKeyGenerator) |
484 m_formKeyGenerator = FormKeyGenerator::create(); | 484 m_formKeyGenerator = FormKeyGenerator::create(); |
485 SavedFormStateMap::iterator it = | 485 SavedFormStateMap::iterator it = |
486 m_savedFormStateMap.find(m_formKeyGenerator->formKey(control)); | 486 m_savedFormStateMap.find(m_formKeyGenerator->formKey(control)); |
487 if (it == m_savedFormStateMap.end()) | 487 if (it == m_savedFormStateMap.end()) |
488 return FormControlState(); | 488 return FormControlState(); |
489 FormControlState state = | 489 FormControlState state = |
490 it->value->takeControlState(control.name(), control.type()); | 490 it->value->takeControlState(control.name(), control.type()); |
491 if (it->value->isEmpty()) | 491 if (it->value->isEmpty()) |
492 m_savedFormStateMap.remove(it); | 492 m_savedFormStateMap.erase(it); |
493 return state; | 493 return state; |
494 } | 494 } |
495 | 495 |
496 void FormController::formStatesFromStateVector( | 496 void FormController::formStatesFromStateVector( |
497 const Vector<String>& stateVector, | 497 const Vector<String>& stateVector, |
498 SavedFormStateMap& map) { | 498 SavedFormStateMap& map) { |
499 map.clear(); | 499 map.clear(); |
500 | 500 |
501 size_t i = 0; | 501 size_t i = 0; |
502 if (stateVector.size() < 1 || stateVector[i++] != formStateSignature()) | 502 if (stateVector.size() < 1 || stateVector[i++] != formStateSignature()) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 HTMLFormControlElementWithState& control) { | 570 HTMLFormControlElementWithState& control) { |
571 m_documentState->addControl(&control); | 571 m_documentState->addControl(&control); |
572 } | 572 } |
573 | 573 |
574 void FormController::unregisterStatefulFormControl( | 574 void FormController::unregisterStatefulFormControl( |
575 HTMLFormControlElementWithState& control) { | 575 HTMLFormControlElementWithState& control) { |
576 m_documentState->removeControl(&control); | 576 m_documentState->removeControl(&control); |
577 } | 577 } |
578 | 578 |
579 } // namespace blink | 579 } // namespace blink |
OLD | NEW |