Reset master to testing content
This commit is contained in:
1 parent
0f2587b719
commit
42afa2a56c
1483 files changed
+145308
-938069
No files matched your search
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package atspi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A successful ScrollTo can precede the browser's visibility/geometry update.
|
||||
// Retry missing geometry on the calling worker, leaving the native event owner
|
||||
// free to process those updates. Unsupported geometry gets at most 50ms of
|
||||
// extra waiting; native calls remain bounded by the caller's context.
|
||||
func retryDocumentSoundGeometry(ctx context.Context, linked bool, capture func(context.Context) ([2]SoundGeometry, error)) ([2]SoundGeometry, error) {
|
||||
for attempt := 0; ; attempt++ {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return [2]SoundGeometry{}, err
|
||||
}
|
||||
geometry, err := capture(ctx)
|
||||
if err != nil {
|
||||
return [2]SoundGeometry{}, err
|
||||
}
|
||||
ready := geometry[0].ObjectKnown && geometry[0].ReferenceKnown
|
||||
if linked {
|
||||
ready = ready && geometry[1].ObjectKnown && geometry[1].ReferenceKnown
|
||||
}
|
||||
if ready || attempt == 5 {
|
||||
return geometry, nil
|
||||
}
|
||||
timer := time.NewTimer(10 * time.Millisecond)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
timer.Stop()
|
||||
return [2]SoundGeometry{}, ctx.Err()
|
||||
case <-timer.C:
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user