Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7

The branch, tlsa/shared-styles has been updated
       via  6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7 (commit)
      from  fab01f4f1a11e0e2db971247a3dd8e00ccb9bcbe (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=6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7
commit 6e3e0dc16d05a632fdf42ccb4a68ed59b982ccc7
Author: Michael Drake <t...@netsurf-browser.org>
Commit: Michael Drake <t...@netsurf-browser.org>

    Work in Progress: Update for style-sharing LibCSS API.

diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index 69a1b2f..aaede77 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -253,6 +253,7 @@ static void nscss_dom_user_data_handler(dom_node_operation 
operation,
 css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
                uint64_t media, const css_stylesheet *inline_style)
 {
+       css_computed_style *composed;
        css_select_results *styles;
        int pseudo_element;
        css_error error;
@@ -274,11 +275,16 @@ css_select_results *nscss_get_style(nscss_select_ctx 
*ctx, dom_node *n,
                error = css_computed_style_compose(ctx->parent_style,
                                styles->styles[CSS_PSEUDO_ELEMENT_NONE],
                                nscss_compute_font_size, NULL,
-                               styles->styles[CSS_PSEUDO_ELEMENT_NONE]);
+                               &composed);
                if (error != CSS_OK) {
                        css_select_results_destroy(styles);
                        return NULL;
                }
+
+               /* Replace select_results style with composed style */
+               css_computed_style_destroy(
+                               styles->styles[CSS_PSEUDO_ELEMENT_NONE]);
+               styles->styles[CSS_PSEUDO_ELEMENT_NONE] = composed;
        }
 
        for (pseudo_element = CSS_PSEUDO_ELEMENT_NONE + 1;
@@ -301,40 +307,20 @@ css_select_results *nscss_get_style(nscss_select_ctx 
*ctx, dom_node *n,
                                styles->styles[CSS_PSEUDO_ELEMENT_NONE],
                                styles->styles[pseudo_element],
                                nscss_compute_font_size, NULL,
-                               styles->styles[pseudo_element]);
+                               &composed);
                if (error != CSS_OK) {
                        /* TODO: perhaps this shouldn't be quite so
                         * catastrophic? */
                        css_select_results_destroy(styles);
                        return NULL;
                }
-       }
-
-       return styles;
-}
-
-/**
- * Get an initial style
- *
- * \param ctx    CSS selection context
- * \return Pointer to partial computed style, or NULL on failure
- */
-static css_computed_style *nscss_get_initial_style(nscss_select_ctx *ctx)
-{
-       css_computed_style *style;
-       css_error error;
-
-       error = css_computed_style_create(&style);
-       if (error != CSS_OK)
-               return NULL;
 
-       error = css_computed_style_initialise(style, &selection_handler, ctx);
-       if (error != CSS_OK) {
-               css_computed_style_destroy(style);
-               return NULL;
+               /* Replace select_results style with composed style */
+               css_computed_style_destroy(styles->styles[pseudo_element]);
+               styles->styles[pseudo_element] = composed;
        }
 
-       return style;
+       return styles;
 }
 
 /**
@@ -347,21 +333,26 @@ static css_computed_style 
*nscss_get_initial_style(nscss_select_ctx *ctx)
 css_computed_style *nscss_get_blank_style(nscss_select_ctx *ctx,
                const css_computed_style *parent)
 {
-       css_computed_style *partial;
+       css_computed_style *partial, *composed;
        css_error error;
 
-       partial = nscss_get_initial_style(ctx);
-       if (partial == NULL)
+       error = css_select_default_style(ctx->ctx,
+                       &selection_handler, ctx, &partial);
+       if (error != CSS_OK) {
                return NULL;
+       }
 
+       /* TODO: Do we really need to compose?  Initial style shouldn't
+        * have any inherited properties. */
        error = css_computed_style_compose(parent, partial,
-                       nscss_compute_font_size, NULL, partial);
+                       nscss_compute_font_size, NULL, &composed);
+       css_computed_style_destroy(partial);
        if (error != CSS_OK) {
-               css_computed_style_destroy(partial);
+               css_computed_style_destroy(composed);
                return NULL;
        }
 
-       return partial;
+       return composed;
 }
 
 /**


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

Summary of changes:
 content/handlers/css/select.c |   55 +++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 32 deletions(-)

diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index 69a1b2f..aaede77 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -253,6 +253,7 @@ static void nscss_dom_user_data_handler(dom_node_operation 
operation,
 css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
                uint64_t media, const css_stylesheet *inline_style)
 {
+       css_computed_style *composed;
        css_select_results *styles;
        int pseudo_element;
        css_error error;
@@ -274,11 +275,16 @@ css_select_results *nscss_get_style(nscss_select_ctx 
*ctx, dom_node *n,
                error = css_computed_style_compose(ctx->parent_style,
                                styles->styles[CSS_PSEUDO_ELEMENT_NONE],
                                nscss_compute_font_size, NULL,
-                               styles->styles[CSS_PSEUDO_ELEMENT_NONE]);
+                               &composed);
                if (error != CSS_OK) {
                        css_select_results_destroy(styles);
                        return NULL;
                }
+
+               /* Replace select_results style with composed style */
+               css_computed_style_destroy(
+                               styles->styles[CSS_PSEUDO_ELEMENT_NONE]);
+               styles->styles[CSS_PSEUDO_ELEMENT_NONE] = composed;
        }
 
        for (pseudo_element = CSS_PSEUDO_ELEMENT_NONE + 1;
@@ -301,40 +307,20 @@ css_select_results *nscss_get_style(nscss_select_ctx 
*ctx, dom_node *n,
                                styles->styles[CSS_PSEUDO_ELEMENT_NONE],
                                styles->styles[pseudo_element],
                                nscss_compute_font_size, NULL,
-                               styles->styles[pseudo_element]);
+                               &composed);
                if (error != CSS_OK) {
                        /* TODO: perhaps this shouldn't be quite so
                         * catastrophic? */
                        css_select_results_destroy(styles);
                        return NULL;
                }
-       }
-
-       return styles;
-}
-
-/**
- * Get an initial style
- *
- * \param ctx    CSS selection context
- * \return Pointer to partial computed style, or NULL on failure
- */
-static css_computed_style *nscss_get_initial_style(nscss_select_ctx *ctx)
-{
-       css_computed_style *style;
-       css_error error;
-
-       error = css_computed_style_create(&style);
-       if (error != CSS_OK)
-               return NULL;
 
-       error = css_computed_style_initialise(style, &selection_handler, ctx);
-       if (error != CSS_OK) {
-               css_computed_style_destroy(style);
-               return NULL;
+               /* Replace select_results style with composed style */
+               css_computed_style_destroy(styles->styles[pseudo_element]);
+               styles->styles[pseudo_element] = composed;
        }
 
-       return style;
+       return styles;
 }
 
 /**
@@ -347,21 +333,26 @@ static css_computed_style 
*nscss_get_initial_style(nscss_select_ctx *ctx)
 css_computed_style *nscss_get_blank_style(nscss_select_ctx *ctx,
                const css_computed_style *parent)
 {
-       css_computed_style *partial;
+       css_computed_style *partial, *composed;
        css_error error;
 
-       partial = nscss_get_initial_style(ctx);
-       if (partial == NULL)
+       error = css_select_default_style(ctx->ctx,
+                       &selection_handler, ctx, &partial);
+       if (error != CSS_OK) {
                return NULL;
+       }
 
+       /* TODO: Do we really need to compose?  Initial style shouldn't
+        * have any inherited properties. */
        error = css_computed_style_compose(parent, partial,
-                       nscss_compute_font_size, NULL, partial);
+                       nscss_compute_font_size, NULL, &composed);
+       css_computed_style_destroy(partial);
        if (error != CSS_OK) {
-               css_computed_style_destroy(partial);
+               css_computed_style_destroy(composed);
                return NULL;
        }
 
-       return partial;
+       return composed;
 }
 
 /**


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
netsurf-commits@netsurf-browser.org
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to