Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
AX: Expose bold and italic font styling as text attributes for macOS
https://bugs.webkit.org/show_bug.cgi?id=249688 rdar://problem/103577386 Reviewed by Chris Fleizach. Currently WebKit only exposes bold and italic properties of font styling for iOS. This patch adds bold and italic font styling information to accessibility for macOS by checking the bold and italic symbolic font traits in AXAttributedStringSetFont and adding their result as AXFontBold and AXFontItalic font attributes. * LayoutTests/accessibility/mac/attributed-string/attributed-string-text-styling-expected.txt: Added. * LayoutTests/accessibility/mac/attributed-string/attributed-string-text-styling.html: Added. * Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (AXAttributedStringSetFont): Canonical link: https://commits.webkit.org/258212@main
- Loading branch information
1 parent
bf10c63
commit 9a11844523ca34c274cd4b361f9805010fc759ae
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
This test ensures that attributed string for text marker range includes text styling information. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS textPlain.attributedStringForTextMarkerRange(textPlainRange) is textPlainAttributes | ||
PASS textBold.attributedStringForTextMarkerRange(textBoldRange) is textBoldAttributes | ||
PASS textItalic.attributedStringForTextMarkerRange(textItalicRange) is textItalicAttributes | ||
PASS textBoldItalic.attributedStringForTextMarkerRange(textBoldItalicRange) is textBoldItalicAttributes | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
The | ||
|
||
Fox | ||
|
||
Jumped | ||
|
||
Over |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../../resources/accessibility-helper.js"></script> | ||
<script src="../../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<p id="text-plain">The</p> | ||
<p id="text-bold" style="font-weight: bold">Fox</p> | ||
<p id="text-italic" style="font-style: italic">Jumped</p> | ||
<p id="text-bold-italic" style="font-style: italic; font-weight: bold;">Over</p> | ||
|
||
<script> | ||
description("This test ensures that attributed string for text marker range includes text styling information."); | ||
if (window.accessibilityController) { | ||
var textPlain = accessibilityController.accessibleElementById("text-plain"); | ||
var textPlainRange = textPlain.textMarkerRangeForElement(textPlain); | ||
var textPlainAttributes = "AXFont - {\n AXFontFamily = Times;\n AXFontName = \"Times-Roman\";\n AXFontSize = 16;\n AXVisibleName = \"Times Roman\";\n}, The"; | ||
shouldBe("textPlain.attributedStringForTextMarkerRange(textPlainRange)", "textPlainAttributes"); | ||
|
||
var textBold = accessibilityController.accessibleElementById("text-bold"); | ||
var textBoldRange = textBold.textMarkerRangeForElement(textBold); | ||
var textBoldAttributes = "AXFont - {\n AXFontBold = 1;\n AXFontFamily = Times;\n AXFontName = \"Times-Bold\";\n AXFontSize = 16;\n AXVisibleName = \"Times Bold\";\n}, Fox"; | ||
shouldBe("textBold.attributedStringForTextMarkerRange(textBoldRange)", "textBoldAttributes"); | ||
|
||
var textItalic = accessibilityController.accessibleElementById("text-italic"); | ||
var textItalicRange = textItalic.textMarkerRangeForElement(textItalic); | ||
var textItalicAttributes = "AXFont - {\n AXFontFamily = Times;\n AXFontItalic = 1;\n AXFontName = \"Times-Italic\";\n AXFontSize = 16;\n AXVisibleName = \"Times Italic\";\n}, Jumped"; | ||
shouldBe("textItalic.attributedStringForTextMarkerRange(textItalicRange)", "textItalicAttributes"); | ||
|
||
var textBoldItalic = accessibilityController.accessibleElementById("text-bold-italic"); | ||
var textBoldItalicRange = textBoldItalic.textMarkerRangeForElement(textBoldItalic); | ||
var textBoldItalicAttributes = "AXFont - {\n AXFontBold = 1;\n AXFontFamily = Times;\n AXFontItalic = 1;\n AXFontName = \"Times-BoldItalic\";\n AXFontSize = 16;\n AXVisibleName = \"Times Bold Italic\";\n}, Over"; | ||
shouldBe("textBoldItalic.attributedStringForTextMarkerRange(textBoldItalicRange)", "textBoldItalicAttributes"); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters