diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-04-27 13:50:49 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-04-27 13:50:49 +0000 |
commit | 1304964f92249a1f8e685db89aa694f77307d6ae (patch) | |
tree | 706003fb75d65aa2fe2e6f6e2a08f6c0091ca1e0 /render/box_construct.c | |
parent | d0e7a5ecacc8692b533c8102bfa6b2267f309ab9 (diff) | |
download | netsurf-1304964f92249a1f8e685db89aa694f77307d6ae.tar.gz netsurf-1304964f92249a1f8e685db89aa694f77307d6ae.tar.bz2 |
Reduce number of page reflows and viewport
redraws as images are fetched:
+ Flag known-sized boxes generated by images.
+ Treat them as replaced all through layout.
+ Only reflow the document for fetched images
if we don't already have the box at the
right size.
svn path=/trunk/netsurf/; revision=12243
Diffstat (limited to 'render/box_construct.c')
-rw-r--r-- | render/box_construct.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/render/box_construct.c b/render/box_construct.c index b47405c12..f780d0714 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1159,6 +1159,11 @@ bool box_image(BOX_SPECIAL_PARAMS) bool ok; char *s, *url; xmlChar *alt, *src; + enum css_width_e wtype; + enum css_height_e htype; + css_fixed value = 0; + css_unit wunit = CSS_UNIT_PX; + css_unit hunit = CSS_UNIT_PX; if (box->style && css_computed_display(box->style, n->parent == NULL) == CSS_DISPLAY_NONE) @@ -1196,6 +1201,17 @@ bool box_image(BOX_SPECIAL_PARAMS) ok = html_fetch_object(content, url, box, image_types, content->available_width, 1000, false); free(url); + + wtype = css_computed_width(box->style, &value, &wunit); + htype = css_computed_height(box->style, &value, &hunit); + + if (wtype == CSS_WIDTH_SET && wunit != CSS_UNIT_PCT && + htype == CSS_HEIGHT_SET && hunit != CSS_UNIT_PCT) { + /* We know the dimensions the image will be shown at before it's + * fetched. */ + box->flags |= REPLACE_DIM; + } + return ok; } |