After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780139 - Toggling OCG layer on next page only takes effect after changing zoom level
Toggling OCG layer on next page only takes effect after changing zoom level
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-03-16 12:11 UTC by Georges Dupéron
Modified: 2017-03-27 10:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
2-page PDF file with the OCG toggle links. With the second link, the display is refreshed only after a change of the zoom level. (14.59 KB, application/pdf)
2017-03-16 12:11 UTC, Georges Dupéron
  Details
Source LaTeX file which was used to generate the PDF. Must be compiled 4 times with pdflatex. (899 bytes, text/plain)
2017-03-16 12:13 UTC, Georges Dupéron
  Details
Tentative patch based on José Aliste's comment. I havent compiled or tested it. (800 bytes, patch)
2017-03-16 13:57 UTC, Georges Dupéron
committed Details | Review

Description Georges Dupéron 2017-03-16 12:11:42 UTC
Created attachment 348076 [details]
2-page PDF file with the OCG toggle links. With the second link, the display is refreshed only after a change of the zoom level.

Evince version 3.20.1

In the attached document are two links which toggle OCG layers. The first one toggles elements on the same page as the link, while the second link toggles elements present on the following page.

When the  first link is clicked, everything works fine (the text is alternatively showed and hidden).

When the second link is clicked, the second page is not updated (even if it was not into view and it was necessary to scroll there). If the zoom level is changed (via the drop-down or with Ctrl+Plus and Ctrl+Minus), this refreshes the display, and the text on the second page gets shown/hidden according to its current toggle status.

When enabling and disabling the layer in the Layers side panel (which is opened with F9), the second page's display is updated as it should.
Comment 1 Georges Dupéron 2017-03-16 12:13:17 UTC
Created attachment 348077 [details]
Source LaTeX file which was used to generate the PDF. Must be compiled 4 times with pdflatex.
Comment 2 José Aliste 2017-03-16 13:41:11 UTC
Good catch. I don't have the time to fix this but I it comes from this line
https://git.gnome.org/browse/evince/tree/libview/ev-view.c#n2015

Basically, we are assuming that the change of visibility on the layers was on the current page, and this is the incorrect assumption. Either we should reload the whole view, or if it's possible to get the page of the OCG Layer whose visibility has changed, then reload that page instead of the current page. Do you want to give it a try at producing a patch?
Comment 3 Georges Dupéron 2017-03-16 13:57:19 UTC
Created attachment 348087 [details] [review]
Tentative patch based on José Aliste's comment. I havent compiled or tested it.

Hi José Aliste, thanks for looking into this.

The OCG layer can have elements on several pages, and all should be updated. It's therefore probably simpler (albeit less efficient) to update the whole view.

Here's a patch which does this. I don't have a proper development environment set up for C (and my distribution, NixOS, makes it a bit of a pain to set up), so I have not compiled or tested it.
Comment 4 José Aliste 2017-03-16 14:14:49 UTC
I think you are right, from the PDF 1.7 Adobe Reference book:

"An optional content group is a dictionary representing a collection of graphics
that can be made visible or invisible dynamically by users of viewer applications.
The graphics belonging to such a group can reside anywhere in the document:
they need not be consecutive in drawing order, nor even belong to the same content
stream."

Therefore, your patch should be correct. @Carlos?
Comment 5 Carlos Garcia Campos 2017-03-27 10:01:27 UTC
(In reply to José Aliste from comment #4)
> I think you are right, from the PDF 1.7 Adobe Reference book:
> 
> "An optional content group is a dictionary representing a collection of
> graphics
> that can be made visible or invisible dynamically by users of viewer
> applications.
> The graphics belonging to such a group can reside anywhere in the document:
> they need not be consecutive in drawing order, nor even belong to the same
> content
> stream."
> 
> Therefore, your patch should be correct. @Carlos?

Yes, I'm afraid there's no other way, we don't know the pages that need to be reloaded.
Comment 6 Carlos Garcia Campos 2017-03-27 10:01:44 UTC
Comment on attachment 348087 [details] [review]
Tentative patch based on José Aliste's comment. I havent compiled or tested it.

Pushed, thanks!