Expose marked content IDs for images and alt text.
- Adds two new public bits of API:
- StructElement_GetMCID(STRUCTELEMENT) to return the marked content
ID of the struct element.
- IMAGEOBJ_METADATA.mcid to contain the marked content ID of the
image.
- Restores ContentMark::GetMCID, which was removed with other dead
code in https://pdfium-review.googlesource.com/c/pdfium/+/19170.
- Adds a couple calls to tests, including a simple new PDF to test
the struct tree marked content ID.
Bug:pdfium:957
Change-Id: I92856e43d741df989e53a575a08258da19a39f22
Reviewed-on: https://pdfium-review.googlesource.com/20632
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 4842e35..0d7ba56 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -267,6 +267,8 @@
if (!pImg)
return false;
+ metadata->marked_content_id = pObj->m_ContentMark.GetMarkedContentID();
+
const int nPixelWidth = pImg->GetPixelWidth();
const int nPixelHeight = pImg->GetPixelHeight();
metadata->width = nPixelWidth;