Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: Source/core/html/HTMLFormElement.h

Issue 145353004: Build HTMLFormElement::m_associatedElements lazily (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix crash Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/html/HTMLFormElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 }; 104 };
105 105
106 void requestAutocomplete(); 106 void requestAutocomplete();
107 void finishRequestAutocomplete(AutocompleteResult); 107 void finishRequestAutocomplete(AutocompleteResult);
108 108
109 DEFINE_ATTRIBUTE_EVENT_LISTENER(autocomplete); 109 DEFINE_ATTRIBUTE_EVENT_LISTENER(autocomplete);
110 DEFINE_ATTRIBUTE_EVENT_LISTENER(autocompleteerror); 110 DEFINE_ATTRIBUTE_EVENT_LISTENER(autocompleteerror);
111 111
112 CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } 112 CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
113 113
114 const Vector<FormAssociatedElement*>& associatedElements() const { return m_ associatedElements; } 114 const Vector<FormAssociatedElement*>& associatedElements() const;
115 const Vector<HTMLImageElement*>& imageElements(); 115 const Vector<HTMLImageElement*>& imageElements();
116 116
117 void getTextFieldValues(StringPairVector& fieldNamesAndValues) const; 117 void getTextFieldValues(StringPairVector& fieldNamesAndValues) const;
118 void anonymousNamedGetter(const AtomicString& name, bool&, RefPtr<RadioNodeL ist>&, bool&, RefPtr<Node>&); 118 void anonymousNamedGetter(const AtomicString& name, bool&, RefPtr<RadioNodeL ist>&, bool&, RefPtr<Node>&);
119 119
120 private: 120 private:
121 explicit HTMLFormElement(Document&); 121 explicit HTMLFormElement(Document&);
122 122
123 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 123 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
124 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 124 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
125 virtual void removedFrom(ContainerNode*) OVERRIDE; 125 virtual void removedFrom(ContainerNode*) OVERRIDE;
126 virtual void finishParsingChildren() OVERRIDE; 126 virtual void finishParsingChildren() OVERRIDE;
127 127
128 virtual void handleLocalEvents(Event*) OVERRIDE; 128 virtual void handleLocalEvents(Event*) OVERRIDE;
129 129
130 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 130 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
131 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 131 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
132 132
133 virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; } 133 virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
134 134
135 virtual void copyNonAttributePropertiesFromElement(const Element&) OVERRIDE; 135 virtual void copyNonAttributePropertiesFromElement(const Element&) OVERRIDE;
136 136
137 void submitDialog(PassRefPtr<FormSubmission>); 137 void submitDialog(PassRefPtr<FormSubmission>);
138 void submit(Event*, bool activateSubmitButton, bool processingUserGesture, F ormSubmissionTrigger); 138 void submit(Event*, bool activateSubmitButton, bool processingUserGesture, F ormSubmissionTrigger);
139 139
140 void scheduleFormSubmission(PassRefPtr<FormSubmission>); 140 void scheduleFormSubmission(PassRefPtr<FormSubmission>);
141 141
142 unsigned formElementIndexWithFormAttribute(Element*, unsigned rangeStart, un signed rangeEnd); 142 void collectAssociatedElements(Node* root, Vector<FormAssociatedElement*>&) const;
143 unsigned formElementIndex(FormAssociatedElement&);
144 void collectImageElements(Node* root, Vector<HTMLImageElement*>&); 143 void collectImageElements(Node* root, Vector<HTMLImageElement*>&);
145 144
146 // Returns true if the submission should proceed. 145 // Returns true if the submission should proceed.
147 bool validateInteractively(Event*); 146 bool validateInteractively(Event*);
148 147
149 // Validates each of the controls, and stores controls of which 'invalid' 148 // Validates each of the controls, and stores controls of which 'invalid'
150 // event was not canceled to the specified vector. Returns true if there 149 // event was not canceled to the specified vector. Returns true if there
151 // are any invalid controls in this form. 150 // are any invalid controls in this form.
152 bool checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedEle ment> >*, HTMLFormControlElement::CheckValidityDispatchEvents = HTMLFormControlE lement::CheckValidityDispatchEventsAllowed); 151 bool checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedEle ment> >*, HTMLFormControlElement::CheckValidityDispatchEvents = HTMLFormControlE lement::CheckValidityDispatchEventsAllowed);
153 152
154 Node* elementFromPastNamesMap(const AtomicString&); 153 Node* elementFromPastNamesMap(const AtomicString&);
155 void addToPastNamesMap(Node*, const AtomicString& pastName); 154 void addToPastNamesMap(Node*, const AtomicString& pastName);
156 void removeFromPastNamesMap(HTMLElement&); 155 void removeFromPastNamesMap(HTMLElement&);
157 156
158 typedef HashMap<AtomicString, Node*> PastNamesMap; 157 typedef HashMap<AtomicString, Node*> PastNamesMap;
159 158
160 FormSubmission::Attributes m_attributes; 159 FormSubmission::Attributes m_attributes;
161 OwnPtr<PastNamesMap> m_pastNamesMap; 160 OwnPtr<PastNamesMap> m_pastNamesMap;
162 161
163 CheckedRadioButtons m_checkedRadioButtons; 162 CheckedRadioButtons m_checkedRadioButtons;
164 163
165 unsigned m_associatedElementsBeforeIndex; 164 // Do not access m_associatedElements directly. Use associatedElements() ins tead.
166 unsigned m_associatedElementsAfterIndex;
167 Vector<FormAssociatedElement*> m_associatedElements; 165 Vector<FormAssociatedElement*> m_associatedElements;
168 // Do not read m_imageElements directly. Use imageElements() instead. 166 // Do not access m_imageElements directly. Use imageElements() instead.
169 Vector<HTMLImageElement*> m_imageElements; 167 Vector<HTMLImageElement*> m_imageElements;
170 WeakPtrFactory<HTMLFormElement> m_weakPtrFactory; 168 WeakPtrFactory<HTMLFormElement> m_weakPtrFactory;
169 bool m_associatedElementsAreDirty;
171 bool m_imageElementsAreDirty; 170 bool m_imageElementsAreDirty;
172 bool m_hasElementsAssociatedByParser; 171 bool m_hasElementsAssociatedByParser;
173 bool m_didFinishParsingChildren; 172 bool m_didFinishParsingChildren;
174 173
175 bool m_wasUserSubmitted; 174 bool m_wasUserSubmitted;
176 bool m_isSubmittingOrPreparingForSubmission; 175 bool m_isSubmittingOrPreparingForSubmission;
177 bool m_shouldSubmit; 176 bool m_shouldSubmit;
178 177
179 bool m_isInResetFunction; 178 bool m_isInResetFunction;
180 179
181 bool m_wasDemoted; 180 bool m_wasDemoted;
182 181
183 void requestAutocompleteTimerFired(Timer<HTMLFormElement>*); 182 void requestAutocompleteTimerFired(Timer<HTMLFormElement>*);
184 183
185 Vector<RefPtr<Event> > m_pendingAutocompleteEvents; 184 Vector<RefPtr<Event> > m_pendingAutocompleteEvents;
186 Timer<HTMLFormElement> m_requestAutocompleteTimer; 185 Timer<HTMLFormElement> m_requestAutocompleteTimer;
187 }; 186 };
188 187
189 DEFINE_NODE_TYPE_CASTS(HTMLFormElement, hasTagName(HTMLNames::formTag)); 188 DEFINE_NODE_TYPE_CASTS(HTMLFormElement, hasTagName(HTMLNames::formTag));
190 189
191 } // namespace WebCore 190 } // namespace WebCore
192 191
193 #endif // HTMLFormElement_h 192 #endif // HTMLFormElement_h
OLDNEW
« no previous file with comments | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/html/HTMLFormElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698