Commit f36d3d64 authored by keishi@webkit.org's avatar keishi@webkit.org

Dragging to edge should always snap to min/max.

https://bugs.webkit.org/show_bug.cgi?id=113477

Reviewed by Kent Tamura.

Source/WebCore:

Dragging to the edge of a slider should always snap to the min/max.

Test: fast/forms/range/range-slow-drag-to-edge.html

* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint):

LayoutTests:

* fast/forms/range/range-slow-drag-to-edge-expected.txt: Added.
* fast/forms/range/range-slow-drag-to-edge.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cc3a2234
2013-03-27 Keishi Hattori <keishi@webkit.org>
Dragging to edge should always snap to min/max.
https://bugs.webkit.org/show_bug.cgi?id=113477
Reviewed by Kent Tamura.
* fast/forms/range/range-slow-drag-to-edge-expected.txt: Added.
* fast/forms/range/range-slow-drag-to-edge.html: Added.
2013-03-27 Shinya Kawanaka <shinyak@chromium.org>
[Chromium] Unreviewed gardening. Test Expectations update.
Test for dragging operations of <input type=range>
Dragging to edge should always set the value to min/max.
PASS input.value is "0"
PASS input.value is "255"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description">Test for dragging operations of &lt;input type=range&gt;</p>
<div id="console"></div>
<style>
input::-webkit-slider-thumb {
width: 15px;
}
</style>
<input type=range id=range min=0 max=255 style="width:129px;">
<script>
function slowDragToRightEdge() {
var centerY = input.offsetTop + input.offsetHeight / 2;
eventSender.mouseMoveTo(input.offsetLeft + input.offsetWidth / 2, centerY);
eventSender.mouseDown();
for (var i = 40; i > 0; i--) {
eventSender.mouseMoveTo(input.offsetLeft + input.offsetWidth - i, centerY);
}
eventSender.mouseUp();
}
function slowDragToLeftEdge() {
var centerY = input.offsetTop + input.offsetHeight / 2;
eventSender.mouseMoveTo(input.offsetLeft + input.offsetWidth / 2, centerY);
eventSender.mouseDown();
for (var i = 40; i > 0; i--) {
eventSender.mouseMoveTo(input.offsetLeft + i, centerY);
}
eventSender.mouseUp();
}
debug('Dragging to edge should always set the value to min/max.');
var input = document.getElementById('range');
input.focus();
slowDragToLeftEdge();
shouldBeEqualToString('input.value', '0');
slowDragToRightEdge();
shouldBeEqualToString('input.value', '255');
debug('');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
2013-03-27 Keishi Hattori <keishi@webkit.org>
Dragging to edge should always snap to min/max.
https://bugs.webkit.org/show_bug.cgi?id=113477
Reviewed by Kent Tamura.
Dragging to the edge of a slider should always snap to the min/max.
Test: fast/forms/range/range-slow-drag-to-edge.html
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint):
2013-03-27 Simon Fraser <simon.fraser@apple.com>
Add a way to update GraphicsLayerCA visibleRects without having to do a flush
......@@ -286,9 +286,6 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
}
position = max<LayoutUnit>(0, min(position, trackSize));
if (position == currentPosition)
return;
const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize);
const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio;
StepRange stepRange(input->createStepRange(RejectAny));
......@@ -308,8 +305,12 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
}
#endif
String valueString = serializeForNumberType(value);
if (valueString == input->value())
return;
// FIXME: This is no longer being set from renderer. Consider updating the method name.
input->setValueFromRenderer(serializeForNumberType(value));
input->setValueFromRenderer(valueString);
renderer()->setNeedsLayout(true);
input->dispatchFormControlChangeEvent();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment