• Hui Yingst's avatar
    Handle null coordinates from XYZ named destination of an in-doc link. · 5c0a0585
    Hui Yingst authored
    For a XYZ fit type named destination, if the x or y coordinate is null,
    that specific coordinate of the current viewport should be retained (See
    table 151 in ISO 32000-1 for more details.). Also, one null parameter
    does not invalidate other parameters, all parameters should be handled
    independently.
    
    Currently, the PDF viewer ignores both the x and y coordinates if either
    one of them is null, and it always resets the viewport position to (0,0)
    (top-left corner) without retaining the current coordinate which receives
    a null input.
    
    This CL does the following changes to fix this issue:
    - Makes PDFiumPage::GetPageDestinationTarget() return x and y
      coordinates separately, so that each null input can be handled
      individually as an undefined value.
    - Introduces retrieveCurrentScreenCoordinates() to calculate the current
      in-screen coordinates of the viewport, so that goToPageAndXY() can use
      its return value to retain x/y coordinate while navigating to a new
      destination.
    
    Bug: 1163701,1157061
    Change-Id: I4a4e8f1e193aab8ad2d5c8f3a277d0892e3e72c6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2632325Reviewed-by: default avatardsinclair <dsinclair@chromium.org>
    Commit-Queue: Hui Yingst <nigi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#844663}
    5c0a0585
viewport.js 47.2 KB