| 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 16 matching lines...) Expand all Loading... |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 virtual bool isKeyboardFocusable() const override; | 136 virtual bool isKeyboardFocusable() const override; |
| 136 virtual bool shouldShowFocusRingOnMouseFocus() const; | 137 virtual bool shouldShowFocusRingOnMouseFocus() const; |
| 137 virtual bool shouldHaveFocusAppearance() const override final; | 138 virtual bool shouldHaveFocusAppearance() const override final; |
| 138 virtual void dispatchBlurEvent(Element* newFocusedElement) override; | 139 virtual void dispatchBlurEvent(Element* newFocusedElement) override; |
| 139 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) overr
ide; | 140 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) overr
ide; |
| 140 virtual void willCallDefaultEventHandler(const Event&) override final; | 141 virtual void willCallDefaultEventHandler(const Event&) override final; |
| 141 | 142 |
| 142 virtual void didRecalcStyle(StyleRecalcChange) override final; | 143 virtual void didRecalcStyle(StyleRecalcChange) override final; |
| 143 | 144 |
| 144 // This must be called any time the result of willValidate() has changed. | 145 // This must be called any time the result of willValidate() has changed. |
| 145 void setNeedsWillValidateCheck(); | 146 void setNeedsWillValidateCheck(bool = true); |
| 146 virtual bool recalcWillValidate() const; | 147 virtual bool recalcWillValidate() const; |
| 147 | 148 |
| 148 virtual void resetImpl() { } | 149 virtual void resetImpl() { } |
| 149 virtual bool supportsAutofocus() const; | 150 virtual bool supportsAutofocus() const; |
| 150 | 151 |
| 151 private: | 152 private: |
| 152 #if !ENABLE(OILPAN) | 153 #if !ENABLE(OILPAN) |
| 153 virtual void refFormAssociatedElement() override final { ref(); } | 154 virtual void refFormAssociatedElement() override final { ref(); } |
| 154 virtual void derefFormAssociatedElement() override final { deref(); } | 155 virtual void derefFormAssociatedElement() override final { deref(); } |
| 155 #endif | 156 #endif |
| 156 | 157 |
| 157 virtual bool isFormControlElement() const override final { return true; } | 158 virtual bool isFormControlElement() const override final { return true; } |
| 158 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true;
} | 159 virtual bool alwaysCreateUserAgentShadowRoot() const override { return true;
} |
| 159 | 160 |
| 160 virtual short tabIndex() const override final; | 161 virtual short tabIndex() const override final; |
| 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 specified 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 Loading... |
| 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 |
| OLD | NEW |