OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. |
3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 m_values = another.m_values; | 64 m_values = another.m_values; |
65 return *this; | 65 return *this; |
66 } | 66 } |
67 | 67 |
68 inline void FormControlState::append(const String& value) | 68 inline void FormControlState::append(const String& value) |
69 { | 69 { |
70 m_type = TypeRestore; | 70 m_type = TypeRestore; |
71 m_values.append(value); | 71 m_values.append(value); |
72 } | 72 } |
73 | 73 |
74 typedef HashMap<AtomicString, OwnPtr<SavedFormState> > SavedFormStateMap; | |
75 | |
76 class DocumentState : public RefCounted<DocumentState> { | |
77 public: | |
78 static PassRefPtr<DocumentState> create(); | |
79 ~DocumentState(); | |
80 | |
81 void addControl(HTMLFormControlElementWithState*); | |
82 void removeControl(HTMLFormControlElementWithState*); | |
83 Vector<String> toStateVector(); | |
84 | |
85 private: | |
86 typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElement ListHashSet; | |
87 FormElementListHashSet m_formControls; | |
88 }; | |
abarth-chromium
2014/04/17 23:41:24
Should this class have its own header?
Nate Chapin
2014/04/17 23:48:19
I was planning on that initially, but it was surpr
| |
89 | |
74 class FormController { | 90 class FormController { |
75 WTF_MAKE_FAST_ALLOCATED; | 91 WTF_MAKE_FAST_ALLOCATED; |
76 public: | 92 public: |
77 static PassOwnPtr<FormController> create() | 93 static PassOwnPtr<FormController> create() |
78 { | 94 { |
79 return adoptPtr(new FormController); | 95 return adoptPtr(new FormController); |
80 } | 96 } |
81 ~FormController(); | 97 ~FormController(); |
82 | 98 |
83 RadioButtonGroupScope& radioButtonGroupScope() { return m_radioButtonGroupSc ope; } | 99 RadioButtonGroupScope& radioButtonGroupScope() { return m_radioButtonGroupSc ope; } |
84 | 100 |
85 void registerStatefulFormControl(HTMLFormControlElementWithState&); | 101 void registerStatefulFormControl(HTMLFormControlElementWithState&); |
86 void unregisterStatefulFormControl(HTMLFormControlElementWithState&); | 102 void unregisterStatefulFormControl(HTMLFormControlElementWithState&); |
87 // This should be callled only by Document::formElementsState(). | 103 // This should be callled only by Document::formElementsState(). |
88 Vector<String> formElementsState() const; | 104 DocumentState* formElementsState() const; |
89 // This should be callled only by Document::setStateForNewFormElements(). | 105 // This should be callled only by Document::setStateForNewFormElements(). |
90 void setStateForNewFormElements(const Vector<String>&); | 106 void setStateForNewFormElements(const Vector<String>&); |
91 void willDeleteForm(HTMLFormElement*); | 107 void willDeleteForm(HTMLFormElement*); |
92 void restoreControlStateFor(HTMLFormControlElementWithState&); | 108 void restoreControlStateFor(HTMLFormControlElementWithState&); |
93 void restoreControlStateIn(HTMLFormElement&); | 109 void restoreControlStateIn(HTMLFormElement&); |
94 | 110 |
95 static Vector<String> getReferencedFilePaths(const Vector<String>& stateVect or); | 111 static Vector<String> getReferencedFilePaths(const Vector<String>& stateVect or); |
96 | 112 |
97 private: | 113 private: |
98 typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElement ListHashSet; | |
99 typedef HashMap<AtomicString, OwnPtr<SavedFormState> > SavedFormStateMap; | |
100 | |
101 FormController(); | 114 FormController(); |
102 static PassOwnPtr<SavedFormStateMap> createSavedFormStateMap(const FormEleme ntListHashSet&); | |
103 FormControlState takeStateForFormElement(const HTMLFormControlElementWithSta te&); | 115 FormControlState takeStateForFormElement(const HTMLFormControlElementWithSta te&); |
104 static void formStatesFromStateVector(const Vector<String>&, SavedFormStateM ap&); | 116 static void formStatesFromStateVector(const Vector<String>&, SavedFormStateM ap&); |
105 | 117 |
106 RadioButtonGroupScope m_radioButtonGroupScope; | 118 RadioButtonGroupScope m_radioButtonGroupScope; |
107 FormElementListHashSet m_formControls; | 119 RefPtr<DocumentState> m_documentState; |
108 SavedFormStateMap m_savedFormStateMap; | 120 SavedFormStateMap m_savedFormStateMap; |
109 OwnPtr<FormKeyGenerator> m_formKeyGenerator; | 121 OwnPtr<FormKeyGenerator> m_formKeyGenerator; |
110 }; | 122 }; |
111 | 123 |
112 } // namespace WebCore | 124 } // namespace WebCore |
113 #endif | 125 #endif |
OLD | NEW |