Repository navigation
Conversation
… macOS does apply took a scroll view's new content size and frame but left its offset where it was, past the new end, where macOS pulls it back to the end once the scroll is at rest and reports where it went. Once the rest of the batch is applied, the ItemScrollBy keeping the visible content in place included, apply now pulls each resized scroll view that does not zoom back to its end and posts the scroll report. Fixes nsgo-dev#1020
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1020.
applytook a scroll view's new content size (ItemScrollContent) and frame (ItemFrame), but it left the offset where it was, past the new end, and the app heard no scroll report. macOS pulls the offset back to the end once the scroll is at rest and reports where it went (internal/platform/macos/scroll.go:591-592,:799-809).nsgotestnow does the same once the rest of the batch is applied, including theItemScrollBythat keeps the visible content in place: it pulls each resized scroll view that does not zoom back to its end and posts theEventScroll. A test of an app that reacts to that report now sees the offset the app ends up with on a Mac.nsgotest/model.go:applyremembers the scroll views whose content or frame changed, and after the batch pulls an offset past the end back to it.nsgotest/mount_test.go:TestScrollPastItsEndComesBackToItshrinks the content under a scroll at its end, then grows the viewport past it. It fails on main withcontent shrank: offset 400, the app heard 400, want the new end 200andviewport grew: offset 400, the app heard 400, want the new end 150.CHANGELOG.md: anUnreleasedline.I only checked the macOS backend. The iOS driver only sets the
UIScrollView'scontentSize(internal/platform/ios/behavior.go:310-317), and UIKit leavescontentOffsetwhere it is. If headless should follow the target OS here, I can limit the pull-back to the desktop environments.Targets
core,base,ui,tsx, thensgotool)Screenshots
None.
Verification
go tool nsgo test -run '^TestScrollPastItsEndComesBackToIt$' ./nsgotestfails on main at4b3a9f7cand passes with this change, three runs out of three.go tool nsgo checkon Linux x86_64 (the host): passes.go tool nsgo teston Linux x86_64 under Xvfb (GDK_BACKEND=x11,GSK_RENDERER=cairo, a private D-Bus session and a temporary HOME): 3,075 passed, 8 failed, 59 skipped. Main at4b3a9f7cin the same environment: 3,074 passed, with the same 8 failing.TestAccessibilitySelectedAndExpandedReachATSPI: no AT-SPI registry.TestVideoShowsWhatIsBehindItsTransparentPixels: no GStreamer plug-in for the alpha video.TestInstance*: the run's longTMPDIRpushed their socket paths past the address limit. All six pass three times out of three with a short one.-targettests, as the change is in the headless model only.Checklist
fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.CHANGELOG.md'sUnreleasedhas a line for a capability users can see.