Commit 8bb71e6e authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Handle links in tagged PDFs.

Most of the magic that connects PDF annotations for hyperlinks to their
corresponding struct tree node happens inside of Skia. All that's needed
in Chromium is to add the proper node type for a link.

Bug: 1100712
Change-Id: Ica08cd04bc9dcb00684af5eb299927353618d0a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278173Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786099}
parent fa76cf61
...@@ -544,6 +544,14 @@ const char kExpectedStructTreeJSON[] = R"({ ...@@ -544,6 +544,14 @@ const char kExpectedStructTreeJSON[] = R"({
"type": "NonStruct" "type": "NonStruct"
} ] } ]
} ] } ]
}, {
"type": "Div",
"~children": [ {
"type": "Link",
"~children": [ {
"type": "NonStruct"
} ]
} ]
}, { }, {
"type": "Table", "type": "Table",
"~children": [ { "~children": [ {
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<li>Item 1</li> <li>Item 1</li>
<li>Item 2</li> <li>Item 2</li>
</ul> </ul>
<div>
<a href="https://google.com/">Link to Google</a>
</div>
<table> <table>
<tr> <tr>
<th>Header 1</th> <th>Header 1</th>
......
...@@ -27,6 +27,7 @@ const char kPDFStructureTypeDocument[] = "Document"; ...@@ -27,6 +27,7 @@ const char kPDFStructureTypeDocument[] = "Document";
const char kPDFStructureTypeParagraph[] = "P"; const char kPDFStructureTypeParagraph[] = "P";
const char kPDFStructureTypeDiv[] = "Div"; const char kPDFStructureTypeDiv[] = "Div";
const char kPDFStructureTypeHeading[] = "H"; const char kPDFStructureTypeHeading[] = "H";
const char kPDFStructureTypeLink[] = "Link";
const char kPDFStructureTypeList[] = "L"; const char kPDFStructureTypeList[] = "L";
const char kPDFStructureTypeListItemLabel[] = "Lbl"; const char kPDFStructureTypeListItemLabel[] = "Lbl";
const char kPDFStructureTypeListItemBody[] = "LI"; const char kPDFStructureTypeListItemBody[] = "LI";
...@@ -109,6 +110,9 @@ bool RecursiveBuildStructureTree(const ui::AXNode* ax_node, ...@@ -109,6 +110,9 @@ bool RecursiveBuildStructureTree(const ui::AXNode* ax_node,
tag->fTypeString = GetHeadingStructureType(ax_node->GetIntAttribute( tag->fTypeString = GetHeadingStructureType(ax_node->GetIntAttribute(
ax::mojom::IntAttribute::kHierarchicalLevel)); ax::mojom::IntAttribute::kHierarchicalLevel));
break; break;
case ax::mojom::Role::kLink:
tag->fTypeString = kPDFStructureTypeLink;
break;
case ax::mojom::Role::kList: case ax::mojom::Role::kList:
tag->fTypeString = kPDFStructureTypeList; tag->fTypeString = kPDFStructureTypeList;
break; break;
......
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