diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-03-18 14:48:00 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-03-18 14:48:00 +0000 |
commit | 5930e4bcc46f8e49c34e5630cf875f2b055502ff (patch) | |
tree | 5c4f6af0e164a02fbcbeebeb66072eee22715adb /render | |
parent | bf69cfa74bb3bac972a0fb23ccbffeba5aa49412 (diff) | |
download | netsurf-5930e4bcc46f8e49c34e5630cf875f2b055502ff.tar.gz netsurf-5930e4bcc46f8e49c34e5630cf875f2b055502ff.tar.bz2 |
Fix bug where html conversion began before STYLE element fetch had been launched.
Diffstat (limited to 'render')
-rw-r--r-- | render/html.c | 21 | ||||
-rw-r--r-- | render/html_css.c | 2 | ||||
-rw-r--r-- | render/html_internal.h | 8 | ||||
-rw-r--r-- | render/html_script.c | 4 |
4 files changed, 30 insertions, 5 deletions
diff --git a/render/html.c b/render/html.c index ad7ab9997..0f854bc67 100644 --- a/render/html.c +++ b/render/html.c @@ -1121,13 +1121,30 @@ static bool html_convert(struct content *c) /* if there are no active fetches in progress no scripts are * being fetched or they completed already. - */ - if (htmlc->base.active == 0) { + */ + if (html_can_begin_conversion(htmlc)) { return html_begin_conversion(htmlc); } return true; } +/* Exported interface documented in html_internal.h */ +bool html_can_begin_conversion(html_content *htmlc) +{ + unsigned int i; + bool got_modified_stylesheet = false; + + for (i = 0; i != htmlc->stylesheet_count; i++) { + if (htmlc->stylesheets[i].modified) + got_modified_stylesheet = true; + } + + if (htmlc->base.active != 0 || got_modified_stylesheet) + return false; + + return true; +} + bool html_begin_conversion(html_content *htmlc) { diff --git a/render/html_css.c b/render/html_css.c index a2e3a1be0..6242f9da7 100644 --- a/render/html_css.c +++ b/render/html_css.c @@ -143,7 +143,7 @@ html_convert_css_callback(hlcache_handle *css, assert(0); } - if (parent->base.active == 0) { + if (html_can_begin_conversion(parent)) { html_begin_conversion(parent); } diff --git a/render/html_internal.h b/render/html_internal.h index 90f014307..a78dc8f8a 100644 --- a/render/html_internal.h +++ b/render/html_internal.h @@ -221,6 +221,14 @@ void html_set_search(struct content *c, struct search_context *s); void html_finish_conversion(html_content *htmlc); /** + * Test if an HTML content conversion can begin + * + * \param htmlc html content to test + * \return true iff the html content conversion can begin + */ +bool html_can_begin_conversion(html_content *htmlc); + +/** * Begin conversion of an HTML document * * \param htmlc Content to convert diff --git a/render/html_script.c b/render/html_script.c index 9c14e84ce..89d67413e 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -255,7 +255,7 @@ convert_script_defer_cb(hlcache_handle *script, /* if there are no active fetches remaining begin post parse * conversion */ - if (parent->base.active == 0) { + if (html_can_begin_conversion(parent)) { html_begin_conversion(parent); } @@ -349,7 +349,7 @@ convert_script_sync_cb(hlcache_handle *script, /* if there are no active fetches remaining begin post parse * conversion */ - if (parent->base.active == 0) { + if (html_can_begin_conversion(parent)) { html_begin_conversion(parent); } |