Commit 6f0f8a2c authored by Ankit Kumar 🌪️'s avatar Ankit Kumar 🌪️ Committed by Commit Bot

Fix note accessibility structure in PDF highlights

Currently note is added to highlights as:
Highlight
++ Note

While the correct format is:
Highlight
++ Note
++++ Note text

The CL fixes the structure for addition of notes in PDF highlights for
accessibility. Tests have been updated to reflect the new structure.

CQ_INCLUDE_TRYBOTS=luci.chromium.try:mac_chromium_dbg_ng

Bug: 1008775
Change-Id: I83e1f4e09c901b4c2d5969528e1aeef7aebc6196
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315373
Commit-Queue: Ankit Kumar 🌪️ <ankk@microsoft.com>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792554}
parent 8f7971c2
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
++++++[paragraph] ++++++[paragraph]
++++++++[push button] name='Hello' ++++++++[push button] name='Hello'
++++++++++[static] name='Hello' ++++++++++[static] name='Hello'
++++++++++[comment] name='Text Note' ++++++++++[comment]
++++++++++++[static] name='Text Note'
++++++++[static] name=', nice ' ++++++++[static] name=', nice '
++++++++[push button] name='meeting' ++++++++[push button] name='meeting'
++++++++++[static] name='meeting' ++++++++++[static] name='meeting'
......
...@@ -5,7 +5,8 @@ embeddedObject ...@@ -5,7 +5,8 @@ embeddedObject
++++++++pdfActionableHighlight name='Hello' roleDescription='Highlight' restriction=readOnly ++++++++pdfActionableHighlight name='Hello' roleDescription='Highlight' restriction=readOnly
++++++++++staticText name='Hello' restriction=readOnly ++++++++++staticText name='Hello' restriction=readOnly
++++++++++++inlineTextBox name='Hello' restriction=readOnly ++++++++++++inlineTextBox name='Hello' restriction=readOnly
++++++++++note name='Text Note' roleDescription='Note' restriction=readOnly ++++++++++note roleDescription='Note' restriction=readOnly
++++++++++++staticText name='Text Note' restriction=readOnly
++++++++staticText name=', nice ' restriction=readOnly ++++++++staticText name=', nice ' restriction=readOnly
++++++++++inlineTextBox name=', nice ' restriction=readOnly ++++++++++inlineTextBox name=', nice ' restriction=readOnly
++++++++pdfActionableHighlight name='meeting' roleDescription='Highlight' restriction=readOnly ++++++++pdfActionableHighlight name='meeting' roleDescription='Highlight' restriction=readOnly
......
...@@ -4,7 +4,8 @@ AXGroup AXDescription='PDF document containing 1 page' ...@@ -4,7 +4,8 @@ AXGroup AXDescription='PDF document containing 1 page'
++++++AXGroup ++++++AXGroup
++++++++AXButton AXDescription='Hello' ++++++++AXButton AXDescription='Hello'
++++++++++AXStaticText AXValue='Hello' ++++++++++AXStaticText AXValue='Hello'
++++++++++AXGroup AXDescription='Text Note' ++++++++++AXGroup
++++++++++++AXStaticText AXValue='Text Note'
++++++++AXStaticText AXValue=', nice ' ++++++++AXStaticText AXValue=', nice '
++++++++AXButton AXDescription='meeting' ++++++++AXButton AXDescription='meeting'
++++++++++AXStaticText AXValue='meeting' ++++++++++AXStaticText AXValue='meeting'
......
...@@ -4,7 +4,8 @@ Pane ...@@ -4,7 +4,8 @@ Pane
++++++Group IsControlElement=false ++++++Group IsControlElement=false
++++++++Custom Name='Hello' ++++++++Custom Name='Hello'
++++++++++Text Name='Hello' IsControlElement=false ++++++++++Text Name='Hello' IsControlElement=false
++++++++++Group Name='Text Note' ++++++++++Group IsControlElement=false
++++++++++++Text Name='Text Note' IsControlElement=false
++++++++Text Name=', nice ' ++++++++Text Name=', nice '
++++++++Custom Name='meeting' ++++++++Custom Name='meeting'
++++++++++Text Name='meeting' IsControlElement=false ++++++++++Text Name='meeting' IsControlElement=false
......
...@@ -4,7 +4,8 @@ IA2_ROLE_SECTION UNAVAILABLE FOCUSABLE ...@@ -4,7 +4,8 @@ IA2_ROLE_SECTION UNAVAILABLE FOCUSABLE
++++++IA2_ROLE_PARAGRAPH READONLY ++++++IA2_ROLE_PARAGRAPH READONLY
++++++++ROLE_SYSTEM_PUSHBUTTON name='Hello' READONLY ++++++++ROLE_SYSTEM_PUSHBUTTON name='Hello' READONLY
++++++++++ROLE_SYSTEM_STATICTEXT name='Hello' READONLY ++++++++++ROLE_SYSTEM_STATICTEXT name='Hello' READONLY
++++++++++IA2_ROLE_NOTE name='Text Note' READONLY ++++++++++IA2_ROLE_NOTE READONLY
++++++++++++ROLE_SYSTEM_STATICTEXT name='Text Note' READONLY
++++++++ROLE_SYSTEM_STATICTEXT name=', nice ' READONLY ++++++++ROLE_SYSTEM_STATICTEXT name=', nice ' READONLY
++++++++ROLE_SYSTEM_PUSHBUTTON name='meeting' READONLY ++++++++ROLE_SYSTEM_PUSHBUTTON name='meeting' READONLY
++++++++++ROLE_SYSTEM_STATICTEXT name='meeting' READONLY ++++++++++ROLE_SYSTEM_STATICTEXT name='meeting' READONLY
......
...@@ -683,11 +683,20 @@ class PdfAccessibilityTreeBuilder { ...@@ -683,11 +683,20 @@ class PdfAccessibilityTreeBuilder {
popup_note_node->AddStringAttribute( popup_note_node->AddStringAttribute(
ax::mojom::StringAttribute::kRoleDescription, ax::mojom::StringAttribute::kRoleDescription,
l10n_util::GetStringUTF8(IDS_AX_ROLE_DESCRIPTION_PDF_POPUP_NOTE)); l10n_util::GetStringUTF8(IDS_AX_ROLE_DESCRIPTION_PDF_POPUP_NOTE));
popup_note_node->AddStringAttribute(ax::mojom::StringAttribute::kName,
highlight.note_text);
popup_note_node->relative_bounds.bounds = popup_note_node->relative_bounds.bounds =
PpFloatRectToGfxRectF(highlight.bounds); PpFloatRectToGfxRectF(highlight.bounds);
ui::AXNodeData* static_popup_note_text_node = CreateNode(
ax::mojom::Role::kStaticText, ax::mojom::Restriction::kReadOnly,
render_accessibility_, nodes_);
static_popup_note_text_node->AddStringAttribute(
ax::mojom::StringAttribute::kName, highlight.note_text);
static_popup_note_text_node->relative_bounds.bounds =
PpFloatRectToGfxRectF(highlight.bounds);
popup_note_node->child_ids.push_back(static_popup_note_text_node->id);
return popup_note_node; return popup_note_node;
} }
......
...@@ -493,6 +493,7 @@ TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) { ...@@ -493,6 +493,7 @@ TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) {
* ++++++ Highlight * ++++++ Highlight
* ++++++++ Static Text * ++++++++ Static Text
* ++++++++ Note * ++++++++ Note
* ++++++++++ Static Text
*/ */
ui::AXNode* root_node = pdf_accessibility_tree.GetRoot(); ui::AXNode* root_node = pdf_accessibility_tree.GetRoot();
...@@ -534,13 +535,21 @@ TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) { ...@@ -534,13 +535,21 @@ TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) {
ui::AXNode* popup_note_node = highlight_node->children()[1]; ui::AXNode* popup_note_node = highlight_node->children()[1];
ASSERT_TRUE(popup_note_node); ASSERT_TRUE(popup_note_node);
EXPECT_EQ(ax::mojom::Role::kNote, popup_note_node->data().role); EXPECT_EQ(ax::mojom::Role::kNote, popup_note_node->data().role);
EXPECT_EQ(kPopupNoteText, popup_note_node->GetStringAttribute(
ax::mojom::StringAttribute::kName));
EXPECT_EQ(l10n_util::GetStringUTF8(IDS_AX_ROLE_DESCRIPTION_PDF_POPUP_NOTE), EXPECT_EQ(l10n_util::GetStringUTF8(IDS_AX_ROLE_DESCRIPTION_PDF_POPUP_NOTE),
popup_note_node->GetStringAttribute( popup_note_node->GetStringAttribute(
ax::mojom::StringAttribute::kRoleDescription)); ax::mojom::StringAttribute::kRoleDescription));
EXPECT_EQ(gfx::RectF(1.0f, 1.0f, 5.0f, 6.0f), EXPECT_EQ(gfx::RectF(1.0f, 1.0f, 5.0f, 6.0f),
popup_note_node->data().relative_bounds.bounds); popup_note_node->data().relative_bounds.bounds);
ASSERT_EQ(1u, popup_note_node->children().size());
ui::AXNode* static_popup_note_text_node = popup_note_node->children()[0];
ASSERT_TRUE(static_popup_note_text_node);
EXPECT_EQ(ax::mojom::Role::kStaticText,
static_popup_note_text_node->data().role);
EXPECT_EQ(kPopupNoteText, static_popup_note_text_node->GetStringAttribute(
ax::mojom::StringAttribute::kName));
EXPECT_EQ(gfx::RectF(1.0f, 1.0f, 5.0f, 6.0f),
static_popup_note_text_node->data().relative_bounds.bounds);
} }
TEST_F(PdfAccessibilityTreeTest, TestTextFieldNodeCreation) { TEST_F(PdfAccessibilityTreeTest, TestTextFieldNodeCreation) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment