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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 using FormToKeyMap = HeapHashMap<Member<HTMLFormElement>, AtomicString>; | 320 using FormToKeyMap = HeapHashMap<Member<HTMLFormElement>, AtomicString>; |
321 using FormSignatureToNextIndexMap = HashMap<String, unsigned>; | 321 using FormSignatureToNextIndexMap = HashMap<String, unsigned>; |
322 FormToKeyMap m_formToKeyMap; | 322 FormToKeyMap m_formToKeyMap; |
323 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; | 323 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; |
324 }; | 324 }; |
325 | 325 |
326 static inline void recordFormStructure(const HTMLFormElement& form, | 326 static inline void recordFormStructure(const HTMLFormElement& form, |
327 StringBuilder& builder) { | 327 StringBuilder& builder) { |
328 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 | 328 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 |
329 const size_t namedControlsToBeRecorded = 2; | 329 const size_t namedControlsToBeRecorded = 2; |
330 const FormAssociatedElement::List& controls = form.associatedElements(); | 330 const ListedElement::List& controls = form.listedElements(); |
331 builder.append(" ["); | 331 builder.append(" ["); |
332 for (size_t i = 0, namedControls = 0; | 332 for (size_t i = 0, namedControls = 0; |
333 i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { | 333 i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { |
334 if (!controls[i]->isFormControlElementWithState()) | 334 if (!controls[i]->isFormControlElementWithState()) |
335 continue; | 335 continue; |
336 HTMLFormControlElementWithState* control = | 336 HTMLFormControlElementWithState* control = |
337 toHTMLFormControlElementWithState(controls[i]); | 337 toHTMLFormControlElementWithState(controls[i]); |
338 if (!ownerFormForState(*control)) | 338 if (!ownerFormForState(*control)) |
339 continue; | 339 continue; |
340 AtomicString name = control->name(); | 340 AtomicString name = control->name(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return; | 531 return; |
532 if (ownerFormForState(control)) | 532 if (ownerFormForState(control)) |
533 return; | 533 return; |
534 FormControlState state = takeStateForFormElement(control); | 534 FormControlState state = takeStateForFormElement(control); |
535 if (state.valueSize() > 0) | 535 if (state.valueSize() > 0) |
536 control.restoreFormControlState(state); | 536 control.restoreFormControlState(state); |
537 } | 537 } |
538 | 538 |
539 void FormController::restoreControlStateIn(HTMLFormElement& form) { | 539 void FormController::restoreControlStateIn(HTMLFormElement& form) { |
540 EventQueueScope scope; | 540 EventQueueScope scope; |
541 const FormAssociatedElement::List& elements = form.associatedElements(); | 541 const ListedElement::List& elements = form.listedElements(); |
542 for (const auto& element : elements) { | 542 for (const auto& element : elements) { |
543 if (!element->isFormControlElementWithState()) | 543 if (!element->isFormControlElementWithState()) |
544 continue; | 544 continue; |
545 HTMLFormControlElementWithState* control = | 545 HTMLFormControlElementWithState* control = |
546 toHTMLFormControlElementWithState(element); | 546 toHTMLFormControlElementWithState(element); |
547 if (!control->shouldSaveAndRestoreFormControlState()) | 547 if (!control->shouldSaveAndRestoreFormControlState()) |
548 continue; | 548 continue; |
549 if (ownerFormForState(*control) != &form) | 549 if (ownerFormForState(*control) != &form) |
550 continue; | 550 continue; |
551 FormControlState state = takeStateForFormElement(*control); | 551 FormControlState state = takeStateForFormElement(*control); |
(...skipping 18 matching lines...) Expand all 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 |