
PDFiumPage::GetTextRunInfo() already has good heuristics to calculate the set of characters that form a text run. Use it in PDFiumRange::GetScreenRects() to create a rectangle for every text run. Then add more heuristics to merge the rectangles when they have sufficient overlap in the horizontal direction. As a result, the text selection, which is based on GetScreenRects() calculations, will appear more continuous and less jagged. Update test expectations to match the new code's behavior. Keep the original FPDFText_CountRects()-based implementation around, behind an emergency kill switch, in case the new code has serious problems. Bug: 40448046 Change-Id: I17b9dd744671c6721faaf9060622cff788371f1f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237116 Reviewed-by: Andy Phan <andyphan@chromium.org> Reviewed-by: Alan Screen <awscreen@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1417508}
//pdf
contains the PDF plugin, its Blink-based replacement, as well as PDF
utility functions that leverage PDFium. It can use low-level components that
live below the content layer, as well as other foundational code like
//printing
. It should not use //content
or anything in //components
that
lives above the content layer. Code that lives above the content layer should
live in //components/pdf
, or in the embedder. All the code here should run in
sandboxed child processes.
TODO(crbug.com/40186598): Remove existing //content
dependencies.