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

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

Issue 658063002: Fix the issue where checking a form for :valid/:invalid would trigger invalid events for its elemen… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change bool into enum for dispatching invalid event on checkValidity 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 matchesValidityPseudoClasses() const override;
89 88
90 void updateVisibleValidationMessage(); 89 void updateVisibleValidationMessage();
91 void hideVisibleValidationMessage(); 90 void hideVisibleValidationMessage();
92 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0); 91 enum DispatchInvalidEvent { DispatchInvalidEventUnknown, DispatchInvalidEven tEnabled, DispatchInvalidEventDisabled };
keishi 2014/10/17 05:46:12 We're not switching a enabled/disabled state so I
Bartek Nowierski 2014/10/17 06:17:59 Your suggestion created a clash with DispatcNoEven
92 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement > >* unhandledInvalidControls = 0, DispatchInvalidEvent = DispatchInvalidEventEn abled);
93 // 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.
94 void setNeedsValidityCheck(); 94 void setNeedsValidityCheck();
95 virtual void setCustomValidity(const String&) override final; 95 virtual void setCustomValidity(const String&) override final;
96 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);
97 97
98 bool isReadOnly() const { return m_isReadOnly; } 98 bool isReadOnly() const { return m_isReadOnly; }
99 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; } 99 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe adOnly; }
100 100
101 bool isAutofocusable() const; 101 bool isAutofocusable() const;
102 102
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 virtual void derefFormAssociatedElement() override final { deref(); } 150 virtual void derefFormAssociatedElement() override final { deref(); }
151 #endif 151 #endif
152 152
153 virtual bool isFormControlElement() const override final { return true; } 153 virtual bool isFormControlElement() const override final { return true; }
154 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true; } 154 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true; }
155 155
156 virtual short tabIndex() const override final; 156 virtual short tabIndex() const override final;
157 157
158 virtual bool isDefaultButtonForForm() const override final; 158 virtual bool isDefaultButtonForForm() const override final;
159 virtual bool isValidElement() override final; 159 virtual bool isValidElement() override final;
160 virtual bool matchesValidityPseudoClasses() const override final;
160 void updateAncestorDisabledState() const; 161 void updateAncestorDisabledState() const;
161 162
162 bool isValidationMessageVisible() const; 163 bool isValidationMessageVisible() const;
163 ValidationMessageClient* validationMessageClient() const; 164 ValidationMessageClient* validationMessageClient() const;
164 165
165 // Requests validity recalc for the form owner, if one exists. 166 // Requests validity recalc for the form owner, if one exists.
166 void formOwnerSetNeedsValidityCheck(); 167 void formOwnerSetNeedsValidityCheck();
167 168
168 bool m_disabled : 1; 169 bool m_disabled : 1;
169 bool m_isAutofilled : 1; 170 bool m_isAutofilled : 1;
(...skipping 24 matching lines...) Expand all
194 { 195 {
195 return element.isFormControlElement(); 196 return element.isFormControlElement();
196 } 197 }
197 198
198 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 199 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
199 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 200 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
200 201
201 } // namespace 202 } // namespace
202 203
203 #endif 204 #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