Commit ea4b7409 authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Make link to PDF page that does not exist unselectable.

Uses the new FPDFDest_GetDestPageIndex call in PDFium.

Bug: pdfium:938
Change-Id: I6e35cb5c8b257bd3d07fd0d05a8260a7fb6681e1
Reviewed-on: https://chromium-review.googlesource.com/894148
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: default avatardsinclair <dsinclair@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533785}
parent 464f86cf
......@@ -360,14 +360,17 @@ PDFiumPage::Area PDFiumPage::GetDestinationTarget(FPDF_DEST destination,
if (!target)
return NONSELECTABLE_AREA;
target->page = FPDFDest_GetPageIndex(engine_->doc(), destination);
int page_index = FPDFDest_GetDestPageIndex(engine_->doc(), destination);
if (page_index < 0)
return NONSELECTABLE_AREA;
target->page = page_index;
base::Optional<std::pair<float, float>> xy = GetPageXYTarget(destination);
if (!xy)
return DOCLINK_AREA;
target->y_in_pixels = TransformPageToScreenXY(xy.value()).second;
return DOCLINK_AREA;
}
......
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