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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "core/html/FormAssociatedElement.h" | 27 #include "core/html/FormAssociatedElement.h" |
28 #include "core/html/LabelableElement.h" | 28 #include "core/html/LabelableElement.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 class FormDataList; | 32 class FormDataList; |
33 class HTMLFormElement; | 33 class HTMLFormElement; |
34 class ValidationMessageClient; | 34 class ValidationMessageClient; |
35 | 35 |
36 enum CheckValidityEventBehavior { CheckValidityDispatchNoEvent, CheckValidityDis
patchInvalidEvent }; | 36 enum CheckValidityEventBehavior { CheckValidityDispatchNoEvent, CheckValidityDis
patchInvalidEvent }; |
37 enum ValidityRecalcReason { ElementAddition, ElementRemoval, ElementModification
}; | |
38 | 37 |
39 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, | 38 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, |
40 // and form-associated element implementations should use HTMLFormControlElement | 39 // and form-associated element implementations should use HTMLFormControlElement |
41 // unless there is a special reason. | 40 // unless there is a special reason. |
42 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { | 41 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { |
43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); | 42 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); |
44 | 43 |
45 public: | 44 public: |
46 virtual ~HTMLFormControlElement(); | 45 virtual ~HTMLFormControlElement(); |
47 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 162 |
164 virtual bool isDefaultButtonForForm() const override final; | 163 virtual bool isDefaultButtonForForm() const override final; |
165 virtual bool isValidElement() override; | 164 virtual bool isValidElement() override; |
166 virtual bool matchesValidityPseudoClasses() const override; | 165 virtual bool matchesValidityPseudoClasses() const override; |
167 void updateAncestorDisabledState() const; | 166 void updateAncestorDisabledState() const; |
168 | 167 |
169 bool isValidationMessageVisible() const; | 168 bool isValidationMessageVisible() const; |
170 ValidationMessageClient* validationMessageClient() const; | 169 ValidationMessageClient* validationMessageClient() const; |
171 | 170 |
172 // Requests validity recalc for the form owner, if one exists. | 171 // Requests validity recalc for the form owner, if one exists. |
173 // In case of removal, isValid specifies element validity upon removal. | 172 void formOwnerSetNeedsValidityCheck(); |
174 // In case of addition and modification, it specifies new validity. | |
175 void formOwnerSetNeedsValidityCheck(ValidityRecalcReason, bool isValid); | |
176 // Requests validity recalc for all ancestor fieldsets, if exist. | 173 // Requests validity recalc for all ancestor fieldsets, if exist. |
177 void fieldSetAncestorsSetNeedsValidityCheck(Node*); | 174 void fieldSetAncestorsSetNeedsValidityCheck(Node*); |
178 | 175 |
179 bool m_disabled : 1; | 176 bool m_disabled : 1; |
180 bool m_isAutofilled : 1; | 177 bool m_isAutofilled : 1; |
181 bool m_isReadOnly : 1; | 178 bool m_isReadOnly : 1; |
182 bool m_isRequired : 1; | 179 bool m_isRequired : 1; |
183 bool m_hasValidationMessage : 1; | 180 bool m_hasValidationMessage : 1; |
184 | 181 |
185 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS
tateEnabled, AncestorDisabledStateDisabled }; | 182 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS
tateEnabled, AncestorDisabledStateDisabled }; |
186 mutable AncestorDisabledState m_ancestorDisabledState; | 183 mutable AncestorDisabledState m_ancestorDisabledState; |
187 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; | 184 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; |
188 mutable enum DataListAncestorState m_dataListAncestorState; | 185 mutable enum DataListAncestorState m_dataListAncestorState; |
189 | 186 |
190 // The initial value of m_willValidate depends on the derived class. We can'
t | 187 // The initial value of m_willValidate depends on the derived class. We can'
t |
191 // initialize it with a virtual function in the constructor. m_willValidate | 188 // initialize it with a virtual function in the constructor. m_willValidate |
192 // is not deterministic as long as m_willValidateInitialized is false. | 189 // is not deterministic as long as m_willValidateInitialized is false. |
193 mutable bool m_willValidateInitialized: 1; | 190 mutable bool m_willValidateInitialized: 1; |
194 mutable bool m_willValidate : 1; | 191 mutable bool m_willValidate : 1; |
195 | 192 |
196 // Cache of valid(). | 193 // Cache of valid(). |
197 // But "candidate for constraint validation" doesn't affect m_isValid. | |
198 bool m_isValid : 1; | 194 bool m_isValid : 1; |
| 195 bool m_validityIsDirty : 1; |
199 | 196 |
200 bool m_wasChangedSinceLastFormControlChangeEvent : 1; | 197 bool m_wasChangedSinceLastFormControlChangeEvent : 1; |
201 bool m_wasFocusedByMouse : 1; | 198 bool m_wasFocusedByMouse : 1; |
202 }; | 199 }; |
203 | 200 |
204 inline bool isHTMLFormControlElement(const Element& element) | 201 inline bool isHTMLFormControlElement(const Element& element) |
205 { | 202 { |
206 return element.isFormControlElement(); | 203 return element.isFormControlElement(); |
207 } | 204 } |
208 | 205 |
209 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); | 206 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); |
210 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); | 207 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); |
211 | 208 |
212 } // namespace | 209 } // namespace |
213 | 210 |
214 #endif | 211 #endif |
OLD | NEW |