| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 #if ENABLE(OILPAN) | 102 #if ENABLE(OILPAN) |
| 103 visitor->trace(m_pastNamesMap); | 103 visitor->trace(m_pastNamesMap); |
| 104 visitor->trace(m_radioButtonGroupScope); | 104 visitor->trace(m_radioButtonGroupScope); |
| 105 visitor->trace(m_associatedElements); | 105 visitor->trace(m_associatedElements); |
| 106 visitor->trace(m_imageElements); | 106 visitor->trace(m_imageElements); |
| 107 visitor->trace(m_pendingAutocompleteEventsQueue); | 107 visitor->trace(m_pendingAutocompleteEventsQueue); |
| 108 #endif | 108 #endif |
| 109 HTMLElement::trace(visitor); | 109 HTMLElement::trace(visitor); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool HTMLFormElement::willValidate() const |
| 113 { |
| 114 return true; |
| 115 } |
| 116 |
| 117 bool HTMLFormElement::isValidElement() |
| 118 { |
| 119 return checkValidity(); |
| 120 } |
| 121 |
| 112 bool HTMLFormElement::rendererIsNeeded(const RenderStyle& style) | 122 bool HTMLFormElement::rendererIsNeeded(const RenderStyle& style) |
| 113 { | 123 { |
| 114 if (!m_wasDemoted) | 124 if (!m_wasDemoted) |
| 115 return HTMLElement::rendererIsNeeded(style); | 125 return HTMLElement::rendererIsNeeded(style); |
| 116 | 126 |
| 117 ContainerNode* node = parentNode(); | 127 ContainerNode* node = parentNode(); |
| 118 if (!node || !node->renderer()) | 128 if (!node || !node->renderer()) |
| 119 return HTMLElement::rendererIsNeeded(style); | 129 return HTMLElement::rendererIsNeeded(style); |
| 120 RenderObject* parentRenderer = node->renderer(); | 130 RenderObject* parentRenderer = node->renderer(); |
| 121 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| b
elow). | 131 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| b
elow). |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 if (!elements[i]->isFormControlElement()) | 719 if (!elements[i]->isFormControlElement()) |
| 710 continue; | 720 continue; |
| 711 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i]); | 721 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i]); |
| 712 if (control->isSuccessfulSubmitButton()) | 722 if (control->isSuccessfulSubmitButton()) |
| 713 return control; | 723 return control; |
| 714 } | 724 } |
| 715 | 725 |
| 716 return 0; | 726 return 0; |
| 717 } | 727 } |
| 718 | 728 |
| 729 void HTMLFormElement::setNeedsValidityCheck() |
| 730 { |
| 731 // For now unconditionally order style recalculation, which triggers |
| 732 // validity recalculation. In the near future, implement validity cache and |
| 733 // recalculate style only if it changed. |
| 734 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createW
ithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid)); |
| 735 } |
| 736 |
| 719 bool HTMLFormElement::checkValidity() | 737 bool HTMLFormElement::checkValidity() |
| 720 { | 738 { |
| 721 return !checkInvalidControlsAndCollectUnhandled(0); | 739 return !checkInvalidControlsAndCollectUnhandled(0); |
| 722 } | 740 } |
| 723 | 741 |
| 724 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<R
efPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls) | 742 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<R
efPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls) |
| 725 { | 743 { |
| 726 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); | 744 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); |
| 727 // Copy associatedElements because event handlers called from | 745 // Copy associatedElements because event handlers called from |
| 728 // HTMLFormControlElement::checkValidity() might change associatedElements. | 746 // HTMLFormControlElement::checkValidity() might change associatedElements. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 862 } |
| 845 | 863 |
| 846 void HTMLFormElement::setDemoted(bool demoted) | 864 void HTMLFormElement::setDemoted(bool demoted) |
| 847 { | 865 { |
| 848 if (demoted) | 866 if (demoted) |
| 849 UseCounter::count(document(), UseCounter::DemotedFormElement); | 867 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 850 m_wasDemoted = demoted; | 868 m_wasDemoted = demoted; |
| 851 } | 869 } |
| 852 | 870 |
| 853 } // namespace | 871 } // namespace |
| OLD | NEW |