<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>15251</bug_id>
          
          <creation_ts>2007-09-21 11:31:23 -0700</creation_ts>
          <short_desc>REGRESSION: &lt;input type=range&gt; doesn&apos;t respond to form.reset() or setting input.value</short_desc>
          <delta_ts>2007-09-22 21:13:26 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>523.x (Safari 3)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Roben (:aroben)">aroben</reporter>
          <assigned_to name="Adam Roben (:aroben)">aroben</assigned_to>
          <cc>adele</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>194</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 11:31:23 -0700</bug_when>
    <thetext>Setting input.value for &lt;input type=range&gt; does not update the position of the slider thumb.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>195</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 11:33:51 -0700</bug_when>
    <thetext>Hm, I can&apos;t reproduce this in a smaller testcase. Maybe it&apos;s a bug with the page I was working on...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>196</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 11:39:58 -0700</bug_when>
    <thetext>Turns out I was wrong. This works! \o/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>197</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 11:58:51 -0700</bug_when>
    <thetext>Ok, so this bug does happen, but only if you&apos;ve dragged the thumb once. Attaching a testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192</commentid>
    <comment_count>4</comment_count>
      <attachid>16341</attachid>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 12:00:51 -0700</bug_when>
    <thetext>Created attachment 16341
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193</commentid>
    <comment_count>5</comment_count>
      <attachid>16342</attachid>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 12:07:28 -0700</bug_when>
    <thetext>Created attachment 16342
potential fix

So this patch seems to fix the bug, though I&apos;d like Adele&apos;s opinion on whether this is the right way to go about it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>191</commentid>
    <comment_count>6</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-21 12:28:12 -0700</bug_when>
    <thetext>Adele said she didn&apos;t think the approach in my first patch was right, so I debugged a bit more, and I think I have found the real cause.

It looks as though the thumb&apos;s position will only get updated if HTMLInputElement::setChanged() is called at some point. When setting the value through JS, this happens in HTMLInputElement::parseMappedAttribute:

    } else if (attr-&gt;name() == valueAttr) {
        // We only need to setChanged if the form is looking at the default value right now.
        if (m_value.isNull())
            setChanged();
        setValueMatchesRenderer(false);

Note the check for if (m_value.isNull()). Normally, modifications to m_value only happen if HTMLInputElement::storesValueSeparateFromAttribute() returns true (which it does not for &lt;input type=range&gt;). So for an &lt;input type=range&gt;, we would expect m_value.isNull() to always be true, and therefore setChanged() to always be called when input.value is modified.

However, there is one place where m_value is set without first checking storesValueSeparateFromAttribute(): HTMLInputElement::setValueFromRenderer(). This method gets called from RenderSlider::setValueForPosition(), which is called when you drag the thumb. This sets m_value, so setChanged() is never subsequently called when input.value is set from JS.

It seems like RenderSlider really wants to set the value attribute directly, not HTMLInputElement::m_value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190</commentid>
    <comment_count>7</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2007-09-21 13:30:34 -0700</bug_when>
    <thetext>&quot;It seems like RenderSlider really wants to set the value attribute directly,
not HTMLInputElement::m_value.&quot;

I don&apos;t think so... you need to be able to reset a slider back to its default value.  The value attribute represents the default value that you will reset to (as well as the initial value).  If the user drags the slider thumb, then this should not change the default value.  It is just changing the current value.

If the user then resets the form, the slider should revert back to its default value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>186</commentid>
    <comment_count>8</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2007-09-21 13:33:26 -0700</bug_when>
    <thetext>The patch in this bug is absolutely correct, although you&apos;ll need to make sure Safari RSS doesn&apos;t break.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>180</commentid>
    <comment_count>9</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2007-09-21 14:19:45 -0700</bug_when>
    <thetext>This is a regression from Safari 2.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>182</commentid>
    <comment_count>10</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2007-09-21 14:23:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/5498169&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130</commentid>
    <comment_count>11</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-22 18:14:44 -0700</bug_when>
    <thetext>Looks like resetting via form.reset() is also broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128</commentid>
    <comment_count>12</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2007-09-22 21:13:26 -0700</bug_when>
    <thetext>Fixed in r25701</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>16341</attachid>
            <date>2007-09-21 12:00:51 -0700</date>
            <delta_ts>2007-09-21 12:00:51 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>slider.html</filename>
            <type>text/html</type>
            <size>543</size>
            <attacher name="Adam Roben (:aroben)">aroben</attacher>
            
              <data encoding="base64">PGEgaHJlZj0iaHR0cDovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTUyNTEiPkJ1
ZyAxNTI1MTogU2V0dGluZyBpbnB1dC52YWx1ZSBmb3IgJmx0O2lucHV0IHR5cGU9cmFuZ2UmZ3Q7
IGRvZXMgbm90IHVwZGF0ZSB0aGUgcG9zaXRpb24gb2YgdGhlIHNsaWRlciB0aHVtYiBpZiB0aGUg
dGh1bWIgaGFzIGJlZW4gZHJhZ2dlZCBvbmNlPC9hPgoKPHA+VG8gcmVwcm9kdWNlLCBjbGljayB0
aGUgYnV0dG9uLCB0aGVuIGRyYWcgdGhlIHRodW1iLCB0aGVuIGNsaWNrIHRoZSBidXR0b24gYWdh
aW4uIEFueSBjbGlja3Mgb2YgdGhlIGJ1dHRvbiBhZnRlciBkcmFnZ2luZyB0aGUgdGh1bWIgd2ls
bCBoYXZlIG5vIGVmZmVjdCBvbiB0aGUgcG9zaXRpb24gb2YgdGhlIHRodW1iLjwvcD4KCjxpbnB1
dCBpZD0ic2xpZGVyIiB0eXBlPSJyYW5nZSIgbWluPSIwIiBtYXg9IjEwMCI+Cgo8YnV0dG9uIG9u
Y2xpY2s9ImRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzbGlkZXInKS52YWx1ZSA9IDEwIj5DbGlj
ayB0byBzZXQgdmFsdWUgdG8gMTA8L2J1dHRvbj4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>16342</attachid>
            <date>2007-09-21 12:07:28 -0700</date>
            <delta_ts>2007-09-21 12:07:28 -0700</delta_ts>
            <desc>potential fix</desc>
            <filename>slider.patch</filename>
            <type>text/plain</type>
            <size>592</size>
            <attacher name="Adam Roben (:aroben)">aroben</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvaHRtbC9IVE1MSW5wdXRFbGVtZW50LmNwcCBiL1dlYkNvcmUv
aHRtbC9IVE1MSW5wdXRFbGVtZW50LmNwcAppbmRleCAyZWViZTYwLi4xY2U4YjRmIDEwMDY0NAot
LS0gYS9XZWJDb3JlL2h0bWwvSFRNTElucHV0RWxlbWVudC5jcHAKKysrIGIvV2ViQ29yZS9odG1s
L0hUTUxJbnB1dEVsZW1lbnQuY3BwCkBAIC0xMDAwLDEzICsxMDAwLDEzIEBAIGJvb2wgSFRNTElu
cHV0RWxlbWVudDo6c3RvcmVzVmFsdWVTZXBhcmF0ZUZyb21BdHRyaWJ1dGUoKSBjb25zdAogICAg
ICAgICBjYXNlIEhJRERFTjoKICAgICAgICAgY2FzZSBJTUFHRToKICAgICAgICAgY2FzZSBSQURJ
TzoKLSAgICAgICAgY2FzZSBSQU5HRToKICAgICAgICAgY2FzZSBSRVNFVDoKICAgICAgICAgY2Fz
ZSBTVUJNSVQ6CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIGNhc2UgRklMRToK
ICAgICAgICAgY2FzZSBJU0lOREVYOgogICAgICAgICBjYXNlIFBBU1NXT1JEOgorICAgICAgICBj
YXNlIFJBTkdFOgogICAgICAgICBjYXNlIFNFQVJDSDoKICAgICAgICAgY2FzZSBURVhUOgogICAg
ICAgICAgICAgcmV0dXJuIHRydWU7Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>