Repository navigation
ax: prune background elements occluded by later opaque sibling views - #38
Open
chiroro-jr wants to merge 1 commit into
Open
chiroro-jr wants to merge 1 commit into
chiroro-jr wants to merge 1 commit into
Conversation
Owner
|
Not merged yet. This changes what every snapshot returns on a heuristic (opaque background colour, alpha, clipping), so a wrong guess hides real elements. It needs testing on more apps than we have here, and it overlaps #33's modal handling. Happy to take it after #33 lands, ideally with a switch to turn it off and the before and after element counts on a few apps. |
chiroro-jr
force-pushed
the
fix/opaque-sibling-occlusion
branch
from
November 27, 2026 14:00
a874373 to
3096bd4
Compare
Contributor
Author
|
Thanks for the review — you called it right on testing more apps! Testing open-source SwiftUI apps immediately surfaced a real false-positive occlusion case in the earlier flat-window implementation: What changed (rebased onto
|
| App / Screen | --no-occlusion (before) |
Default (after) | Notes |
|---|---|---|---|
Home Screen (SpringBoard) |
15 | 15 | SpringBoard unpruned |
Settings (com.apple.Preferences) |
13 | 13 | Zero elements lost |
SwiftChartsExamples (com.oss.swiftcharts) |
5 | 5 | Zero elements lost |
SwiftUICatalog Toggles (com.oss.swiftuicatalog) |
10 | 10 | Zero elements lost |
SwiftUIProbe detail (ZStack overlay Back button) |
3 | 3 | @e1 button "Back" (34,135) preserved & tappable |
LiquidGlassShowcase Button Styles (ZStack overlay Back button) |
13 | 13 | @e1 button "Back" (34,135) preserved & tappable (previously hidden!) |
DartNative SearchAppBar (expanded opaque search overlay) |
37 | 19 | All 18 occluded background rows pruned; all 19 visible overlay & nav controls intact |
Happy to rebase once more after #33 lands as well!
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.
Problem
When an app displays an opaque in-VC sibling overlay (for example a search suggestions overlay like DartNative's
AppBar.searchBar/DNSearchOverlayHostcovering the screen with an opaqueUIView, or an opaque view controller sliding over a previous page) without settingaccessibilityViewIsModal,hooks/ax.c:walk()walks all subviews in painter order and emits both the occluded background views and the visible overlay views.In
SearchAppBar, expanding the search overlay produced 37–40 elements: all 18 hidden background rows (including occluded buttons like"Switch to: leading + search + avatar"and duplicate copies of every mail row) leaked alongside the 16 visible overlay rows.Fix
In
hooks/ax.c, buffer each window's walked elements with their painter-order indexzand track solid opaqueUIViewcontainers painted later in the same window:UIView(depth > 0,>= 40x40pt) is recorded as an occluder before recursing into its descendants (so it can mathematically never occlude itself or its own children) when:alpha >= 0.99,layer.zPosition,layer.mask == nil, andlayer.backgroundColor/view.backgroundColorhasCGColorGetAlpha >= 0.99(looked up viadlsym(RTLD_DEFAULT, "CGColorGetAlpha"), requiring no new link flags).clipsToBounds/masksToBoundsrects and inset vertically bylayer.cornerRadius.e.z < occ.z,zPosition == 0) whose visible window-clipped rect has its center insideocc.frameand>= 80%of its visible area covered byocc.frame.SpringBoardandWebContent(dump_web_now) unpruned.(Note:
hooks/prebuilt/libagentsim-ax.dylibis intentionally not committed in this PR so maintainers can rebuild it withhooks/build.shon macOS.)Verification
hooks/ax.cforarm64-apple-ios15.0-simulatorwith-O2 -Wall -Werror(zero warnings).iPhone18,1):SearchAppBar(expanded overlay): all 18 hidden background rows (The bar region IS the search pill...,Switch to: leading + search + avatar, and all 8 duplicate background mail rows) are pruned while all 16 visible suggestions rows and navigation bar controls (Search in mail,Close,Back) remain intact (44 msdump).15elements), Settings (13SwiftUI/UIKit elements), DartNativeLiquidGlass(Glass & Fluid Merge,13translucent glass/text elements), and SafariWebContent(example.comDOM + toolbar) all snapshot cleanly with zero regressions.