Commit 95ffd07b authored by trchen@chromium.org's avatar trchen@chromium.org

Fix scrollbar thumb drag cancellation in RTL mode

Scrollbar stores original scroll position in non-negative scroll coordinates.
When sending those coordinates to ScrollableArea, they should be offsetted
with minimumScrollPosition() first.

R=jchaffraix@chromium.org
BUG=377131

Review URL: https://codereview.chromium.org/302603009

git-svn-id: svn://svn.chromium.org/blink/trunk@175100 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b330b30f
PASS container.scrollLeft is 0
PASS container.scrollLeft is 350
PASS successfullyParsed is true
TEST COMPLETE
This test verifies scroll position restores correctly when a thumb drag has been cancelled in RTL mode.
This test is expected to fail on Mac because it doesn't cancel scrolling when mouse cursor is out of a certain range. It is Aura-specific behavior.
<!DOCTYPE html>
<style>
#container {
position: absolute;
left: 100px;
top: 0;
width: 300px;
height: 200px;
direction: rtl;
overflow: scroll;
}
#content {
width: 1000px;
height: 1px;
}
</style>
<div id="container">
<div id="content">
</div>
</div>
This test verifies scroll position restores correctly when a thumb drag has been cancelled in RTL mode.<br/>
This test is expected to fail on Mac because it doesn't cancel scrolling when mouse cursor is out of a certain range. It is Aura-specific behavior.
<script src="../../resources/js-test.js"></script>
<script>
var container = document.getElementById("container");
container.scrollLeft = 350;
if (window.eventSender) {
eventSender.dragMode = false;
eventSender.mouseMoveTo(250, 195);
eventSender.mouseDown();
eventSender.mouseMoveTo(100, 195);
shouldBe("container.scrollLeft" , "0");
eventSender.mouseMoveTo(0, 195);
shouldBe("container.scrollLeft" , "350");
}
</script>
PASS container.scrollLeft is 0
FAIL container.scrollLeft should be 350. Was 0.
PASS successfullyParsed is true
TEST COMPLETE
This test verifies scroll position restores correctly when a thumb drag has been cancelled in RTL mode.
This test is expected to fail on Mac because it doesn't cancel scrolling when mouse cursor is out of a certain range. It is Aura-specific behavior.
......@@ -392,7 +392,7 @@ void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
if (m_pressedPart == ThumbPart) {
if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
if (m_scrollableArea)
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation));
} else {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingWindow(evt.position()).x() :
......
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