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

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

Issue 365223004: Have the form control element directly handle validation message updating. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_hasValidationMessage checks out from validationMessageClient() Created 6 years, 5 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/html/FormAssociatedElement.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 15 matching lines...) Expand all
26 26
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 WebCore { 30 namespace WebCore {
31 31
32 class FormDataList; 32 class FormDataList;
33 class HTMLFieldSetElement; 33 class HTMLFieldSetElement;
34 class HTMLFormElement; 34 class HTMLFormElement;
35 class HTMLLegendElement; 35 class HTMLLegendElement;
36 class ValidationMessage; 36 class ValidationMessageClient;
37 class ValidityState; 37 class ValidityState;
38 38
39 // HTMLFormControlElement is the default implementation of FormAssociatedElement , 39 // HTMLFormControlElement is the default implementation of FormAssociatedElement ,
40 // and form-associated element implementations should use HTMLFormControlElement 40 // and form-associated element implementations should use HTMLFormControlElement
41 // unless there is a special reason. 41 // unless there is a special reason.
42 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle ment { 42 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle ment {
43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement);
44 44
45 public: 45 public:
46 virtual ~HTMLFormControlElement(); 46 virtual ~HTMLFormControlElement();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; } 151 virtual bool isFormControlElement() const OVERRIDE FINAL { return true; }
152 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; } 152 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; }
153 153
154 virtual short tabIndex() const OVERRIDE FINAL; 154 virtual short tabIndex() const OVERRIDE FINAL;
155 155
156 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL; 156 virtual bool isDefaultButtonForForm() const OVERRIDE FINAL;
157 virtual bool isValidFormControlElement() OVERRIDE FINAL; 157 virtual bool isValidFormControlElement() OVERRIDE FINAL;
158 void updateAncestorDisabledState() const; 158 void updateAncestorDisabledState() const;
159 159
160 OwnPtr<ValidationMessage> m_validationMessage; 160 bool isValidationMessageVisible() const;
161 ValidationMessageClient* validationMessageClient() const;
162
161 bool m_disabled : 1; 163 bool m_disabled : 1;
162 bool m_isAutofilled : 1; 164 bool m_isAutofilled : 1;
163 bool m_isReadOnly : 1; 165 bool m_isReadOnly : 1;
164 bool m_isRequired : 1; 166 bool m_isRequired : 1;
167 bool m_hasValidationMessage : 1;
165 168
166 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled }; 169 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled };
167 mutable AncestorDisabledState m_ancestorDisabledState; 170 mutable AncestorDisabledState m_ancestorDisabledState;
168 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; 171 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList };
169 mutable enum DataListAncestorState m_dataListAncestorState; 172 mutable enum DataListAncestorState m_dataListAncestorState;
170 173
171 // The initial value of m_willValidate depends on the derived class. We can' t 174 // The initial value of m_willValidate depends on the derived class. We can' t
172 // initialize it with a virtual function in the constructor. m_willValidate 175 // initialize it with a virtual function in the constructor. m_willValidate
173 // is not deterministic as long as m_willValidateInitialized is false. 176 // is not deterministic as long as m_willValidateInitialized is false.
174 mutable bool m_willValidateInitialized: 1; 177 mutable bool m_willValidateInitialized: 1;
(...skipping 11 matching lines...) Expand all
186 { 189 {
187 return element.isFormControlElement(); 190 return element.isFormControlElement();
188 } 191 }
189 192
190 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 193 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
191 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 194 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
192 195
193 } // namespace 196 } // namespace
194 197
195 #endif 198 #endif
OLDNEW
« no previous file with comments | « Source/core/html/FormAssociatedElement.h ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698