Web fixes.

This commit is contained in:
ak47 committed 2026-11-04 21:22:51 -05:00
1 parent 914d174925
commit 453206b85b
11 files changed
+643 -25

No files matched your search

+31 -4
View File
@@ -330,7 +330,7 @@ func (worker *Worker) jumpDocumentFragment(ctx context.Context, cursor *Document
func (worker *Worker) placeDocumentWithRetry(ctx context.Context, cursor *DocumentCursor, result Result) Result {
place := func(result Result) Result {
if result.DocumentCaretCommand != 0 {
return worker.placeDocumentCaret(ctx, result)
return worker.placeDocumentCaret(ctx, cursor, result)
}
return worker.placeDocument(ctx, cursor, result)
}
@@ -489,7 +489,7 @@ func (worker *Worker) moveDocumentCaret(ctx context.Context, cursor *DocumentCur
return worker.placeDocumentWithRetry(ctx, cursor, result), cursor
}
func (worker *Worker) placeDocumentCaret(ctx context.Context, result Result) Result {
func (worker *Worker) placeDocumentCaret(ctx context.Context, cursor *DocumentCursor, result Result) Result {
if result.Err != nil || !result.Moved ||
!worker.CurrentDocumentResult(result) || worker.focus() != result.DocumentFocus {
return result
@@ -512,6 +512,12 @@ func (worker *Worker) placeDocumentCaret(ctx context.Context, result Result) Res
nativeOffset = 0
}
result.CaretErr = navigator.SetDocumentCaretPosition(deadline, result.DocumentPosition.Object, result.DocumentFocus, nativeOffset)
if result.CaretErr == nil && worker.CurrentDocumentResult(result) {
switch result.DocumentCaretCommand {
case CaretNextLine, CaretPreviousLine, CaretNextWord, CaretPreviousWord, CaretDocumentStart, CaretDocumentEnd:
result = worker.refreshDocumentSoundGeometry(deadline, cursor, result)
}
}
return result
}
@@ -755,17 +761,29 @@ func (worker *Worker) refreshDocumentSoundGeometry(ctx context.Context, cursor *
// Geometry belongs to this presentation, not the document's initial viewport.
// Failed refreshes must not reuse an old position after scrolling or resizing.
result.DocumentPosition.Snapshot.SoundGeometry = atspi.SoundGeometry{}
link := atspi.ObjectReference{}
result.DocumentCaretContext = append([]atspi.Snapshot(nil), result.DocumentCaretContext...)
var linkID atspi.ObjectID
for index := range result.DocumentCaretContext {
ancestor := &result.DocumentCaretContext[index]
ancestor.SoundGeometry = atspi.SoundGeometry{}
if !linkID.Valid() && ancestor.Role == "link" && ancestor.ID() != result.DocumentPosition.Object.ID() {
linkID = ancestor.ID()
}
}
if previous := result.DocumentPosition.LinkedHeading; previous != nil {
copy := *previous
copy.SoundGeometry = atspi.SoundGeometry{}
result.DocumentPosition.LinkedHeading = &copy
linkID = copy.ID()
}
link := atspi.ObjectReference{}
if linkID.Valid() {
if cursor == nil {
result.DocumentSoundErr = atspi.ErrStaleObject
return result
}
var err error
link, err = cursor.tree.Reference(copy.ID())
link, err = cursor.tree.Reference(linkID)
if err != nil {
result.DocumentSoundErr = err
return result
@@ -778,6 +796,15 @@ func (worker *Worker) refreshDocumentSoundGeometry(ctx context.Context, cursor *
if result.DocumentPosition.LinkedHeading != nil {
result.DocumentPosition.LinkedHeading.SoundGeometry = geometry[1]
}
for index := range result.DocumentCaretContext {
ancestor := &result.DocumentCaretContext[index]
switch ancestor.ID() {
case result.DocumentPosition.Object.ID():
ancestor.SoundGeometry = geometry[0]
case linkID:
ancestor.SoundGeometry = geometry[1]
}
}
}
return result
}