Found a few ways in which the Braille problem with browsers could resurface. Fixed now.
This commit is contained in:
1 parent
0a3d946ffa
commit
a47253d697
13 files changed
+292
-23
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package atspi
|
||||
|
||||
import "unicode/utf8"
|
||||
import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// DocumentCaretUnit selects the AT-SPI text granularity for virtual browsing.
|
||||
type DocumentCaretUnit uint8
|
||||
@@ -39,6 +42,28 @@ type DocumentCaretText struct {
|
||||
Bounds Rectangle
|
||||
}
|
||||
|
||||
func (line *DocumentCaretText) applyExpandedText(expanded, name string, incomplete bool) {
|
||||
line.RawText = line.Text
|
||||
// An accessible name describes the whole object. It can recover a failed
|
||||
// descendant read only when this range covers that entire object; using it
|
||||
// on a wrapped line would repeat unrelated text and move the reading point.
|
||||
if incomplete && line.CharacterCount > 0 && line.Start == 0 && line.End == line.CharacterCount &&
|
||||
strings.TrimSpace(name) != "" && !strings.ContainsRune(name, '\ufffc') {
|
||||
expanded = name
|
||||
}
|
||||
line.Text, line.Expanded = expanded, expanded != line.RawText
|
||||
}
|
||||
|
||||
func (snapshot *Snapshot) applyDocumentCaretLine(line DocumentCaretText, offset int) {
|
||||
// A caret capture already expanded this exact native line. Preserve that
|
||||
// text instead of replacing it with the raw line used for offset repair.
|
||||
if snapshot.BrailleLine != line.RawText || snapshot.BrailleLineStart != line.Start || snapshot.CharacterCount != line.CharacterCount {
|
||||
snapshot.Text = sanitizeSnapshotField(line.Text)
|
||||
}
|
||||
snapshot.BrailleLine, snapshot.BrailleLineStart, snapshot.BrailleCaret = line.RawText, line.Start, offset
|
||||
snapshot.CharacterCount = line.CharacterCount
|
||||
}
|
||||
|
||||
func documentCaretCharacter(value string) string {
|
||||
if value == "" {
|
||||
return ""
|
||||
|
||||
Reference in new issue
Block a user