4794de398ea8337d223a91e207181c56fcf4ad76
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6dd8c9aaf0 |
gui: a page's own scrollbar is dragged by the mouse (#1213)
Dragging a scrollbar did nothing on any page with content taller than the
window: the thumb would not move, and letting go left it where it started
(emo172, #1089). The wheel worked, so only the drag was broken, and a
scrollbar dragged in a container the app does not listen to scrolled
normally.
"Where the reader is" holds a view still unless the reader asked for the
scroll: the wheel, a touch, the keys, or a drag of the content, each of
which says so through an event. A scrollbar dragged by the mouse has no
such event — Chromium and WebView2 give it no pointermove — so every
scroll it produced was put back as it came, the thumb sliding back under
the pointer. The wheel works because wheel is one of the events.
The press on a scrollbar does reach the view, with the pointer past its
content in the scrollbar's band, and the lift ends the drag. Held from
that press to the lift, the drag's scrolls count as the reader's.
Two more things hold the page still that a wheel already lets go of, and
the drag lets go of the same two:
- what the last click was holding in place, which keeps what was clicked
on the screen frame by frame for a few seconds after it;
- the reader's window itself, which WebKit needs held open past the lift:
it sends the drag's last scrolls once the gesture is over, after the
pointerup, so closing the window on the lift put those back.
A scroll nothing asked for — code setting scrollTop — is still put back:
only the bar's own drag counts as the reader's, not every scroll.
view-scrollbar-drag.test.cjs is new. It drags a page's own scrollbar in
both engines in English and Chinese, straight away and after a click in
the page that holds what was clicked; it checks the page follows the bar
and stays where it was left, that the wheel still scrolls, that a scroll
code set is still put back, and that a scroll arriving after the lift is
still the reader's. It uses the pages' own scrollbar CSS rather than one
of its own: a scrollbar-width set on the view makes Chromium drop every
::-webkit-scrollbar rule (app.css) and draw Windows' classic bar. The
Routing page is dragged at a narrow window, where it has room to scroll:
at a wide one it lays its stage beside the list and has ~35px left, not
enough to tell a drag from a nudge. The scroll arriving after the lift is
checked on the list page only. It was left off Routing while #1249 was
open — WebKit clamped Routing's last stretch there, so a scroll sent
after the lift measured that bug rather than the window held open past
it. #1249 is fixed in main now, so the check could be widened to Routing;
it is not, because that clamp was only ever checked on Windows headless
WebKit here and not on the macOS WKWebView, and widening a check is
beyond what review asked for.
Three of the checks were reworked after they were run four test files at
a time and each was found to pass for the wrong reason, or to race:
- the click in the page lands on a part that leaves the page as it is.
The Routing page's own header opens the group editor in English,
growing the page and scrolling it on its own, so where the drag left
the page passed without the drag having moved it. The page is measured
again where it is now and the drag is judged by how far it moves it.
- the scroll arriving after the lift is written from the pointerup
itself, installed in the page before the lift. A round trip between the
lift and that scroll measured 6-180ms alone and 314ms four files at a
time — past the 250ms window the app holds open for it.
- the wheel's scroll is waited for to come to rest, not for a fixed
time, which under load was not always long enough.
The scroll code sets a value the page is not already at, and runs before
any click: a click holds what was clicked on the screen for a few
seconds, and that hold moves the page on its own, which would answer for
the app.
It fails on main (the drag leaves the page at 0) and passes with this.
Verified at this head, rebased onto main
|