[EPubGenerator] Avoid pointless scans of the whole document

Authored by bruns on May 22 2019, 10:28 PM.

Description

[EPubGenerator] Avoid pointless scans of the whole document

Summary:
The "<video></video>" tag is a placeholder, and should only be processed
when it has been inserted for this toc item, i.e. when movieAnnots is
non-empty. Also place the search cursor at the last inserted block,
otherwise the expression will search from the beginning of the document.

Do likewise for audio/soundActions.

This makes loading large documents much fasters, and even fixes crashing
on huge documents, e.g. from project Gutenberg "The Complete Works of
William Shakespeare" (3200 pages) or the "King James Bible" (1400 pages).

Test Plan: open a large EPub file (see above)

Reviewers: Okular, aacid

Reviewed By: Okular, aacid

Subscribers: aacid, okular-devel

Tags: Okular

Differential Revision: https://phabricator.kde.org/D20948