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) |
77 , m_autocomplete(true) | 78 , m_autocomplete(true) |
78 , m_insubmit(false) | 79 , m_insubmit(false) |
79 , m_doingsubmit(false) | 80 , m_doingsubmit(false) |
80 , m_inreset(false) | 81 , m_inreset(false) |
81 , m_malformed(false) | 82 , m_malformed(false) |
82 , m_demoted(false) | 83 , m_demoted(false) |
83 { | 84 { |
84 ASSERT(hasTagName(formTag)); | 85 ASSERT(hasTagName(formTag)); |
85 } | 86 } |
86 | 87 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 Frame* frame = document()->frame(); | 364 Frame* frame = document()->frame(); |
364 if (!view || !frame) | 365 if (!view || !frame) |
365 return; | 366 return; |
366 | 367 |
367 if (m_insubmit) { | 368 if (m_insubmit) { |
368 m_doingsubmit = true; | 369 m_doingsubmit = true; |
369 return; | 370 return; |
370 } | 371 } |
371 | 372 |
372 m_insubmit = true; | 373 m_insubmit = true; |
| 374 m_submissionTrigger = formSubmissionTrigger; |
373 | 375 |
374 HTMLFormControlElement* firstSuccessfulSubmitButton = 0; | 376 HTMLFormControlElement* firstSuccessfulSubmitButton = 0; |
375 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? | 377 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? |
376 | 378 |
377 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { | 379 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { |
378 HTMLFormControlElement* control = m_associatedElements[i]; | 380 HTMLFormControlElement* control = m_associatedElements[i]; |
379 if (needButtonActivation) { | 381 if (needButtonActivation) { |
380 if (control->isActivatedSubmit()) | 382 if (control->isActivatedSubmit()) |
381 needButtonActivation = false; | 383 needButtonActivation = false; |
382 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) | 384 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 void HTMLFormElement::setMethod(const String &value) | 554 void HTMLFormElement::setMethod(const String &value) |
553 { | 555 { |
554 setAttribute(methodAttr, value); | 556 setAttribute(methodAttr, value); |
555 } | 557 } |
556 | 558 |
557 String HTMLFormElement::target() const | 559 String HTMLFormElement::target() const |
558 { | 560 { |
559 return getAttribute(targetAttr); | 561 return getAttribute(targetAttr); |
560 } | 562 } |
561 | 563 |
| 564 FormSubmissionTrigger HTMLFormElement::submissionTrigger() const |
| 565 { |
| 566 return m_submissionTrigger; |
| 567 } |
| 568 |
562 HTMLFormControlElement* HTMLFormElement::defaultButton() const | 569 HTMLFormControlElement* HTMLFormElement::defaultButton() const |
563 { | 570 { |
564 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { | 571 for (unsigned i = 0; i < m_associatedElements.size(); ++i) { |
565 HTMLFormControlElement* control = m_associatedElements[i]; | 572 HTMLFormControlElement* control = m_associatedElements[i]; |
566 if (control->isSuccessfulSubmitButton()) | 573 if (control->isSuccessfulSubmitButton()) |
567 return control; | 574 return control; |
568 } | 575 } |
569 | 576 |
570 return 0; | 577 return 0; |
571 } | 578 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 654 } |
648 | 655 |
649 void HTMLFormElement::didMoveToNewOwnerDocument() | 656 void HTMLFormElement::didMoveToNewOwnerDocument() |
650 { | 657 { |
651 if (!m_autocomplete) | 658 if (!m_autocomplete) |
652 document()->registerForDocumentActivationCallbacks(this); | 659 document()->registerForDocumentActivationCallbacks(this); |
653 HTMLElement::didMoveToNewOwnerDocument(); | 660 HTMLElement::didMoveToNewOwnerDocument(); |
654 } | 661 } |
655 | 662 |
656 } // namespace | 663 } // namespace |
OLD | NEW |