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

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

Issue 703473003: Fix bug where form/fieldset :valid/:invalid won't be recalculated upon control's willValidate change (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update a css layout test now that number of SubtreeStyleChange went down Created 6 years, 1 month 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 16 matching lines...) Expand all
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 };
37 38
38 // HTMLFormControlElement is the default implementation of FormAssociatedElement , 39 // HTMLFormControlElement is the default implementation of FormAssociatedElement ,
39 // and form-associated element implementations should use HTMLFormControlElement 40 // and form-associated element implementations should use HTMLFormControlElement
40 // unless there is a special reason. 41 // unless there is a special reason.
41 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle ment { 42 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle ment {
42 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement);
43 44
44 public: 45 public:
45 virtual ~HTMLFormControlElement(); 46 virtual ~HTMLFormControlElement();
46 virtual void trace(Visitor*) override; 47 virtual void trace(Visitor*) override;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 virtual bool isDefaultButtonForForm() const override final; 163 virtual bool isDefaultButtonForForm() const override final;
163 virtual bool isValidElement() override; 164 virtual bool isValidElement() override;
164 virtual bool matchesValidityPseudoClasses() const override; 165 virtual bool matchesValidityPseudoClasses() const override;
165 void updateAncestorDisabledState() const; 166 void updateAncestorDisabledState() const;
166 167
167 bool isValidationMessageVisible() const; 168 bool isValidationMessageVisible() const;
168 ValidationMessageClient* validationMessageClient() const; 169 ValidationMessageClient* validationMessageClient() const;
169 170
170 // Requests validity recalc for the form owner, if one exists. 171 // Requests validity recalc for the form owner, if one exists.
171 void formOwnerSetNeedsValidityCheck(); 172 // In case of removal, isValid specifies element validity upon removal.
173 // In case of addition and modification, it specifies new validity.
174 void formOwnerSetNeedsValidityCheck(ValidityRecalcReason, bool isValid);
172 // Requests validity recalc for all ancestor fieldsets, if exist. 175 // Requests validity recalc for all ancestor fieldsets, if exist.
173 void fieldSetAncestorsSetNeedsValidityCheck(Node*); 176 void fieldSetAncestorsSetNeedsValidityCheck(Node*);
174 177
175 bool m_disabled : 1; 178 bool m_disabled : 1;
176 bool m_isAutofilled : 1; 179 bool m_isAutofilled : 1;
177 bool m_isReadOnly : 1; 180 bool m_isReadOnly : 1;
178 bool m_isRequired : 1; 181 bool m_isRequired : 1;
179 bool m_hasValidationMessage : 1; 182 bool m_hasValidationMessage : 1;
180 183
181 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled }; 184 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled };
(...skipping 19 matching lines...) Expand all
201 { 204 {
202 return element.isFormControlElement(); 205 return element.isFormControlElement();
203 } 206 }
204 207
205 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 208 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
206 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 209 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
207 210
208 } // namespace 211 } // namespace
209 212
210 #endif 213 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/form-pseudo-valid-style-expected.txt ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698