| 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::matchesValidityPseudoClasses() 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 if (!elements[i]->isFormControlElement()) | 716 if (!elements[i]->isFormControlElement()) |
| 707 continue; | 717 continue; |
| 708 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i]); | 718 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i]); |
| 709 if (control->isSuccessfulSubmitButton()) | 719 if (control->isSuccessfulSubmitButton()) |
| 710 return control; | 720 return control; |
| 711 } | 721 } |
| 712 | 722 |
| 713 return 0; | 723 return 0; |
| 714 } | 724 } |
| 715 | 725 |
| 726 void HTMLFormElement::setNeedsValidityCheck() |
| 727 { |
| 728 // For now unconditionally order style recalculation, which triggers |
| 729 // validity recalculation. In the near future, implement validity cache and |
| 730 // recalculate style only if it changed. |
| 731 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createW
ithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid)); |
| 732 } |
| 733 |
| 716 bool HTMLFormElement::checkValidity() | 734 bool HTMLFormElement::checkValidity() |
| 717 { | 735 { |
| 718 return !checkInvalidControlsAndCollectUnhandled(0); | 736 return !checkInvalidControlsAndCollectUnhandled(0); |
| 719 } | 737 } |
| 720 | 738 |
| 721 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<R
efPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls) | 739 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<R
efPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls) |
| 722 { | 740 { |
| 723 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); | 741 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); |
| 724 // Copy associatedElements because event handlers called from | 742 // Copy associatedElements because event handlers called from |
| 725 // HTMLFormControlElement::checkValidity() might change associatedElements. | 743 // HTMLFormControlElement::checkValidity() might change associatedElements. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 } | 859 } |
| 842 | 860 |
| 843 void HTMLFormElement::setDemoted(bool demoted) | 861 void HTMLFormElement::setDemoted(bool demoted) |
| 844 { | 862 { |
| 845 if (demoted) | 863 if (demoted) |
| 846 UseCounter::count(document(), UseCounter::DemotedFormElement); | 864 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 847 m_wasDemoted = demoted; | 865 m_wasDemoted = demoted; |
| 848 } | 866 } |
| 849 | 867 |
| 850 } // namespace | 868 } // namespace |
| OLD | NEW |