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 23 matching lines...) Expand all Loading... |
34 class ValidationMessageClient; | 34 class ValidationMessageClient; |
35 | 35 |
36 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, | 36 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, |
37 // and form-associated element implementations should use HTMLFormControlElement | 37 // and form-associated element implementations should use HTMLFormControlElement |
38 // unless there is a special reason. | 38 // unless there is a special reason. |
39 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { | 39 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { |
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); | 40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); |
41 | 41 |
42 public: | 42 public: |
43 virtual ~HTMLFormControlElement(); | 43 virtual ~HTMLFormControlElement(); |
44 virtual void trace(Visitor*) OVERRIDE; | 44 virtual void trace(Visitor*) override; |
45 | 45 |
46 String formEnctype() const; | 46 String formEnctype() const; |
47 void setFormEnctype(const AtomicString&); | 47 void setFormEnctype(const AtomicString&); |
48 String formMethod() const; | 48 String formMethod() const; |
49 void setFormMethod(const AtomicString&); | 49 void setFormMethod(const AtomicString&); |
50 bool formNoValidate() const; | 50 bool formNoValidate() const; |
51 | 51 |
52 void ancestorDisabledStateWasChanged(); | 52 void ancestorDisabledStateWasChanged(); |
53 | 53 |
54 void reset(); | 54 void reset(); |
55 | 55 |
56 bool wasChangedSinceLastFormControlChangeEvent() const { return m_wasChanged
SinceLastFormControlChangeEvent; } | 56 bool wasChangedSinceLastFormControlChangeEvent() const { return m_wasChanged
SinceLastFormControlChangeEvent; } |
57 void setChangedSinceLastFormControlChangeEvent(bool); | 57 void setChangedSinceLastFormControlChangeEvent(bool); |
58 | 58 |
59 virtual void dispatchFormControlChangeEvent(); | 59 virtual void dispatchFormControlChangeEvent(); |
60 void dispatchChangeEvent(); | 60 void dispatchChangeEvent(); |
61 void dispatchFormControlInputEvent(); | 61 void dispatchFormControlInputEvent(); |
62 | 62 |
63 virtual HTMLFormElement* formOwner() const OVERRIDE FINAL; | 63 virtual HTMLFormElement* formOwner() const override final; |
64 | 64 |
65 virtual bool isDisabledFormControl() const OVERRIDE; | 65 virtual bool isDisabledFormControl() const override; |
66 | 66 |
67 virtual bool isEnumeratable() const OVERRIDE { return false; } | 67 virtual bool isEnumeratable() const override { return false; } |
68 | 68 |
69 bool isRequired() const; | 69 bool isRequired() const; |
70 | 70 |
71 const AtomicString& type() const { return formControlType(); } | 71 const AtomicString& type() const { return formControlType(); } |
72 | 72 |
73 virtual const AtomicString& formControlType() const = 0; | 73 virtual const AtomicString& formControlType() const = 0; |
74 | 74 |
75 virtual bool canTriggerImplicitSubmission() const { return false; } | 75 virtual bool canTriggerImplicitSubmission() const { return false; } |
76 | 76 |
77 // Override in derived classes to get the encoded name=value pair for submit
ting. | 77 // Override in derived classes to get the encoded name=value pair for submit
ting. |
78 // Return true for a successful control (see HTML4-17.13.2). | 78 // Return true for a successful control (see HTML4-17.13.2). |
79 virtual bool appendFormData(FormDataList&, bool) OVERRIDE { return false; } | 79 virtual bool appendFormData(FormDataList&, bool) override { return false; } |
80 virtual String resultForDialogSubmit(); | 80 virtual String resultForDialogSubmit(); |
81 | 81 |
82 virtual bool canBeSuccessfulSubmitButton() const { return false; } | 82 virtual bool canBeSuccessfulSubmitButton() const { return false; } |
83 bool isSuccessfulSubmitButton() const; | 83 bool isSuccessfulSubmitButton() const; |
84 virtual bool isActivatedSubmit() const { return false; } | 84 virtual bool isActivatedSubmit() const { return false; } |
85 virtual void setActivatedSubmit(bool) { } | 85 virtual void setActivatedSubmit(bool) { } |
86 | 86 |
87 virtual bool willValidate() const OVERRIDE; | 87 virtual bool willValidate() const override; |
88 void updateVisibleValidationMessage(); | 88 void updateVisibleValidationMessage(); |
89 void hideVisibleValidationMessage(); | 89 void hideVisibleValidationMessage(); |
90 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement
> >* unhandledInvalidControls = 0); | 90 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement
> >* unhandledInvalidControls = 0); |
91 // This must be called when a validation constraint or control value is chan
ged. | 91 // This must be called when a validation constraint or control value is chan
ged. |
92 void setNeedsValidityCheck(); | 92 void setNeedsValidityCheck(); |
93 virtual void setCustomValidity(const String&) OVERRIDE FINAL; | 93 virtual void setCustomValidity(const String&) override final; |
94 void findCustomValidationMessageTextDirection(const String& message, TextDir
ection &messageDir, String& subMessage, TextDirection& subMessageDir); | 94 void findCustomValidationMessageTextDirection(const String& message, TextDir
ection &messageDir, String& subMessage, TextDirection& subMessageDir); |
95 | 95 |
96 bool isReadOnly() const { return m_isReadOnly; } | 96 bool isReadOnly() const { return m_isReadOnly; } |
97 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe
adOnly; } | 97 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe
adOnly; } |
98 | 98 |
99 bool isAutofocusable() const; | 99 bool isAutofocusable() const; |
100 | 100 |
101 bool isAutofilled() const { return m_isAutofilled; } | 101 bool isAutofilled() const { return m_isAutofilled; } |
102 void setAutofilled(bool = true); | 102 void setAutofilled(bool = true); |
103 | 103 |
104 static HTMLFormControlElement* enclosingFormControlElement(Node*); | 104 static HTMLFormControlElement* enclosingFormControlElement(Node*); |
105 | 105 |
106 String nameForAutofill() const; | 106 String nameForAutofill() const; |
107 | 107 |
108 virtual void setFocus(bool flag) OVERRIDE; | 108 virtual void setFocus(bool flag) override; |
109 | 109 |
110 #if !ENABLE(OILPAN) | 110 #if !ENABLE(OILPAN) |
111 using Node::ref; | 111 using Node::ref; |
112 using Node::deref; | 112 using Node::deref; |
113 #endif | 113 #endif |
114 | 114 |
115 protected: | 115 protected: |
116 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem
ent*); | 116 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem
ent*); |
117 | 117 |
118 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 118 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
119 virtual void requiredAttributeChanged(); | 119 virtual void requiredAttributeChanged(); |
120 virtual void disabledAttributeChanged(); | 120 virtual void disabledAttributeChanged(); |
121 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 121 virtual void attach(const AttachContext& = AttachContext()) override; |
122 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 122 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
123 virtual void removedFrom(ContainerNode*) OVERRIDE; | 123 virtual void removedFrom(ContainerNode*) override; |
124 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 124 virtual void didMoveToNewDocument(Document& oldDocument) override; |
125 | 125 |
126 virtual bool supportsFocus() const OVERRIDE; | 126 virtual bool supportsFocus() const override; |
127 virtual bool isKeyboardFocusable() const OVERRIDE; | 127 virtual bool isKeyboardFocusable() const override; |
128 virtual bool shouldShowFocusRingOnMouseFocus() const; | 128 virtual bool shouldShowFocusRingOnMouseFocus() const; |
129 virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL; | 129 virtual bool shouldHaveFocusAppearance() const override final; |
130 virtual void dispatchBlurEvent(Element* newFocusedElement) OVERRIDE; | 130 virtual void dispatchBlurEvent(Element* newFocusedElement) override; |
131 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) OVERR
IDE; | 131 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) overr
ide; |
132 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL; | 132 virtual void willCallDefaultEventHandler(const Event&) override final; |
133 | 133 |
134 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE FINAL; | 134 virtual void didRecalcStyle(StyleRecalcChange) override final; |
135 | 135 |
136 // This must be called any time the result of willValidate() has changed. | 136 // This must be called any time the result of willValidate() has changed. |
137 void setNeedsWillValidateCheck(); | 137 void setNeedsWillValidateCheck(); |
138 virtual bool recalcWillValidate() const; | 138 virtual bool recalcWillValidate() const; |
139 | 139 |
140 virtual void resetImpl() { } | 140 virtual void resetImpl() { } |
141 virtual bool supportsAutofocus() const; | 141 virtual bool supportsAutofocus() const; |
142 | 142 |
143 private: | 143 private: |
144 #if !ENABLE(OILPAN) | 144 #if !ENABLE(OILPAN) |
145 virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); } | 145 virtual void refFormAssociatedElement() override final { ref(); } |
146 virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); } | 146 virtual void derefFormAssociatedElement() override final { deref(); } |
147 #endif | 147 #endif |
148 | 148 |
149 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; } | 149 virtual bool isFormControlElement() const override final { return true; } |
150 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true;
} | 150 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true;
} |
151 | 151 |
152 virtual short tabIndex() const OVERRIDE FINAL; | 152 virtual short tabIndex() const override final; |
153 | 153 |
154 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL; | 154 virtual bool isDefaultButtonForForm() const override final; |
155 virtual bool isValidFormControlElement() OVERRIDE FINAL; | 155 virtual bool isValidFormControlElement() override final; |
156 void updateAncestorDisabledState() const; | 156 void updateAncestorDisabledState() const; |
157 | 157 |
158 bool isValidationMessageVisible() const; | 158 bool isValidationMessageVisible() const; |
159 ValidationMessageClient* validationMessageClient() const; | 159 ValidationMessageClient* validationMessageClient() const; |
160 | 160 |
161 bool m_disabled : 1; | 161 bool m_disabled : 1; |
162 bool m_isAutofilled : 1; | 162 bool m_isAutofilled : 1; |
163 bool m_isReadOnly : 1; | 163 bool m_isReadOnly : 1; |
164 bool m_isRequired : 1; | 164 bool m_isRequired : 1; |
165 bool m_hasValidationMessage : 1; | 165 bool m_hasValidationMessage : 1; |
(...skipping 21 matching lines...) Expand all Loading... |
187 { | 187 { |
188 return element.isFormControlElement(); | 188 return element.isFormControlElement(); |
189 } | 189 } |
190 | 190 |
191 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); | 191 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); |
192 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); | 192 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); |
193 | 193 |
194 } // namespace | 194 } // namespace |
195 | 195 |
196 #endif | 196 #endif |
OLD | NEW |