| 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 |
| 6 * reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * | 8 * |
| 8 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 12 * | 13 * |
| 13 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 101 } |
| 101 | 102 |
| 102 bool HTMLFormElement::layoutObjectIsNeeded(const ComputedStyle& style) { | 103 bool HTMLFormElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
| 103 if (!m_wasDemoted) | 104 if (!m_wasDemoted) |
| 104 return HTMLElement::layoutObjectIsNeeded(style); | 105 return HTMLElement::layoutObjectIsNeeded(style); |
| 105 | 106 |
| 106 ContainerNode* node = parentNode(); | 107 ContainerNode* node = parentNode(); |
| 107 if (!node || !node->layoutObject()) | 108 if (!node || !node->layoutObject()) |
| 108 return HTMLElement::layoutObjectIsNeeded(style); | 109 return HTMLElement::layoutObjectIsNeeded(style); |
| 109 LayoutObject* parentLayoutObject = node->layoutObject(); | 110 LayoutObject* parentLayoutObject = node->layoutObject(); |
| 110 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| bel
ow). | 111 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| |
| 112 // below). |
| 111 // FIXME: This check is not correct for Shadow DOM. | 113 // FIXME: This check is not correct for Shadow DOM. |
| 112 bool parentIsTableElementPart = | 114 bool parentIsTableElementPart = |
| 113 (parentLayoutObject->isTable() && isHTMLTableElement(*node)) || | 115 (parentLayoutObject->isTable() && isHTMLTableElement(*node)) || |
| 114 (parentLayoutObject->isTableRow() && isHTMLTableRowElement(*node)) || | 116 (parentLayoutObject->isTableRow() && isHTMLTableRowElement(*node)) || |
| 115 (parentLayoutObject->isTableSection() && node->hasTagName(tbodyTag)) || | 117 (parentLayoutObject->isTableSection() && node->hasTagName(tbodyTag)) || |
| 116 (parentLayoutObject->isLayoutTableCol() && node->hasTagName(colTag)) || | 118 (parentLayoutObject->isLayoutTableCol() && node->hasTagName(colTag)) || |
| 117 (parentLayoutObject->isTableCell() && isHTMLTableRowElement(*node)); | 119 (parentLayoutObject->isTableCell() && isHTMLTableRowElement(*node)); |
| 118 | 120 |
| 119 if (!parentIsTableElementPart) | 121 if (!parentIsTableElementPart) |
| 120 return true; | 122 return true; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 395 } |
| 394 | 396 |
| 395 void HTMLFormElement::scheduleFormSubmission(FormSubmission* submission) { | 397 void HTMLFormElement::scheduleFormSubmission(FormSubmission* submission) { |
| 396 DCHECK(submission->method() == FormSubmission::PostMethod || | 398 DCHECK(submission->method() == FormSubmission::PostMethod || |
| 397 submission->method() == FormSubmission::GetMethod); | 399 submission->method() == FormSubmission::GetMethod); |
| 398 DCHECK(submission->data()); | 400 DCHECK(submission->data()); |
| 399 DCHECK(submission->form()); | 401 DCHECK(submission->form()); |
| 400 if (submission->action().isEmpty()) | 402 if (submission->action().isEmpty()) |
| 401 return; | 403 return; |
| 402 if (document().isSandboxed(SandboxForms)) { | 404 if (document().isSandboxed(SandboxForms)) { |
| 403 // FIXME: This message should be moved off the console once a solution to ht
tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 405 // FIXME: This message should be moved off the console once a solution to |
| 406 // https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 404 document().addConsoleMessage(ConsoleMessage::create( | 407 document().addConsoleMessage(ConsoleMessage::create( |
| 405 SecurityMessageSource, ErrorMessageLevel, | 408 SecurityMessageSource, ErrorMessageLevel, |
| 406 "Blocked form submission to '" + submission->action().elidedString() + | 409 "Blocked form submission to '" + submission->action().elidedString() + |
| 407 "' because the form's frame is sandboxed and the 'allow-forms' " | 410 "' because the form's frame is sandboxed and the 'allow-forms' " |
| 408 "permission is not set.")); | 411 "permission is not set.")); |
| 409 return; | 412 return; |
| 410 } | 413 } |
| 411 | 414 |
| 412 if (protocolIsJavaScript(submission->action())) { | 415 if (protocolIsJavaScript(submission->action())) { |
| 413 if (!document().contentSecurityPolicy()->allowFormAction( | 416 if (!document().contentSecurityPolicy()->allowFormAction( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 477 } |
| 475 | 478 |
| 476 void HTMLFormElement::parseAttribute(const QualifiedName& name, | 479 void HTMLFormElement::parseAttribute(const QualifiedName& name, |
| 477 const AtomicString& oldValue, | 480 const AtomicString& oldValue, |
| 478 const AtomicString& value) { | 481 const AtomicString& value) { |
| 479 if (name == actionAttr) { | 482 if (name == actionAttr) { |
| 480 m_attributes.parseAction(value); | 483 m_attributes.parseAction(value); |
| 481 logUpdateAttributeIfIsolatedWorldAndInDocument("form", actionAttr, oldValue, | 484 logUpdateAttributeIfIsolatedWorldAndInDocument("form", actionAttr, oldValue, |
| 482 value); | 485 value); |
| 483 | 486 |
| 484 // If we're not upgrading insecure requests, and the new action attribute is
pointing to | 487 // If we're not upgrading insecure requests, and the new action attribute is |
| 485 // an insecure "action" location from a secure page it is marked as "passive
" mixed content. | 488 // pointing to an insecure "action" location from a secure page it is marked |
| 489 // as "passive" mixed content. |
| 486 if (document().getInsecureRequestPolicy() & kUpgradeInsecureRequests) | 490 if (document().getInsecureRequestPolicy() & kUpgradeInsecureRequests) |
| 487 return; | 491 return; |
| 488 KURL actionURL = document().completeURL(m_attributes.action().isEmpty() | 492 KURL actionURL = document().completeURL(m_attributes.action().isEmpty() |
| 489 ? document().url().getString() | 493 ? document().url().getString() |
| 490 : m_attributes.action()); | 494 : m_attributes.action()); |
| 491 if (MixedContentChecker::isMixedFormAction(document().frame(), actionURL)) | 495 if (MixedContentChecker::isMixedFormAction(document().frame(), actionURL)) |
| 492 UseCounter::count(document().frame(), | 496 UseCounter::count(document().frame(), |
| 493 UseCounter::MixedContentFormPresent); | 497 UseCounter::MixedContentFormPresent); |
| 494 } else if (name == targetAttr) { | 498 } else if (name == targetAttr) { |
| 495 m_attributes.setTarget(value); | 499 m_attributes.setTarget(value); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 } | 609 } |
| 606 | 610 |
| 607 String HTMLFormElement::name() const { | 611 String HTMLFormElement::name() const { |
| 608 return getNameAttribute(); | 612 return getNameAttribute(); |
| 609 } | 613 } |
| 610 | 614 |
| 611 bool HTMLFormElement::noValidate() const { | 615 bool HTMLFormElement::noValidate() const { |
| 612 return fastHasAttribute(novalidateAttr); | 616 return fastHasAttribute(novalidateAttr); |
| 613 } | 617 } |
| 614 | 618 |
| 615 // FIXME: This function should be removed because it does not do the same thing
as the | 619 // FIXME: This function should be removed because it does not do the same thing |
| 616 // JavaScript binding for action, which treats action as a URL attribute. Last t
ime I | 620 // as the JavaScript binding for action, which treats action as a URL attribute. |
| 617 // (Darin Adler) removed this, someone added it back, so I am leaving it in for
now. | 621 // Last time I (Darin Adler) removed this, someone added it back, so I am |
| 622 // leaving it in for now. |
| 618 const AtomicString& HTMLFormElement::action() const { | 623 const AtomicString& HTMLFormElement::action() const { |
| 619 return getAttribute(actionAttr); | 624 return getAttribute(actionAttr); |
| 620 } | 625 } |
| 621 | 626 |
| 622 void HTMLFormElement::setEnctype(const AtomicString& value) { | 627 void HTMLFormElement::setEnctype(const AtomicString& value) { |
| 623 setAttribute(enctypeAttr, value); | 628 setAttribute(enctypeAttr, value); |
| 624 } | 629 } |
| 625 | 630 |
| 626 String HTMLFormElement::method() const { | 631 String HTMLFormElement::method() const { |
| 627 return FormSubmission::Attributes::methodString(m_attributes.method()); | 632 return FormSubmission::Attributes::methodString(m_attributes.method()); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 for (const auto& control : associatedElements()) { | 809 for (const auto& control : associatedElements()) { |
| 805 if (!control->isFormControlElement()) | 810 if (!control->isFormControlElement()) |
| 806 continue; | 811 continue; |
| 807 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) | 812 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
| 808 toHTMLFormControlElement(control)->pseudoStateChanged( | 813 toHTMLFormControlElement(control)->pseudoStateChanged( |
| 809 CSSSelector::PseudoDefault); | 814 CSSSelector::PseudoDefault); |
| 810 } | 815 } |
| 811 } | 816 } |
| 812 | 817 |
| 813 } // namespace blink | 818 } // namespace blink |
| OLD | NEW |