Title: [118501] trunk
- Revision
- 118501
- Author
- [email protected]
- Date
- 2012-05-25 02:30:49 -0700 (Fri, 25 May 2012)
Log Message
Bad checkValidity result on recently "enabled" form fields
https://bugs.webkit.org/show_bug.cgi?id=85704
Reviewed by Kent Tamura.
Source/WebCore:
Test: fast/forms/disabled-attr-checkvalidity.html
We were tripping on the assertion m_isValid == validity()->valid()
inside HTMLFormControlElement::isValidFormControlElement.
m_isValid was becoming stale because setNeedsValidityCheck wasn't called
after m_willValidate changed.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::willValidate): We used const_cast
because it was too difficult to remove const. We are checking if the
value from willValidate has changed to avoid an infinite loop.
(WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
LayoutTests:
* fast/forms/disabled-attr-checkvalidity-expected.txt: Added.
* fast/forms/disabled-attr-checkvalidity.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (118500 => 118501)
--- trunk/LayoutTests/ChangeLog 2012-05-25 09:28:44 UTC (rev 118500)
+++ trunk/LayoutTests/ChangeLog 2012-05-25 09:30:49 UTC (rev 118501)
@@ -1,3 +1,13 @@
+2012-05-25 Keishi Hattori <[email protected]>
+
+ Bad checkValidity result on recently "enabled" form fields
+ https://bugs.webkit.org/show_bug.cgi?id=85704
+
+ Reviewed by Kent Tamura.
+
+ * fast/forms/disabled-attr-checkvalidity-expected.txt: Added.
+ * fast/forms/disabled-attr-checkvalidity.html: Added.
+
2012-05-25 János Badics <[email protected]>
[Qt] Unreviewed gardening after r118448. Added rebaseline to 2 tests on Qt platform that
Added: trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity-expected.txt (0 => 118501)
--- trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity-expected.txt 2012-05-25 09:30:49 UTC (rev 118501)
@@ -0,0 +1,10 @@
+Test if changing disabled updates checkValidity.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.checkValidity() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity.html (0 => 118501)
--- trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity.html (rev 0)
+++ trunk/LayoutTests/fast/forms/disabled-attr-checkvalidity.html 2012-05-25 09:30:49 UTC (rev 118501)
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<input id="input" disabled required />
+
+<script>
+description('Test if changing disabled updates checkValidity.');
+
+var input = document.getElementById('input');
+input.value = "";
+input.disabled = false;
+shouldBeFalse('input.checkValidity()');
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (118500 => 118501)
--- trunk/Source/WebCore/ChangeLog 2012-05-25 09:28:44 UTC (rev 118500)
+++ trunk/Source/WebCore/ChangeLog 2012-05-25 09:30:49 UTC (rev 118501)
@@ -1,3 +1,23 @@
+2012-05-25 Keishi Hattori <[email protected]>
+
+ Bad checkValidity result on recently "enabled" form fields
+ https://bugs.webkit.org/show_bug.cgi?id=85704
+
+ Reviewed by Kent Tamura.
+
+ Test: fast/forms/disabled-attr-checkvalidity.html
+
+ We were tripping on the assertion m_isValid == validity()->valid()
+ inside HTMLFormControlElement::isValidFormControlElement.
+ m_isValid was becoming stale because setNeedsValidityCheck wasn't called
+ after m_willValidate changed.
+
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::willValidate): We used const_cast
+ because it was too difficult to remove const. We are checking if the
+ value from willValidate has changed to avoid an infinite loop.
+ (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
+
2012-05-24 Kinuko Yasuda <[email protected]>
[chromium] DataTransferItem.webkitGetAsEntry() shouldn't be exposed without flag yet
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (118500 => 118501)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2012-05-25 09:28:44 UTC (rev 118500)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2012-05-25 09:30:49 UTC (rev 118501)
@@ -374,7 +374,11 @@
{
if (!m_willValidateInitialized || m_dataListAncestorState == Unknown) {
m_willValidateInitialized = true;
- m_willValidate = recalcWillValidate();
+ bool newWillValidate = recalcWillValidate();
+ if (m_willValidate != newWillValidate) {
+ m_willValidate = newWillValidate;
+ const_cast<HTMLFormControlElement*>(this)->setNeedsValidityCheck();
+ }
} else {
// If the following assertion fails, setNeedsWillValidateCheck() is not
// called correctly when something which changes recalcWillValidate() result
@@ -392,6 +396,7 @@
return;
m_willValidateInitialized = true;
m_willValidate = newWillValidate;
+ setNeedsValidityCheck();
setNeedsStyleRecalc();
if (!m_willValidate)
hideVisibleValidationMessage();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes