issennknight on Discord (macOS 13.7.8, v0.1.1902), after f92db4cdd:
"路由 用量 页面 刚点开并滚动页面时会抖动复位".
Two causes, both in the window's own scroll guard, which every page
takes:
1. A load landing under the wheel (show()'s back on the page's first
reads, loadProvidersNow's put-back after render) called backToReader
with the place last heard of. The page hears of a scroll a frame or
more late (WebKit scrolls off the main thread; a loaded Mac), so each
load took the reader's last steps back and stopped their coast.
backAfterLoad now keeps a view that has gone on the way the reader's
own scrolls go (readerWay, set from each of theirs) as theirs, and
puts back only a move against it (a redraw's clamp).
2. On macOS 13's WebKit (16.6) the page never hears the wheel. Every
gesture's first scrolls were put back until three the same way made
a run (puttingBack): a shake at the start of each gesture, a page
just opened included. The first run given back is now remembered
(localStorage magpie.unheardWheels, for the next start too); from
then on a scroll at rest waits 120ms before it is put back
(waitsBack), and a second the same way within 80ms, the page's
height unchanged between them, is the reader's at once (code's two
scrolls in a row, 100ms apart in view-wheel-unheard, are both put
back). A lone
scroll (a redraw's, code's) is still put back, 120ms later; one
under a click's hold at once, as before. What the wait puts back is
recorded as an at-once put-back is, so a wheel heard later than the
wait (a loaded machine) still gives it back (givesBack).
Not changed: the browser's scroll anchoring. It lowers scrollTop as data
comes in above with what's on the screen still; the test tells that from
a put-back (view up and what was under the pointer going down with it).
Nothing between v0.1.1902 and 425a61322 touched this guard (68 commits;
none in backToReader, readerScrolls, readerLeaves, puttingBack or
overflow-anchor), and no view has smooth scrolling.
Size budgets: app.js 1,313,704, the core 1,532,830 (main's plus 1,969), both the guard's own,
with no room added.
Tests:
- New view-open-wheel.test.cjs: Usage and Routing, opened and opened
again, the first data held until the wheel is going; the page told of
each scroll 80ms late (late) or never (unheard, a capture listener
stopping the wheel, learned on the Agents page first); every frame's
place and every write moving a view up are recorded. en, zh, zh-TW,
ja, de; 420 and 1000 wide; Chromium and WebKit. 162/162 on this tree
(mote).
- Broken by hand: on the base's assets (425a61322) 117/162 red: late
Routing 31, late Usage 4 (210 to 180 under the wheel), unheard all 80
("nothing put the view back up": 30, 30, 30 put back each gesture).
With backAfterLoad but no waitsBack, the unheard half was 80/80 red
the same way; with waitsBack but readerAt unset taken as no move, red
too (found by logging each write's stack), fixed to 0 as backToReader
reads it.
- click-scroll.test.cjs: new subtest, a wheel heard 250ms late with
the unheard wheels learned still scrolls the view. Red in both
engines (Windows, 2 of 2 runs) with the wait's put-back not recorded,
24/24 green with it (3 of 3). Found from the whole suite's first run:
under WSL's load, click-scroll's late-heard wheel subtest went red in
webkit, which learned the unheard wheels from a run put back.
- Also tried and dropped: .view { overflow-anchor: none }. It only
silenced a scrollTop-only check; anchoring moves nothing on screen.
- TestCoreScriptBudget ok (mote); gofmt -l clean.
- After the rebase onto 2f5548371: TestCoreScriptBudget and the
app.js budget ok (mote); view-open-wheel, view-wheel-unheard,
click-scroll on mote under another session's suite (load 16 to 35):
192/192 once, and 1 of 80 unheard subtests red once (#4132: under
load the driver's second wheel comes after waitsBack's 120ms).
- Rebased onto c3462d5fe (main's GUI changes: context.js, i18n.js,
the Codex auto-reset title; none in the scroll guard). app.js budget
ok (mote). TestCoreScriptBudget is red by 670 bytes at c3462d5fe
itself (1,531,531 > 1,530,861, #4133, taken by another session); this
commit adds its own 1,969 to both, so the core stays 670 over, not
more. The four scroll files on WSL: chromium all green; Linux WebKit
red in click-scroll, view-wheel-unheard and view-wheel-after-click as
at 2f5548371, and 7 of 80 view-open-wheel unheard subtests (a first
gesture's put-backs before the run is learned, the #4132 class). On
mote at load 81 (another session's full GUI suite) 14 of 113 red,
mostly 5s click timeouts; not counted as a run.
- Whole GUI suite at this tree, WSL magpie-desktop (mote had another
session's suite): 14,519 tests, 14,263 pass, 256 red. Every red file
is named on #4120 / #4121 (Linux reds at main) or was run alone at
2f5548371 and is red there the same: routing-rule-models,
recent-calls-more, searcher-pick, usage-ledger-chart, list-sort
(#4131), click-scroll's late-heard wheel, inner-scroll-contain,
view-wheel-after-click and view-wheel-unheard in WebKit on Linux
(base 9 to 10 red, this tree 4 to 9). Recorded on #4120.
- Tried and dropped: a check in waitsBack's timer for a view gone on
further untold. It took a code scroll whose event was still pending
under load as the reader's (view-wheel-unheard webkit red on mote).
Not tried: a real macOS 13 WebKit 16.6 (none here). The unheard case is
an emulation (wheels stopped before the page), the same one
view-wheel-unheard and view-wheel-after-redraw use. The first gesture
of a fresh install on macOS 13 still shakes once, until the run is
seen.