mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 10:19:10 +00:00
fede4b2197
If the current scroll position is fractional, e.g. y=N.4 CSS pixels, and something tries to read the position in CSS pixels and scroll to that position (e.g. calling window.scrollTo(0, rootElem.scrollTop), or equivalently window.scrollBy(0, 0)), it can actually end up scrolling backwards. So create a new method nsIScrollableFrame::ScrollToCSSPixels which ensures that scrolling to a CSS pixel offset tries to preserve the current fractional scroll position if that's possible, and if that's not possible at least does not allow the scroll position to move in the wrong direction.
13 lines
284 B
HTML
13 lines
284 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<body style="margin:0" onload="doTest()">
|
|
<div style="height:1205.6px"></div>
|
|
<div id="d" style="height:0.6px; background:red"></div>
|
|
<script>
|
|
function doTest() {
|
|
window.scrollTo(0, document.documentElement.scrollTop);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|