Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/3f764b04597e0587fa7bb034c16c9a38401b8002
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/3f764b04597e0587fa7bb034c16c9a38401b8002
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/3f764b04597e0587fa7bb034c16c9a38401b8002

The branch, master has been updated
       via  3f764b04597e0587fa7bb034c16c9a38401b8002 (commit)
       via  4cb38c4704e4ed11cf10fc046b32ef6ef5afa78f (commit)
      from  41de6cb6f8ee73a712e305f8c1b6d34090a24523 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=3f764b04597e0587fa7bb034c16c9a38401b8002
commit 3f764b04597e0587fa7bb034c16c9a38401b8002
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    html: layout: Ensure all object types are reflowed if appropriate
    
    The SVGTiny content handler uses the reflow method to set the
    content width/height. The when the content first broadcasts "done",
    the HTML handler checks if there had already been a layout. If there
    has, it calls the SVG's content reflow method with the box dimensions.
    If not, it calls the reflow method with width/height zero.
    
    Since the layout code was only reflowing objects if they were HTML,
    these SVG contents were never getting their actual dimensions.
    
    The result of this was that when we came to plot these SVGs we were
    dividing by zero in the building of the transformation matrix:
    
        transform[0] = (float) width / (float) c->width;
    ...
        transform[3] = (float) height / (float) c->height;
    
    These divided the plot size by the content size.
    
    The result of this on the GTK front end was infinities in the
    transformation matrix passed to Cairo, and the turning of the
    whole nsgtk window into a glitchy ruin while the SVG was on
    screen.
    
    It may have affected other front ends too; these divide by zeros
    were happening in the core, and passed to the front ends' plotters.
    
    This issue only affected SVGs on HTML pages, and not when viewed
    directly. Also the SVGs had to be completely fetched and converted
    before the document had undergone layout.
    
    This was the case with SVGs at the top of both Wikipedia and The
    Register. In both cases the glitching window would be fixed by
    scrolling down the page past the SVG.

diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c
index 827180c..76ce24d 100644
--- a/content/handlers/html/layout.c
+++ b/content/handlers/html/layout.c
@@ -2305,7 +2305,7 @@ static bool layout_block_object(struct box *block)
        NSLOG(layout, DEBUG,  "block %p, object %p, width %i", block,
              hlcache_handle_get_url(block->object), block->width);
 
-       if (content_get_type(block->object) == CONTENT_HTML) {
+       if (content_can_reformat(block->object)) {
                content_reformat(block->object, false, block->width, 1);
        } else {
                /* Non-HTML objects */
@@ -2984,7 +2984,7 @@ layout_line(struct box *first,
                }
 
                /* Reformat object to new box size */
-               if (b->object && content_get_type(b->object) == CONTENT_HTML &&
+               if (b->object && content_can_reformat(b->object) &&
                                b->width !=
                                content_get_available_width(b->object)) {
                        css_fixed value = 0;


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=4cb38c4704e4ed11cf10fc046b32ef6ef5afa78f
commit 4cb38c4704e4ed11cf10fc046b32ef6ef5afa78f
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    css: Add option to ignore author level CSS
    
    This adds a new config option, `author_level_css`.
    
    When it is disabled, NetSurf will ignore all CSS from the web
    page. In this case only the default CSS rules from the browser
    and user CSS rules will be applied. It is enabled by default.
    
    Tested by running:
    
        ./nsgtk3 --author_level_css=0

diff --git a/content/handlers/css/hints.c b/content/handlers/css/hints.c
index defeae1..286befa 100644
--- a/content/handlers/css/hints.c
+++ b/content/handlers/css/hints.c
@@ -1587,6 +1587,10 @@ static void css_hint_list(
        dom_exception err;
        dom_string *attr;
 
+       if (nsoption_bool(author_level_css) == false) {
+               return;
+       }
+
        err = dom_element_get_attribute(node, corestring_dom_type, &attr);
        if (err == DOM_NO_ERR && attr != NULL) {
                const char *attr_str = dom_string_data(attr);
diff --git a/content/handlers/html/box_construct.c 
b/content/handlers/html/box_construct.c
index eeadb84..8519c2b 100644
--- a/content/handlers/html/box_construct.c
+++ b/content/handlers/html/box_construct.c
@@ -249,16 +249,19 @@ box_get_style(html_content *c,
              const css_computed_style *root_style,
              dom_node *n)
 {
-       dom_string *s;
-       dom_exception err;
+       dom_string *s = NULL;
        css_stylesheet *inline_style = NULL;
        css_select_results *styles;
        nscss_select_ctx ctx;
 
        /* Firstly, construct inline stylesheet, if any */
-       err = dom_element_get_attribute(n, corestring_dom_style, &s);
-       if (err != DOM_NO_ERR)
-               return NULL;
+       if (nsoption_bool(author_level_css)) {
+               dom_exception err;
+               err = dom_element_get_attribute(n, corestring_dom_style, &s);
+               if (err != DOM_NO_ERR) {
+                       return NULL;
+               }
+       }
 
        if (s != NULL) {
                inline_style = nscss_create_inline_style(
diff --git a/content/handlers/html/css.c b/content/handlers/html/css.c
index be17ac8..69d5458 100644
--- a/content/handlers/html/css.c
+++ b/content/handlers/html/css.c
@@ -683,6 +683,11 @@ html_css_new_selection_context(html_content *c, 
css_select_ctx **ret_select_ctx)
                        origin = CSS_ORIGIN_USER;
                }
 
+               if (origin == CSS_ORIGIN_AUTHOR &&
+                   nsoption_bool(author_level_css) == false) {
+                       continue;
+               }
+
                if (hsheet->sheet != NULL) {
                        sheet = nscss_get_stylesheet(hsheet->sheet);
                }
diff --git a/desktop/options.h b/desktop/options.h
index a12275e..b74fab8 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -123,6 +123,9 @@ NSOPTION_BOOL(animate_images, true)
 /** Whether to execute javascript */
 NSOPTION_BOOL(enable_javascript, false)
 
+/** Whether to allow Author level CSS. */
+NSOPTION_BOOL(author_level_css, true)
+
 /** Maximum time (in seconds) to wait for a script to run */
 NSOPTION_INTEGER(script_timeout, 10)
 


-----------------------------------------------------------------------

Summary of changes:
 content/handlers/css/hints.c          |    4 ++++
 content/handlers/html/box_construct.c |   13 ++++++++-----
 content/handlers/html/css.c           |    5 +++++
 content/handlers/html/layout.c        |    4 ++--
 desktop/options.h                     |    3 +++
 5 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/content/handlers/css/hints.c b/content/handlers/css/hints.c
index defeae1..286befa 100644
--- a/content/handlers/css/hints.c
+++ b/content/handlers/css/hints.c
@@ -1587,6 +1587,10 @@ static void css_hint_list(
        dom_exception err;
        dom_string *attr;
 
+       if (nsoption_bool(author_level_css) == false) {
+               return;
+       }
+
        err = dom_element_get_attribute(node, corestring_dom_type, &attr);
        if (err == DOM_NO_ERR && attr != NULL) {
                const char *attr_str = dom_string_data(attr);
diff --git a/content/handlers/html/box_construct.c 
b/content/handlers/html/box_construct.c
index eeadb84..8519c2b 100644
--- a/content/handlers/html/box_construct.c
+++ b/content/handlers/html/box_construct.c
@@ -249,16 +249,19 @@ box_get_style(html_content *c,
              const css_computed_style *root_style,
              dom_node *n)
 {
-       dom_string *s;
-       dom_exception err;
+       dom_string *s = NULL;
        css_stylesheet *inline_style = NULL;
        css_select_results *styles;
        nscss_select_ctx ctx;
 
        /* Firstly, construct inline stylesheet, if any */
-       err = dom_element_get_attribute(n, corestring_dom_style, &s);
-       if (err != DOM_NO_ERR)
-               return NULL;
+       if (nsoption_bool(author_level_css)) {
+               dom_exception err;
+               err = dom_element_get_attribute(n, corestring_dom_style, &s);
+               if (err != DOM_NO_ERR) {
+                       return NULL;
+               }
+       }
 
        if (s != NULL) {
                inline_style = nscss_create_inline_style(
diff --git a/content/handlers/html/css.c b/content/handlers/html/css.c
index be17ac8..69d5458 100644
--- a/content/handlers/html/css.c
+++ b/content/handlers/html/css.c
@@ -683,6 +683,11 @@ html_css_new_selection_context(html_content *c, 
css_select_ctx **ret_select_ctx)
                        origin = CSS_ORIGIN_USER;
                }
 
+               if (origin == CSS_ORIGIN_AUTHOR &&
+                   nsoption_bool(author_level_css) == false) {
+                       continue;
+               }
+
                if (hsheet->sheet != NULL) {
                        sheet = nscss_get_stylesheet(hsheet->sheet);
                }
diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c
index 827180c..76ce24d 100644
--- a/content/handlers/html/layout.c
+++ b/content/handlers/html/layout.c
@@ -2305,7 +2305,7 @@ static bool layout_block_object(struct box *block)
        NSLOG(layout, DEBUG,  "block %p, object %p, width %i", block,
              hlcache_handle_get_url(block->object), block->width);
 
-       if (content_get_type(block->object) == CONTENT_HTML) {
+       if (content_can_reformat(block->object)) {
                content_reformat(block->object, false, block->width, 1);
        } else {
                /* Non-HTML objects */
@@ -2984,7 +2984,7 @@ layout_line(struct box *first,
                }
 
                /* Reformat object to new box size */
-               if (b->object && content_get_type(b->object) == CONTENT_HTML &&
+               if (b->object && content_can_reformat(b->object) &&
                                b->width !=
                                content_get_available_width(b->object)) {
                        css_fixed value = 0;
diff --git a/desktop/options.h b/desktop/options.h
index a12275e..b74fab8 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -123,6 +123,9 @@ NSOPTION_BOOL(animate_images, true)
 /** Whether to execute javascript */
 NSOPTION_BOOL(enable_javascript, false)
 
+/** Whether to allow Author level CSS. */
+NSOPTION_BOOL(author_level_css, true)
+
 /** Maximum time (in seconds) to wait for a script to run */
 NSOPTION_INTEGER(script_timeout, 10)
 


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to