| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 || display == TABLE_COLUMN_GROUP || display == TABLE_COLUMN || display =
= TABLE_CELL | 131 || display == TABLE_COLUMN_GROUP || display == TABLE_COLUMN || display =
= TABLE_CELL |
| 132 || display == TABLE_CAPTION; | 132 || display == TABLE_CAPTION; |
| 133 | 133 |
| 134 return formIsTablePart; | 134 return formIsTablePart; |
| 135 } | 135 } |
| 136 | 136 |
| 137 Node::InsertionNotificationRequest HTMLFormElement::insertedInto(ContainerNode*
insertionPoint) | 137 Node::InsertionNotificationRequest HTMLFormElement::insertedInto(ContainerNode*
insertionPoint) |
| 138 { | 138 { |
| 139 HTMLElement::insertedInto(insertionPoint); | 139 HTMLElement::insertedInto(insertionPoint); |
| 140 logAddElementIfIsolatedWorldAndInDocument("form", methodAttr, actionAttr); | 140 logAddElementIfIsolatedWorldAndInDocument("form", methodAttr, actionAttr); |
| 141 if (insertionPoint->inShadowIncludingDocument()) | 141 if (insertionPoint->isConnected()) |
| 142 this->document().didAssociateFormControl(this); | 142 this->document().didAssociateFormControl(this); |
| 143 return InsertionDone; | 143 return InsertionDone; |
| 144 } | 144 } |
| 145 | 145 |
| 146 template<class T> | 146 template<class T> |
| 147 void notifyFormRemovedFromTree(const T& elements, Node& root) | 147 void notifyFormRemovedFromTree(const T& elements, Node& root) |
| 148 { | 148 { |
| 149 for (const auto& element : elements) | 149 for (const auto& element : elements) |
| 150 element->formRemovedFromTree(root); | 150 element->formRemovedFromTree(root); |
| 151 } | 151 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 void HTMLFormElement::submit(Event* event, bool activateSubmitButton) | 339 void HTMLFormElement::submit(Event* event, bool activateSubmitButton) |
| 340 { | 340 { |
| 341 FrameView* view = document().view(); | 341 FrameView* view = document().view(); |
| 342 LocalFrame* frame = document().frame(); | 342 LocalFrame* frame = document().frame(); |
| 343 if (!view || !frame || !frame->page()) | 343 if (!view || !frame || !frame->page()) |
| 344 return; | 344 return; |
| 345 // See crbug.com/586749. | 345 // See crbug.com/586749. |
| 346 if (!inShadowIncludingDocument()) | 346 if (!isConnected()) |
| 347 UseCounter::count(document(), UseCounter::FormSubmissionNotInDocumentTre
e); | 347 UseCounter::count(document(), UseCounter::FormSubmissionNotInDocumentTre
e); |
| 348 | 348 |
| 349 if (m_isSubmittingOrInUserJSSubmitEvent) { | 349 if (m_isSubmittingOrInUserJSSubmitEvent) { |
| 350 m_shouldSubmit = true; | 350 m_shouldSubmit = true; |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 | 353 |
| 354 m_isSubmittingOrInUserJSSubmitEvent = true; | 354 m_isSubmittingOrInUserJSSubmitEvent = true; |
| 355 | 355 |
| 356 HTMLFormControlElement* firstSuccessfulSubmitButton = nullptr; | 356 HTMLFormControlElement* firstSuccessfulSubmitButton = nullptr; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 // This function should be const conceptually. However we update some fields | 551 // This function should be const conceptually. However we update some fields |
| 552 // because of lazy evaluation. | 552 // because of lazy evaluation. |
| 553 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const | 553 const FormAssociatedElement::List& HTMLFormElement::associatedElements() const |
| 554 { | 554 { |
| 555 if (!m_associatedElementsAreDirty) | 555 if (!m_associatedElementsAreDirty) |
| 556 return m_associatedElements; | 556 return m_associatedElements; |
| 557 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); | 557 HTMLFormElement* mutableThis = const_cast<HTMLFormElement*>(this); |
| 558 Node* scope = mutableThis; | 558 Node* scope = mutableThis; |
| 559 if (m_hasElementsAssociatedByParser) | 559 if (m_hasElementsAssociatedByParser) |
| 560 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); | 560 scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); |
| 561 if (inShadowIncludingDocument() && m_hasElementsAssociatedByFormAttribute) | 561 if (isConnected() && m_hasElementsAssociatedByFormAttribute) |
| 562 scope = &treeScope().rootNode(); | 562 scope = &treeScope().rootNode(); |
| 563 ASSERT(scope); | 563 ASSERT(scope); |
| 564 collectAssociatedElements(*scope, mutableThis->m_associatedElements); | 564 collectAssociatedElements(*scope, mutableThis->m_associatedElements); |
| 565 mutableThis->m_associatedElementsAreDirty = false; | 565 mutableThis->m_associatedElementsAreDirty = false; |
| 566 return m_associatedElements; | 566 return m_associatedElements; |
| 567 } | 567 } |
| 568 | 568 |
| 569 void HTMLFormElement::collectImageElements(Node& root, HeapVector<Member<HTMLIma
geElement>>& elements) | 569 void HTMLFormElement::collectImageElements(Node& root, HeapVector<Member<HTMLIma
geElement>>& elements) |
| 570 { | 570 { |
| 571 elements.clear(); | 571 elements.clear(); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 { | 784 { |
| 785 for (const auto& control : associatedElements()) { | 785 for (const auto& control : associatedElements()) { |
| 786 if (!control->isFormControlElement()) | 786 if (!control->isFormControlElement()) |
| 787 continue; | 787 continue; |
| 788 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) | 788 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
| 789 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P
seudoDefault); | 789 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P
seudoDefault); |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace blink | 793 } // namespace blink |
| OLD | NEW |