Gitweb links:

...log 
http://git.netsurf-browser.org/libcss.git/shortlog/bfb92e00a220fc46dab265d5958d017c62d54351
...commit 
http://git.netsurf-browser.org/libcss.git/commit/bfb92e00a220fc46dab265d5958d017c62d54351
...tree 
http://git.netsurf-browser.org/libcss.git/tree/bfb92e00a220fc46dab265d5958d017c62d54351

The branch, master has been updated
       via  bfb92e00a220fc46dab265d5958d017c62d54351 (commit)
       via  be9acc6c80dfc41974425824b77585e45e4498e9 (commit)
       via  44225e55530fa5fb0199b369f3d1eb2eac4adf80 (commit)
      from  0504194e51a35a88ceba06288a6a2d8243b27516 (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/libcss.git/commit/?id=bfb92e00a220fc46dab265d5958d017c62d54351
commit bfb92e00a220fc46dab265d5958d017c62d54351
Author: Michael Drake <Michael Drake t...@netsurf-browser.org>
Commit: Michael Drake <Michael Drake t...@netsurf-browser.org>

    Add regression test for system font callback units.
    
    Thanks to Ralf Junker.

diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 33ba589..1a91e82 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -14069,3 +14069,112 @@ word-spacing: normal
 writing-mode: horizontal-tb
 z-index: auto
 #reset
+
+#tree
+| p*
+#ua
+p { font: special-system-font }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: "special-system-font" sans-serif
+font-size: 22pt
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: 33em
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
diff --git a/test/select.c b/test/select.c
index 664994e..33f31dd 100644
--- a/test/select.c
+++ b/test/select.c
@@ -509,6 +509,39 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, 
size_t len)
        }
 }
 
+static css_error css_font_resolution_func(void *pw, lwc_string *name,
+               css_system_font *system_font)
+{
+       lwc_error err;
+
+       if (system_font == NULL) {
+               return CSS_BADPARM;
+       }
+
+       (void)(pw);
+
+       if (strncmp(lwc_string_data(name), "special-system-font",
+                       lwc_string_length(name)) != 0) {
+               return CSS_INVALID;
+       }
+
+       system_font->style = CSS_FONT_STYLE_NORMAL;
+       system_font->variant = CSS_FONT_VARIANT_NORMAL;
+       system_font->weight = CSS_FONT_WEIGHT_NORMAL;
+       system_font->size.size = INTTOFIX(22);
+       system_font->size.unit = CSS_UNIT_PT;
+       system_font->line_height.size = INTTOFIX(33);
+       system_font->line_height.unit = CSS_UNIT_EM;
+       err = lwc_intern_string("special-system-font",
+                       strlen("special-system-font"),
+                       &system_font->family);
+       if (err != lwc_error_ok) {
+               return CSS_NOMEM;
+       }
+
+       return CSS_OK;
+}
+
 void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
 {
        css_stylesheet_params params;
@@ -559,7 +592,7 @@ void css__parse_sheet(line_ctx *ctx, const char *data, 
size_t len)
        params.import_pw = NULL;
        params.color = NULL;
        params.color_pw = NULL;
-       params.font = NULL;
+       params.font = css_font_resolution_func;
        params.font_pw = NULL;
 
        /** \todo How are we going to handle @import? */


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=be9acc6c80dfc41974425824b77585e45e4498e9
commit be9acc6c80dfc41974425824b77585e45e4498e9
Author: Michael Drake <Michael Drake t...@netsurf-browser.org>
Commit: Michael Drake <Michael Drake t...@netsurf-browser.org>

    parse: Squash leak of system font names.

diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index fce4012..681c613 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -290,6 +290,9 @@ css_error css__parse_font(css_language *c,
 
                error = parse_system_font(c, result, &system_font);
 
+               lwc_string_unref(system_font.family);
+               system_font.family = NULL;
+
                if (error == CSS_OK)
                        parserutils_vector_iterate(vector, ctx);
 


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=44225e55530fa5fb0199b369f3d1eb2eac4adf80
commit 44225e55530fa5fb0199b369f3d1eb2eac4adf80
Author: Michael Drake <Michael Drake t...@netsurf-browser.org>
Commit: Michael Drake <Michael Drake t...@netsurf-browser.org>

    parse: Perform client to parse unit conversion for system fonts.

diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 9903f75..fce4012 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -13,6 +13,45 @@
 #include "parse/properties/properties.h"
 #include "parse/properties/utils.h"
 
+/**
+ * Convert css_unit to a bytecode unit.
+ */
+static inline uint32_t css__to_parse_unit(css_unit u)
+{
+       switch (u) {
+       case CSS_UNIT_PX:   return UNIT_PX;
+       case CSS_UNIT_EX:   return UNIT_EX;
+       case CSS_UNIT_EM:   return UNIT_EM;
+       case CSS_UNIT_IN:   return UNIT_IN;
+       case CSS_UNIT_CM:   return UNIT_CM;
+       case CSS_UNIT_MM:   return UNIT_MM;
+       case CSS_UNIT_PT:   return UNIT_PT;
+       case CSS_UNIT_PC:   return UNIT_PC;
+       case CSS_UNIT_CAP:  return UNIT_CAP;
+       case CSS_UNIT_CH:   return UNIT_CH;
+       case CSS_UNIT_IC:   return UNIT_IC;
+       case CSS_UNIT_REM:  return UNIT_REM;
+       case CSS_UNIT_LH:   return UNIT_LH;
+       case CSS_UNIT_RLH:  return UNIT_RLH;
+       case CSS_UNIT_VH:   return UNIT_VH;
+       case CSS_UNIT_VW:   return UNIT_VW;
+       case CSS_UNIT_VI:   return UNIT_VI;
+       case CSS_UNIT_VB:   return UNIT_VB;
+       case CSS_UNIT_VMIN: return UNIT_VMIN;
+       case CSS_UNIT_VMAX: return UNIT_VMAX;
+       case CSS_UNIT_Q:    return UNIT_Q;
+       case CSS_UNIT_PCT:  return UNIT_PCT;
+       case CSS_UNIT_DEG:  return UNIT_DEG;
+       case CSS_UNIT_GRAD: return UNIT_GRAD;
+       case CSS_UNIT_RAD:  return UNIT_RAD;
+       case CSS_UNIT_MS:   return UNIT_MS;
+       case CSS_UNIT_S:    return UNIT_S;
+       case CSS_UNIT_HZ:   return UNIT_HZ;
+       case CSS_UNIT_KHZ:  return UNIT_KHZ;
+       }
+
+       return 0;
+}
 
 static css_error parse_system_font(css_language *c,
                css_style *result, css_system_font *system_font)
@@ -124,7 +163,9 @@ static css_error parse_system_font(css_language *c,
        if (error != CSS_OK)
                return error;
 
-       error = css__stylesheet_style_vappend(result, 2, 
system_font->size.size, system_font->size.unit);
+       error = css__stylesheet_style_vappend(result, 2,
+                       system_font->size.size,
+                       css__to_parse_unit(system_font->size.unit));
        if (error != CSS_OK)
                return error;
 
@@ -133,7 +174,9 @@ static css_error parse_system_font(css_language *c,
        if (error != CSS_OK)
                return error;
 
-       error = css__stylesheet_style_vappend(result, 2, 
system_font->line_height.size, system_font->line_height.unit);
+       error = css__stylesheet_style_vappend(result, 2,
+                       system_font->line_height.size,
+                       css__to_parse_unit(system_font->line_height.unit));
        if (error != CSS_OK)
                return error;
 


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

Summary of changes:
 src/parse/properties/font.c |   50 +++++++++++++++++++-
 test/data/select/tests1.dat |  109 +++++++++++++++++++++++++++++++++++++++++++
 test/select.c               |   35 +++++++++++++-
 3 files changed, 191 insertions(+), 3 deletions(-)

diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 9903f75..681c613 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -13,6 +13,45 @@
 #include "parse/properties/properties.h"
 #include "parse/properties/utils.h"
 
+/**
+ * Convert css_unit to a bytecode unit.
+ */
+static inline uint32_t css__to_parse_unit(css_unit u)
+{
+       switch (u) {
+       case CSS_UNIT_PX:   return UNIT_PX;
+       case CSS_UNIT_EX:   return UNIT_EX;
+       case CSS_UNIT_EM:   return UNIT_EM;
+       case CSS_UNIT_IN:   return UNIT_IN;
+       case CSS_UNIT_CM:   return UNIT_CM;
+       case CSS_UNIT_MM:   return UNIT_MM;
+       case CSS_UNIT_PT:   return UNIT_PT;
+       case CSS_UNIT_PC:   return UNIT_PC;
+       case CSS_UNIT_CAP:  return UNIT_CAP;
+       case CSS_UNIT_CH:   return UNIT_CH;
+       case CSS_UNIT_IC:   return UNIT_IC;
+       case CSS_UNIT_REM:  return UNIT_REM;
+       case CSS_UNIT_LH:   return UNIT_LH;
+       case CSS_UNIT_RLH:  return UNIT_RLH;
+       case CSS_UNIT_VH:   return UNIT_VH;
+       case CSS_UNIT_VW:   return UNIT_VW;
+       case CSS_UNIT_VI:   return UNIT_VI;
+       case CSS_UNIT_VB:   return UNIT_VB;
+       case CSS_UNIT_VMIN: return UNIT_VMIN;
+       case CSS_UNIT_VMAX: return UNIT_VMAX;
+       case CSS_UNIT_Q:    return UNIT_Q;
+       case CSS_UNIT_PCT:  return UNIT_PCT;
+       case CSS_UNIT_DEG:  return UNIT_DEG;
+       case CSS_UNIT_GRAD: return UNIT_GRAD;
+       case CSS_UNIT_RAD:  return UNIT_RAD;
+       case CSS_UNIT_MS:   return UNIT_MS;
+       case CSS_UNIT_S:    return UNIT_S;
+       case CSS_UNIT_HZ:   return UNIT_HZ;
+       case CSS_UNIT_KHZ:  return UNIT_KHZ;
+       }
+
+       return 0;
+}
 
 static css_error parse_system_font(css_language *c,
                css_style *result, css_system_font *system_font)
@@ -124,7 +163,9 @@ static css_error parse_system_font(css_language *c,
        if (error != CSS_OK)
                return error;
 
-       error = css__stylesheet_style_vappend(result, 2, 
system_font->size.size, system_font->size.unit);
+       error = css__stylesheet_style_vappend(result, 2,
+                       system_font->size.size,
+                       css__to_parse_unit(system_font->size.unit));
        if (error != CSS_OK)
                return error;
 
@@ -133,7 +174,9 @@ static css_error parse_system_font(css_language *c,
        if (error != CSS_OK)
                return error;
 
-       error = css__stylesheet_style_vappend(result, 2, 
system_font->line_height.size, system_font->line_height.unit);
+       error = css__stylesheet_style_vappend(result, 2,
+                       system_font->line_height.size,
+                       css__to_parse_unit(system_font->line_height.unit));
        if (error != CSS_OK)
                return error;
 
@@ -247,6 +290,9 @@ css_error css__parse_font(css_language *c,
 
                error = parse_system_font(c, result, &system_font);
 
+               lwc_string_unref(system_font.family);
+               system_font.family = NULL;
+
                if (error == CSS_OK)
                        parserutils_vector_iterate(vector, ctx);
 
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 33ba589..1a91e82 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -14069,3 +14069,112 @@ word-spacing: normal
 writing-mode: horizontal-tb
 z-index: auto
 #reset
+
+#tree
+| p*
+#ua
+p { font: special-system-font }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: "special-system-font" sans-serif
+font-size: 22pt
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: 33em
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
diff --git a/test/select.c b/test/select.c
index 664994e..33f31dd 100644
--- a/test/select.c
+++ b/test/select.c
@@ -509,6 +509,39 @@ void css__parse_tree_data(line_ctx *ctx, const char *data, 
size_t len)
        }
 }
 
+static css_error css_font_resolution_func(void *pw, lwc_string *name,
+               css_system_font *system_font)
+{
+       lwc_error err;
+
+       if (system_font == NULL) {
+               return CSS_BADPARM;
+       }
+
+       (void)(pw);
+
+       if (strncmp(lwc_string_data(name), "special-system-font",
+                       lwc_string_length(name)) != 0) {
+               return CSS_INVALID;
+       }
+
+       system_font->style = CSS_FONT_STYLE_NORMAL;
+       system_font->variant = CSS_FONT_VARIANT_NORMAL;
+       system_font->weight = CSS_FONT_WEIGHT_NORMAL;
+       system_font->size.size = INTTOFIX(22);
+       system_font->size.unit = CSS_UNIT_PT;
+       system_font->line_height.size = INTTOFIX(33);
+       system_font->line_height.unit = CSS_UNIT_EM;
+       err = lwc_intern_string("special-system-font",
+                       strlen("special-system-font"),
+                       &system_font->family);
+       if (err != lwc_error_ok) {
+               return CSS_NOMEM;
+       }
+
+       return CSS_OK;
+}
+
 void css__parse_sheet(line_ctx *ctx, const char *data, size_t len)
 {
        css_stylesheet_params params;
@@ -559,7 +592,7 @@ void css__parse_sheet(line_ctx *ctx, const char *data, 
size_t len)
        params.import_pw = NULL;
        params.color = NULL;
        params.color_pw = NULL;
-       params.font = NULL;
+       params.font = css_font_resolution_func;
        params.font_pw = NULL;
 
        /** \todo How are we going to handle @import? */


-- 
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to