| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 void HTMLFormElement::submit() | 323 void HTMLFormElement::submit() |
| 324 { | 324 { |
| 325 submit(0, false, true, NotSubmittedByJavaScript); | 325 submit(0, false, true, NotSubmittedByJavaScript); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void HTMLFormElement::submitFromJavaScript() | 328 void HTMLFormElement::submitFromJavaScript() |
| 329 { | 329 { |
| 330 submit(0, false, UserGestureIndicator::processingUserGesture(), SubmittedByJ
avaScript); | 330 submit(0, false, UserGestureIndicator::processingUserGesture(), SubmittedByJ
avaScript); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void HTMLFormElement::submitDialog(PassRefPtr<FormSubmission> formSubmission) | 333 void HTMLFormElement::submitDialog(PassRefPtrWillBeRawPtr<FormSubmission> formSu
bmission) |
| 334 { | 334 { |
| 335 for (Node* node = this; node; node = node->parentOrShadowHostNode()) { | 335 for (Node* node = this; node; node = node->parentOrShadowHostNode()) { |
| 336 if (isHTMLDialogElement(*node)) { | 336 if (isHTMLDialogElement(*node)) { |
| 337 toHTMLDialogElement(*node).closeDialog(formSubmission->result()); | 337 toHTMLDialogElement(*node).closeDialog(formSubmission->result()); |
| 338 return; | 338 return; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce
ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) | 343 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce
ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 362 if (control->isActivatedSubmit()) | 362 if (control->isActivatedSubmit()) |
| 363 needButtonActivation = false; | 363 needButtonActivation = false; |
| 364 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) | 364 else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSu
bmitButton()) |
| 365 firstSuccessfulSubmitButton = control; | 365 firstSuccessfulSubmitButton = control; |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 if (needButtonActivation && firstSuccessfulSubmitButton) | 369 if (needButtonActivation && firstSuccessfulSubmitButton) |
| 370 firstSuccessfulSubmitButton->setActivatedSubmit(true); | 370 firstSuccessfulSubmitButton->setActivatedSubmit(true); |
| 371 | 371 |
| 372 RefPtr<FormSubmission> formSubmission = FormSubmission::create(this, m_attri
butes, event, formSubmissionTrigger); | 372 RefPtrWillBeRawPtr<FormSubmission> formSubmission = FormSubmission::create(t
his, m_attributes, event, formSubmissionTrigger); |
| 373 EventQueueScope scopeForDialogClose; // Delay dispatching 'close' to dialog
until done submitting. | 373 EventQueueScope scopeForDialogClose; // Delay dispatching 'close' to dialog
until done submitting. |
| 374 if (formSubmission->method() == FormSubmission::DialogMethod) | 374 if (formSubmission->method() == FormSubmission::DialogMethod) |
| 375 submitDialog(formSubmission.release()); | 375 submitDialog(formSubmission.release()); |
| 376 else | 376 else |
| 377 scheduleFormSubmission(formSubmission.release()); | 377 scheduleFormSubmission(formSubmission.release()); |
| 378 | 378 |
| 379 if (needButtonActivation && firstSuccessfulSubmitButton) | 379 if (needButtonActivation && firstSuccessfulSubmitButton) |
| 380 firstSuccessfulSubmitButton->setActivatedSubmit(false); | 380 firstSuccessfulSubmitButton->setActivatedSubmit(false); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void HTMLFormElement::scheduleFormSubmission(PassRefPtr<FormSubmission> submissi
on) | 383 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi
on> submission) |
| 384 { | 384 { |
| 385 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); | 385 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); |
| 386 ASSERT(submission->data()); | 386 ASSERT(submission->data()); |
| 387 ASSERT(submission->state()); | 387 ASSERT(submission->state()); |
| 388 if (submission->action().isEmpty()) | 388 if (submission->action().isEmpty()) |
| 389 return; | 389 return; |
| 390 if (document().isSandboxed(SandboxForms)) { | 390 if (document().isSandboxed(SandboxForms)) { |
| 391 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 391 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 392 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "
Blocked form submission to '" + submission->action().elidedString() + "' because
the form's frame is sandboxed and the 'allow-forms' permission is not set."); | 392 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "
Blocked form submission to '" + submission->action().elidedString() + "' because
the form's frame is sandboxed and the 'allow-forms' permission is not set."); |
| 393 return; | 393 return; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 799 } |
| 800 | 800 |
| 801 void HTMLFormElement::setDemoted(bool demoted) | 801 void HTMLFormElement::setDemoted(bool demoted) |
| 802 { | 802 { |
| 803 if (demoted) | 803 if (demoted) |
| 804 UseCounter::count(document(), UseCounter::DemotedFormElement); | 804 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 805 m_wasDemoted = demoted; | 805 m_wasDemoted = demoted; |
| 806 } | 806 } |
| 807 | 807 |
| 808 } // namespace | 808 } // namespace |
| OLD | NEW |