⚡ perf(vscode): 代码阅读预览屏幕外的顶层块跳过样式、排版和绘制(content-visibility),没画过的按内容估的高度占位;跳到某一行、恢复滚动位置、跳到改动和定义前先把目标那一带照常排版再量,滚过去位置不变

This commit is contained in:
cruldra committed 2026-10-13 15:11:21 +11:00
1 parent ffb0f147e1
commit 8a5d3761fd
9 files changed
+201 -9

No files matched your search

@@ -97,4 +97,15 @@ describe('卡片位置量过就记着', () => {
layout.anchorAt(0)
expect(reads).toBe(first * 2)
})
it('要滚过去的:目标所在的顶层块连同上下几屏之内的先照常排版,过两帧放回去', async () => {
const { root } = page()
const layout = new PageLayout()
layout.attach(root, null)
const items = [...root.querySelectorAll('.cr-item')]
expect(layout.cardForLine(40)?.line).toBe(40)
expect(items.map(item => item.hasAttribute('data-settle'))).toEqual([true, true, true])
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => setTimeout(resolve))))
expect(items.some(item => item.hasAttribute('data-settle'))).toBe(false)
})
})