<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56385] trunk/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/56385">56385</a></dd>
<dt>Author</dt> <dd>tkent@chromium.org</dd>
<dt>Date</dt> <dd>2010-03-23 04:07:45 -0700 (Tue, 23 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>2010-03-23  Kent Tamura  &lt;tkent@chromium.org&gt;

        Reviewed by Adam Barth.

        Add checks if setNeedsWillValidateCheck() and
        setNeedsValidityCheck() are called correctly.
        https://bugs.webkit.org/show_bug.cgi?id=34924

        Introduce HTMLFormControlElement::m_willValidate and
        m_isValid. They are the caches of willValidate() and
        isValidFormControlElement(). setNeedsWillValidateCheck() updates
        m_willValidate and setNeedsValidityCheck() updates m_isValid.

        willValidate() and isValidFormControlElement() have assertions to
        check m_willvalidate or m_isValid has the correct state. If
        setNeedsWillValidateCheck() or setNeedsValidityCheck() is needed
        to be called and is not called, these assertions fail.

        * html/HTMLButtonElement.h:
        (WebCore::HTMLButtonElement::recalcWillValidate):
        * html/HTMLFieldSetElement.h:
        (WebCore::HTMLFieldSetElement::recalcWillValidate):
        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElement::HTMLFormControlElement):
        (WebCore::HTMLFormControlElement::parseMappedAttribute):
        (WebCore::HTMLFormControlElement::recalcWillValidate):
        (WebCore::HTMLFormControlElement::willValidate):
        (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
        (WebCore::HTMLFormControlElement::validationMessage):
        (WebCore::HTMLFormControlElement::isValidFormControlElement):
        (WebCore::HTMLFormControlElement::setNeedsValidityCheck):
        * html/HTMLFormControlElement.h:
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::setInputType):
        (WebCore::HTMLInputElement::parseMappedAttribute):
        (WebCore::HTMLInputElement::setValue):
        (WebCore::HTMLInputElement::recalcWillValidate):
        * html/HTMLInputElement.h:
        * html/HTMLTextAreaElement.cpp:
        (WebCore::HTMLTextAreaElement::setNonDirtyValue):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorehtmlHTMLButtonElementh">trunk/WebCore/html/HTMLButtonElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLFieldSetElementh">trunk/WebCore/html/HTMLFieldSetElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLFormControlElementcpp">trunk/WebCore/html/HTMLFormControlElement.cpp</a></li>
<li><a href="#trunkWebCorehtmlHTMLFormControlElementh">trunk/WebCore/html/HTMLFormControlElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementcpp">trunk/WebCore/html/HTMLInputElement.cpp</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementh">trunk/WebCore/html/HTMLInputElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLTextAreaElementcpp">trunk/WebCore/html/HTMLTextAreaElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/ChangeLog        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2010-03-23  Kent Tamura  &lt;tkent@chromium.org&gt;
+
+        Reviewed by Adam Barth.
+
+        Add checks if setNeedsWillValidateCheck() and
+        setNeedsValidityCheck() are called correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=34924
+
+        Introduce HTMLFormControlElement::m_willValidate and
+        m_isValid. They are the caches of willValidate() and
+        isValidFormControlElement(). setNeedsWillValidateCheck() updates
+        m_willValidate and setNeedsValidityCheck() updates m_isValid.
+
+        willValidate() and isValidFormControlElement() have assertions to
+        check m_willvalidate or m_isValid has the correct state. If
+        setNeedsWillValidateCheck() or setNeedsValidityCheck() is needed
+        to be called and is not called, these assertions fail.
+
+        * html/HTMLButtonElement.h:
+        (WebCore::HTMLButtonElement::recalcWillValidate):
+        * html/HTMLFieldSetElement.h:
+        (WebCore::HTMLFieldSetElement::recalcWillValidate):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::HTMLFormControlElement):
+        (WebCore::HTMLFormControlElement::parseMappedAttribute):
+        (WebCore::HTMLFormControlElement::recalcWillValidate):
+        (WebCore::HTMLFormControlElement::willValidate):
+        (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
+        (WebCore::HTMLFormControlElement::validationMessage):
+        (WebCore::HTMLFormControlElement::isValidFormControlElement):
+        (WebCore::HTMLFormControlElement::setNeedsValidityCheck):
+        * html/HTMLFormControlElement.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setInputType):
+        (WebCore::HTMLInputElement::parseMappedAttribute):
+        (WebCore::HTMLInputElement::setValue):
+        (WebCore::HTMLInputElement::recalcWillValidate):
+        * html/HTMLInputElement.h:
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::setNonDirtyValue):
+
</ins><span class="cx"> 2010-03-22  Pavel Feldman  &lt;pfeldman@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Dave Hyatt.
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLButtonElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLButtonElement.h (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLButtonElement.h        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLButtonElement.h        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -57,11 +57,10 @@
</span><span class="cx">     String value() const;
</span><span class="cx">     void setValue(const String&amp;);
</span><span class="cx"> 
</span><del>-    virtual bool willValidate() const { return false; }
-    
</del><span class="cx"> private:
</span><span class="cx">     enum Type { SUBMIT, RESET, BUTTON };
</span><span class="cx">     virtual bool isOptionalFormControl() const { return true; }
</span><ins>+    virtual bool recalcWillValidate() const { return false; }
</ins><span class="cx"> 
</span><span class="cx">     Type m_type;
</span><span class="cx">     bool m_activeSubmit;
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFieldSetElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFieldSetElement.h (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFieldSetElement.h        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLFieldSetElement.h        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -47,8 +47,8 @@
</span><span class="cx">     virtual bool supportsFocus() const;
</span><span class="cx">     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
</span><span class="cx">     virtual const AtomicString&amp; formControlType() const;
</span><del>-
-    virtual bool willValidate() const { return false; }
</del><ins>+private:
+    virtual bool recalcWillValidate() const { return false; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } //namespace
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFormControlElement.cpp (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFormControlElement.cpp        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLFormControlElement.cpp        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx">     , m_readOnly(false)
</span><span class="cx">     , m_required(false)
</span><span class="cx">     , m_valueMatchesRenderer(false)
</span><ins>+    , m_willValidate(false)
+    , m_isValid(true)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_form)
</span><span class="cx">         m_form = findFormAncestor();
</span><span class="lines">@@ -90,7 +92,6 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr)
</span><span class="cx"> {
</span><del>-    bool oldWillValidate = willValidate();
</del><span class="cx">     if (attr-&gt;name() == nameAttr)
</span><span class="cx">         m_hasName = !attr-&gt;isEmpty();
</span><span class="cx">     else if (attr-&gt;name() == disabledAttr) {
</span><span class="lines">@@ -112,12 +113,13 @@
</span><span class="cx">     } else if (attr-&gt;name() == requiredAttr) {
</span><span class="cx">         bool oldRequired = m_required;
</span><span class="cx">         m_required = !attr-&gt;isNull();
</span><del>-        if (oldRequired != m_required)
-            setNeedsStyleRecalc();
</del><ins>+        if (oldRequired != m_required) {
+            setNeedsValidityCheck();
+            setNeedsStyleRecalc(); // Updates for :required :optional classes.
+        }
</ins><span class="cx">     } else
</span><span class="cx">         HTMLElement::parseMappedAttribute(attr);
</span><del>-    if (oldWillValidate != willValidate())
-        setNeedsWillValidateCheck();
</del><ins>+    setNeedsWillValidateCheck();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormControlElement::attach()
</span><span class="lines">@@ -299,26 +301,36 @@
</span><span class="cx">     return Element::tabIndex();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool HTMLFormControlElement::willValidate() const
</del><ins>+bool HTMLFormControlElement::recalcWillValidate() const
</ins><span class="cx"> {
</span><del>-    // FIXME: Implementation shall be completed with these checks:
-    //      The control does not have a repetition template as an ancestor.
-    //      The control does not have a datalist element as an ancestor.
-    //      The control is not an output element.
</del><ins>+    // FIXME: Check if the control does not have a datalist element as an ancestor.
</ins><span class="cx">     return m_form &amp;&amp; m_hasName &amp;&amp; !m_disabled &amp;&amp; !m_readOnly;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String HTMLFormControlElement::validationMessage()
</del><ins>+bool HTMLFormControlElement::willValidate() const
</ins><span class="cx"> {
</span><del>-    return validity()-&gt;validationMessage();
</del><ins>+    // If the following assertion fails, setNeedsWillValidateCheck() is not
+    // called correctly when something which changes recalcWillValidate() result
+    // is updated.
+    ASSERT(m_willValidate == recalcWillValidate());
+    return m_willValidate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormControlElement::setNeedsWillValidateCheck()
</span><span class="cx"> {
</span><ins>+    bool newWillValidate = recalcWillValidate();
+    if (m_willValidate == newWillValidate)
+        return;
+    m_willValidate = newWillValidate;
</ins><span class="cx">     setNeedsStyleRecalc();
</span><span class="cx">     // FIXME: Show/hide a validation message.
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String HTMLFormControlElement::validationMessage()
+{
+    return validity()-&gt;validationMessage();
+}
+
</ins><span class="cx"> bool HTMLFormControlElement::checkValidity()
</span><span class="cx"> {
</span><span class="cx">     if (willValidate() &amp;&amp; !isValidFormControlElement()) {
</span><span class="lines">@@ -329,12 +341,22 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLFormControlElement::isValidFormControlElement()
+{
+    // If the following assertion fails, setNeedsValidityCheck() is not called
+    // correctly when something which changes validity is updated.
+    ASSERT(m_isValid == validity()-&gt;valid());
+    return m_isValid;
+}
+
</ins><span class="cx"> void HTMLFormControlElement::setNeedsValidityCheck()
</span><span class="cx"> {
</span><del>-    if (willValidate()) {
</del><ins>+    bool newIsValid = validity()-&gt;valid();
+    if (willValidate() &amp;&amp; newIsValid != m_isValid) {
</ins><span class="cx">         // Update style for pseudo classes such as :valid :invalid.
</span><span class="cx">         setNeedsStyleRecalc();
</span><span class="cx">     }
</span><ins>+    m_isValid = newIsValid;
</ins><span class="cx">     // FIXME: show/hide a validation message.
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -369,11 +391,6 @@
</span><span class="cx">     return isSuccessfulSubmitButton() &amp;&amp; m_form &amp;&amp; m_form-&gt;defaultButton() == this;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool HTMLFormControlElement::isValidFormControlElement()
-{
-    return validity()-&gt;valid();
-}
-
</del><span class="cx"> void HTMLFormControlElement::removeFromForm()
</span><span class="cx"> {
</span><span class="cx">     if (!m_form)
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFormControlElement.h (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFormControlElement.h        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLFormControlElement.h        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual short tabIndex() const;
</span><span class="cx"> 
</span><del>-    virtual bool willValidate() const;
</del><ins>+    bool willValidate() const;
</ins><span class="cx">     String validationMessage();
</span><span class="cx">     bool checkValidity();
</span><span class="cx">     // This must be called when a validation constraint or control value is changed.
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx">     void removeFromForm();
</span><span class="cx">     // This must be called any time the result of willValidate() has changed.
</span><span class="cx">     void setNeedsWillValidateCheck();
</span><ins>+    virtual bool recalcWillValidate() const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual HTMLFormElement* virtualForm() const;
</span><span class="lines">@@ -138,6 +139,10 @@
</span><span class="cx">     bool m_readOnly : 1;
</span><span class="cx">     bool m_required : 1;
</span><span class="cx">     bool m_valueMatchesRenderer : 1;
</span><ins>+    bool m_willValidate : 1;
+    // Cache of validity()-&gt;valid().
+    // &quot;candidate for constraint validation&quot; doesn't affect to m_isValid.
+    bool m_isValid : 1;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class HTMLFormControlElementWithState : public HTMLFormControlElement {
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.cpp (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.cpp        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLInputElement.cpp        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -805,7 +805,6 @@
</span><span class="cx">     // type change, otherwise a JavaScript programmer would be able to set a text
</span><span class="cx">     // field's value to something like /etc/passwd and then change it to a file field.
</span><span class="cx">     if (inputType() != newType) {
</span><del>-        bool oldWillValidate = willValidate();
</del><span class="cx">         if (newType == FILE &amp;&amp; m_haveType)
</span><span class="cx">             // Set the attribute back to the old value.
</span><span class="cx">             // Useful in case we were called from inside parseMappedAttribute.
</span><span class="lines">@@ -862,9 +861,8 @@
</span><span class="cx">             checkedRadioButtons(this).addButton(this);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        setNeedsWillValidateCheck();
</ins><span class="cx">         setNeedsValidityCheck();
</span><del>-        if (oldWillValidate != willValidate())
-            setNeedsWillValidateCheck();
</del><span class="cx">         InputElement::notifyFormStateChanged(this);
</span><span class="cx">     }
</span><span class="cx">     m_haveType = true;
</span><span class="lines">@@ -1146,8 +1144,14 @@
</span><span class="cx">                || attr-&gt;name() == incrementalAttr)
</span><span class="cx">         setNeedsStyleRecalc();
</span><span class="cx">     else if (attr-&gt;name() == minAttr
</span><del>-             || attr-&gt;name() == maxAttr
-             || attr-&gt;name() == multipleAttr
</del><ins>+             || attr-&gt;name() == maxAttr) {
+        if (inputType() == RANGE) {
+            // Sanitize the value.
+            setValue(value());
+            setNeedsStyleRecalc();
+        }
+        setNeedsValidityCheck();
+    } else if (attr-&gt;name() == multipleAttr
</ins><span class="cx">              || attr-&gt;name() == patternAttr
</span><span class="cx">              || attr-&gt;name() == precisionAttr
</span><span class="cx">              || attr-&gt;name() == stepAttr)
</span><span class="lines">@@ -1573,10 +1577,14 @@
</span><span class="cx"> 
</span><span class="cx">     setFormControlValueMatchesRenderer(false);
</span><span class="cx">     if (storesValueSeparateFromAttribute()) {
</span><del>-        if (inputType() == FILE)
</del><ins>+        if (inputType() == FILE) {
</ins><span class="cx">             m_fileList-&gt;clear();
</span><del>-        else {
</del><ins>+            setNeedsValidityCheck();
+        } else {
</ins><span class="cx">             m_data.setValue(sanitizeValue(value));
</span><ins>+            // setNeedsValidityCheck() needs to be called after updating the value,
+            // before style recalc.
+            setNeedsValidityCheck();
</ins><span class="cx">             if (isTextField()) {
</span><span class="cx">                 updatePlaceholderVisibility(false);
</span><span class="cx">                 if (inDocument())
</span><span class="lines">@@ -1586,8 +1594,10 @@
</span><span class="cx">         if (renderer())
</span><span class="cx">             renderer()-&gt;updateFromElement();
</span><span class="cx">         setNeedsStyleRecalc();
</span><del>-    } else
</del><ins>+    } else {
</ins><span class="cx">         setAttribute(valueAttr, sanitizeValue(value));
</span><ins>+        setNeedsValidityCheck();
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (isTextField()) {
</span><span class="cx">         unsigned max = m_data.value().length();
</span><span class="lines">@@ -1604,7 +1614,6 @@
</span><span class="cx">         dispatchFormControlChangeEvent();
</span><span class="cx"> 
</span><span class="cx">     InputElement::notifyFormStateChanged(this);
</span><del>-    setNeedsValidityCheck();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double HTMLInputElement::parseToDouble(const String&amp; src, double defaultValue) const
</span><span class="lines">@@ -2630,11 +2639,10 @@
</span><span class="cx">     addSubresourceURL(urls, src());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool HTMLInputElement::willValidate() const
</del><ins>+bool HTMLInputElement::recalcWillValidate() const
</ins><span class="cx"> {
</span><del>-    // FIXME: This shall check for new WF2 input types too
-    return HTMLFormControlElementWithState::willValidate() &amp;&amp; inputType() != HIDDEN &amp;&amp;
-           inputType() != BUTTON &amp;&amp; inputType() != RESET;
</del><ins>+    return HTMLFormControlElementWithState::recalcWillValidate()
+        &amp;&amp; inputType() != HIDDEN &amp;&amp; inputType() != BUTTON &amp;&amp; inputType() != RESET;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String HTMLInputElement::serializeForNumberType(double number)
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.h (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.h        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLInputElement.h        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -261,8 +261,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void addSubresourceAttributeURLs(ListHashSet&lt;KURL&gt;&amp;) const;
</span><span class="cx">     
</span><del>-    virtual bool willValidate() const;
-
</del><span class="cx">     // Converts the specified string to a floating number.
</span><span class="cx">     // If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures.  This returns false for an empty string input.
</span><span class="cx">     // The double* parameter may be 0.
</span><span class="lines">@@ -295,6 +293,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
</span><span class="cx">     virtual bool isRequiredFormControl() const;
</span><ins>+    virtual bool recalcWillValidate() const;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;HTMLFormElement&gt; createTemporaryFormForIsIndex();
</span><span class="cx">     // Helper for getAllowedValueStep();
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLTextAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLTextAreaElement.cpp (56384 => 56385)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLTextAreaElement.cpp        2010-03-23 08:18:55 UTC (rev 56384)
+++ trunk/WebCore/html/HTMLTextAreaElement.cpp        2010-03-23 11:07:45 UTC (rev 56385)
</span><span class="lines">@@ -291,6 +291,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_value = normalizedValue;
</span><ins>+    setNeedsValidityCheck();
</ins><span class="cx">     m_isDirty = false;
</span><span class="cx">     setFormControlValueMatchesRenderer(true);
</span><span class="cx">     updatePlaceholderVisibility(false);
</span><span class="lines">@@ -305,7 +306,6 @@
</span><span class="cx">         setSelectionRange(endOfString, endOfString);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    setNeedsValidityCheck();
</del><span class="cx">     notifyFormStateChanged(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>