Changeset 57274 in webkit
- Timestamp:
- Apr 8, 2010 7:10:49 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 20 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57269 r57274 1 2010-04-08 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 willValidate doesn't need to check existence of a form element and a name attribute. 6 https://bugs.webkit.org/show_bug.cgi?id=34733 7 8 - Merge willvalidate-00x tests into one file. 9 - Update tests affected by the willValidate behavior change. 10 11 * fast/forms/input-live-pseudo-selectors-expected.txt: 12 * fast/forms/resources/input-live-pseudo-selectors.js: 13 * fast/forms/resources/textarea-live-pseudo-selectors.js: 14 * fast/forms/script-tests/willvalidate.js: Added. 15 * fast/forms/textarea-live-pseudo-selectors-expected.txt: 16 * fast/forms/willvalidate-000-expected.txt: Removed. 17 * fast/forms/willvalidate-000.html: Removed. 18 * fast/forms/willvalidate-001-expected.txt: Removed. 19 * fast/forms/willvalidate-001.html: Removed. 20 * fast/forms/willvalidate-002-expected.txt: Removed. 21 * fast/forms/willvalidate-002.html: Removed. 22 * fast/forms/willvalidate-003-expected.txt: Removed. 23 * fast/forms/willvalidate-003.html: Removed. 24 * fast/forms/willvalidate-004-expected.txt: Removed. 25 * fast/forms/willvalidate-004.html: Removed. 26 * fast/forms/willvalidate-005-expected.txt: Removed. 27 * fast/forms/willvalidate-005.html: Removed. 28 * fast/forms/willvalidate-006-expected.txt: Removed. 29 * fast/forms/willvalidate-006.html: Removed. 30 * fast/forms/willvalidate-007-expected.txt: Removed. 31 * fast/forms/willvalidate-007.html: Removed. 32 * fast/forms/willvalidate-008-expected.txt: Removed. 33 * fast/forms/willvalidate-008.html: Removed. 34 * fast/forms/willvalidate-009-expected.txt: Removed. 35 * fast/forms/willvalidate-009.html: Removed. 36 * fast/forms/willvalidate-expected.txt: Added. 37 * fast/forms/willvalidate.html: Added. 38 1 39 2010-04-08 Vitaly Repeshko <vitalyr@chromium.org> 2 40 -
trunk/LayoutTests/fast/forms/input-live-pseudo-selectors-expected.txt
r54274 r57274 7 7 PASS backgroundOf(el) is invalidColor 8 8 Change name: 9 PASS backgroundOf(el) is normalColor9 PASS backgroundOf(el) is invalidColor 10 10 PASS backgroundOf(el) is invalidColor 11 11 Change disabled: … … 16 16 PASS backgroundOf(el) is invalidColor 17 17 Inside/outside of a form: 18 PASS backgroundOf(el) is normalColor18 PASS backgroundOf(el) is invalidColor 19 19 PASS backgroundOf(el) is invalidColor 20 20 Change the value by DOM attribute: -
trunk/LayoutTests/fast/forms/resources/input-live-pseudo-selectors.js
r54274 r57274 37 37 debug('Change name:'); 38 38 el.name = ''; 39 shouldBe(elBackground, ' normalColor');39 shouldBe(elBackground, 'invalidColor'); 40 40 el.name = 'bar'; 41 41 shouldBe(elBackground, 'invalidColor'); … … 58 58 el = makeInvalid(); 59 59 nonForm.appendChild(el); 60 shouldBe(elBackground, ' normalColor');60 shouldBe(elBackground, 'invalidColor'); 61 61 form.appendChild(el); 62 62 shouldBe(elBackground, 'invalidColor'); -
trunk/LayoutTests/fast/forms/resources/textarea-live-pseudo-selectors.js
r54274 r57274 37 37 debug('Change name:'); 38 38 el.name = ''; 39 shouldBe(elBackground, ' normalColor');39 shouldBe(elBackground, 'invalidColor'); 40 40 el.name = 'bar'; 41 41 shouldBe(elBackground, 'invalidColor'); … … 58 58 el = makeInvalid(); 59 59 nonForm.appendChild(el); 60 shouldBe(elBackground, ' normalColor');60 shouldBe(elBackground, 'invalidColor'); 61 61 form.appendChild(el); 62 62 shouldBe(elBackground, 'invalidColor'); -
trunk/LayoutTests/fast/forms/textarea-live-pseudo-selectors-expected.txt
r54274 r57274 7 7 PASS backgroundOf(el) is invalidColor 8 8 Change name: 9 PASS backgroundOf(el) is normalColor9 PASS backgroundOf(el) is invalidColor 10 10 PASS backgroundOf(el) is invalidColor 11 11 Change disabled: … … 16 16 PASS backgroundOf(el) is invalidColor 17 17 Inside/outside of a form: 18 PASS backgroundOf(el) is normalColor18 PASS backgroundOf(el) is invalidColor 19 19 PASS backgroundOf(el) is invalidColor 20 20 Change the value by DOM attribute: -
trunk/WebCore/ChangeLog
r57273 r57274 1 2010-04-08 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 willValidate doesn't need to check existence of a form element and a name attribute. 6 https://bugs.webkit.org/show_bug.cgi?id=34733 7 8 Remove checks against m_form and m_hasName in 9 HTMLFormControlElement::willValidate(), and remove the code to 10 track their updates. 11 12 Test: fast/forms/willvalidate.html 13 14 * html/HTMLFormControlElement.cpp: 15 (WebCore::HTMLFormControlElement::HTMLFormControlElement): 16 (WebCore::HTMLFormControlElement::parseMappedAttribute): 17 (WebCore::HTMLFormControlElement::insertedIntoTree): 18 (WebCore::HTMLFormControlElement::removedFromTree): 19 (WebCore::HTMLFormControlElement::recalcWillValidate): 20 (WebCore::HTMLFormControlElement::willValidate): 21 (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck): 22 * html/HTMLFormControlElement.h: 23 (WebCore::HTMLFormControlElement::formDestroyed): 24 * html/HTMLInputElement.cpp: 25 (WebCore::HTMLInputElement::setInputType): 26 setNeedsWillValidateCheck() should be called before 27 setAttribute(valueAttr, ...) is called. 28 1 29 2010-04-08 Young Han Lee <joybro@company100.net> 2 30 -
trunk/WebCore/html/HTMLFormControlElement.cpp
r57012 r57274 53 53 : HTMLElement(tagName, doc, constructionType) 54 54 , m_form(f) 55 , m_hasName(false)56 55 , m_disabled(false) 57 56 , m_readOnly(false) 58 57 , m_required(false) 59 58 , m_valueMatchesRenderer(false) 60 , m_willValidate(false) 59 , m_willValidateInitialized(false) 60 , m_willValidate(true) 61 61 , m_isValid(true) 62 62 { … … 93 93 void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr) 94 94 { 95 if (attr->name() == nameAttr) 96 m_hasName = !attr->isEmpty(); 97 else if (attr->name() == disabledAttr) { 95 if (attr->name() == disabledAttr) { 98 96 bool oldDisabled = m_disabled; 99 97 m_disabled = !attr->isNull(); … … 156 154 // and so we don't need to do anything. 157 155 m_form = findFormAncestor(); 158 if (m_form) {156 if (m_form) 159 157 m_form->registerFormElement(this); 160 setNeedsWillValidateCheck(); 161 } else 158 else 162 159 document()->checkedRadioButtons().addButton(this); 163 160 } … … 186 183 m_form->removeFormElement(this); 187 184 m_form = 0; 188 setNeedsWillValidateCheck();189 185 } 190 186 191 187 HTMLElement::removedFromTree(deep); 192 }193 194 void HTMLFormControlElement::formDestroyed()195 {196 if (m_form)197 setNeedsWillValidateCheck();198 m_form = 0;199 188 } 200 189 … … 304 293 bool HTMLFormControlElement::recalcWillValidate() const 305 294 { 306 // FIXME: Check if the control does not have a datalist element as an ancestor. 307 return m_form && m_hasName && !m_disabled && !m_readOnly; 295 // FIXME: Should return false if this element has a datalist element as an 296 // ancestor. See HTML5 4.10.10 'The datalist element.' 297 return !m_disabled && !m_readOnly; 308 298 } 309 299 310 300 bool HTMLFormControlElement::willValidate() const 311 301 { 312 // If the following assertion fails, setNeedsWillValidateCheck() is not 313 // called correctly when something which changes recalcWillValidate() result 314 // is updated. 315 ASSERT(m_willValidate == recalcWillValidate()); 302 if (!m_willValidateInitialized) { 303 m_willValidateInitialized = true; 304 m_willValidate = recalcWillValidate(); 305 } else { 306 // If the following assertion fails, setNeedsWillValidateCheck() is not 307 // called correctly when something which changes recalcWillValidate() result 308 // is updated. 309 ASSERT(m_willValidate == recalcWillValidate()); 310 } 316 311 return m_willValidate; 317 312 } … … 319 314 void HTMLFormControlElement::setNeedsWillValidateCheck() 320 315 { 316 // We need to recalculate willValidte immediately because willValidate 317 // change can causes style change. 321 318 bool newWillValidate = recalcWillValidate(); 322 if (m_willValidate == newWillValidate)319 if (m_willValidateInitialized && m_willValidate == newWillValidate) 323 320 return; 321 m_willValidateInitialized = true; 324 322 m_willValidate = newWillValidate; 325 323 setNeedsStyleRecalc(); -
trunk/WebCore/html/HTMLFormControlElement.h
r57012 r57274 107 107 virtual short tabIndex() const; 108 108 109 bool willValidate() const;109 virtual bool willValidate() const; 110 110 String validationMessage(); 111 111 bool checkValidity(); … … 117 117 virtual bool tooLong() const { return false; } 118 118 119 void formDestroyed() ;119 void formDestroyed() { m_form = 0; } 120 120 121 121 virtual void dispatchFocusEvent(); … … 135 135 HTMLFormElement* m_form; 136 136 OwnPtr<ValidityState> m_validityState; 137 bool m_hasName : 1;138 137 bool m_disabled : 1; 139 138 bool m_readOnly : 1; 140 139 bool m_required : 1; 141 140 bool m_valueMatchesRenderer : 1; 142 bool m_willValidate : 1; 141 // The initial value of m_willValidate depends on a subclass, and we can't 142 // initialize it with a virtual function in the constructor. m_willValidate 143 // is not deterministic during m_willValidateInitialized=false. 144 mutable bool m_willValidateInitialized: 1; 145 mutable bool m_willValidate : 1; 143 146 // Cache of validity()->valid(). 144 147 // "candidate for constraint validation" doesn't affect to m_isValid. -
trunk/WebCore/html/HTMLInputElement.cpp
r57109 r57274 818 818 bool didRespectHeightAndWidth = respectHeightAndWidthAttrs(); 819 819 m_type = newType; 820 setNeedsWillValidateCheck(); 820 821 bool willStoreValue = storesValueSeparateFromAttribute(); 821 822 bool isPasswordField = inputType() == PASSWORD; … … 856 857 } 857 858 858 setNeedsWillValidateCheck();859 859 setNeedsValidityCheck(); 860 860 InputElement::notifyFormStateChanged(this);
Note: See TracChangeset
for help on using the changeset viewer.