| Index: Source/core/html/FormController.cpp
|
| diff --git a/Source/core/html/FormController.cpp b/Source/core/html/FormController.cpp
|
| index a82d78c31403fc2b745b15df4633fd242f7ec63f..51b4e88eb9d9de421feea589b22c6fecb1c0bb97 100644
|
| --- a/Source/core/html/FormController.cpp
|
| +++ b/Source/core/html/FormController.cpp
|
| @@ -32,12 +32,12 @@ namespace WebCore {
|
|
|
| using namespace HTMLNames;
|
|
|
| -static inline HTMLFormElement* ownerFormForState(const HTMLFormControlElementWithState& control)
|
| +static inline HTMLFormElement* ownerFormForState(Handle<const HTMLFormControlElementWithState> control)
|
| {
|
| // Assume controls with form attribute have no owners because we restore
|
| // state during parsing and form owners of such controls might be
|
| // indeterminate.
|
| - return control.fastHasAttribute(formAttr) ? 0 : control.form();
|
| + return control->fastHasAttribute(formAttr) ? 0 : control->form();
|
| }
|
|
|
| // ----------------------------------------------------------------------------
|
| @@ -293,7 +293,7 @@ class FormKeyGenerator {
|
|
|
| public:
|
| static PassOwnPtr<FormKeyGenerator> create() { return adoptPtr(new FormKeyGenerator); }
|
| - AtomicString formKey(const HTMLFormControlElementWithState&);
|
| + AtomicString formKey(Handle<const HTMLFormControlElementWithState>);
|
| void willDeleteForm(HTMLFormElement*);
|
|
|
| void clearWeakPointers(Visitor*);
|
| @@ -316,8 +316,8 @@ static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
|
| for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) {
|
| if (!controls[i]->isFormControlElementWithState())
|
| continue;
|
| - HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]);
|
| - if (!ownerFormForState(*control))
|
| + Handle<HTMLFormControlElementWithState> control(static_cast<HTMLFormControlElementWithState*>(controls[i]));
|
| + if (!ownerFormForState(control))
|
| continue;
|
| AtomicString name = control->name();
|
| if (name.isEmpty())
|
| @@ -343,7 +343,7 @@ static inline String formSignature(const HTMLFormElement& form)
|
| return builder.toString();
|
| }
|
|
|
| -AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control)
|
| +AtomicString FormKeyGenerator::formKey(Handle<const HTMLFormControlElementWithState> control)
|
| {
|
| HTMLFormElement* form = ownerFormForState(control);
|
| if (!form) {
|
| @@ -402,10 +402,10 @@ PassOwnPtr<FormController::SavedFormStateMap> FormController::createSavedFormSta
|
| OwnPtr<FormKeyGenerator> keyGenerator = FormKeyGenerator::create();
|
| OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap);
|
| for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) {
|
| - HTMLFormControlElementWithState* control = *it;
|
| + Handle<HTMLFormControlElementWithState> control = Handle<HTMLFormControlElementWithState>(*it); // FIXME(oilpan): Remove Handle<>().
|
| if (!control->shouldSaveAndRestoreFormControlState())
|
| continue;
|
| - SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr);
|
| + SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(control).impl(), nullptr);
|
| if (result.isNewEntry)
|
| result.iterator->value = SavedFormState::create();
|
| result.iterator->value->appendControlState(control->name(), control->type(), control->saveFormControlState());
|
| @@ -434,7 +434,7 @@ void FormController::setStateForNewFormElements(const Vector<String>& stateVecto
|
| formStatesFromStateVector(stateVector, m_savedFormStateMap);
|
| }
|
|
|
| -FormControlState FormController::takeStateForFormElement(const HTMLFormControlElementWithState& control)
|
| +FormControlState FormController::takeStateForFormElement(Handle<const HTMLFormControlElementWithState> control)
|
| {
|
| if (m_savedFormStateMap.isEmpty())
|
| return FormControlState();
|
| @@ -443,7 +443,7 @@ FormControlState FormController::takeStateForFormElement(const HTMLFormControlEl
|
| SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl());
|
| if (it == m_savedFormStateMap.end())
|
| return FormControlState();
|
| - FormControlState state = it->value->takeControlState(control.name(), control.type());
|
| + FormControlState state = it->value->takeControlState(control->name(), control->type());
|
| if (it->value->isEmpty())
|
| m_savedFormStateMap.remove(it);
|
| return state;
|
| @@ -476,18 +476,18 @@ void FormController::willDeleteForm(HTMLFormElement* form)
|
| m_formKeyGenerator->willDeleteForm(form);
|
| }
|
|
|
| -void FormController::restoreControlStateFor(HTMLFormControlElementWithState& control)
|
| +void FormController::restoreControlStateFor(Handle<HTMLFormControlElementWithState> control)
|
| {
|
| // We don't save state of a control with shouldSaveAndRestoreFormControlState()
|
| // == false. But we need to skip restoring process too because a control in
|
| // another form might have the same pair of name and type and saved its state.
|
| - if (!control.shouldSaveAndRestoreFormControlState())
|
| + if (!control->shouldSaveAndRestoreFormControlState())
|
| return;
|
| if (ownerFormForState(control))
|
| return;
|
| FormControlState state = takeStateForFormElement(control);
|
| if (state.valueSize() > 0)
|
| - control.restoreFormControlState(state);
|
| + control->restoreFormControlState(state);
|
| }
|
|
|
| void FormController::restoreControlStateIn(HTMLFormElement& form)
|
| @@ -496,12 +496,12 @@ void FormController::restoreControlStateIn(HTMLFormElement& form)
|
| for (size_t i = 0; i < elements.size(); ++i) {
|
| if (!elements[i]->isFormControlElementWithState())
|
| continue;
|
| - HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(elements[i]);
|
| + Handle<HTMLFormControlElementWithState> control(static_cast<HTMLFormControlElementWithState*>(elements[i]));
|
| if (!control->shouldSaveAndRestoreFormControlState())
|
| continue;
|
| - if (ownerFormForState(*control) != &form)
|
| + if (ownerFormForState(control) != &form)
|
| continue;
|
| - FormControlState state = takeStateForFormElement(*control);
|
| + FormControlState state = takeStateForFormElement(control);
|
| if (state.valueSize() > 0)
|
| control->restoreFormControlState(state);
|
| }
|
|
|