| OLD | NEW |
| 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 Loading... |
| 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 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 }; |
| 37 |
| 36 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, | 38 // HTMLFormControlElement is the default implementation of FormAssociatedElement
, |
| 37 // and form-associated element implementations should use HTMLFormControlElement | 39 // and form-associated element implementations should use HTMLFormControlElement |
| 38 // unless there is a special reason. | 40 // unless there is a special reason. |
| 39 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { | 41 class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
ment { |
| 40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); | 42 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLFormControlElement); |
| 41 | 43 |
| 42 public: | 44 public: |
| 43 virtual ~HTMLFormControlElement(); | 45 virtual ~HTMLFormControlElement(); |
| 44 virtual void trace(Visitor*) override; | 46 virtual void trace(Visitor*) override; |
| 45 | 47 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Return true for a successful control (see HTML4-17.13.2). | 80 // Return true for a successful control (see HTML4-17.13.2). |
| 79 virtual bool appendFormData(FormDataList&, bool) override { return false; } | 81 virtual bool appendFormData(FormDataList&, bool) override { return false; } |
| 80 virtual String resultForDialogSubmit(); | 82 virtual String resultForDialogSubmit(); |
| 81 | 83 |
| 82 virtual bool canBeSuccessfulSubmitButton() const { return false; } | 84 virtual bool canBeSuccessfulSubmitButton() const { return false; } |
| 83 bool isSuccessfulSubmitButton() const; | 85 bool isSuccessfulSubmitButton() const; |
| 84 virtual bool isActivatedSubmit() const { return false; } | 86 virtual bool isActivatedSubmit() const { return false; } |
| 85 virtual void setActivatedSubmit(bool) { } | 87 virtual void setActivatedSubmit(bool) { } |
| 86 | 88 |
| 87 virtual bool willValidate() const override; | 89 virtual bool willValidate() const override; |
| 88 virtual bool matchesValidityPseudoClasses() const override; | |
| 89 | 90 |
| 90 void updateVisibleValidationMessage(); | 91 void updateVisibleValidationMessage(); |
| 91 void hideVisibleValidationMessage(); | 92 void hideVisibleValidationMessage(); |
| 92 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement
> >* unhandledInvalidControls = 0); | 93 bool checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement
> >* unhandledInvalidControls = 0, CheckValidityEventBehavior = CheckValidityDis
patchInvalidEvent); |
| 93 // This must be called when a validation constraint or control value is chan
ged. | 94 // This must be called when a validation constraint or control value is chan
ged. |
| 94 void setNeedsValidityCheck(); | 95 void setNeedsValidityCheck(); |
| 95 virtual void setCustomValidity(const String&) override final; | 96 virtual void setCustomValidity(const String&) override final; |
| 96 void findCustomValidationMessageTextDirection(const String& message, TextDir
ection &messageDir, String& subMessage, TextDirection& subMessageDir); | 97 void findCustomValidationMessageTextDirection(const String& message, TextDir
ection &messageDir, String& subMessage, TextDirection& subMessageDir); |
| 97 | 98 |
| 98 bool isReadOnly() const { return m_isReadOnly; } | 99 bool isReadOnly() const { return m_isReadOnly; } |
| 99 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe
adOnly; } | 100 bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isRe
adOnly; } |
| 100 | 101 |
| 101 bool isAutofocusable() const; | 102 bool isAutofocusable() const; |
| 102 | 103 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 virtual void derefFormAssociatedElement() override final { deref(); } | 151 virtual void derefFormAssociatedElement() override final { deref(); } |
| 151 #endif | 152 #endif |
| 152 | 153 |
| 153 virtual bool isFormControlElement() const override final { return true; } | 154 virtual bool isFormControlElement() const override final { return true; } |
| 154 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true;
} | 155 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true;
} |
| 155 | 156 |
| 156 virtual short tabIndex() const override final; | 157 virtual short tabIndex() const override final; |
| 157 | 158 |
| 158 virtual bool isDefaultButtonForForm() const override final; | 159 virtual bool isDefaultButtonForForm() const override final; |
| 159 virtual bool isValidElement() override final; | 160 virtual bool isValidElement() override final; |
| 161 virtual bool matchesValidityPseudoClasses() const override final; |
| 160 void updateAncestorDisabledState() const; | 162 void updateAncestorDisabledState() const; |
| 161 | 163 |
| 162 bool isValidationMessageVisible() const; | 164 bool isValidationMessageVisible() const; |
| 163 ValidationMessageClient* validationMessageClient() const; | 165 ValidationMessageClient* validationMessageClient() const; |
| 164 | 166 |
| 165 // Requests validity recalc for the form owner, if one exists. | 167 // Requests validity recalc for the form owner, if one exists. |
| 166 void formOwnerSetNeedsValidityCheck(); | 168 void formOwnerSetNeedsValidityCheck(); |
| 167 | 169 |
| 168 bool m_disabled : 1; | 170 bool m_disabled : 1; |
| 169 bool m_isAutofilled : 1; | 171 bool m_isAutofilled : 1; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 194 { | 196 { |
| 195 return element.isFormControlElement(); | 197 return element.isFormControlElement(); |
| 196 } | 198 } |
| 197 | 199 |
| 198 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); | 200 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement); |
| 199 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); | 201 DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, contro
l->isFormControlElement(), control.isFormControlElement()); |
| 200 | 202 |
| 201 } // namespace | 203 } // namespace |
| 202 | 204 |
| 203 #endif | 205 #endif |
| OLD | NEW |