Make web document navigation survive live-updating pages

Recreated-node caret recovery, tolerant caret validation, per-root retained document trees and cursors across tab switches, document warm-up, coalesced structural moves, and hung-provider fast-fail with an 'Application is not responding' announcement.
This commit is contained in:
hjozwiak committed 2026-11-03 10:34:55 -05:00
1 parent 8ce5e5cdad
commit 7eef6e8be6
30 files changed
+1484 -174

No files matched your search

+4 -4
View File
@@ -101,7 +101,7 @@ func (cursor *DocumentCursor) MoveCaret(ctx context.Context, reader DocumentCare
if !found || doc.Nodes[current].Reference != place.object {
return DocumentCaretMove{}, atspi.ErrStaleObject
}
if err := cursor.tree.ValidateDocumentRange(ctx, doc, current, current); err != nil {
if err := cursor.tree.ValidateDocumentCaretRange(ctx, doc, current, current); err != nil {
return DocumentCaretMove{}, err
}
if command >= TableLeft {
@@ -120,7 +120,7 @@ func (cursor *DocumentCursor) MoveCaret(ctx context.Context, reader DocumentCare
}
indices := cursor.caretRanges
if len(indices) == 0 {
if err := cursor.tree.ValidateDocumentRange(ctx, doc, 0, len(doc.Nodes)-1); err != nil {
if err := cursor.tree.ValidateDocumentCaretRange(ctx, doc, 0, len(doc.Nodes)-1); err != nil {
return DocumentCaretMove{}, err
}
return DocumentCaretMove{Position: documentPosition(doc, *place)}, nil
@@ -149,7 +149,7 @@ func (cursor *DocumentCursor) MoveCaret(ctx context.Context, reader DocumentCare
// during recovery would skip the line. Synthetic whole-object stops
// still need validation because they bypass the native text reader.
if !navigationReader.did_read(place.object) {
if err := cursor.tree.ValidateDocumentRange(ctx, doc, current, target); err != nil {
if err := cursor.tree.ValidateDocumentCaretRange(ctx, doc, current, target); err != nil {
return DocumentCaretMove{}, err
}
}
@@ -162,7 +162,7 @@ func (cursor *DocumentCursor) MoveCaret(ctx context.Context, reader DocumentCare
if command == CaretPreviousCharacter || command == CaretPreviousWord || command == CaretPreviousLine || command == CaretDocumentStart {
boundary = 0
}
if err := cursor.tree.ValidateDocumentRange(ctx, doc, current, boundary); err != nil {
if err := cursor.tree.ValidateDocumentCaretRange(ctx, doc, current, boundary); err != nil {
return DocumentCaretMove{}, err
}
}