Commit 264c3081 authored by Ankit Kumar 🌪️'s avatar Ankit Kumar 🌪️ Committed by Commit Bot

PDF Accessibility: Fix invoke on link

In CL:1730426 support for click action handling was added. In the struct
PP_PdfAccessibilityActionData two more members were added but the
members were not added in IPC_STRUCT in ppapi_messages.h file. Due to
this, the values were not being sent from the mimehandler process to the
plugin process. The default values for the members were being utilized
by the plugin process instead of the values in the mimehandler process.
Invoke on any link would always navigate to the first link of the page.
This CL adds the members in the IPC_STRUCT.

A test has been modified to invoke the second link instead of the first.

Bug: 981448, 1006729
Change-Id: I7b40753887916cd08a338c9d4c3c63f3dd432480
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826743
Commit-Queue: Ankit Kumar 🌪️ <ankk@microsoft.com>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarIan Prest <iapres@microsoft.com>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701529}
parent 317b7906
......@@ -705,6 +705,16 @@ TEST_F(PdfAccessibilityTreeTest, TestClickActionDataConversion) {
links_.push_back(std::move(link));
}
{
ppapi::PdfAccessibilityLinkInfo link;
link.url = kChromiumTestUrl;
link.text_run_index = 1;
link.text_run_count = 1;
link.bounds = {{10, 10}, {10, 10}};
link.index_in_page = 1;
links_.push_back(std::move(link));
}
page_info_.text_run_count = text_runs_.size();
page_info_.char_count = chars_.size();
page_info_.link_count = links_.size();
......@@ -728,7 +738,7 @@ TEST_F(PdfAccessibilityTreeTest, TestClickActionDataConversion) {
ASSERT_EQ(1u, page_nodes.size());
const std::vector<ui::AXNode*>& para_nodes = page_nodes[0]->children();
ASSERT_EQ(2u, para_nodes.size());
const std::vector<ui::AXNode*>& link_nodes = para_nodes[0]->children();
const std::vector<ui::AXNode*>& link_nodes = para_nodes[1]->children();
ASSERT_EQ(1u, link_nodes.size());
const ui::AXNode* link_node = link_nodes[0];
......@@ -746,7 +756,7 @@ TEST_F(PdfAccessibilityTreeTest, TestClickActionDataConversion) {
EXPECT_EQ(PP_PdfAccessibilityScrollAlignment::PP_PDF_SCROLL_NONE,
pdf_action_data.vertical_scroll_alignment);
EXPECT_EQ(0u, pdf_action_data.page_index);
EXPECT_EQ(0u, pdf_action_data.link_index);
EXPECT_EQ(1u, pdf_action_data.link_index);
CompareRect({{0, 0}, {0, 0}}, pdf_action_data.target_rect);
}
......
......@@ -57,8 +57,8 @@ bool PdfAXActionTarget::Click() const {
if ((target_plugin_node_.data().role != ax::mojom::Role::kLink) ||
!pdf_accessibility_tree_source_->GetPdfLinkInfoFromAXNode(
target_plugin_node_.data().id, &pdf_action_data.link_index,
&pdf_action_data.page_index)) {
target_plugin_node_.data().id, &pdf_action_data.page_index,
&pdf_action_data.link_index)) {
return false;
}
......
......@@ -235,6 +235,8 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(PP_PdfAccessibilityActionData)
IPC_STRUCT_TRAITS_MEMBER(action)
IPC_STRUCT_TRAITS_MEMBER(target_rect)
IPC_STRUCT_TRAITS_MEMBER(link_index)
IPC_STRUCT_TRAITS_MEMBER(page_index)
IPC_STRUCT_TRAITS_MEMBER(horizontal_scroll_alignment)
IPC_STRUCT_TRAITS_MEMBER(vertical_scroll_alignment)
IPC_STRUCT_TRAITS_END()
......
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