Title: [97244] trunk
Revision
97244
Author
[email protected]
Date
2011-10-12 02:07:05 -0700 (Wed, 12 Oct 2011)

Log Message

REGRESSION(r94836): An assertion fails in HTMLFormControlElement::isValidFormControlElement
when HTMLInputElement::setValue() is called while the element is focused.
https://bugs.webkit.org/show_bug.cgi?id=69909

Reviewed by Ryosuke Niwa.

Source/WebCore:

setNeedsValidityCheck() should be called after the value update
and before any style recalculation. r94836 moved
setSelectionRange() call, and it recalculates the element style.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValue): Move setNeedsValidityCheck() to setValueInternal().
(WebCore::HTMLInputElement::setValueInternal): Move setNeedsValidityCheck() from setValue().

LayoutTests:

* fast/forms/input-live-pseudo-selectors-expected.txt:
* fast/forms/resources/input-live-pseudo-selectors.js: Add a testcase for the bug.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97243 => 97244)


--- trunk/LayoutTests/ChangeLog	2011-10-12 08:39:42 UTC (rev 97243)
+++ trunk/LayoutTests/ChangeLog	2011-10-12 09:07:05 UTC (rev 97244)
@@ -1,3 +1,14 @@
+2011-10-12  Kent Tamura  <[email protected]>
+
+        REGRESSION(r94836): An assertion fails in HTMLFormControlElement::isValidFormControlElement
+        when HTMLInputElement::setValue() is called while the element is focused.
+        https://bugs.webkit.org/show_bug.cgi?id=69909
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/forms/input-live-pseudo-selectors-expected.txt:
+        * fast/forms/resources/input-live-pseudo-selectors.js: Add a testcase for the bug.
+
 2011-10-12  Gabor Rapcsanyi  <[email protected]>
 
         [Qt] Unreviewed gardening.

Modified: trunk/LayoutTests/fast/forms/input-live-pseudo-selectors-expected.txt (97243 => 97244)


--- trunk/LayoutTests/fast/forms/input-live-pseudo-selectors-expected.txt	2011-10-12 08:39:42 UTC (rev 97243)
+++ trunk/LayoutTests/fast/forms/input-live-pseudo-selectors-expected.txt	2011-10-12 09:07:05 UTC (rev 97244)
@@ -20,6 +20,8 @@
 Change the value by DOM attribute:
 PASS backgroundOf(el) is validColor
 PASS backgroundOf(el) is invalidColor
+Change the value by DOM attribute for a focused text field:
+PASS backgroundOf(el) is validColor
 Change the value by key input:
 PASS backgroundOf(el) is validColor
 PASS backgroundOf(el) is invalidColor

Modified: trunk/LayoutTests/fast/forms/resources/input-live-pseudo-selectors.js (97243 => 97244)


--- trunk/LayoutTests/fast/forms/resources/input-live-pseudo-selectors.js	2011-10-12 08:39:42 UTC (rev 97243)
+++ trunk/LayoutTests/fast/forms/resources/input-live-pseudo-selectors.js	2011-10-12 09:07:05 UTC (rev 97244)
@@ -71,6 +71,12 @@
 el.value = '';
 shouldBe(elBackground, 'invalidColor');
 
+debug('Change the value by DOM attribute for a focused text field:');
+el = makeInvalid();
+el.focus();
+el.value = 'abc';
+shouldBe(elBackground, 'validColor');
+
 debug('Change the value by key input:');
 el = makeInvalid();
 el.focus();

Modified: trunk/Source/WebCore/ChangeLog (97243 => 97244)


--- trunk/Source/WebCore/ChangeLog	2011-10-12 08:39:42 UTC (rev 97243)
+++ trunk/Source/WebCore/ChangeLog	2011-10-12 09:07:05 UTC (rev 97244)
@@ -1,5 +1,21 @@
 2011-10-12  Kent Tamura  <[email protected]>
 
+        REGRESSION(r94836): An assertion fails in HTMLFormControlElement::isValidFormControlElement
+        when HTMLInputElement::setValue() is called while the element is focused.
+        https://bugs.webkit.org/show_bug.cgi?id=69909
+
+        Reviewed by Ryosuke Niwa.
+
+        setNeedsValidityCheck() should be called after the value update
+        and before any style recalculation. r94836 moved
+        setSelectionRange() call, and it recalculates the element style.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setValue): Move setNeedsValidityCheck() to setValueInternal().
+        (WebCore::HTMLInputElement::setValueInternal): Move setNeedsValidityCheck() from setValue().
+
+2011-10-12  Kent Tamura  <[email protected]>
+
         Build fixes for r97238.
         https://bugs.webkit.org/show_bug.cgi?id=69828
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (97243 => 97244)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-12 08:39:42 UTC (rev 97243)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-12 09:07:05 UTC (rev 97244)
@@ -1089,8 +1089,6 @@
     m_suggestedValue = String(); // Prevent TextFieldInputType::setValue from using the suggested value.
     m_inputType->setValue(sanitizedValue, valueChanged, sendChangeEvent);
 
-    setNeedsValidityCheck();
-
     if (!valueChanged)
         return;
 
@@ -1108,6 +1106,7 @@
 {
     m_valueIfDirty = sanitizedValue;
     m_wasModifiedByUser = sendChangeEvent;
+    setNeedsValidityCheck();
 }
 
 double HTMLInputElement::valueAsDate() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to