summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-02-06 13:31:47 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-02-06 17:10:40 +0100
commitf95ec7d7093dec14c2fdf00eb9dace54d4cbe1f5 (patch)
treed3e9e807344d658531eb5be44acbd4178395f523
parentc100c4c77a88782ba5c4634994171db611952d44 (diff)
downloadmupdf-f95ec7d7093dec14c2fdf00eb9dace54d4cbe1f5.tar.xz
Make sure to fill in 'doc' field of HTML links.
-rw-r--r--include/mupdf/html.h2
-rw-r--r--source/html/epub-doc.c2
-rw-r--r--source/html/html-doc.c2
-rw-r--r--source/html/html-layout.c5
4 files changed, 7 insertions, 4 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h
index e23a606d..1bd72197 100644
--- a/include/mupdf/html.h
+++ b/include/mupdf/html.h
@@ -281,7 +281,7 @@ void fz_layout_html(fz_context *ctx, fz_html *html, float w, float h, float em);
void fz_draw_html(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, fz_html *html, int page);
float fz_find_html_target(fz_context *ctx, fz_html *html, const char *id);
-fz_link *fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *base_uri);
+fz_link *fz_load_html_links(fz_context *ctx, fz_html *html, int page, const char *base_uri, void *doc);
void fz_drop_html(fz_context *ctx, fz_html *html);
fz_bookmark fz_make_html_bookmark(fz_context *ctx, fz_html *html, int page);
int fz_lookup_html_bookmark(fz_context *ctx, fz_html *html, fz_bookmark mark);
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;