Right now we expose bold and italic font styling for iOS but not macOS which prevents VoiceOver from knowing if some web-based fonts are bold or italic.
<rdar://problem/103577386>
Created attachment 464129 [details] Patch
Comment on attachment 464129 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=464129&action=review > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:658 > + [fontAttributes setValue:@YES forKey:@"AXFontBold"]; do we not have keys for these already? does iOS not use AXAttributedStringSetFont ?
(In reply to chris fleizach from comment #3) > do we not have keys for these already? > does iOS not use AXAttributedStringSetFont ? iOS does use AXttributedStringSetFont and uses UIAccessibilityTokenBold/Italic. MacOS doesn't have an existing key so we could either add one like this patch currently does that follows macOS attribute naming style or we could just untarget the iOS code so that it compiles for macOS and iOS and expose the iOS keys as those are defined in this file for all platforms.
(In reply to Tommy McHugh from comment #4) > (In reply to chris fleizach from comment #3) > > do we not have keys for these already? > > does iOS not use AXAttributedStringSetFont ? > iOS does use AXttributedStringSetFont and uses > UIAccessibilityTokenBold/Italic. MacOS doesn't have an existing key so we > could either add one like this patch currently does that follows macOS > attribute naming style or we could just untarget the iOS code so that it > compiles for macOS and iOS and expose the iOS keys as those are defined in > this file for all platforms. On macOS, it looks like the proper way to get bold status is use the font text attributes [attributedString addAttribute:NSAccessibilityFontTextAttribute value:fontAttributes.get() range:range]; and then recreate your font to get the bold status CTFontRef fontRef = _copyFontRefForFontAttributes(fontAttributes); if (fontRef != NULL) { CTFontSymbolicTraits fontTraits = CTFontGetSymbolicTraits(fontRef); bold = (fontTraits & kCTFontBoldTrait);
new test failure +++ /Volumes/Data/worker/macOS-BigSur-Release-WK2-Tests-EWS/build/layout-test-results/accessibility/content-editable-as-textarea-actual.txt @@ -19,6 +19,7 @@ }worl{ AXBackgroundColor = " [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1)] ( 0 0 0 0 )"; AXFont = { + AXFontBold = 1; AXFontFamily = Times; AXFontName = "Times-Bold"; AXFontSize = 16;
Created attachment 464143 [details] Patch
All the tests are now passing. Chris, if you think this is ready, could you please cq+?
Committed 258212@main (9a11844523ca): <https://commits.webkit.org/258212@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 464143 [details].