diff options
Diffstat (limited to 'render/html.c')
-rw-r--r-- | render/html.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/render/html.c b/render/html.c index 422528ad0..5fce63c26 100644 --- a/render/html.c +++ b/render/html.c @@ -181,6 +181,7 @@ bool html_convert(struct content *c, int width, int height) xmlDoc *document; xmlNode *html, *head; union content_msg_data msg_data; + int descendant_width; /* finish parsing */ htmlParseChunk(c->data.html.parser, "", 0, 1); @@ -251,7 +252,16 @@ bool html_convert(struct content *c, int width, int height) c->data.html.box_pool); /*box_dump(c->data.html.layout->children, 0);*/ - c->width = c->data.html.layout->children->width; + descendant_width = c->data.html.layout->children->descendant_x1 - + c->data.html.layout->children->descendant_x0; + + LOG(("Available width: %d, Returned Width: %d, Required width: %d", width, c->data.html.layout->children->width, descendant_width)); + + if (descendant_width > c->data.html.layout->children->width) + c->width = descendant_width; + else + c->width = c->data.html.layout->children->width; + c->height = c->data.html.layout->children->height; if (c->active == 0) { @@ -828,9 +838,21 @@ void html_stop(struct content *c) void html_reformat(struct content *c, int width, int height) { + int descendant_width; + layout_document(c->data.html.layout->children, width, c->data.html.box_pool); - c->width = c->data.html.layout->children->width; + + descendant_width = c->data.html.layout->children->descendant_x1 - + c->data.html.layout->children->descendant_x0; + + LOG(("Available width: %d, Returned Width: %d, Required width: %d", width, c->data.html.layout->children->width, descendant_width)); + + if (descendant_width > c->data.html.layout->children->width) + c->width = descendant_width; + else + c->width = c->data.html.layout->children->width; + c->height = c->data.html.layout->children->height; } |