| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef FormAssociatedElement_h | 25 #ifndef ListedElement_h |
| 26 #define FormAssociatedElement_h | 26 #define ListedElement_h |
| 27 | 27 |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 30 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class ContainerNode; | 34 class ContainerNode; |
| 35 class Document; | 35 class Document; |
| 36 class FormAttributeTargetObserver; | 36 class FormAttributeTargetObserver; |
| 37 class FormData; | 37 class FormData; |
| 38 class HTMLElement; | 38 class HTMLElement; |
| 39 class HTMLFormElement; | 39 class HTMLFormElement; |
| 40 class Node; | 40 class Node; |
| 41 class ValidityState; | 41 class ValidityState; |
| 42 | 42 |
| 43 class CORE_EXPORT FormAssociatedElement : public GarbageCollectedMixin { | 43 // https://html.spec.whatwg.org/multipage/forms.html#category-listed |
| 44 class CORE_EXPORT ListedElement : public GarbageCollectedMixin { |
| 44 public: | 45 public: |
| 45 virtual ~FormAssociatedElement(); | 46 virtual ~ListedElement(); |
| 46 | 47 |
| 47 static HTMLFormElement* findAssociatedForm(const HTMLElement*); | 48 static HTMLFormElement* findAssociatedForm(const HTMLElement*); |
| 48 HTMLFormElement* form() const { return m_form.get(); } | 49 HTMLFormElement* form() const { return m_form.get(); } |
| 49 ValidityState* validity(); | 50 ValidityState* validity(); |
| 50 | 51 |
| 51 virtual bool isFormControlElement() const = 0; | 52 virtual bool isFormControlElement() const = 0; |
| 52 virtual bool isFormControlElementWithState() const; | 53 virtual bool isFormControlElementWithState() const; |
| 53 virtual bool isEnumeratable() const = 0; | 54 virtual bool isEnumeratable() const = 0; |
| 54 | 55 |
| 55 // Returns the 'name' attribute value. If this element has no name | 56 // Returns the 'name' attribute value. If this element has no name |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 virtual bool tooShort() const; | 81 virtual bool tooShort() const; |
| 81 virtual bool typeMismatch() const; | 82 virtual bool typeMismatch() const; |
| 82 virtual bool valueMissing() const; | 83 virtual bool valueMissing() const; |
| 83 virtual String validationMessage() const; | 84 virtual String validationMessage() const; |
| 84 virtual String validationSubMessage() const; | 85 virtual String validationSubMessage() const; |
| 85 bool valid() const; | 86 bool valid() const; |
| 86 virtual void setCustomValidity(const String&); | 87 virtual void setCustomValidity(const String&); |
| 87 | 88 |
| 88 void formAttributeTargetChanged(); | 89 void formAttributeTargetChanged(); |
| 89 | 90 |
| 90 typedef HeapVector<Member<FormAssociatedElement>> List; | 91 typedef HeapVector<Member<ListedElement>> List; |
| 91 | 92 |
| 92 DECLARE_VIRTUAL_TRACE(); | 93 DECLARE_VIRTUAL_TRACE(); |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 FormAssociatedElement(); | 96 ListedElement(); |
| 96 | 97 |
| 97 void insertedInto(ContainerNode*); | 98 void insertedInto(ContainerNode*); |
| 98 void removedFrom(ContainerNode*); | 99 void removedFrom(ContainerNode*); |
| 99 void didMoveToNewDocument(Document& oldDocument); | 100 void didMoveToNewDocument(Document& oldDocument); |
| 100 | 101 |
| 101 // FIXME: Remove usage of setForm. resetFormOwner should be enough, and | 102 // FIXME: Remove usage of setForm. resetFormOwner should be enough, and |
| 102 // setForm is confusing. | 103 // setForm is confusing. |
| 103 void setForm(HTMLFormElement*); | 104 void setForm(HTMLFormElement*); |
| 104 void associateByParser(HTMLFormElement*); | 105 void associateByParser(HTMLFormElement*); |
| 105 void formAttributeChanged(); | 106 void formAttributeChanged(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 void resetFormAttributeTargetObserver(); | 118 void resetFormAttributeTargetObserver(); |
| 118 | 119 |
| 119 Member<FormAttributeTargetObserver> m_formAttributeTargetObserver; | 120 Member<FormAttributeTargetObserver> m_formAttributeTargetObserver; |
| 120 Member<HTMLFormElement> m_form; | 121 Member<HTMLFormElement> m_form; |
| 121 Member<ValidityState> m_validityState; | 122 Member<ValidityState> m_validityState; |
| 122 String m_customValidationMessage; | 123 String m_customValidationMessage; |
| 123 // If m_formWasSetByParser is true, m_form is always non-null. | 124 // If m_formWasSetByParser is true, m_form is always non-null. |
| 124 bool m_formWasSetByParser; | 125 bool m_formWasSetByParser; |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 CORE_EXPORT HTMLElement* toHTMLElement(FormAssociatedElement*); | 128 CORE_EXPORT HTMLElement* toHTMLElement(ListedElement*); |
| 128 CORE_EXPORT HTMLElement& toHTMLElement(FormAssociatedElement&); | 129 CORE_EXPORT HTMLElement& toHTMLElement(ListedElement&); |
| 129 CORE_EXPORT const HTMLElement* toHTMLElement(const FormAssociatedElement*); | 130 CORE_EXPORT const HTMLElement* toHTMLElement(const ListedElement*); |
| 130 CORE_EXPORT const HTMLElement& toHTMLElement(const FormAssociatedElement&); | 131 CORE_EXPORT const HTMLElement& toHTMLElement(const ListedElement&); |
| 131 | 132 |
| 132 } // namespace blink | 133 } // namespace blink |
| 133 | 134 |
| 134 #endif // FormAssociatedElement_h | 135 #endif // ListedElement_h |
| OLD | NEW |