New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 765374 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 2
Type: Bug



Sign in to add a comment

PDF hyperlinks that should be occluded are clickable

Reported by br...@amazon.com, Sep 14 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.113 Chrome/60.0.3112.113 Safari/537.36

Steps to reproduce the problem:
1. Load a page that includes a hyperlinked region that is partially occluded by
   other content (e.g. partially_occluded_hyperlink.html attached).
2. Print the page to PDF through Chromium, selecting "Background graphics" under
   "More settings".
3. Observe that the entire yellow square is hyperlinked in the output PDF,
   including the area occluded by the red rectangle.

What is the expected behavior?
Only the yellow area should be hyperlinked---none of the red area should be
hyperlinked.

What went wrong?
Hyperlinks are clickable on regions of the printed page that should not be
clickable based on occlusion.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 60.0.3112.113  Channel: stable
OS Version: 16.04
Flash Version: Shockwave Flash 26.0 r0

== Attached Artifacts ==

Compare the clickable region when loading the attached .html versus the
clickable region when loading the .pdf.  I also attach a .png screenshot,
illustrating the hyperlink tooltip when the cursor is positioned over the red
box in the .pdf.

== Preliminary Diagnosis ==

I believe this issue spans both Blink and Skia.

Skia:

On the one hand, SkPDFDevice appears to draw all "annotations" (e.g. hyperlinks)
last.  See SkPDFDevice::drawAnnotation, which enqueues annotations for later
drawing rather than drawing them "inline".  Annotations get drawn during
SkPDFDocument::onEndPage(), causing annotations to appear on top rather than
honoring occluding elements.  So, I believe the first step is correcting
SkPDFDevice to draw the annotations "inline" rather than queuing and drawing at
the end.

Blink:

On the other hand, I noticed that on more complex pages, the draw call order
sometimes, but not always, calls drawAnnotation() prior to the content being
annotated.  This might result in the opposite problem, where a hyperlink which
should be clickable is occluded by its content.  For example, a piece of text
that is meant to be hyperlinked might have this call order:

SkDevice::drawAnnotation()
SkDevice::drawtext()

instead of:

SkDevice::drawText()
SkDevice::drawAnnotation()

So, there might be a second step to shuffle some calls in blink to ensure the
device draw order ultimately ends up being correct.
 
partially_occluded_hyperlink.html
249 bytes View Download
partially_occluded_hyperlink.pdf
24.8 KB Download
partially_occluded_hyperlink.png
32.0 KB View Download
Labels: Needs-Triage-M60
Please provide a sample tescase for repro.

Comment 2 by br...@amazon.com, Sep 14 2017

Is there any particular type of test case that would help repro this, beyond the
MWE described above?
Cc: divya.pa...@techmahindra.com
Labels: Triaged-ET M-63 OS-Windows
Status: Untriaged (was: Unconfirmed)
Tested the issue on reported version Stable 61.0.3163.79, Latest Canary 63.0.3216.0 using Windows 7 and Ubuntu 14.04
This issue is seen from M50 and is a Non-Regression issue.
Hence marking it as untraiged for further inputs on this.

Note: Issue is not reproducible on Mac 10.12.1
Cc: thestig@chromium.org
Components: Internals>Printing
Without selecting "background graphics" the squares do not appear in the printed PDF, but the link is still there and in a square shape, without occlusion. "linux_chrome61_nobggraphics.pdf" attached to illustrate.

Also, for me the bug did reproduce on macOS 10.12.6. Attached "mac_chrome60.pdf" with the result.
linux_chrome61_nobggraphics.pdf
25.3 KB Download
mac_chrome60.pdf
17.9 KB Download
Cc: halcanary@google.com
Components: Internals>Skia>PDF

Comment 8 by junov@chromium.org, Sep 29 2017

Components: -Blink>Canvas
Status: Available (was: Untriaged)
Project Member

Comment 9 by sheriffbot@chromium.org, Oct 1

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Recharge-Cold -M-63 -Needs-Triage-M60
Status: Available (was: Untriaged)
halcanary: Can you take a look?
PDF link annotations can only be specified as a rectangle.

See PDF 32000-1:2008, Section 12.5.2: "The annotation rectangle, defining the location of the annotation on the page in default user space units."

Blink could break the region into a sequence of rectangles and create a link for each of them.

Sign in to add a comment