Commit ed682d81 authored by szager's avatar szager Committed by Commit bot

Recompute scroll origin when scrollbar existence has changed.

BUG=568706
R=eae@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#367185}
parent 428f9b85
Check that the scroll offset in an LTR block is correctly preserved when the existence of its vertical scrollbar changes.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS finalOffset is initialOffset
PASS successfullyParsed is true
TEST COMPLETE
INNER INNER INNER
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<style>
#scrollLeftRtl {
width: 100px;
height: 100px;
background-color: green;
direction: rtl;
overflow: scroll;
}
#inner {
white-space: nowrap;
}
</style>
<div id="scrollLeftRtl">
<span id="inner">INNER INNER INNER</span>
</div>
<script>
description("Check that the scroll offset in an LTR block is correctly preserved when the existence of its vertical scrollbar changes.");
var scrollLeftDiv = document.getElementById("scrollLeftRtl");
var initialOffset = scrollLeftDiv.scrollWidth - scrollLeftDiv.clientWidth - scrollLeftDiv.scrollLeft;
scrollLeftDiv.style.overflow = "auto";
var finalOffset = scrollLeftDiv.scrollWidth - scrollLeftDiv.clientWidth - scrollLeftDiv.scrollLeft;
shouldBe("finalOffset", "initialOffset");
</script>
......@@ -629,6 +629,9 @@ void PaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset,
setHasVerticalScrollbar(hasVerticalOverflow);
else if (box().style()->overflowY() == OSCROLL)
setHasVerticalScrollbar(true);
// If vertical scrollbar existence has changed, LTR blocks need to update scroll origin to account
// for left-hand vertical scrollbar width.
computeScrollDimensions();
}
}
......
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