Commit 7db8cdaf authored by Mansi Awasthi's avatar Mansi Awasthi Committed by Commit Bot

Making Paragraph node a line breaking object in PDF

UI Automation APIs ExpandToEnclosingUnit() and Move() for TextUnit
Paragraph is giving wrong output for PDF. It is not able to
correctly identify paragraph boundary because kIsLineBreakingObject
attribute is not set for Paragraph nodes in PDF. The fix is to set
kIsLineBreakingObject as true for Paragraph nodes.

Bug: 1025170
Change-Id: Ife69fc0646f1709d21c7a9fcc392524912a1988d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1921929Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Mansi Awasthi <maawas@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#716898}
parent 5049b803
...@@ -689,6 +689,8 @@ ui::AXNodeData* PdfAccessibilityTree::CreateParagraphNode( ...@@ -689,6 +689,8 @@ ui::AXNodeData* PdfAccessibilityTree::CreateParagraphNode(
double font_size, double font_size,
double heading_font_size_threshold) { double heading_font_size_threshold) {
ui::AXNodeData* para_node = CreateNode(ax::mojom::Role::kParagraph); ui::AXNodeData* para_node = CreateNode(ax::mojom::Role::kParagraph);
para_node->AddBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject,
true);
// If font size exceeds the |heading_font_size_threshold|, then classify // If font size exceeds the |heading_font_size_threshold|, then classify
// it as a Heading. // it as a Heading.
......
...@@ -288,6 +288,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) { ...@@ -288,6 +288,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) {
ui::AXNode* paragraph_node = page_node->children()[0]; ui::AXNode* paragraph_node = page_node->children()[0];
ASSERT_TRUE(paragraph_node); ASSERT_TRUE(paragraph_node);
EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role); EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role);
EXPECT_TRUE(paragraph_node->GetBoolAttribute(
ax::mojom::BoolAttribute::kIsLineBreakingObject));
ASSERT_EQ(1u, paragraph_node->children().size()); ASSERT_EQ(1u, paragraph_node->children().size());
ui::AXNode* link_node = paragraph_node->children()[0]; ui::AXNode* link_node = paragraph_node->children()[0];
...@@ -302,6 +304,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) { ...@@ -302,6 +304,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) {
paragraph_node = page_node->children()[1]; paragraph_node = page_node->children()[1];
ASSERT_TRUE(paragraph_node); ASSERT_TRUE(paragraph_node);
EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role); EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role);
EXPECT_TRUE(paragraph_node->GetBoolAttribute(
ax::mojom::BoolAttribute::kIsLineBreakingObject));
ASSERT_EQ(3u, paragraph_node->children().size()); ASSERT_EQ(3u, paragraph_node->children().size());
ui::AXNode* static_text_node = paragraph_node->children()[0]; ui::AXNode* static_text_node = paragraph_node->children()[0];
...@@ -386,6 +390,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPreviousNextOnLine) { ...@@ -386,6 +390,8 @@ TEST_F(PdfAccessibilityTreeTest, TestPreviousNextOnLine) {
ui::AXNode* paragraph_node = page_node->children()[0]; ui::AXNode* paragraph_node = page_node->children()[0];
ASSERT_TRUE(paragraph_node); ASSERT_TRUE(paragraph_node);
EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role); EXPECT_EQ(ax::mojom::Role::kParagraph, paragraph_node->data().role);
EXPECT_TRUE(paragraph_node->GetBoolAttribute(
ax::mojom::BoolAttribute::kIsLineBreakingObject));
ASSERT_EQ(2u, paragraph_node->children().size()); ASSERT_EQ(2u, paragraph_node->children().size());
ui::AXNode* static_text_node = paragraph_node->children()[0]; ui::AXNode* static_text_node = paragraph_node->children()[0];
......
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