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

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: Apply keshi's comments 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
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 virtual bool isValidElement() OVERRIDE FINAL;
89
88 void updateVisibleValidationMessage(); 90 void updateVisibleValidationMessage();
89 void hideVisibleValidationMessage(); 91 void hideVisibleValidationMessage();
90 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0); 92 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0);
91 // This must be called when a validation constraint or control value is chan ged. 93 // This must be called when a validation constraint or control value is chan ged.
92 void setNeedsValidityCheck(); 94 void setNeedsValidityCheck();
93 virtual void setCustomValidity(const String&) OVERRIDE FINAL; 95 virtual void setCustomValidity(const String&) OVERRIDE FINAL;
94 void findCustomValidationMessageTextDirection(const String& message, TextDir ection &messageDir, String& subMessage, TextDirection& subMessageDir); 96 void findCustomValidationMessageTextDirection(const String& message, TextDir ection &messageDir, String& subMessage, TextDirection& subMessageDir);
95 97
96 bool isReadOnly() const { return m_isReadOnly; } 98 bool isReadOnly() const { return m_isReadOnly; }
97 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; } 99 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); } 147 virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); }
146 virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); } 148 virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); }
147 #endif 149 #endif
148 150
149 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; } 151 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; }
150 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; } 152 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; }
151 153
152 virtual short tabIndex() const OVERRIDE FINAL; 154 virtual short tabIndex() const OVERRIDE FINAL;
153 155
154 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL; 156 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL;
155 virtual bool isValidFormControlElement() OVERRIDE FINAL;
156 void updateAncestorDisabledState() const; 157 void updateAncestorDisabledState() const;
157 158
158 bool isValidationMessageVisible() const; 159 bool isValidationMessageVisible() const;
159 ValidationMessageClient* validationMessageClient() const; 160 ValidationMessageClient* validationMessageClient() const;
160 161
162 // Requests validity recalc for the form owner, if one exists.
163 void formOwnerSetNeedsValidityCheck();
164
161 bool m_disabled : 1; 165 bool m_disabled : 1;
162 bool m_isAutofilled : 1; 166 bool m_isAutofilled : 1;
163 bool m_isReadOnly : 1; 167 bool m_isReadOnly : 1;
164 bool m_isRequired : 1; 168 bool m_isRequired : 1;
165 bool m_hasValidationMessage : 1; 169 bool m_hasValidationMessage : 1;
166 170
167 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled }; 171 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled };
168 mutable AncestorDisabledState m_ancestorDisabledState; 172 mutable AncestorDisabledState m_ancestorDisabledState;
169 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; 173 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList };
170 mutable enum DataListAncestorState m_dataListAncestorState; 174 mutable enum DataListAncestorState m_dataListAncestorState;
(...skipping 16 matching lines...) Expand all
187 { 191 {
188 return element.isFormControlElement(); 192 return element.isFormControlElement();
189 } 193 }
190 194
191 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 195 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
192 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 196 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
193 197
194 } // namespace 198 } // namespace
195 199
196 #endif 200 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698