diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-19 21:38:54 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-19 21:38:54 +0100 |
commit | 6d268bac50e60fbe881505108e75f014e812bcc9 (patch) | |
tree | 4090ec8934ab63e0941e47f0013392ea91cac979 /src/html.cc | |
parent | 5d812893837cb4842277b134dcaf3820d31d5db9 (diff) |
load <style></style> content only if applicable
Diffstat (limited to 'src/html.cc')
-rw-r--r-- | src/html.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/html.cc b/src/html.cc index a354cece..e06c5653 100644 --- a/src/html.cc +++ b/src/html.cc @@ -457,6 +457,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, InVisitedLink = false; ReqTagClose = false; TagSoup = true; + loadCssFromStash = false; Num_HTML = Num_HEAD = Num_BODY = Num_TITLE = 0; @@ -1642,11 +1643,12 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) { const char *attrbuf; + html->loadCssFromStash = true; + if (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "type"))) { BUG_MSG("type attribute is required for <style>\n"); } else if (dStrcasecmp(attrbuf, "text/css")) { - MSG("Shouldn't be applying <style type=\"%s\">\n", attrbuf); - /* We need to inform close_style() */ + html->loadCssFromStash = false; } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "media")) && dStrcasecmp(attrbuf, "all") && !dStristr(attrbuf, "screen")) { @@ -1655,8 +1657,9 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) * TODO can be a comma-separated list. * TODO handheld. */ - MSG("Shouldn't be applying <style media=\"%s\">\n", attrbuf); + html->loadCssFromStash = false; } + a_Html_stash_init(html); S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_VERBATIM; } @@ -1666,7 +1669,7 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) */ static void Html_tag_close_style(DilloHtml *html, int TagIdx) { - if (prefs.parse_embedded_css) + if (prefs.parse_embedded_css && html->loadCssFromStash) html->styleEngine->parse(html->Stash->str, html->Stash->len, CSS_ORIGIN_AUTHOR); } |