Announce text attributes in VoiceOver.

It is essential for users of VoiceOver on the Mac platform to have
access to stylistic information for all the text on a web page. This
change exposes font size, foreground color, background color, bold,
italic, underline, and strikethrough text attributes to AT users. "When
 text attributes change:" needs to be set to "Speak Attributes" in
VoiceOver Utility to observe this change.

A later change will expose the remaining text attributes.

bold, italic, underline and strikethrough in VoiceOver.

Bug: 958811
Change-Id: I4f291fdd27466a71d2e65dff8add64475bd820f8
AX-Relnotes: Announce font size, foreground color, background color,
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4313423
Reviewed-by: David Tseng <[email protected]>
Commit-Queue: Sara Tang <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1119570}
diff --git a/ui/accessibility/ax_text_attributes.cc b/ui/accessibility/ax_text_attributes.cc
index ce95eeca..545a978 100644
--- a/ui/accessibility/ax_text_attributes.cc
+++ b/ui/accessibility/ax_text_attributes.cc
@@ -75,4 +75,11 @@
          marker_types.size() == 0 && highlight_types.size() == 0;
 }
 
+bool AXTextAttributes::HasTextStyle(
+    ax::mojom::TextStyle text_style_enum) const {
+  return text_style != kUnsetValue &&
+         (static_cast<uint32_t>(text_style) &
+          (1U << static_cast<uint32_t>(text_style_enum))) != 0;
+}
+
 }  // namespace ui