OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 static int64_t generateFormDataIdentifier() | 67 static int64_t generateFormDataIdentifier() |
68 { | 68 { |
69 // Initialize to the current time to reduce the likelihood of generating | 69 // Initialize to the current time to reduce the likelihood of generating |
70 // identifiers that overlap with those from past/future browser sessions. | 70 // identifiers that overlap with those from past/future browser sessions. |
71 static int64_t nextIdentifier = static_cast<int64_t>(currentTime() * 1000000
.0); | 71 static int64_t nextIdentifier = static_cast<int64_t>(currentTime() * 1000000
.0); |
72 return ++nextIdentifier; | 72 return ++nextIdentifier; |
73 } | 73 } |
74 | 74 |
75 HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* documen
t) | 75 HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* documen
t) |
76 : HTMLElement(tagName, document) | 76 : HTMLElement(tagName, document) |
77 , m_submissionTrigger(NotSubmittedByJavaScript) | |
78 , m_autocomplete(true) | 77 , m_autocomplete(true) |
79 , m_insubmit(false) | 78 , m_insubmit(false) |
80 , m_doingsubmit(false) | 79 , m_doingsubmit(false) |
81 , m_inreset(false) | 80 , m_inreset(false) |
82 , m_malformed(false) | 81 , m_malformed(false) |
83 , m_demoted(false) | 82 , m_demoted(false) |
84 { | 83 { |
85 ASSERT(hasTagName(formTag)); | 84 ASSERT(hasTagName(formTag)); |
86 } | 85 } |
87 | 86 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 Frame* frame = document()->frame(); | 363 Frame* frame = document()->frame(); |
365 if (!view || !frame) | 364 if (!view || !frame) |
366 return; | 365 return; |
367 | 366 |
368 if (m_insubmit) { | 367 if (m_insubmit) { |
369 m_doingsubmit = true; | 368 m_doingsubmit = true; |
370 return; | 369 return; |
371 } | 370 } |
372 | 371 |
373 m_insubmit = true; | 372 m_insubmit = true; |
374 m_submissionTrigger = formSubmissionTrigger; | |
375 | 373 |
376 HTMLFormControlElement* firstSuccessfulSubmitButton = 0; | 374 HTMLFormControlElement* firstSuccessfulSubmitButton = 0; |
377 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? | 375 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? |
378 | 376 |
379 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { | 377 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { |
380 HTMLFormControlElement* control = m_associatedElements[i]; | 378 HTMLFormControlElement* control = m_associatedElements[i]; |
381 if (needButtonActivation) { | 379 if (needButtonActivation) { |
382 if (control->isActivatedSubmit()) | 380 if (control->isActivatedSubmit()) |
383 needButtonActivation = false; | 381 needButtonActivation = false; |
384 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) | 382 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 void HTMLFormElement::setMethod(const String &value) | 552 void HTMLFormElement::setMethod(const String &value) |
555 { | 553 { |
556 setAttribute(methodAttr, value); | 554 setAttribute(methodAttr, value); |
557 } | 555 } |
558 | 556 |
559 String HTMLFormElement::target() const | 557 String HTMLFormElement::target() const |
560 { | 558 { |
561 return getAttribute(targetAttr); | 559 return getAttribute(targetAttr); |
562 } | 560 } |
563 | 561 |
564 FormSubmissionTrigger HTMLFormElement::submissionTrigger() const | |
565 { | |
566 return m_submissionTrigger; | |
567 } | |
568 | |
569 HTMLFormControlElement* HTMLFormElement::defaultButton() const | 562 HTMLFormControlElement* HTMLFormElement::defaultButton() const |
570 { | 563 { |
571 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { | 564 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { |
572 HTMLFormControlElement* control = m_associatedElements[i]; | 565 HTMLFormControlElement* control = m_associatedElements[i]; |
573 if (control->isSuccessfulSubmitButton()) | 566 if (control->isSuccessfulSubmitButton()) |
574 return control; | 567 return control; |
575 } | 568 } |
576 | 569 |
577 return 0; | 570 return 0; |
578 } | 571 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 } | 647 } |
655 | 648 |
656 void HTMLFormElement::didMoveToNewOwnerDocument() | 649 void HTMLFormElement::didMoveToNewOwnerDocument() |
657 { | 650 { |
658 if (!m_autocomplete) | 651 if (!m_autocomplete) |
659 document()->registerForDocumentActivationCallbacks(this); | 652 document()->registerForDocumentActivationCallbacks(this); |
660 HTMLElement::didMoveToNewOwnerDocument(); | 653 HTMLElement::didMoveToNewOwnerDocument(); |
661 } | 654 } |
662 | 655 |
663 } // namespace | 656 } // namespace |
OLD | NEW |