Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Side by Side Diff: Source/core/html/HTMLFormControlElement.h

Issue 616443002: Implement :valid and :invalid pseudoclass for <form> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move code around Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
88 void updateVisibleValidationMessage(); 89 void updateVisibleValidationMessage();
89 void hideVisibleValidationMessage(); 90 void hideVisibleValidationMessage();
90 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0); 91 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0);
91 // This must be called when a validation constraint or control value is chan ged. 92 // This must be called when a validation constraint or control value is chan ged.
92 void setNeedsValidityCheck(); 93 void setNeedsValidityCheck();
93 virtual void setCustomValidity(const String&) OVERRIDE FINAL; 94 virtual void setCustomValidity(const String&) OVERRIDE FINAL;
94 void findCustomValidationMessageTextDirection(const String& message, TextDir ection &messageDir, String& subMessage, TextDirection& subMessageDir); 95 void findCustomValidationMessageTextDirection(const String& message, TextDir ection &messageDir, String& subMessage, TextDirection& subMessageDir);
95 96
96 bool isReadOnly() const { return m_isReadOnly; } 97 bool isReadOnly() const { return m_isReadOnly; }
97 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; } 98 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; }
(...skipping 16 matching lines...) Expand all
114 115
115 protected: 116 protected:
116 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem ent*); 117 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem ent*);
117 118
118 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 119 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
119 virtual void requiredAttributeChanged(); 120 virtual void requiredAttributeChanged();
120 virtual void disabledAttributeChanged(); 121 virtual void disabledAttributeChanged();
121 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 122 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
122 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 123 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
123 virtual void removedFrom(ContainerNode*) OVERRIDE; 124 virtual void removedFrom(ContainerNode*) OVERRIDE;
125 virtual void willChangeForm() OVERRIDE;
126 virtual void didChangeForm() OVERRIDE;
124 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 127 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
125 128
126 virtual bool supportsFocus() const OVERRIDE; 129 virtual bool supportsFocus() const OVERRIDE;
127 virtual bool isKeyboardFocusable() const OVERRIDE; 130 virtual bool isKeyboardFocusable() const OVERRIDE;
128 virtual bool shouldShowFocusRingOnMouseFocus() const; 131 virtual bool shouldShowFocusRingOnMouseFocus() const;
129 virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL; 132 virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL;
130 virtual void dispatchBlurEvent(Element* newFocusedElement) OVERRIDE; 133 virtual void dispatchBlurEvent(Element* newFocusedElement) OVERRIDE;
131 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) OVERR IDE; 134 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) OVERR IDE;
132 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL; 135 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL;
133 136
(...skipping 11 matching lines...) Expand all
145 virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); } 148 virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); }
146 virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); } 149 virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); }
147 #endif 150 #endif
148 151
149 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; } 152 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; }
150 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; } 153 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; }
151 154
152 virtual short tabIndex() const OVERRIDE FINAL; 155 virtual short tabIndex() const OVERRIDE FINAL;
153 156
154 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL; 157 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL;
155 virtual bool isValidFormControlElement() OVERRIDE FINAL; 158 virtual bool isValidElement() OVERRIDE FINAL;
156 void updateAncestorDisabledState() const; 159 void updateAncestorDisabledState() const;
157 160
158 bool isValidationMessageVisible() const; 161 bool isValidationMessageVisible() const;
159 ValidationMessageClient* validationMessageClient() const; 162 ValidationMessageClient* validationMessageClient() const;
160 163
164 // Requests validity recalc for the form owner, if one exists.
165 void formOwnerSetNeedsValidityCheck();
166
161 bool m_disabled : 1; 167 bool m_disabled : 1;
162 bool m_isAutofilled : 1; 168 bool m_isAutofilled : 1;
163 bool m_isReadOnly : 1; 169 bool m_isReadOnly : 1;
164 bool m_isRequired : 1; 170 bool m_isRequired : 1;
165 bool m_hasValidationMessage : 1; 171 bool m_hasValidationMessage : 1;
166 172
167 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled }; 173 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled };
168 mutable AncestorDisabledState m_ancestorDisabledState; 174 mutable AncestorDisabledState m_ancestorDisabledState;
169 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; 175 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList };
170 mutable enum DataListAncestorState m_dataListAncestorState; 176 mutable enum DataListAncestorState m_dataListAncestorState;
(...skipping 16 matching lines...) Expand all
187 { 193 {
188 return element.isFormControlElement(); 194 return element.isFormControlElement();
189 } 195 }
190 196
191 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 197 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
192 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 198 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
193 199
194 } // namespace 200 } // namespace
195 201
196 #endif 202 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698