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 |
(...skipping 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
29 #include "core/html/HTMLElement.h" | 29 #include "core/html/HTMLElement.h" |
30 #include "core/html/HTMLFormControlElement.h" | 30 #include "core/html/HTMLFormControlElement.h" |
31 #include "core/html/forms/RadioButtonGroupScope.h" | 31 #include "core/html/forms/RadioButtonGroupScope.h" |
32 #include "core/loader/FormSubmission.h" | 32 #include "core/loader/FormSubmission.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class Event; | 36 class Event; |
37 class FormAssociatedElement; | 37 class ListedElement; |
38 class HTMLFormControlElement; | 38 class HTMLFormControlElement; |
39 class HTMLFormControlsCollection; | 39 class HTMLFormControlsCollection; |
40 class HTMLImageElement; | 40 class HTMLImageElement; |
41 class RadioNodeListOrElement; | 41 class RadioNodeListOrElement; |
42 | 42 |
43 class CORE_EXPORT HTMLFormElement final : public HTMLElement { | 43 class CORE_EXPORT HTMLFormElement final : public HTMLElement { |
44 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
45 | 45 |
46 public: | 46 public: |
47 static HTMLFormElement* create(Document&); | 47 static HTMLFormElement* create(Document&); |
48 ~HTMLFormElement() override; | 48 ~HTMLFormElement() override; |
49 DECLARE_VIRTUAL_TRACE(); | 49 DECLARE_VIRTUAL_TRACE(); |
50 | 50 |
51 HTMLFormControlsCollection* elements(); | 51 HTMLFormControlsCollection* elements(); |
52 void getNamedElements(const AtomicString&, HeapVector<Member<Element>>&); | 52 void getNamedElements(const AtomicString&, HeapVector<Member<Element>>&); |
53 | 53 |
54 unsigned length() const; | 54 unsigned length() const; |
55 HTMLElement* item(unsigned index); | 55 HTMLElement* item(unsigned index); |
56 | 56 |
57 String enctype() const { return m_attributes.encodingType(); } | 57 String enctype() const { return m_attributes.encodingType(); } |
58 void setEnctype(const AtomicString&); | 58 void setEnctype(const AtomicString&); |
59 | 59 |
60 String encoding() const { return m_attributes.encodingType(); } | 60 String encoding() const { return m_attributes.encodingType(); } |
61 void setEncoding(const AtomicString& value) { setEnctype(value); } | 61 void setEncoding(const AtomicString& value) { setEnctype(value); } |
62 | 62 |
63 bool shouldAutocomplete() const; | 63 bool shouldAutocomplete() const; |
64 | 64 |
65 void associate(FormAssociatedElement&); | 65 void associate(ListedElement&); |
66 void disassociate(FormAssociatedElement&); | 66 void disassociate(ListedElement&); |
67 void associate(HTMLImageElement&); | 67 void associate(HTMLImageElement&); |
68 void disassociate(HTMLImageElement&); | 68 void disassociate(HTMLImageElement&); |
69 void didAssociateByParser(); | 69 void didAssociateByParser(); |
70 | 70 |
71 void prepareForSubmission(Event*, HTMLFormControlElement* submitButton); | 71 void prepareForSubmission(Event*, HTMLFormControlElement* submitButton); |
72 void submitFromJavaScript(); | 72 void submitFromJavaScript(); |
73 void reset(); | 73 void reset(); |
74 | 74 |
75 void setDemoted(bool); | 75 void setDemoted(bool); |
76 | 76 |
(...skipping 14 matching lines...) Expand all Loading... | |
91 | 91 |
92 bool checkValidity(); | 92 bool checkValidity(); |
93 bool reportValidity(); | 93 bool reportValidity(); |
94 bool matchesValidityPseudoClasses() const final; | 94 bool matchesValidityPseudoClasses() const final; |
95 bool isValidElement() final; | 95 bool isValidElement() final; |
96 | 96 |
97 RadioButtonGroupScope& radioButtonGroupScope() { | 97 RadioButtonGroupScope& radioButtonGroupScope() { |
98 return m_radioButtonGroupScope; | 98 return m_radioButtonGroupScope; |
99 } | 99 } |
100 | 100 |
101 const FormAssociatedElement::List& associatedElements() const; | 101 const ListedElement::List& listedElements() const; |
102 const HeapVector<Member<HTMLImageElement>>& imageElements(); | 102 const HeapVector<Member<HTMLImageElement>>& imageElements(); |
103 | 103 |
104 void anonymousNamedGetter(const AtomicString& name, RadioNodeListOrElement&); | 104 void anonymousNamedGetter(const AtomicString& name, RadioNodeListOrElement&); |
105 void invalidateDefaultButtonStyle() const; | 105 void invalidateDefaultButtonStyle() const; |
106 | 106 |
107 private: | 107 private: |
108 explicit HTMLFormElement(Document&); | 108 explicit HTMLFormElement(Document&); |
109 | 109 |
110 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 110 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
111 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 111 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
(...skipping 10 matching lines...) Expand all Loading... | |
122 | 122 |
123 bool shouldRegisterAsNamedItem() const override { return true; } | 123 bool shouldRegisterAsNamedItem() const override { return true; } |
124 | 124 |
125 void copyNonAttributePropertiesFromElement(const Element&) override; | 125 void copyNonAttributePropertiesFromElement(const Element&) override; |
126 | 126 |
127 void submitDialog(FormSubmission*); | 127 void submitDialog(FormSubmission*); |
128 void submit(Event*, HTMLFormControlElement* submitButton); | 128 void submit(Event*, HTMLFormControlElement* submitButton); |
129 | 129 |
130 void scheduleFormSubmission(FormSubmission*); | 130 void scheduleFormSubmission(FormSubmission*); |
131 | 131 |
132 void collectAssociatedElements(Node& root, | 132 void collectlistedElements(Node& root, ListedElement::List&) const; |
tkent
2016/12/04 12:57:10
collectlistedElement -> collectListedElement
| |
133 FormAssociatedElement::List&) const; | |
134 void collectImageElements(Node& root, HeapVector<Member<HTMLImageElement>>&); | 133 void collectImageElements(Node& root, HeapVector<Member<HTMLImageElement>>&); |
135 | 134 |
136 // Returns true if the submission should proceed. | 135 // Returns true if the submission should proceed. |
137 bool validateInteractively(); | 136 bool validateInteractively(); |
138 | 137 |
139 // Validates each of the controls, and stores controls of which 'invalid' | 138 // Validates each of the controls, and stores controls of which 'invalid' |
140 // event was not canceled to the specified vector. Returns true if there | 139 // event was not canceled to the specified vector. Returns true if there |
141 // are any invalid controls in this form. | 140 // are any invalid controls in this form. |
142 bool checkInvalidControlsAndCollectUnhandled( | 141 bool checkInvalidControlsAndCollectUnhandled( |
143 HeapVector<Member<HTMLFormControlElement>>*, | 142 HeapVector<Member<HTMLFormControlElement>>*, |
144 CheckValidityEventBehavior); | 143 CheckValidityEventBehavior); |
145 | 144 |
146 Element* elementFromPastNamesMap(const AtomicString&); | 145 Element* elementFromPastNamesMap(const AtomicString&); |
147 void addToPastNamesMap(Element*, const AtomicString& pastName); | 146 void addToPastNamesMap(Element*, const AtomicString& pastName); |
148 void removeFromPastNamesMap(HTMLElement&); | 147 void removeFromPastNamesMap(HTMLElement&); |
149 | 148 |
150 typedef HeapHashMap<AtomicString, Member<Element>> PastNamesMap; | 149 typedef HeapHashMap<AtomicString, Member<Element>> PastNamesMap; |
151 | 150 |
152 FormSubmission::Attributes m_attributes; | 151 FormSubmission::Attributes m_attributes; |
153 Member<PastNamesMap> m_pastNamesMap; | 152 Member<PastNamesMap> m_pastNamesMap; |
154 | 153 |
155 RadioButtonGroupScope m_radioButtonGroupScope; | 154 RadioButtonGroupScope m_radioButtonGroupScope; |
156 | 155 |
157 // Do not access m_associatedElements directly. Use associatedElements() | 156 // Do not access m_listedElements directly. Use listedElements() |
158 // instead. | 157 // instead. |
159 FormAssociatedElement::List m_associatedElements; | 158 ListedElement::List m_listedElements; |
160 // Do not access m_imageElements directly. Use imageElements() instead. | 159 // Do not access m_imageElements directly. Use imageElements() instead. |
161 HeapVector<Member<HTMLImageElement>> m_imageElements; | 160 HeapVector<Member<HTMLImageElement>> m_imageElements; |
162 | 161 |
163 // https://html.spec.whatwg.org/multipage/forms.html#planned-navigation | 162 // https://html.spec.whatwg.org/multipage/forms.html#planned-navigation |
164 // Unlike the specification, we use this only for web-exposed submit() | 163 // Unlike the specification, we use this only for web-exposed submit() |
165 // function in 'submit' event handler. | 164 // function in 'submit' event handler. |
166 Member<FormSubmission> m_plannedNavigation; | 165 Member<FormSubmission> m_plannedNavigation; |
167 | 166 |
168 bool m_isSubmitting = false; | 167 bool m_isSubmitting = false; |
169 bool m_inUserJSSubmitEvent = false; | 168 bool m_inUserJSSubmitEvent = false; |
170 | 169 |
171 bool m_associatedElementsAreDirty : 1; | 170 bool m_listedElementsAreDirty : 1; |
172 bool m_imageElementsAreDirty : 1; | 171 bool m_imageElementsAreDirty : 1; |
173 bool m_hasElementsAssociatedByParser : 1; | 172 bool m_hasElementsAssociatedByParser : 1; |
174 bool m_hasElementsAssociatedByFormAttribute : 1; | 173 bool m_hasElementsAssociatedByFormAttribute : 1; |
175 bool m_didFinishParsingChildren : 1; | 174 bool m_didFinishParsingChildren : 1; |
176 bool m_isInResetFunction : 1; | 175 bool m_isInResetFunction : 1; |
177 bool m_wasDemoted : 1; | 176 bool m_wasDemoted : 1; |
178 }; | 177 }; |
179 | 178 |
180 } // namespace blink | 179 } // namespace blink |
181 | 180 |
182 #endif // HTMLFormElement_h | 181 #endif // HTMLFormElement_h |
OLD | NEW |