WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
15251
REGRESSION: <input type=range> doesn't respond to form.reset() or setting input.value
https://bugs.webkit.org/show_bug.cgi?id=15251
Summary
REGRESSION: <input type=range> doesn't respond to form.reset() or setting inp...
Adam Roben (:aroben)
Reported
2007-09-21 11:31:23 PDT
Setting input.value for <input type=range> does not update the position of the slider thumb.
Attachments
testcase
(543 bytes, text/html)
2007-09-21 12:00 PDT
,
Adam Roben (:aroben)
no flags
Details
potential fix
(592 bytes, patch)
2007-09-21 12:07 PDT
,
Adam Roben (:aroben)
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Adam Roben (:aroben)
Comment 1
2007-09-21 11:33:51 PDT
Hm, I can't reproduce this in a smaller testcase. Maybe it's a bug with the page I was working on...
Adam Roben (:aroben)
Comment 2
2007-09-21 11:39:58 PDT
Turns out I was wrong. This works! \o/
Adam Roben (:aroben)
Comment 3
2007-09-21 11:58:51 PDT
Ok, so this bug does happen, but only if you've dragged the thumb once. Attaching a testcase.
Adam Roben (:aroben)
Comment 4
2007-09-21 12:00:51 PDT
Created
attachment 16341
[details]
testcase
Adam Roben (:aroben)
Comment 5
2007-09-21 12:07:28 PDT
Created
attachment 16342
[details]
potential fix So this patch seems to fix the bug, though I'd like Adele's opinion on whether this is the right way to go about it.
Adam Roben (:aroben)
Comment 6
2007-09-21 12:28:12 PDT
Adele said she didn'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'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->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 <input type=range>). So for an <input type=range>, 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.
Dave Hyatt
Comment 7
2007-09-21 13:30:34 PDT
"It seems like RenderSlider really wants to set the value attribute directly, not HTMLInputElement::m_value." I don'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.
Dave Hyatt
Comment 8
2007-09-21 13:33:26 PDT
The patch in this bug is absolutely correct, although you'll need to make sure Safari RSS doesn't break.
Dave Hyatt
Comment 9
2007-09-21 14:19:45 PDT
This is a regression from Safari 2.
Dave Hyatt
Comment 10
2007-09-21 14:23:14 PDT
<
rdar://problem/5498169
>
Adam Roben (:aroben)
Comment 11
2007-09-22 18:14:44 PDT
Looks like resetting via form.reset() is also broken.
Adam Roben (:aroben)
Comment 12
2007-09-22 21:13:26 PDT
Fixed in
r25701
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug