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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 using FormSignatureToNextIndexMap = HashMap<String, unsigned>; | 305 using FormSignatureToNextIndexMap = HashMap<String, unsigned>; |
306 FormToKeyMap m_formToKeyMap; | 306 FormToKeyMap m_formToKeyMap; |
307 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; | 307 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; |
308 }; | 308 }; |
309 | 309 |
310 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
r& builder) | 310 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
r& builder) |
311 { | 311 { |
312 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 | 312 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 |
313 const size_t namedControlsToBeRecorded = 2; | 313 const size_t namedControlsToBeRecorded = 2; |
314 const FormAssociatedElement::List& controls = form.associatedElements(); | 314 const FormAssociatedElement::List& controls = form.associatedElements(); |
315 builder.appendLiteral(" ["); | 315 builder.append(" ["); |
316 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls <
namedControlsToBeRecorded; ++i) { | 316 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls <
namedControlsToBeRecorded; ++i) { |
317 if (!controls[i]->isFormControlElementWithState()) | 317 if (!controls[i]->isFormControlElementWithState()) |
318 continue; | 318 continue; |
319 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(controls[i]); | 319 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS
tate(controls[i]); |
320 if (!ownerFormForState(*control)) | 320 if (!ownerFormForState(*control)) |
321 continue; | 321 continue; |
322 AtomicString name = control->name(); | 322 AtomicString name = control->name(); |
323 if (name.isEmpty()) | 323 if (name.isEmpty()) |
324 continue; | 324 continue; |
325 namedControls++; | 325 namedControls++; |
(...skipping 30 matching lines...) Expand all Loading... |
356 if (it != m_formToKeyMap.end()) | 356 if (it != m_formToKeyMap.end()) |
357 return it->value; | 357 return it->value; |
358 | 358 |
359 String signature = formSignature(*form); | 359 String signature = formSignature(*form); |
360 ASSERT(!signature.isNull()); | 360 ASSERT(!signature.isNull()); |
361 FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMa
p.add(signature, 0); | 361 FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMa
p.add(signature, 0); |
362 unsigned nextIndex = result.storedValue->value++; | 362 unsigned nextIndex = result.storedValue->value++; |
363 | 363 |
364 StringBuilder formKeyBuilder; | 364 StringBuilder formKeyBuilder; |
365 formKeyBuilder.append(signature); | 365 formKeyBuilder.append(signature); |
366 formKeyBuilder.appendLiteral(" #"); | 366 formKeyBuilder.append(" #"); |
367 formKeyBuilder.appendNumber(nextIndex); | 367 formKeyBuilder.appendNumber(nextIndex); |
368 FormToKeyMap::AddResult addFormKeyresult = m_formToKeyMap.add(form, formKeyB
uilder.toAtomicString()); | 368 FormToKeyMap::AddResult addFormKeyresult = m_formToKeyMap.add(form, formKeyB
uilder.toAtomicString()); |
369 return addFormKeyresult.storedValue->value; | 369 return addFormKeyresult.storedValue->value; |
370 } | 370 } |
371 | 371 |
372 void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) | 372 void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) |
373 { | 373 { |
374 ASSERT(form); | 374 ASSERT(form); |
375 m_formToKeyMap.remove(form); | 375 m_formToKeyMap.remove(form); |
376 } | 376 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 { | 550 { |
551 m_documentState->addControl(&control); | 551 m_documentState->addControl(&control); |
552 } | 552 } |
553 | 553 |
554 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta
te& control) | 554 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta
te& control) |
555 { | 555 { |
556 m_documentState->removeControl(&control); | 556 m_documentState->removeControl(&control); |
557 } | 557 } |
558 | 558 |
559 } // namespace blink | 559 } // namespace blink |
OLD | NEW |