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

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

Issue 646543004: Implement :valid and :invalid pseudoclass for <form> (resubmitting) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reorder matchesValidityPseudoClasses() 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 virtual bool matchesValidityPseudoClasses() const override;
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 16 matching lines...) Expand all
114 116
115 protected: 117 protected:
116 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem ent*); 118 HTMLFormControlElement(const QualifiedName& tagName, Document&, HTMLFormElem ent*);
117 119
118 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide; 120 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide;
119 virtual void requiredAttributeChanged(); 121 virtual void requiredAttributeChanged();
120 virtual void disabledAttributeChanged(); 122 virtual void disabledAttributeChanged();
121 virtual void attach(const AttachContext& = AttachContext()) override; 123 virtual void attach(const AttachContext& = AttachContext()) override;
122 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; 124 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
123 virtual void removedFrom(ContainerNode*) override; 125 virtual void removedFrom(ContainerNode*) override;
126 virtual void willChangeForm() override;
127 virtual void didChangeForm() override;
124 virtual void didMoveToNewDocument(Document& oldDocument) override; 128 virtual void didMoveToNewDocument(Document& oldDocument) override;
125 129
126 virtual bool supportsFocus() const override; 130 virtual bool supportsFocus() const override;
127 virtual bool isKeyboardFocusable() const override; 131 virtual bool isKeyboardFocusable() const override;
128 virtual bool shouldShowFocusRingOnMouseFocus() const; 132 virtual bool shouldShowFocusRingOnMouseFocus() const;
129 virtual bool shouldHaveFocusAppearance() const override final; 133 virtual bool shouldHaveFocusAppearance() const override final;
130 virtual void dispatchBlurEvent(Element* newFocusedElement) override; 134 virtual void dispatchBlurEvent(Element* newFocusedElement) override;
131 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) overr ide; 135 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) overr ide;
132 virtual void willCallDefaultEventHandler(const Event&) override final; 136 virtual void willCallDefaultEventHandler(const Event&) override final;
133 137
(...skipping 11 matching lines...) Expand all
145 virtual void refFormAssociatedElement() override final { ref(); } 149 virtual void refFormAssociatedElement() override final { ref(); }
146 virtual void derefFormAssociatedElement() override final { deref(); } 150 virtual void derefFormAssociatedElement() override final { deref(); }
147 #endif 151 #endif
148 152
149 virtual bool isFormControlElement() const override final { return true; } 153 virtual bool isFormControlElement() const override final { return true; }
150 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true; } 154 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true; }
151 155
152 virtual short tabIndex() const override final; 156 virtual short tabIndex() const override final;
153 157
154 virtual bool isDefaultButtonForForm() const override final; 158 virtual bool isDefaultButtonForForm() const override final;
155 virtual bool isValidFormControlElement() override final; 159 virtual bool isValidElement() override final;
156 void updateAncestorDisabledState() const; 160 void updateAncestorDisabledState() const;
157 161
158 bool isValidationMessageVisible() const; 162 bool isValidationMessageVisible() const;
159 ValidationMessageClient* validationMessageClient() const; 163 ValidationMessageClient* validationMessageClient() const;
160 164
165 // Requests validity recalc for the form owner, if one exists.
166 void formOwnerSetNeedsValidityCheck();
167
161 bool m_disabled : 1; 168 bool m_disabled : 1;
162 bool m_isAutofilled : 1; 169 bool m_isAutofilled : 1;
163 bool m_isReadOnly : 1; 170 bool m_isReadOnly : 1;
164 bool m_isRequired : 1; 171 bool m_isRequired : 1;
165 bool m_hasValidationMessage : 1; 172 bool m_hasValidationMessage : 1;
166 173
167 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled }; 174 enum AncestorDisabledState { AncestorDisabledStateUnknown, AncestorDisabledS tateEnabled, AncestorDisabledStateDisabled };
168 mutable AncestorDisabledState m_ancestorDisabledState; 175 mutable AncestorDisabledState m_ancestorDisabledState;
169 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList }; 176 enum DataListAncestorState { Unknown, InsideDataList, NotInsideDataList };
170 mutable enum DataListAncestorState m_dataListAncestorState; 177 mutable enum DataListAncestorState m_dataListAncestorState;
(...skipping 16 matching lines...) Expand all
187 { 194 {
188 return element.isFormControlElement(); 195 return element.isFormControlElement();
189 } 196 }
190 197
191 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); 198 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
192 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement()); 199 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro l->isFormControlElement(), control.isFormControlElement());
193 200
194 } // namespace 201 } // namespace
195 202
196 #endif 203 #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