Improved flat review timing by a lot.

This commit is contained in:
Storm Dragon committed 2026-10-20 18:55:32 -04:00
1 parent 58e4b8aa15
commit 08cbcc00cb
11 files changed
+496 -28

No files matched your search

+13 -2
View File
@@ -220,7 +220,16 @@ func captureNativeTree(ctx context.Context, root *C.AtspiAccessible, reviewBusNa
}
}
cachedChildren := known && !cached.childrenInvalid
// Visual review cannot use descendants of hidden controls. Inactive
// notebook pages and closed GTK combo menus can expose thousands of
// children; traversing them can exhaust the entire capture deadline.
// Keep semantic document and desktop/object capture complete.
reviewOnly := !document && reviewBusName != ""
captureChildren := !reviewOnly || !geometry.VisibilityKnown ||
(geometry.Visible && geometry.Showing) || snapshot.Role == "application" || snapshot.Role == "desktop frame"
// A visibility change can reveal children omitted by an earlier review
// capture, even when the provider emits no children-changed event.
cachedChildren := known && !cached.childrenInvalid && (!reviewOnly || !cached.geometryInvalid)
for _, id := range cached.children {
if cache.sources[id] == nil {
cachedChildren = false
@@ -229,7 +238,9 @@ func captureNativeTree(ctx context.Context, root *C.AtspiAccessible, reviewBusNa
}
var childCountError *C.GError
childCount := len(cached.children)
if !cachedChildren {
if !captureChildren {
childCount = 0
} else if !cachedChildren {
// Snapshot refresh above already cleared dirty entries. Clearing
// again discards the state and interface data just fetched.
childCount = int(C.atspi_accessible_get_child_count(source, &childCountError))