Title: [126539] trunk
- Revision
- 126539
- Author
- [email protected]
- Date
- 2012-08-23 21:55:37 -0700 (Thu, 23 Aug 2012)
Log Message
REGRESSION(r126132): thumb doesn't match click position for rtl input type=range
https://bugs.webkit.org/show_bug.cgi?id=94890
Reviewed by Kent Tamura.
Source/WebCore:
r126132 broke rtl input type=range so the thumb doesn't match click position.
Added new tests to range-hit-test-with-padding.html.
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint):
LayoutTests:
* fast/forms/range/range-hit-test-with-padding-expected.txt:
* fast/forms/range/range-hit-test-with-padding.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (126538 => 126539)
--- trunk/LayoutTests/ChangeLog 2012-08-24 04:50:01 UTC (rev 126538)
+++ trunk/LayoutTests/ChangeLog 2012-08-24 04:55:37 UTC (rev 126539)
@@ -1,3 +1,13 @@
+2012-08-23 Keishi Hattori <[email protected]>
+
+ REGRESSION(r126132): thumb doesn't match click position for rtl input type=range
+ https://bugs.webkit.org/show_bug.cgi?id=94890
+
+ Reviewed by Kent Tamura.
+
+ * fast/forms/range/range-hit-test-with-padding-expected.txt:
+ * fast/forms/range/range-hit-test-with-padding.html:
+
2012-08-23 Dominic Cooney <[email protected]>
[Chromium] Unreviewed gardening.
Modified: trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding-expected.txt (126538 => 126539)
--- trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding-expected.txt 2012-08-24 04:50:01 UTC (rev 126538)
+++ trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding-expected.txt 2012-08-24 04:55:37 UTC (rev 126539)
@@ -1,7 +1,10 @@
Clicking middle of input type=range with padding should set the value to middle.
-PASS input.value is "25"
+PASS input_ltr.value is "25"
+PASS input_rtl.value is "25"
+PASS input_vertical_ltr.value is "25"
+PASS input_vertical_rtl.value is "25"
PASS successfullyParsed is true
TEST COMPLETE
-
+
Modified: trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding.html (126538 => 126539)
--- trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding.html 2012-08-24 04:50:01 UTC (rev 126538)
+++ trunk/LayoutTests/fast/forms/range/range-hit-test-with-padding.html 2012-08-24 04:55:37 UTC (rev 126539)
@@ -6,19 +6,44 @@
<body>
<p id="description">Clicking middle of input type=range with padding should set the value to middle.</p>
<div id="console"></div>
-<input id="input" type=range min=0 max=50 step=1 value="0" style="width: 100px; padding: 0 40px;">
+<input id="ltr" type=range min=0 max=50 step=1 value="0" style="width: 100px; padding: 0 40px;">
+<input id="rtl" dir="rtl" type=range min=0 max=50 step=1 value="0" style="width: 100px; padding: 0 40px;">
+<input id="vertical_ltr" type=range min=0 max=50 step=1 value="0" style="-webkit-appearance:slider-vertical; width: 20px; height: 100px; padding: 40px 0;">
+<input id="vertical_rtl" dir="rtl" type=range min=0 max=50 step=1 value="0" style="-webkit-appearance:slider-vertical; width: 20px; height: 100px; padding: 40px 0;">
<script>
-var input = document.getElementById("input");
-function clickSlider(offsetLeft) {
+function clickHorizontalSlider(input, offsetLeft) {
var centerY = input.offsetTop + input.offsetHeight / 2;
+ if (!window.eventSender)
+ return;
eventSender.mouseMoveTo(input.offsetLeft + offsetLeft, centerY);
eventSender.mouseDown();
eventSender.mouseUp();
}
-clickSlider(90); // left padding (40px) + middle (50px)
-shouldBe('input.value', '"25"');
+function clickVerticalSlider(input, offsetTop) {
+ var centerX = input.offsetLeft + input.offsetWidth / 2;
+ if (!window.eventSender)
+ return;
+ eventSender.mouseMoveTo(centerX, input.offsetTop + offsetTop);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+var input_ltr = document.getElementById("ltr");
+clickHorizontalSlider(input_ltr, 90); // left padding (40px) + middle (50px)
+shouldBe('input_ltr.value', '"25"');
+
+var input_rtl = document.getElementById("rtl");
+clickHorizontalSlider(input_rtl, 90); // left padding (40px) + middle (50px)
+shouldBe('input_rtl.value', '"25"');
+
+var input_vertical_ltr = document.getElementById("vertical_rtl");
+clickVerticalSlider(input_vertical_ltr, 90); // top padding (40px) + middle (50px)
+shouldBe('input_vertical_ltr.value', '"25"');
+
+var input_vertical_rtl = document.getElementById("vertical_rtl");
+clickVerticalSlider(input_vertical_rtl, 90); // top padding (40px) + middle (50px)
+shouldBe('input_vertical_rtl.value', '"25"');
</script>
<script src=""
Modified: trunk/Source/WebCore/ChangeLog (126538 => 126539)
--- trunk/Source/WebCore/ChangeLog 2012-08-24 04:50:01 UTC (rev 126538)
+++ trunk/Source/WebCore/ChangeLog 2012-08-24 04:55:37 UTC (rev 126539)
@@ -1,3 +1,17 @@
+2012-08-23 Keishi Hattori <[email protected]>
+
+ REGRESSION(r126132): thumb doesn't match click position for rtl input type=range
+ https://bugs.webkit.org/show_bug.cgi?id=94890
+
+ Reviewed by Kent Tamura.
+
+ r126132 broke rtl input type=range so the thumb doesn't match click position.
+
+ Added new tests to range-hit-test-with-padding.html.
+
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::setPositionFromPoint):
+
2012-08-23 James Robinson <[email protected]>
Add OVERRIDE and deinline virtual getters on *PlatformGestureCurve
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (126538 => 126539)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-08-24 04:50:01 UTC (rev 126538)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-08-24 04:55:37 UTC (rev 126539)
@@ -258,6 +258,7 @@
input->setTextAsOfLastFormControlChangeEvent(input->value());
LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true));
bool isVertical = hasVerticalAppearance(input);
+ bool isLeftToRightDirection = renderBox()->style()->isLeftToRightDirection();
LayoutUnit trackSize;
LayoutUnit position;
LayoutUnit currentPosition;
@@ -276,6 +277,8 @@
} else {
trackSize = trackElement->renderBox()->contentWidth();
position = offset.x() - renderBox()->width() / 2 - trackBoundingBox.x() + inputBoundingBox.x();
+ if (!isLeftToRightDirection)
+ position += renderBox()->width();
currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
}
position = max<LayoutUnit>(0, min(position, trackSize));
@@ -283,7 +286,7 @@
return;
const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize);
- const Decimal fraction = isVertical || !renderBox()->style()->isLeftToRightDirection() ? Decimal(1) - ratio : ratio;
+ const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio;
StepRange stepRange(input->createStepRange(RejectAny));
Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction));
@@ -293,7 +296,7 @@
Decimal closest = input->findClosestTickMarkValue(value);
if (closest.isFinite()) {
double closestFraction = stepRange.proportionFromValue(closest).toDouble();
- double closestRatio = isVertical || !renderBox()->style()->isLeftToRightDirection() ? 1.0 - closestFraction : closestFraction;
+ double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - closestFraction : closestFraction;
LayoutUnit closestPosition = trackSize * closestRatio;
if ((closestPosition - position).abs() <= snappingThreshold)
value = closest;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes