From f95ec7d7093dec14c2fdf00eb9dace54d4cbe1f5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 6 Feb 2017 13:31:47 +0100 Subject: Make sure to fill in 'doc' field of HTML links. --- source/html/epub-doc.c | 2 +- source/html/html-doc.c | 2 +- source/html/html-layout.c | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'source/html') diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 3cfa3f06..dab46155 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -171,7 +171,7 @@ epub_load_links(fz_context *ctx, fz_page *page_) { int cn = ceilf(ch->html->root->h / ch->html->page_h); if (n < count + cn) - return fz_load_html_links(ctx, ch->html, n - count, ch->path); + return fz_load_html_links(ctx, ch->html, n - count, ch->path, doc); count += cn; } diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 47225c06..5802e460 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -94,7 +94,7 @@ htdoc_load_links(fz_context *ctx, fz_page *page_) { html_page *page = (html_page*)page_; html_document *doc = page->doc; - return fz_load_html_links(ctx, doc->html, page->number, ""); + return fz_load_html_links(ctx, doc->html, page->number, "", doc); } static fz_bookmark diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 1cac935b..5793de0e 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -2021,7 +2021,7 @@ static fz_link *load_link_box(fz_context *ctx, fz_html_box *box, fz_link *head, } fz_link * -fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *file) +fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *file, void *doc) { fz_link *link, *head; char dir[2048]; @@ -2036,6 +2036,9 @@ fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *file) link->rect.x1 += html->page_margin[L]; link->rect.y0 += html->page_margin[T]; link->rect.y1 += html->page_margin[T]; + + /* Set document pointer */ + link->doc = doc; } return head; -- cgit v1.2.3