| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap; | 303 typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap; |
| 304 typedef HashMap<String, unsigned> FormSignatureToNextIndexMap; | 304 typedef HashMap<String, unsigned> FormSignatureToNextIndexMap; |
| 305 FormToKeyMap m_formToKeyMap; | 305 FormToKeyMap m_formToKeyMap; |
| 306 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; | 306 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
r& builder) | 309 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
r& builder) |
| 310 { | 310 { |
| 311 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 | 311 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 |
| 312 const size_t namedControlsToBeRecorded = 2; | 312 const size_t namedControlsToBeRecorded = 2; |
| 313 const Vector<FormAssociatedElement*>& controls = form.associatedElements(); | 313 const FormAssociatedElement::List& controls = form.associatedElements(); |
| 314 builder.append(" ["); | 314 builder.append(" ["); |
| 315 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls <
namedControlsToBeRecorded; ++i) { | 315 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls <
namedControlsToBeRecorded; ++i) { |
| 316 if (!controls[i]->isFormControlElementWithState()) | 316 if (!controls[i]->isFormControlElementWithState()) |
| 317 continue; | 317 continue; |
| 318 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(controls[i]); | 318 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(controls[i]); |
| 319 if (!ownerFormForState(*control)) | 319 if (!ownerFormForState(*control)) |
| 320 continue; | 320 continue; |
| 321 AtomicString name = control->name(); | 321 AtomicString name = control->name(); |
| 322 if (name.isEmpty()) | 322 if (name.isEmpty()) |
| 323 continue; | 323 continue; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 return; | 504 return; |
| 505 if (ownerFormForState(control)) | 505 if (ownerFormForState(control)) |
| 506 return; | 506 return; |
| 507 FormControlState state = takeStateForFormElement(control); | 507 FormControlState state = takeStateForFormElement(control); |
| 508 if (state.valueSize() > 0) | 508 if (state.valueSize() > 0) |
| 509 control.restoreFormControlState(state); | 509 control.restoreFormControlState(state); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void FormController::restoreControlStateIn(HTMLFormElement& form) | 512 void FormController::restoreControlStateIn(HTMLFormElement& form) |
| 513 { | 513 { |
| 514 const Vector<FormAssociatedElement*>& elements = form.associatedElements(); | 514 const FormAssociatedElement::List& elements = form.associatedElements(); |
| 515 for (size_t i = 0; i < elements.size(); ++i) { | 515 for (size_t i = 0; i < elements.size(); ++i) { |
| 516 if (!elements[i]->isFormControlElementWithState()) | 516 if (!elements[i]->isFormControlElementWithState()) |
| 517 continue; | 517 continue; |
| 518 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(elements[i]); | 518 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(elements[i]); |
| 519 if (!control->shouldSaveAndRestoreFormControlState()) | 519 if (!control->shouldSaveAndRestoreFormControlState()) |
| 520 continue; | 520 continue; |
| 521 if (ownerFormForState(*control) != &form) | 521 if (ownerFormForState(*control) != &form) |
| 522 continue; | 522 continue; |
| 523 FormControlState state = takeStateForFormElement(*control); | 523 FormControlState state = takeStateForFormElement(*control); |
| 524 if (state.valueSize() > 0) | 524 if (state.valueSize() > 0) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 540 { | 540 { |
| 541 m_documentState->addControl(&control); | 541 m_documentState->addControl(&control); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta
te& control) | 544 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta
te& control) |
| 545 { | 545 { |
| 546 m_documentState->removeControl(&control); | 546 m_documentState->removeControl(&control); |
| 547 } | 547 } |
| 548 | 548 |
| 549 } // namespace WebCore | 549 } // namespace WebCore |
| OLD | NEW |