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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef FormAssociatedElement_h | 24 #ifndef FormAssociatedElement_h |
25 #define FormAssociatedElement_h | 25 #define FormAssociatedElement_h |
26 | 26 |
| 27 #include "platform/heap/Handle.h" |
27 #include "wtf/WeakPtr.h" | 28 #include "wtf/WeakPtr.h" |
28 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
29 | 30 |
30 namespace WebCore { | 31 namespace WebCore { |
31 | 32 |
32 class ContainerNode; | 33 class ContainerNode; |
33 class Document; | 34 class Document; |
34 class FormAttributeTargetObserver; | 35 class FormAttributeTargetObserver; |
35 class FormDataList; | 36 class FormDataList; |
36 class HTMLElement; | 37 class HTMLElement; |
37 class HTMLFormElement; | 38 class HTMLFormElement; |
38 class Node; | 39 class Node; |
39 class ValidationMessage; | 40 class ValidationMessage; |
40 class ValidityState; | 41 class ValidityState; |
41 class VisibleSelection; | 42 class VisibleSelection; |
42 | 43 |
43 class FormAssociatedElement { | 44 class FormAssociatedElement : public WillBeGarbageCollectedMixin { |
44 public: | 45 public: |
45 virtual ~FormAssociatedElement(); | 46 virtual ~FormAssociatedElement(); |
46 | 47 |
| 48 #if !ENABLE(OILPAN) |
47 void ref() { refFormAssociatedElement(); } | 49 void ref() { refFormAssociatedElement(); } |
48 void deref() { derefFormAssociatedElement(); } | 50 void deref() { derefFormAssociatedElement(); } |
| 51 #endif |
49 | 52 |
50 static HTMLFormElement* findAssociatedForm(const HTMLElement*); | 53 static HTMLFormElement* findAssociatedForm(const HTMLElement*); |
51 HTMLFormElement* form() const { return m_form.get(); } | 54 HTMLFormElement* form() const { return m_form.get(); } |
52 ValidityState* validity(); | 55 ValidityState* validity(); |
53 | 56 |
54 virtual bool isFormControlElement() const = 0; | 57 virtual bool isFormControlElement() const = 0; |
55 virtual bool isFormControlElementWithState() const; | 58 virtual bool isFormControlElementWithState() const; |
56 virtual bool isEnumeratable() const = 0; | 59 virtual bool isEnumeratable() const = 0; |
57 | 60 |
58 // Returns the 'name' attribute value. If this element has no name | 61 // Returns the 'name' attribute value. If this element has no name |
(...skipping 24 matching lines...) Expand all Loading... |
83 virtual bool valueMissing() const; | 86 virtual bool valueMissing() const; |
84 virtual String validationMessage() const; | 87 virtual String validationMessage() const; |
85 bool valid() const; | 88 bool valid() const; |
86 virtual void setCustomValidity(const String&); | 89 virtual void setCustomValidity(const String&); |
87 | 90 |
88 void formAttributeTargetChanged(); | 91 void formAttributeTargetChanged(); |
89 | 92 |
90 protected: | 93 protected: |
91 FormAssociatedElement(); | 94 FormAssociatedElement(); |
92 | 95 |
| 96 void trace(Visitor*); |
93 void insertedInto(ContainerNode*); | 97 void insertedInto(ContainerNode*); |
94 void removedFrom(ContainerNode*); | 98 void removedFrom(ContainerNode*); |
95 void didMoveToNewDocument(Document& oldDocument); | 99 void didMoveToNewDocument(Document& oldDocument); |
96 | 100 |
97 // FIXME: Remove usage of setForm. resetFormOwner should be enough, and | 101 // FIXME: Remove usage of setForm. resetFormOwner should be enough, and |
98 // setForm is confusing. | 102 // setForm is confusing. |
99 void setForm(HTMLFormElement*); | 103 void setForm(HTMLFormElement*); |
100 void associateByParser(HTMLFormElement*); | 104 void associateByParser(HTMLFormElement*); |
101 void formAttributeChanged(); | 105 void formAttributeChanged(); |
102 | 106 |
103 // If you add an override of willChangeForm() or didChangeForm() to a class | 107 // If you add an override of willChangeForm() or didChangeForm() to a class |
104 // derived from this one, you will need to add a call to setForm(0) to the | 108 // derived from this one, you will need to add a call to setForm(0) to the |
105 // destructor of that class. | 109 // destructor of that class. |
106 virtual void willChangeForm(); | 110 virtual void willChangeForm(); |
107 virtual void didChangeForm(); | 111 virtual void didChangeForm(); |
108 | 112 |
109 String customValidationMessage() const; | 113 String customValidationMessage() const; |
110 | 114 |
111 private: | 115 private: |
| 116 #if !ENABLE(OILPAN) |
112 virtual void refFormAssociatedElement() = 0; | 117 virtual void refFormAssociatedElement() = 0; |
113 virtual void derefFormAssociatedElement() = 0; | 118 virtual void derefFormAssociatedElement() = 0; |
| 119 #endif |
114 | 120 |
115 void setFormAttributeTargetObserver(PassOwnPtr<FormAttributeTargetObserver>)
; | 121 void setFormAttributeTargetObserver(PassOwnPtr<FormAttributeTargetObserver>)
; |
116 void resetFormAttributeTargetObserver(); | 122 void resetFormAttributeTargetObserver(); |
117 | 123 |
118 OwnPtr<FormAttributeTargetObserver> m_formAttributeTargetObserver; | 124 OwnPtr<FormAttributeTargetObserver> m_formAttributeTargetObserver; |
119 // m_form should be a strong reference in Oilpan. | 125 #if ENABLE(OILPAN) |
| 126 Member<HTMLFormElement> m_form; |
| 127 #else |
120 WeakPtr<HTMLFormElement> m_form; | 128 WeakPtr<HTMLFormElement> m_form; |
121 OwnPtr<ValidityState> m_validityState; | 129 #endif |
| 130 OwnPtrWillBeMember<ValidityState> m_validityState; |
122 String m_customValidationMessage; | 131 String m_customValidationMessage; |
123 bool m_formWasSetByParser; | 132 bool m_formWasSetByParser; |
124 }; | 133 }; |
125 | 134 |
126 HTMLElement* toHTMLElement(FormAssociatedElement*); | 135 HTMLElement* toHTMLElement(FormAssociatedElement*); |
127 HTMLElement& toHTMLElement(FormAssociatedElement&); | 136 HTMLElement& toHTMLElement(FormAssociatedElement&); |
128 const HTMLElement* toHTMLElement(const FormAssociatedElement*); | 137 const HTMLElement* toHTMLElement(const FormAssociatedElement*); |
129 const HTMLElement& toHTMLElement(const FormAssociatedElement&); | 138 const HTMLElement& toHTMLElement(const FormAssociatedElement&); |
130 | 139 |
131 } // namespace | 140 } // namespace |
132 | 141 |
133 #endif // FormAssociatedElement_h | 142 #endif // FormAssociatedElement_h |
OLD | NEW |