Scroll compression. A browser cannot scroll an element that is taller than a few ten million pixels (Chrome and Edge about
33.5M layout px, Firefox about 17.9M, counted in device pixels: a 150% display makes a 32 px row 48 px). With one million
32 px rows the content is 32M px and the last rows could not be reached. Above MAX_SPACER_PX the scroll element gets a
spacer of exactly that height and the position the browser reports (dom) is mapped to the position in the full content
(virtual): virtual = dom * k. Rows are drawn at their virtual place minus the difference, so what is on screen is right.
At or below the limit k is 1 and nothing changes.
Every read or write of the vertical scroll position goes through this one mapping: the renderer's sync, scrollToIndex,
getScroll/setScroll and the anchor restore.
Scroll compression. A browser cannot scroll an element that is taller than a few ten million pixels (Chrome and Edge about 33.5M layout px, Firefox about 17.9M, counted in device pixels: a 150% display makes a 32 px row 48 px). With one million 32 px rows the content is 32M px and the last rows could not be reached. Above
MAX_SPACER_PXthe scroll element gets a spacer of exactly that height and the position the browser reports (dom) is mapped to the position in the full content (virtual):virtual = dom * k. Rows are drawn at their virtual place minus the difference, so what is on screen is right. At or below the limitkis 1 and nothing changes.Every read or write of the vertical scroll position goes through this one mapping: the renderer's sync,
scrollToIndex,getScroll/setScrolland the anchor restore.