Commit a079161e authored by Virender Singh's avatar Virender Singh Committed by Commit Bot

Add PPAPI constructs for sending focus object to PdfAccessibilityTree

This change introduces the PPAPI structures required to send the focus
information from plugin to PdfAccessibilityTree.

Bug: 1015350
Change-Id: I5bfd78b6d34e2ebcf78d9051207fcbc830694678
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2230586Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: Ankit Kumar 🌪️ <ankk@microsoft.com>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Virender Singh <virens@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#793502}
parent 62819c25
......@@ -813,6 +813,8 @@ void OutOfProcessInstance::SendAccessibilityViewportInfo() {
viewport_info.zoom = zoom_;
viewport_info.scale = device_scale_;
viewport_info.focus_info = {
PP_PrivateFocusObjectType::PP_PRIVATEFOCUSOBJECT_NONE, 0, 0};
engine_->GetSelection(&viewport_info.selection_start_page_index,
&viewport_info.selection_start_char_index,
......
......@@ -41,6 +41,32 @@ struct PP_PrivateFindResult {
int length;
};
typedef enum {
PP_PRIVATEFOCUSOBJECT_NONE = 0,
PP_PRIVATEFOCUSOBJECT_DOCUMENT = 1,
PP_PRIVATEFOCUSOBJECT_LINK = 2,
PP_PRIVATEFOCUSOBJECT_HIGHLIGHT = 3,
PP_PRIVATEFOCUSOBJECT_TEXT_FIELD = 4,
PP_PRIVATEFOCUSOBJECT_LAST = PP_PRIVATEFOCUSOBJECT_TEXT_FIELD
} PP_PrivateFocusObjectType;
// Represents the information to uniquely identify the focused object
// in PDF.
struct PP_PrivateAccessibilityFocusInfo {
// Holds the type of the focused object in PDFiumEngine.
PP_PrivateFocusObjectType focused_object_type;
// Holds the PDF page index in the which the focused annotation is present.
// When |focused_object_type| is PP_PRIVATEFOCUSOBJECT_NONE or
// PP_PRIVATEFOCUSOBJECT_DOCUMENT then the value of this member shouldn't
// be used, set to zero as a sentinel value.
uint32_t focused_object_page_index;
// Holds the focused annotation's index in page's annotations array.
// When |focused_object_type| is PP_PRIVATEFOCUSOBJECT_NONE or
// PP_PRIVATEFOCUSOBJECT_DOCUMENT then the value of this member shouldn't
// be used, set to zero as a sentinel value.
uint32_t focused_annotation_index_in_page;
};
struct PP_PrivateAccessibilityViewportInfo {
double zoom;
double scale;
......@@ -50,6 +76,7 @@ struct PP_PrivateAccessibilityViewportInfo {
uint32_t selection_start_char_index;
uint32_t selection_end_page_index;
uint32_t selection_end_char_index;
struct PP_PrivateAccessibilityFocusInfo focus_info;
};
struct PP_PrivateAccessibilityDocInfo {
......
......@@ -163,6 +163,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(PP_PrivateChoiceFieldType, PP_PRIVATECHOICEFIELD_LAST)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(PP_PrivateButtonType,
PP_PRIVATEBUTTON_FIRST,
PP_PRIVATEBUTTON_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(PP_PrivateFocusObjectType, PP_PRIVATEFOCUSOBJECT_LAST)
IPC_STRUCT_TRAITS_BEGIN(PP_Point)
IPC_STRUCT_TRAITS_MEMBER(x)
......@@ -269,6 +270,12 @@ IPC_STRUCT_TRAITS_BEGIN(PP_PdfPrintSettings_Dev)
IPC_STRUCT_TRAITS_MEMBER(scale_factor)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(PP_PrivateAccessibilityFocusInfo)
IPC_STRUCT_TRAITS_MEMBER(focused_object_type)
IPC_STRUCT_TRAITS_MEMBER(focused_object_page_index)
IPC_STRUCT_TRAITS_MEMBER(focused_annotation_index_in_page)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(PP_PrivateAccessibilityViewportInfo)
IPC_STRUCT_TRAITS_MEMBER(zoom)
IPC_STRUCT_TRAITS_MEMBER(scale)
......@@ -278,6 +285,7 @@ IPC_STRUCT_TRAITS_BEGIN(PP_PrivateAccessibilityViewportInfo)
IPC_STRUCT_TRAITS_MEMBER(selection_start_char_index)
IPC_STRUCT_TRAITS_MEMBER(selection_end_page_index)
IPC_STRUCT_TRAITS_MEMBER(selection_end_char_index)
IPC_STRUCT_TRAITS_MEMBER(focus_info)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(PP_PrivateAccessibilityDocInfo)
......
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