Revert "Add annotation structs for PDF accessibility"
This reverts commit 4389c2c30c
.
Reason for revert: Strong candidate for breaking deterministic build of libppapi_cpp_lib.so.
Bug:1025146
Original change's description:
> Add annotation structs for PDF accessibility
>
> This change adds new *AccessibilityAnnotInfo structs to transfer
> accessibility related PDF annotation data from the plugin process up to
> the mimehandler process via the pepper API. This annotation information
> is bundled along with links and images into the
> *AccessibilityPageObjects group of structs introduced as a part of
> http://crrev.com/c/1831957. It will be populated from within pdfium_page
> in a subsequent change.
>
> Bug: 1008775
> Change-Id: I89eabc8f56c135eac95c2c887d33854fbccbbcb7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837558
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Kevin Babbitt <kbabbitt@microsoft.com>
> Reviewed-by: Bill Budge <bbudge@chromium.org>
> Reviewed-by: Ian Prest <iapres@microsoft.com>
> Commit-Queue: Kalpak Tapas <katapas@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#716555}
TBR=dcheng@chromium.org,bbudge@chromium.org,thestig@chromium.org,manojb@microsoft.com,mohitb@microsoft.com,iapres@microsoft.com,virens@microsoft.com,ankk@microsoft.com,katapas@microsoft.com
Change-Id: If77022401de34d4f927a5cf07eca06ffd2c0d939
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1008775
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1925331
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716751}
This commit is contained in:

committed by
Commit Bot

parent
a3477d5f23
commit
3692b43aae
pdf
ppapi
c
private
cpp
proxy
shared_impl
@ -191,7 +191,6 @@ bool GetAccessibilityInfo(
|
|||||||
&page_objects->links);
|
&page_objects->links);
|
||||||
GetAccessibilityImageInfo(engine, page_index, page_info->text_run_count,
|
GetAccessibilityImageInfo(engine, page_index, page_info->text_run_count,
|
||||||
&page_objects->images);
|
&page_objects->images);
|
||||||
// TODO(crbug.com/1008775): Populate highlights
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,29 +149,7 @@ struct PP_PrivateAccessibilityImageInfo {
|
|||||||
struct PP_FloatRect bounds;
|
struct PP_FloatRect bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This holds text highlight information provided by the PDF and will be
|
// Holds links and images within a PDF page so that IPC messages
|
||||||
// used in accessibility to expose it. Text highlights can have an associated
|
|
||||||
// popup note, the data of which is also captured here.
|
|
||||||
// Needs to stay in sync with C++ versions (PdfAccessibilityHighlightInfo and
|
|
||||||
// PrivateAccessibilityHighlightInfo).
|
|
||||||
struct PP_PrivateAccessibilityHighlightInfo {
|
|
||||||
// Represents the text of the associated popup note, if present.
|
|
||||||
const char* note_text;
|
|
||||||
uint32_t note_text_length;
|
|
||||||
// Index of the highlight in the page annotation list. Used to identify the
|
|
||||||
// annotation on which action needs to be performed.
|
|
||||||
uint32_t index_in_page;
|
|
||||||
// Highlights are annotations over existing page text. |text_run_index|
|
|
||||||
// denotes the index of the text run where the highlight starts and
|
|
||||||
// |text_run_count| denotes the number of text runs which the highlight spans
|
|
||||||
// across.
|
|
||||||
uint32_t text_run_index;
|
|
||||||
uint32_t text_run_count;
|
|
||||||
// Bounding box of the highlight.
|
|
||||||
struct PP_FloatRect bounds;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Holds links, images and highlights within a PDF page so that IPC messages
|
|
||||||
// passing accessibility objects do not have too many parameters.
|
// passing accessibility objects do not have too many parameters.
|
||||||
// Needs to stay in sync with C++ versions (PdfAccessibilityPageObjects and
|
// Needs to stay in sync with C++ versions (PdfAccessibilityPageObjects and
|
||||||
// PrivateAccessibilityPageObjects).
|
// PrivateAccessibilityPageObjects).
|
||||||
@ -180,8 +158,6 @@ struct PP_PrivateAccessibilityPageObjects {
|
|||||||
uint32_t link_count;
|
uint32_t link_count;
|
||||||
struct PP_PrivateAccessibilityImageInfo* images;
|
struct PP_PrivateAccessibilityImageInfo* images;
|
||||||
uint32_t image_count;
|
uint32_t image_count;
|
||||||
struct PP_PrivateAccessibilityHighlightInfo* highlights;
|
|
||||||
uint32_t highlight_count;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PPB_PDF {
|
struct PPB_PDF {
|
||||||
|
@ -61,17 +61,6 @@ void ConvertPrivateAccessibilityImageInfo(
|
|||||||
info->bounds = image.bounds;
|
info->bounds = image.bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertPrivateAccessibilityHighlightInfo(
|
|
||||||
const PDF::PrivateAccessibilityHighlightInfo& highlight,
|
|
||||||
PP_PrivateAccessibilityHighlightInfo* info) {
|
|
||||||
info->note_text = highlight.note_text.c_str();
|
|
||||||
info->note_text_length = highlight.note_text.size();
|
|
||||||
info->index_in_page = highlight.index_in_page;
|
|
||||||
info->text_run_index = highlight.text_run_index;
|
|
||||||
info->text_run_count = highlight.text_run_count;
|
|
||||||
info->bounds = highlight.bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -273,22 +262,11 @@ void PDF::SetAccessibilityPageInfo(
|
|||||||
for (size_t i = 0; i < images.size(); ++i)
|
for (size_t i = 0; i < images.size(); ++i)
|
||||||
ConvertPrivateAccessibilityImageInfo(images[i], &image_info[i]);
|
ConvertPrivateAccessibilityImageInfo(images[i], &image_info[i]);
|
||||||
|
|
||||||
const std::vector<PrivateAccessibilityHighlightInfo>& highlights =
|
|
||||||
page_objects.highlights;
|
|
||||||
std::vector<PP_PrivateAccessibilityHighlightInfo> highlight_info(
|
|
||||||
highlights.size());
|
|
||||||
for (size_t i = 0; i < highlights.size(); ++i) {
|
|
||||||
ConvertPrivateAccessibilityHighlightInfo(highlights[i],
|
|
||||||
&highlight_info[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
PP_PrivateAccessibilityPageObjects pp_page_objects;
|
PP_PrivateAccessibilityPageObjects pp_page_objects;
|
||||||
pp_page_objects.links = link_info.data();
|
pp_page_objects.links = link_info.data();
|
||||||
pp_page_objects.link_count = link_info.size();
|
pp_page_objects.link_count = link_info.size();
|
||||||
pp_page_objects.images = image_info.data();
|
pp_page_objects.images = image_info.data();
|
||||||
pp_page_objects.image_count = image_info.size();
|
pp_page_objects.image_count = image_info.size();
|
||||||
pp_page_objects.highlights = highlight_info.data();
|
|
||||||
pp_page_objects.highlight_count = highlight_info.size();
|
|
||||||
|
|
||||||
get_interface<PPB_PDF>()->SetAccessibilityPageInfo(
|
get_interface<PPB_PDF>()->SetAccessibilityPageInfo(
|
||||||
instance.pp_instance(), page_info, text_run_info.data(), chars.data(),
|
instance.pp_instance(), page_info, text_run_info.data(), chars.data(),
|
||||||
|
@ -49,10 +49,7 @@ class PDF {
|
|||||||
// Needs to stay in sync with the C version.
|
// Needs to stay in sync with the C version.
|
||||||
struct PrivateAccessibilityLinkInfo {
|
struct PrivateAccessibilityLinkInfo {
|
||||||
std::string url;
|
std::string url;
|
||||||
// Index of this link in the collection of links in the page.
|
|
||||||
uint32_t index_in_page;
|
uint32_t index_in_page;
|
||||||
// Index of the starting text run of this link in the collection of all
|
|
||||||
// text runs in the page.
|
|
||||||
uint32_t text_run_index;
|
uint32_t text_run_index;
|
||||||
uint32_t text_run_count;
|
uint32_t text_run_count;
|
||||||
FloatRect bounds;
|
FloatRect bounds;
|
||||||
@ -66,25 +63,11 @@ class PDF {
|
|||||||
FloatRect bounds;
|
FloatRect bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
// C++ version of PP_PrivateAccessibilityHighlightInfo.
|
|
||||||
// Needs to stay in sync with the C version.
|
|
||||||
struct PrivateAccessibilityHighlightInfo {
|
|
||||||
std::string note_text;
|
|
||||||
// Index of this highlight in the collection of highlights in the page.
|
|
||||||
uint32_t index_in_page;
|
|
||||||
// Index of the starting text run of this highlight in the collection of all
|
|
||||||
// text runs in the page.
|
|
||||||
uint32_t text_run_index;
|
|
||||||
uint32_t text_run_count;
|
|
||||||
FloatRect bounds;
|
|
||||||
};
|
|
||||||
|
|
||||||
// C++ version of PP_PrivateAccessibilityPageObjects.
|
// C++ version of PP_PrivateAccessibilityPageObjects.
|
||||||
// Needs to stay in sync with the C version.
|
// Needs to stay in sync with the C version.
|
||||||
struct PrivateAccessibilityPageObjects {
|
struct PrivateAccessibilityPageObjects {
|
||||||
std::vector<PrivateAccessibilityLinkInfo> links;
|
std::vector<PrivateAccessibilityLinkInfo> links;
|
||||||
std::vector<PrivateAccessibilityImageInfo> images;
|
std::vector<PrivateAccessibilityImageInfo> images;
|
||||||
std::vector<PrivateAccessibilityHighlightInfo> highlights;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns true if the required interface is available.
|
// Returns true if the required interface is available.
|
||||||
|
@ -236,16 +236,10 @@ void PDFResource::SetAccessibilityPageInfo(
|
|||||||
for (size_t i = 0; i < page_objects->image_count; i++) {
|
for (size_t i = 0; i < page_objects->image_count; i++) {
|
||||||
image_vector.emplace_back(page_objects->images[i]);
|
image_vector.emplace_back(page_objects->images[i]);
|
||||||
}
|
}
|
||||||
std::vector<ppapi::PdfAccessibilityHighlightInfo> highlight_vector;
|
|
||||||
highlight_vector.reserve(page_objects->highlight_count);
|
|
||||||
for (size_t i = 0; i < page_objects->highlight_count; i++) {
|
|
||||||
highlight_vector.emplace_back(page_objects->highlights[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ppapi::PdfAccessibilityPageObjects ppapi_page_objects;
|
ppapi::PdfAccessibilityPageObjects ppapi_page_objects;
|
||||||
ppapi_page_objects.links = std::move(link_vector);
|
ppapi_page_objects.links = std::move(link_vector);
|
||||||
ppapi_page_objects.images = std::move(image_vector);
|
ppapi_page_objects.images = std::move(image_vector);
|
||||||
ppapi_page_objects.highlights = std::move(highlight_vector);
|
|
||||||
|
|
||||||
Post(RENDERER,
|
Post(RENDERER,
|
||||||
PpapiHostMsg_PDF_SetAccessibilityPageInfo(
|
PpapiHostMsg_PDF_SetAccessibilityPageInfo(
|
||||||
|
@ -315,18 +315,9 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityImageInfo)
|
|||||||
IPC_STRUCT_TRAITS_MEMBER(bounds)
|
IPC_STRUCT_TRAITS_MEMBER(bounds)
|
||||||
IPC_STRUCT_TRAITS_END()
|
IPC_STRUCT_TRAITS_END()
|
||||||
|
|
||||||
IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityHighlightInfo)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(note_text)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(index_in_page)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(text_run_index)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(text_run_count)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(bounds)
|
|
||||||
IPC_STRUCT_TRAITS_END()
|
|
||||||
|
|
||||||
IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityPageObjects)
|
IPC_STRUCT_TRAITS_BEGIN(ppapi::PdfAccessibilityPageObjects)
|
||||||
IPC_STRUCT_TRAITS_MEMBER(links)
|
IPC_STRUCT_TRAITS_MEMBER(links)
|
||||||
IPC_STRUCT_TRAITS_MEMBER(images)
|
IPC_STRUCT_TRAITS_MEMBER(images)
|
||||||
IPC_STRUCT_TRAITS_MEMBER(highlights)
|
|
||||||
IPC_STRUCT_TRAITS_END()
|
IPC_STRUCT_TRAITS_END()
|
||||||
|
|
||||||
IPC_STRUCT_TRAITS_BEGIN(PP_URLComponent_Dev)
|
IPC_STRUCT_TRAITS_BEGIN(PP_URLComponent_Dev)
|
||||||
|
@ -60,18 +60,6 @@ PdfAccessibilityImageInfo::PdfAccessibilityImageInfo(
|
|||||||
|
|
||||||
PdfAccessibilityImageInfo::~PdfAccessibilityImageInfo() = default;
|
PdfAccessibilityImageInfo::~PdfAccessibilityImageInfo() = default;
|
||||||
|
|
||||||
PdfAccessibilityHighlightInfo::PdfAccessibilityHighlightInfo() = default;
|
|
||||||
|
|
||||||
PdfAccessibilityHighlightInfo::~PdfAccessibilityHighlightInfo() = default;
|
|
||||||
|
|
||||||
PdfAccessibilityHighlightInfo::PdfAccessibilityHighlightInfo(
|
|
||||||
const PP_PrivateAccessibilityHighlightInfo& highlight)
|
|
||||||
: note_text(std::string(highlight.note_text, highlight.note_text_length)),
|
|
||||||
index_in_page(highlight.index_in_page),
|
|
||||||
text_run_index(highlight.text_run_index),
|
|
||||||
text_run_count(highlight.text_run_count),
|
|
||||||
bounds(highlight.bounds) {}
|
|
||||||
|
|
||||||
PdfAccessibilityPageObjects::PdfAccessibilityPageObjects() = default;
|
PdfAccessibilityPageObjects::PdfAccessibilityPageObjects() = default;
|
||||||
|
|
||||||
PdfAccessibilityPageObjects::PdfAccessibilityPageObjects(
|
PdfAccessibilityPageObjects::PdfAccessibilityPageObjects(
|
||||||
@ -85,11 +73,6 @@ PdfAccessibilityPageObjects::PdfAccessibilityPageObjects(
|
|||||||
for (size_t i = 0; i < page_objects.image_count; i++) {
|
for (size_t i = 0; i < page_objects.image_count; i++) {
|
||||||
images.emplace_back(page_objects.images[i]);
|
images.emplace_back(page_objects.images[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
highlights.reserve(page_objects.highlight_count);
|
|
||||||
for (size_t i = 0; i < page_objects.highlight_count; i++) {
|
|
||||||
highlights.emplace_back(page_objects.highlights[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PdfAccessibilityPageObjects::~PdfAccessibilityPageObjects() = default;
|
PdfAccessibilityPageObjects::~PdfAccessibilityPageObjects() = default;
|
||||||
|
@ -75,20 +75,6 @@ struct PPAPI_SHARED_EXPORT PdfAccessibilityImageInfo {
|
|||||||
PP_FloatRect bounds;
|
PP_FloatRect bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Needs to stay in sync with PP_PrivateAccessibilityHighlightInfo.
|
|
||||||
struct PPAPI_SHARED_EXPORT PdfAccessibilityHighlightInfo {
|
|
||||||
PdfAccessibilityHighlightInfo();
|
|
||||||
explicit PdfAccessibilityHighlightInfo(
|
|
||||||
const PP_PrivateAccessibilityHighlightInfo& highlight);
|
|
||||||
~PdfAccessibilityHighlightInfo();
|
|
||||||
|
|
||||||
std::string note_text;
|
|
||||||
uint32_t index_in_page;
|
|
||||||
uint32_t text_run_index;
|
|
||||||
uint32_t text_run_count;
|
|
||||||
PP_FloatRect bounds;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Needs to stay in sync with PP_PrivateAccessibilityPageObjects.
|
// Needs to stay in sync with PP_PrivateAccessibilityPageObjects.
|
||||||
struct PPAPI_SHARED_EXPORT PdfAccessibilityPageObjects {
|
struct PPAPI_SHARED_EXPORT PdfAccessibilityPageObjects {
|
||||||
PdfAccessibilityPageObjects();
|
PdfAccessibilityPageObjects();
|
||||||
@ -98,7 +84,6 @@ struct PPAPI_SHARED_EXPORT PdfAccessibilityPageObjects {
|
|||||||
|
|
||||||
std::vector<PdfAccessibilityLinkInfo> links;
|
std::vector<PdfAccessibilityLinkInfo> links;
|
||||||
std::vector<PdfAccessibilityImageInfo> images;
|
std::vector<PdfAccessibilityImageInfo> images;
|
||||||
std::vector<PdfAccessibilityHighlightInfo> highlights;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ppapi
|
} // namespace ppapi
|
||||||
|
Reference in New Issue
Block a user