Changeset 57012 in webkit
- Timestamp:
- Apr 2, 2010 11:31:24 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57007 r57012 1 2010-04-02 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Forms with autocomplete=off should not consume saved state 6 https://bugs.webkit.org/show_bug.cgi?id=36762 7 8 * fast/forms/state-restore-to-non-autocomplete-form-expected.txt: Added. 9 * fast/forms/state-restore-to-non-autocomplete-form.html: Added. 10 1 11 2010-04-02 Dirk Schulze <krit@webkit.org> 2 12 -
trunk/WebCore/ChangeLog
r57009 r57012 1 2010-04-02 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Forms with autocomplete=off should not consume saved state 6 https://bugs.webkit.org/show_bug.cgi?id=36762 7 8 Introduce Element::shouldSaveAndRestoreFormControlState() to check 9 if we should save and restore control state. 10 11 Test: fast/forms/state-restore-to-non-autocomplete-form.html 12 13 * dom/Document.cpp: 14 (WebCore::Document::formElementsState): Check shouldSaveAndRestoreFormControlState(). 15 * dom/Element.h: 16 (WebCore::Element::shouldSaveAndRestoreFormControlState): Added. It just returns true. 17 * html/HTMLFormControlElement.cpp: 18 (WebCore::HTMLFormControlElementWithState::autoComplete): 19 Added. It return autocomplete state of the form. 20 (WebCore::HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState): 21 Added. It returns the result of autoComplete(). 22 (WebCore::HTMLFormControlElementWithState::finishParsingChildren): 23 Do not restore state if shouldSaveAndRestoreFormControlState() is false. 24 * html/HTMLFormControlElement.h: Declare autoComplete() and overriding methods. 25 * html/HTMLInputElement.cpp: 26 (WebCore::HTMLInputElement::autoComplete): 27 Reduce code by using autoComplete() of the parent class. 28 (WebCore::HTMLInputElement::saveFormControlState): 29 Remove the autoComplete() check. Document::formElementsState() does equivalent check. 30 1 31 2010-04-02 Simon Fraser <simon.fraser@apple.com> 2 32 -
trunk/WebCore/dom/Document.cpp
r56895 r57012 4211 4211 Iterator end = m_formElementsWithState.end(); 4212 4212 for (Iterator it = m_formElementsWithState.begin(); it != end; ++it) { 4213 Element* e = *it;4213 Element* elementWithState = *it; 4214 4214 String value; 4215 if (e->saveFormControlState(value)) { 4216 stateVector.append(e->formControlName().string()); 4217 stateVector.append(e->formControlType().string()); 4218 stateVector.append(value); 4219 } 4215 if (!elementWithState->shouldSaveAndRestoreFormControlState()) 4216 continue; 4217 if (!elementWithState->saveFormControlState(value)) 4218 continue; 4219 stateVector.append(elementWithState->formControlName().string()); 4220 stateVector.append(elementWithState->formControlType().string()); 4221 stateVector.append(value); 4220 4222 } 4221 4223 return stateVector; -
trunk/WebCore/dom/Element.h
r55167 r57012 266 266 virtual const AtomicString& formControlType() const { return nullAtom; } 267 267 268 virtual bool shouldSaveAndRestoreFormControlState() const { return true; } 268 269 virtual bool saveFormControlState(String&) const { return false; } 269 270 virtual void restoreFormControlState(const String&) { } -
trunk/WebCore/html/HTMLFormControlElement.cpp
r56463 r57012 423 423 } 424 424 425 bool HTMLFormControlElementWithState::autoComplete() const 426 { 427 if (!form()) 428 return true; 429 return form()->autoComplete(); 430 } 431 432 bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const 433 { 434 // We don't save/restore control state in a form with autocomplete=off. 435 return autoComplete(); 436 } 437 425 438 void HTMLFormControlElementWithState::finishParsingChildren() 426 439 { 427 440 HTMLFormControlElement::finishParsingChildren(); 441 442 // We don't save state of a control with shouldSaveAndRestoreFormControlState()=false. 443 // But we need to skip restoring process too because a control in another 444 // form might have the same pair of name and type and saved its state. 445 if (!shouldSaveAndRestoreFormControlState()) 446 return; 447 428 448 Document* doc = document(); 429 449 if (doc->hasStateForNewFormElements()) { -
trunk/WebCore/html/HTMLFormControlElement.h
r56385 r57012 151 151 virtual ~HTMLFormControlElementWithState(); 152 152 153 virtual bool autoComplete() const; 154 virtual bool shouldSaveAndRestoreFormControlState() const; 153 155 virtual void finishParsingChildren(); 154 156 -
trunk/WebCore/html/HTMLInputElement.cpp
r56933 r57012 156 156 if (m_autocomplete != Uninitialized) 157 157 return m_autocomplete == On; 158 159 // Assuming we're still in a Form, respect the Form's setting 160 if (HTMLFormElement* form = this->form()) 161 return form->autoComplete(); 162 163 // The default is true 164 return true; 158 return HTMLTextFormControlElement::autoComplete(); 165 159 } 166 160 … … 912 906 bool HTMLInputElement::saveFormControlState(String& result) const 913 907 { 914 if (!autoComplete())915 return false;916 917 908 switch (inputType()) { 918 909 case BUTTON:
Note: See TracChangeset
for help on using the changeset viewer.