diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-11-04 14:27:32 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-12-03 12:25:51 +0100 |
commit | d05e5e738f22b914607900b8d1f2e38670e2ba24 (patch) | |
tree | d457c05c9e2d7f09acb1a7b2ce103edf53d8ec43 /source/html/handler.c | |
parent | 24c8a6cca270c27a4940ed7398ec01664e488e6f (diff) | |
download | mupdf-d05e5e738f22b914607900b8d1f2e38670e2ba24.tar.xz |
html: Partially compute styles when generating boxes.
Resolve final width and em-scaled numbers at layout time.
Diffstat (limited to 'source/html/handler.c')
-rw-r--r-- | source/html/handler.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/html/handler.c b/source/html/handler.c index f5002437..859721c8 100644 --- a/source/html/handler.c +++ b/source/html/handler.c @@ -1,9 +1,5 @@ #include "mupdf/html.h" -struct html_page_s -{ -}; - void html_close_document(html_document *doc) { @@ -21,7 +17,7 @@ html_page * html_load_page(html_document *doc, int number) { printf("html: load page %d\n", number); - return (html_page*)"nothing"; + return doc->box; } void @@ -43,6 +39,7 @@ void html_run_page(html_document *doc, html_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) { printf("html: run page\n"); + html_run_box(doc->ctx, page, dev, ctm); } html_document * @@ -50,15 +47,14 @@ html_open_document_with_stream(fz_context *ctx, fz_stream *file) { html_document *doc; fz_buffer *buf; - fz_xml *root; + fz_xml *xml; buf = fz_read_all(file, 0); - root = fz_parse_xml(ctx, buf->data, buf->len, 1); + xml = fz_parse_xml(ctx, buf->data, buf->len, 1); fz_drop_buffer(ctx, buf); doc = fz_malloc_struct(ctx, html_document); doc->ctx = ctx; - doc->root = root; doc->super.close = (void*)html_close_document; doc->super.count_pages = (void*)html_count_pages; @@ -67,6 +63,9 @@ html_open_document_with_stream(fz_context *ctx, fz_stream *file) doc->super.run_page_contents = (void*)html_run_page; doc->super.free_page = (void*)html_free_page; + doc->xml = xml; + doc->box = NULL; + html_layout_document(doc, 400, 600); return doc; |