changeset 781:d494f2000cc2

add parse_embedded_css option
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sat, 17 Jan 2009 16:59:38 +0100
parents 3bea75694f07
children b43df60cbb52
files dillorc src/html.cc src/prefs.c src/prefs.h src/styleengine.cc
diffstat 5 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dillorc	Sat Jan 17 16:48:27 2009 +0100
+++ b/dillorc	Sat Jan 17 16:59:38 2009 +0100
@@ -21,6 +21,9 @@
 # Change this if you want to disable loading of CSS stylesheets.
 #load_stylesheets=YES
 
+# Change this if you want to disable parsing of embedded CSS.
+#parse_embedded_css=YES
+
 # Change the buffering scheme for drawing
 # 0 no double buffering - useful for debugging
 # 1 light buffering using a single back buffer for all windows
--- a/src/html.cc	Sat Jan 17 16:48:27 2009 +0100
+++ b/src/html.cc	Sat Jan 17 16:59:38 2009 +0100
@@ -1654,8 +1654,9 @@
  */
 static void Html_tag_close_style(DilloHtml *html, int TagIdx)
 {
-   html->styleEngine->parse(html->Stash->str, html->Stash->len,
-                            0, CSS_ORIGIN_AUTHOR);
+   if (prefs.parse_embedded_css)
+      html->styleEngine->parse(html->Stash->str, html->Stash->len,
+                               0, CSS_ORIGIN_AUTHOR);
 }
 
 /*
--- a/src/prefs.c	Sat Jan 17 16:48:27 2009 +0100
+++ b/src/prefs.c	Sat Jan 17 16:59:38 2009 +0100
@@ -79,6 +79,7 @@
    DRC_TOKEN_MIDDLE_CLICK_OPENS_NEW_TAB,
    DRC_TOKEN_NOPROXY,
    DRC_TOKEN_PANEL_SIZE,
+   DRC_TOKEN_PARSE_EMBEDDED_CSS,
    DRC_TOKEN_PROXY,
    DRC_TOKEN_PROXYUSER,
    DRC_TOKEN_REFERER,
@@ -146,6 +147,7 @@
    { "middle_click_opens_new_tab", DRC_TOKEN_MIDDLE_CLICK_OPENS_NEW_TAB },
    { "no_proxy", DRC_TOKEN_NOPROXY },
    { "panel_size", DRC_TOKEN_PANEL_SIZE },
+   { "parse_embedded_css", DRC_TOKEN_PARSE_EMBEDDED_CSS },
    { "save_dir", DRC_TOKEN_SAVE_DIR },
    { "search_url", DRC_TOKEN_SEARCH_URL },
    { "show_back", DRC_TOKEN_SHOW_BACK },
@@ -264,6 +266,9 @@
       else /* default to "medium" */
          prefs.panel_size = P_medium;
       break;
+   case DRC_TOKEN_PARSE_EMBEDDED_CSS:
+      prefs.parse_embedded_css = (strcmp(value, "YES") == 0);
+      break;
    case DRC_TOKEN_SMALL_ICONS:
       prefs.small_icons = (strcmp(value, "YES") == 0);
       break;
@@ -463,6 +468,7 @@
    prefs.fullwindow_start=FALSE;
    prefs.load_images=TRUE;
    prefs.load_stylesheets=TRUE;
+   prefs.parse_embedded_css=TRUE;
    prefs.buffered_drawing=1;
    prefs.vw_fontname = dStrdup(D_VW_FONTNAME);
    prefs.fw_fontname = dStrdup(D_FW_FONTNAME);
--- a/src/prefs.h	Sat Jan 17 16:48:27 2009 +0100
+++ b/src/prefs.h	Sat Jan 17 16:59:38 2009 +0100
@@ -59,6 +59,7 @@
    bool_t fullwindow_start;
    bool_t load_images;
    bool_t load_stylesheets;
+   bool_t parse_embedded_css;
    int32_t buffered_drawing;
    char *vw_fontname;
    char *fw_fontname;
--- a/src/styleengine.cc	Sat Jan 17 16:48:27 2009 +0100
+++ b/src/styleengine.cc	Sat Jan 17 16:59:38 2009 +0100
@@ -405,7 +405,7 @@
          stack->getRef (stack->size () - 2)->style->backgroundColor;
 
    // parse style information from style="" attribute, if it exists
-   if (styleAttribute)
+   if (styleAttribute && prefs.parse_embedded_css)
       styleAttributeProps =
          a_Css_parse_declaration (styleAttribute, strlen (styleAttribute));