diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-10-17 17:13:32 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-10-28 16:18:38 +0200 |
commit | 8a07b7fb14f11204a0d840792ab9f4bd54b066e5 (patch) | |
tree | e617a898c17aeb353f35d7b362ca2de290cf2b82 /source/tools/murun.c | |
parent | 4029b45e494634361a4205f8896ec429d11e990a (diff) | |
download | mupdf-8a07b7fb14f11204a0d840792ab9f4bd54b066e5.tar.xz |
Clean up link destination handling.
All link destinations should be URIs, and a document specific function
can be called to resolve them to actual page numbers.
Outlines have cached page numbers as well as string URIs.
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r-- | source/tools/murun.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c index fc887105..079a8c3c 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -1601,14 +1601,17 @@ static void to_outline(js_State *J, fz_outline *outline) js_pushundefined(J); js_setproperty(J, -2, "title"); - if (outline->dest.kind == FZ_LINK_GOTO) { - js_pushnumber(J, outline->dest.ld.gotor.page); - js_setproperty(J, -2, "page"); - } - if (outline->dest.kind == FZ_LINK_URI) { - js_pushstring(J, outline->dest.ld.uri.uri); - js_setproperty(J, -2, "uri"); - } + if (outline->uri) + js_pushstring(J, outline->uri); + else + js_pushundefined(J); + js_setproperty(J, -2, "uri"); + + if (outline->page >= 0) + js_pushnumber(J, outline->page); + else + js_pushundefined(J); + js_setproperty(J, -2, "page"); if (outline->down) { to_outline(J, outline->down); @@ -1821,14 +1824,8 @@ static void ffi_Page_getLinks(js_State *J) ffi_pushrect(J, link->rect); js_setproperty(J, -2, "bounds"); - if (link->dest.kind == FZ_LINK_GOTO) { - js_pushnumber(J, link->dest.ld.gotor.page); - js_setproperty(J, -2, "page"); - } - if (link->dest.kind == FZ_LINK_URI) { - js_pushstring(J, link->dest.ld.uri.uri); - js_setproperty(J, -2, "uri"); - } + js_pushstring(J, link->uri); + js_setproperty(J, -2, "uri"); js_setindex(J, -2, i++); } |