netsurf: branch master updated. release/3.10-327-g0c25ae5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0c25ae5e8eb38b3b888a9...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0c25ae5e8eb38b3b888a9bf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0c25ae5e8eb38b3b888a9bfdc...
The branch, master has been updated
via 0c25ae5e8eb38b3b888a9bfdc0fcc6d53af17b04 (commit)
via 1d82ef411a65095f218c15441fb804715e59f0eb (commit)
via 6780766fb7c27145415baa2c40251e386b3e894a (commit)
from 3d739479ea760b948a95edf759d0dc080e26b035 (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=0c25ae5e8eb38b3b888...
commit 0c25ae5e8eb38b3b888a9bfdc0fcc6d53af17b04
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove the ambiguity around the reallocation in utf8_to_html()
diff --git a/utils/utf8.c b/utils/utf8.c
index 7aa7d93..84918cc 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -365,11 +365,11 @@ utf8_convert_html_chunk(iconv_t cd,
/* exported interface documented in utils/utf8.h */
nserror
-utf8_to_html(const char *string, const char *encname, size_t len, char **result)
+utf8_to_html(const char *string, const char *encname, size_t len, char **result_out)
{
iconv_t cd;
const char *in;
- char *out, *origout;
+ char *out, *origout, *result;
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
@@ -452,11 +452,12 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
outlen -= 4;
/* Shrink-wrap */
- *result = realloc(origout, origoutlen - outlen);
- if (*result == NULL) {
+ result = realloc(origout, origoutlen - outlen);
+ if (result == NULL) {
free(origout);
return NSERROR_NOMEM;
}
+ *result_out = result;
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1d82ef411a65095f218...
commit 1d82ef411a65095f218c15441fb804715e59f0eb
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
consolodate duplicated conversion descriptor cache code
diff --git a/utils/utf8.c b/utils/utf8.c
index 84cacd7..7aa7d93 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -44,7 +44,7 @@ uint32_t utf8_to_ucs4(const char *s_in, size_t l)
parserutils_error perror;
perror = parserutils_charset_utf8_to_ucs4((const uint8_t *) s_in, l,
- &ucs4, &len);
+ &ucs4, &len);
if (perror != PARSERUTILS_OK)
ucs4 = 0xfffd;
@@ -106,7 +106,7 @@ size_t utf8_char_byte_length(const char *s)
parserutils_error perror;
perror = parserutils_charset_utf8_char_byte_length((const uint8_t *) s,
- &len);
+ &len);
assert(perror == PARSERUTILS_OK);
return len;
@@ -131,7 +131,7 @@ size_t utf8_next(const char *s, size_t l, size_t o)
parserutils_error perror;
perror = parserutils_charset_utf8_next((const uint8_t *) s, l, o,
- &next);
+ &next);
assert(perror == PARSERUTILS_OK);
return next;
@@ -151,6 +151,47 @@ static inline void utf8_clear_cd_cache(void)
last_cd.cd = 0;
}
+/**
+ * obtain a cached conversion descriptor
+ *
+ * either return the cached conversion descriptor or create one if required
+ */
+static nserror
+get_cached_cd(const char *enc_from, const char *enc_to, iconv_t *cd_out)
+{
+ iconv_t cd;
+ /* we cache the last used conversion descriptor,
+ * so check if we're trying to use it here */
+ if (strncasecmp(last_cd.from, enc_from, sizeof(last_cd.from)) == 0 &&
+ strncasecmp(last_cd.to, enc_to, sizeof(last_cd.to)) == 0 &&
+ last_cd.cd != 0) {
+ *cd_out = last_cd.cd;
+ return NSERROR_OK;
+ }
+
+ /* no match, so create a new cd */
+ cd = iconv_open(enc_to, enc_from);
+ if (cd == (iconv_t) -1) {
+ if (errno == EINVAL) {
+ return NSERROR_BAD_ENCODING;
+ }
+ /* default to no memory */
+ return NSERROR_NOMEM;
+ }
+
+ /* close the last cd - we don't care if this fails */
+ if (last_cd.cd) {
+ iconv_close(last_cd.cd);
+ }
+
+ /* and safely copy the to/from/cd data into last_cd */
+ snprintf(last_cd.from, sizeof(last_cd.from), enc_from);
+ snprintf(last_cd.to, sizeof(last_cd.to), "%s", enc_to);
+ *cd_out = last_cd.cd = cd;
+
+ return NSERROR_OK;
+}
+
/* exported interface documented in utils/utf8.h */
nserror utf8_finalise(void)
{
@@ -187,6 +228,7 @@ utf8_convert(const char *string,
iconv_t cd;
char *temp, *out, *in, *result;
size_t result_len;
+ nserror res;
assert(string && from && to && result_out);
@@ -215,29 +257,9 @@ utf8_convert(const char *string,
in = (char *)string;
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, from, sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(to, from);
- if (cd == (iconv_t)-1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "%s", from);
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", to);
- last_cd.cd = cd;
+ res = get_cached_cd(from, to, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case = ASCII -> UCS4, so allocate an output buffer
@@ -289,14 +311,14 @@ utf8_convert(const char *string,
/* exported interface documented in utils/utf8.h */
nserror utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
+ size_t len, char **result)
{
return utf8_convert(string, len, "UTF-8", encname, result, NULL);
}
/* exported interface documented in utils/utf8.h */
nserror utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result, size_t *result_len)
+ size_t len, char **result, size_t *result_len)
{
return utf8_convert(string, len, encname, "UTF-8", result, result_len);
}
@@ -327,7 +349,7 @@ utf8_convert_html_chunk(iconv_t cd,
esclen = snprintf(escape, sizeof(escape), "&#x%06x;", ucs4);
pescape = escape;
ret = iconv(cd, (void *) &pescape, &esclen,
- (void *) out, outlen);
+ (void *) out, outlen);
if (ret == (size_t) -1)
return NSERROR_NOMEM;
@@ -339,6 +361,8 @@ utf8_convert_html_chunk(iconv_t cd,
return NSERROR_OK;
}
+
+
/* exported interface documented in utils/utf8.h */
nserror
utf8_to_html(const char *string, const char *encname, size_t len, char **result)
@@ -349,35 +373,14 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
+ nserror res;
if (len == 0)
len = strlen(string);
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, "UTF-8", sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, encname,
- sizeof(last_cd.to)) == 0 &&
- last_cd.cd != 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(encname, "UTF-8");
- if (cd == (iconv_t) -1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and safely copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "UTF-8");
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", encname);
- last_cd.cd = cd;
+ res = get_cached_cd("UTF-8", encname, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case is ASCII -> UCS4, with all characters escaped:
@@ -397,13 +400,13 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
while (off < len) {
/* Must escape '&', '<', and '>' */
if (string[off] == '&' || string[off] == '<' ||
- string[off] == '>') {
+ string[off] == '>') {
if (off - prev_off > 0) {
/* Emit chunk */
in = string + prev_off;
inlen = off - prev_off;
ret = utf8_convert_html_chunk(cd, in, inlen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -414,10 +417,10 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
/* Emit mandatory escape */
esclen = snprintf(escape, sizeof(escape),
- "&#x%06x;", string[off]);
+ "&#x%06x;", string[off]);
pescape = escape;
ret = utf8_convert_html_chunk(cd, pescape, esclen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6780766fb7c27145415...
commit 6780766fb7c27145415baa2c40251e386b3e894a
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Improve utf8 conversion function
Newer compilers were (correctly) pointing out use after free.
Slightly reworkeed conversion function to remove compiler warnings
and clean up implementation.
diff --git a/utils/utf8.c b/utils/utf8.c
index f0ac0c9..84cacd7 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -168,49 +168,47 @@ nserror utf8_finalise(void)
* Convert a string from one encoding to another
*
* \param string The NULL-terminated string to convert
- * \param len Length of input string to consider (in bytes), or 0
+ * \param slen Length of input string to consider (in bytes), or 0
* \param from The encoding name to convert from
* \param to The encoding name to convert to
- * \param result Pointer to location in which to store result.
- * \param result_len Pointer to location in which to store result length.
+ * \param result_out Pointer to location in which to store result.
+ * \param result_len_out Pointer to location in which to store result length.
* \return NSERROR_OK for no error, NSERROR_NOMEM on allocation error,
* NSERROR_BAD_ENCODING for a bad character encoding
*/
static nserror
utf8_convert(const char *string,
- size_t len,
+ size_t slen,
const char *from,
const char *to,
- char **result,
- size_t *result_len)
+ char **result_out,
+ size_t *result_len_out)
{
iconv_t cd;
- char *temp, *out, *in;
- size_t slen, rlen;
-
- assert(string && from && to && result);
-
- if (string[0] == '\0') {
- /* On AmigaOS, iconv() returns an error if we pass an
- * empty string. This prevents iconv() being called as
- * there is no conversion necessary anyway. */
- *result = strdup("");
- if (!(*result)) {
- *result = NULL;
- return NSERROR_NOMEM;
- }
+ char *temp, *out, *in, *result;
+ size_t result_len;
- return NSERROR_OK;
+ assert(string && from && to && result_out);
+
+ /* calculate the source length if not given */
+ if (slen==0) {
+ slen = strlen(string);
}
- if (strcasecmp(from, to) == 0) {
- /* conversion from an encoding to itself == strdup */
- slen = len ? len : strlen(string);
- *(result) = strndup(string, slen);
- if (!(*result)) {
- *(result) = NULL;
+ /* process the empty string separately avoiding any conversion
+ * check for the source and destination encoding being the same
+ *
+ * This optimisation is necessary on AmigaOS as iconv()
+ * returns an error if an empty string is passed.
+ */
+ if ((slen == 0) || (strcasecmp(from, to) == 0)) {
+ *result_out = strndup(string, slen);
+ if (*result_out == NULL) {
return NSERROR_NOMEM;
}
+ if (result_len_out != NULL) {
+ *result_len_out = slen;
+ }
return NSERROR_OK;
}
@@ -220,10 +218,9 @@ utf8_convert(const char *string,
/* we cache the last used conversion descriptor,
* so check if we're trying to use it here */
if (strncasecmp(last_cd.from, from, sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
+ strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
cd = last_cd.cd;
- }
- else {
+ } else {
/* no match, so create a new cd */
cd = iconv_open(to, from);
if (cd == (iconv_t)-1) {
@@ -243,20 +240,19 @@ utf8_convert(const char *string,
last_cd.cd = cd;
}
- slen = len ? len : strlen(string);
/* Worst case = ASCII -> UCS4, so allocate an output buffer
* 4 times larger than the input buffer, and add 4 bytes at
* the end for the NULL terminator
*/
- rlen = slen * 4 + 4;
+ result_len = slen * 4 + 4;
- temp = out = malloc(rlen);
+ temp = out = malloc(result_len);
if (!out) {
return NSERROR_NOMEM;
}
/* perform conversion */
- if (iconv(cd, (void *) &in, &slen, &out, &rlen) == (size_t)-1) {
+ if (iconv(cd, (void *) &in, &slen, &out, &result_len) == (size_t)-1) {
free(temp);
/* clear the cached conversion descriptor as it's invalid */
if (last_cd.cd)
@@ -270,19 +266,22 @@ utf8_convert(const char *string,
return NSERROR_NOMEM;
}
- *(result) = realloc(temp, out - temp + 4);
- if (!(*result)) {
+ result_len = out - temp;
+
+ /* resize buffer allowing for null termination */
+ result = realloc(temp, result_len + 4);
+ if (result == NULL) {
free(temp);
- *(result) = NULL; /* for sanity's sake */
return NSERROR_NOMEM;
}
/* NULL terminate - needs 4 characters as we may have
* converted to UTF-32 */
- memset((*result) + (out - temp), 0, 4);
+ memset(result + result_len, 0, 4);
- if (result_len != NULL) {
- *result_len = (out - temp);
+ *result_out = result;
+ if (result_len_out != NULL) {
+ *result_len_out = result_len;
}
return NSERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
utils/utf8.c | 203 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 103 insertions(+), 100 deletions(-)
diff --git a/utils/utf8.c b/utils/utf8.c
index f0ac0c9..84918cc 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -44,7 +44,7 @@ uint32_t utf8_to_ucs4(const char *s_in, size_t l)
parserutils_error perror;
perror = parserutils_charset_utf8_to_ucs4((const uint8_t *) s_in, l,
- &ucs4, &len);
+ &ucs4, &len);
if (perror != PARSERUTILS_OK)
ucs4 = 0xfffd;
@@ -106,7 +106,7 @@ size_t utf8_char_byte_length(const char *s)
parserutils_error perror;
perror = parserutils_charset_utf8_char_byte_length((const uint8_t *) s,
- &len);
+ &len);
assert(perror == PARSERUTILS_OK);
return len;
@@ -131,7 +131,7 @@ size_t utf8_next(const char *s, size_t l, size_t o)
parserutils_error perror;
perror = parserutils_charset_utf8_next((const uint8_t *) s, l, o,
- &next);
+ &next);
assert(perror == PARSERUTILS_OK);
return next;
@@ -151,6 +151,47 @@ static inline void utf8_clear_cd_cache(void)
last_cd.cd = 0;
}
+/**
+ * obtain a cached conversion descriptor
+ *
+ * either return the cached conversion descriptor or create one if required
+ */
+static nserror
+get_cached_cd(const char *enc_from, const char *enc_to, iconv_t *cd_out)
+{
+ iconv_t cd;
+ /* we cache the last used conversion descriptor,
+ * so check if we're trying to use it here */
+ if (strncasecmp(last_cd.from, enc_from, sizeof(last_cd.from)) == 0 &&
+ strncasecmp(last_cd.to, enc_to, sizeof(last_cd.to)) == 0 &&
+ last_cd.cd != 0) {
+ *cd_out = last_cd.cd;
+ return NSERROR_OK;
+ }
+
+ /* no match, so create a new cd */
+ cd = iconv_open(enc_to, enc_from);
+ if (cd == (iconv_t) -1) {
+ if (errno == EINVAL) {
+ return NSERROR_BAD_ENCODING;
+ }
+ /* default to no memory */
+ return NSERROR_NOMEM;
+ }
+
+ /* close the last cd - we don't care if this fails */
+ if (last_cd.cd) {
+ iconv_close(last_cd.cd);
+ }
+
+ /* and safely copy the to/from/cd data into last_cd */
+ snprintf(last_cd.from, sizeof(last_cd.from), enc_from);
+ snprintf(last_cd.to, sizeof(last_cd.to), "%s", enc_to);
+ *cd_out = last_cd.cd = cd;
+
+ return NSERROR_OK;
+}
+
/* exported interface documented in utils/utf8.h */
nserror utf8_finalise(void)
{
@@ -168,95 +209,72 @@ nserror utf8_finalise(void)
* Convert a string from one encoding to another
*
* \param string The NULL-terminated string to convert
- * \param len Length of input string to consider (in bytes), or 0
+ * \param slen Length of input string to consider (in bytes), or 0
* \param from The encoding name to convert from
* \param to The encoding name to convert to
- * \param result Pointer to location in which to store result.
- * \param result_len Pointer to location in which to store result length.
+ * \param result_out Pointer to location in which to store result.
+ * \param result_len_out Pointer to location in which to store result length.
* \return NSERROR_OK for no error, NSERROR_NOMEM on allocation error,
* NSERROR_BAD_ENCODING for a bad character encoding
*/
static nserror
utf8_convert(const char *string,
- size_t len,
+ size_t slen,
const char *from,
const char *to,
- char **result,
- size_t *result_len)
+ char **result_out,
+ size_t *result_len_out)
{
iconv_t cd;
- char *temp, *out, *in;
- size_t slen, rlen;
-
- assert(string && from && to && result);
-
- if (string[0] == '\0') {
- /* On AmigaOS, iconv() returns an error if we pass an
- * empty string. This prevents iconv() being called as
- * there is no conversion necessary anyway. */
- *result = strdup("");
- if (!(*result)) {
- *result = NULL;
- return NSERROR_NOMEM;
- }
+ char *temp, *out, *in, *result;
+ size_t result_len;
+ nserror res;
- return NSERROR_OK;
+ assert(string && from && to && result_out);
+
+ /* calculate the source length if not given */
+ if (slen==0) {
+ slen = strlen(string);
}
- if (strcasecmp(from, to) == 0) {
- /* conversion from an encoding to itself == strdup */
- slen = len ? len : strlen(string);
- *(result) = strndup(string, slen);
- if (!(*result)) {
- *(result) = NULL;
+ /* process the empty string separately avoiding any conversion
+ * check for the source and destination encoding being the same
+ *
+ * This optimisation is necessary on AmigaOS as iconv()
+ * returns an error if an empty string is passed.
+ */
+ if ((slen == 0) || (strcasecmp(from, to) == 0)) {
+ *result_out = strndup(string, slen);
+ if (*result_out == NULL) {
return NSERROR_NOMEM;
}
+ if (result_len_out != NULL) {
+ *result_len_out = slen;
+ }
return NSERROR_OK;
}
in = (char *)string;
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, from, sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
- cd = last_cd.cd;
- }
- else {
- /* no match, so create a new cd */
- cd = iconv_open(to, from);
- if (cd == (iconv_t)-1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "%s", from);
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", to);
- last_cd.cd = cd;
+ res = get_cached_cd(from, to, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
- slen = len ? len : strlen(string);
/* Worst case = ASCII -> UCS4, so allocate an output buffer
* 4 times larger than the input buffer, and add 4 bytes at
* the end for the NULL terminator
*/
- rlen = slen * 4 + 4;
+ result_len = slen * 4 + 4;
- temp = out = malloc(rlen);
+ temp = out = malloc(result_len);
if (!out) {
return NSERROR_NOMEM;
}
/* perform conversion */
- if (iconv(cd, (void *) &in, &slen, &out, &rlen) == (size_t)-1) {
+ if (iconv(cd, (void *) &in, &slen, &out, &result_len) == (size_t)-1) {
free(temp);
/* clear the cached conversion descriptor as it's invalid */
if (last_cd.cd)
@@ -270,19 +288,22 @@ utf8_convert(const char *string,
return NSERROR_NOMEM;
}
- *(result) = realloc(temp, out - temp + 4);
- if (!(*result)) {
+ result_len = out - temp;
+
+ /* resize buffer allowing for null termination */
+ result = realloc(temp, result_len + 4);
+ if (result == NULL) {
free(temp);
- *(result) = NULL; /* for sanity's sake */
return NSERROR_NOMEM;
}
/* NULL terminate - needs 4 characters as we may have
* converted to UTF-32 */
- memset((*result) + (out - temp), 0, 4);
+ memset(result + result_len, 0, 4);
- if (result_len != NULL) {
- *result_len = (out - temp);
+ *result_out = result;
+ if (result_len_out != NULL) {
+ *result_len_out = result_len;
}
return NSERROR_OK;
@@ -290,14 +311,14 @@ utf8_convert(const char *string,
/* exported interface documented in utils/utf8.h */
nserror utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
+ size_t len, char **result)
{
return utf8_convert(string, len, "UTF-8", encname, result, NULL);
}
/* exported interface documented in utils/utf8.h */
nserror utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result, size_t *result_len)
+ size_t len, char **result, size_t *result_len)
{
return utf8_convert(string, len, encname, "UTF-8", result, result_len);
}
@@ -328,7 +349,7 @@ utf8_convert_html_chunk(iconv_t cd,
esclen = snprintf(escape, sizeof(escape), "&#x%06x;", ucs4);
pescape = escape;
ret = iconv(cd, (void *) &pescape, &esclen,
- (void *) out, outlen);
+ (void *) out, outlen);
if (ret == (size_t) -1)
return NSERROR_NOMEM;
@@ -340,45 +361,26 @@ utf8_convert_html_chunk(iconv_t cd,
return NSERROR_OK;
}
+
+
/* exported interface documented in utils/utf8.h */
nserror
-utf8_to_html(const char *string, const char *encname, size_t len, char **result)
+utf8_to_html(const char *string, const char *encname, size_t len, char **result_out)
{
iconv_t cd;
const char *in;
- char *out, *origout;
+ char *out, *origout, *result;
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
+ nserror res;
if (len == 0)
len = strlen(string);
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, "UTF-8", sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, encname,
- sizeof(last_cd.to)) == 0 &&
- last_cd.cd != 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(encname, "UTF-8");
- if (cd == (iconv_t) -1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and safely copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "UTF-8");
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", encname);
- last_cd.cd = cd;
+ res = get_cached_cd("UTF-8", encname, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case is ASCII -> UCS4, with all characters escaped:
@@ -398,13 +400,13 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
while (off < len) {
/* Must escape '&', '<', and '>' */
if (string[off] == '&' || string[off] == '<' ||
- string[off] == '>') {
+ string[off] == '>') {
if (off - prev_off > 0) {
/* Emit chunk */
in = string + prev_off;
inlen = off - prev_off;
ret = utf8_convert_html_chunk(cd, in, inlen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -415,10 +417,10 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
/* Emit mandatory escape */
esclen = snprintf(escape, sizeof(escape),
- "&#x%06x;", string[off]);
+ "&#x%06x;", string[off]);
pescape = escape;
ret = utf8_convert_html_chunk(cd, pescape, esclen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -450,11 +452,12 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
outlen -= 4;
/* Shrink-wrap */
- *result = realloc(origout, origoutlen - outlen);
- if (*result == NULL) {
+ result = realloc(origout, origoutlen - outlen);
+ if (result == NULL) {
free(origout);
return NSERROR_NOMEM;
}
+ *result_out = result;
return NSERROR_OK;
}
--
NetSurf Browser
4 months
netsurf: branch vince/fix-gcc12-warnings updated. release/3.10-326-g5b63441
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5b6344182634b08e15866...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5b6344182634b08e1586682...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5b6344182634b08e1586682c1...
The branch, vince/fix-gcc12-warnings has been updated
via 5b6344182634b08e1586682c1c76a0a88d49a24c (commit)
via 109527d02fd3aeef09bf82a450ecb0e3ed86f8ea (commit)
from 3e14db3dc84dbf38898a6efcb5b180b47b4308f5 (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=5b6344182634b08e158...
commit 5b6344182634b08e1586682c1c76a0a88d49a24c
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove the ambiguity around the reallocation in utf8_to_html()
diff --git a/utils/utf8.c b/utils/utf8.c
index 7aa7d93..84918cc 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -365,11 +365,11 @@ utf8_convert_html_chunk(iconv_t cd,
/* exported interface documented in utils/utf8.h */
nserror
-utf8_to_html(const char *string, const char *encname, size_t len, char **result)
+utf8_to_html(const char *string, const char *encname, size_t len, char **result_out)
{
iconv_t cd;
const char *in;
- char *out, *origout;
+ char *out, *origout, *result;
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
@@ -452,11 +452,12 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
outlen -= 4;
/* Shrink-wrap */
- *result = realloc(origout, origoutlen - outlen);
- if (*result == NULL) {
+ result = realloc(origout, origoutlen - outlen);
+ if (result == NULL) {
free(origout);
return NSERROR_NOMEM;
}
+ *result_out = result;
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=109527d02fd3aeef09b...
commit 109527d02fd3aeef09bf82a450ecb0e3ed86f8ea
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
consolodate duplicated conversion descriptor cache code
diff --git a/utils/utf8.c b/utils/utf8.c
index 84cacd7..7aa7d93 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -44,7 +44,7 @@ uint32_t utf8_to_ucs4(const char *s_in, size_t l)
parserutils_error perror;
perror = parserutils_charset_utf8_to_ucs4((const uint8_t *) s_in, l,
- &ucs4, &len);
+ &ucs4, &len);
if (perror != PARSERUTILS_OK)
ucs4 = 0xfffd;
@@ -106,7 +106,7 @@ size_t utf8_char_byte_length(const char *s)
parserutils_error perror;
perror = parserutils_charset_utf8_char_byte_length((const uint8_t *) s,
- &len);
+ &len);
assert(perror == PARSERUTILS_OK);
return len;
@@ -131,7 +131,7 @@ size_t utf8_next(const char *s, size_t l, size_t o)
parserutils_error perror;
perror = parserutils_charset_utf8_next((const uint8_t *) s, l, o,
- &next);
+ &next);
assert(perror == PARSERUTILS_OK);
return next;
@@ -151,6 +151,47 @@ static inline void utf8_clear_cd_cache(void)
last_cd.cd = 0;
}
+/**
+ * obtain a cached conversion descriptor
+ *
+ * either return the cached conversion descriptor or create one if required
+ */
+static nserror
+get_cached_cd(const char *enc_from, const char *enc_to, iconv_t *cd_out)
+{
+ iconv_t cd;
+ /* we cache the last used conversion descriptor,
+ * so check if we're trying to use it here */
+ if (strncasecmp(last_cd.from, enc_from, sizeof(last_cd.from)) == 0 &&
+ strncasecmp(last_cd.to, enc_to, sizeof(last_cd.to)) == 0 &&
+ last_cd.cd != 0) {
+ *cd_out = last_cd.cd;
+ return NSERROR_OK;
+ }
+
+ /* no match, so create a new cd */
+ cd = iconv_open(enc_to, enc_from);
+ if (cd == (iconv_t) -1) {
+ if (errno == EINVAL) {
+ return NSERROR_BAD_ENCODING;
+ }
+ /* default to no memory */
+ return NSERROR_NOMEM;
+ }
+
+ /* close the last cd - we don't care if this fails */
+ if (last_cd.cd) {
+ iconv_close(last_cd.cd);
+ }
+
+ /* and safely copy the to/from/cd data into last_cd */
+ snprintf(last_cd.from, sizeof(last_cd.from), enc_from);
+ snprintf(last_cd.to, sizeof(last_cd.to), "%s", enc_to);
+ *cd_out = last_cd.cd = cd;
+
+ return NSERROR_OK;
+}
+
/* exported interface documented in utils/utf8.h */
nserror utf8_finalise(void)
{
@@ -187,6 +228,7 @@ utf8_convert(const char *string,
iconv_t cd;
char *temp, *out, *in, *result;
size_t result_len;
+ nserror res;
assert(string && from && to && result_out);
@@ -215,29 +257,9 @@ utf8_convert(const char *string,
in = (char *)string;
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, from, sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(to, from);
- if (cd == (iconv_t)-1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "%s", from);
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", to);
- last_cd.cd = cd;
+ res = get_cached_cd(from, to, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case = ASCII -> UCS4, so allocate an output buffer
@@ -289,14 +311,14 @@ utf8_convert(const char *string,
/* exported interface documented in utils/utf8.h */
nserror utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
+ size_t len, char **result)
{
return utf8_convert(string, len, "UTF-8", encname, result, NULL);
}
/* exported interface documented in utils/utf8.h */
nserror utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result, size_t *result_len)
+ size_t len, char **result, size_t *result_len)
{
return utf8_convert(string, len, encname, "UTF-8", result, result_len);
}
@@ -327,7 +349,7 @@ utf8_convert_html_chunk(iconv_t cd,
esclen = snprintf(escape, sizeof(escape), "&#x%06x;", ucs4);
pescape = escape;
ret = iconv(cd, (void *) &pescape, &esclen,
- (void *) out, outlen);
+ (void *) out, outlen);
if (ret == (size_t) -1)
return NSERROR_NOMEM;
@@ -339,6 +361,8 @@ utf8_convert_html_chunk(iconv_t cd,
return NSERROR_OK;
}
+
+
/* exported interface documented in utils/utf8.h */
nserror
utf8_to_html(const char *string, const char *encname, size_t len, char **result)
@@ -349,35 +373,14 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
+ nserror res;
if (len == 0)
len = strlen(string);
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, "UTF-8", sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, encname,
- sizeof(last_cd.to)) == 0 &&
- last_cd.cd != 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(encname, "UTF-8");
- if (cd == (iconv_t) -1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and safely copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "UTF-8");
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", encname);
- last_cd.cd = cd;
+ res = get_cached_cd("UTF-8", encname, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case is ASCII -> UCS4, with all characters escaped:
@@ -397,13 +400,13 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
while (off < len) {
/* Must escape '&', '<', and '>' */
if (string[off] == '&' || string[off] == '<' ||
- string[off] == '>') {
+ string[off] == '>') {
if (off - prev_off > 0) {
/* Emit chunk */
in = string + prev_off;
inlen = off - prev_off;
ret = utf8_convert_html_chunk(cd, in, inlen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -414,10 +417,10 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
/* Emit mandatory escape */
esclen = snprintf(escape, sizeof(escape),
- "&#x%06x;", string[off]);
+ "&#x%06x;", string[off]);
pescape = escape;
ret = utf8_convert_html_chunk(cd, pescape, esclen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
-----------------------------------------------------------------------
Summary of changes:
utils/utf8.c | 128 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 66 insertions(+), 62 deletions(-)
diff --git a/utils/utf8.c b/utils/utf8.c
index 84cacd7..84918cc 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -44,7 +44,7 @@ uint32_t utf8_to_ucs4(const char *s_in, size_t l)
parserutils_error perror;
perror = parserutils_charset_utf8_to_ucs4((const uint8_t *) s_in, l,
- &ucs4, &len);
+ &ucs4, &len);
if (perror != PARSERUTILS_OK)
ucs4 = 0xfffd;
@@ -106,7 +106,7 @@ size_t utf8_char_byte_length(const char *s)
parserutils_error perror;
perror = parserutils_charset_utf8_char_byte_length((const uint8_t *) s,
- &len);
+ &len);
assert(perror == PARSERUTILS_OK);
return len;
@@ -131,7 +131,7 @@ size_t utf8_next(const char *s, size_t l, size_t o)
parserutils_error perror;
perror = parserutils_charset_utf8_next((const uint8_t *) s, l, o,
- &next);
+ &next);
assert(perror == PARSERUTILS_OK);
return next;
@@ -151,6 +151,47 @@ static inline void utf8_clear_cd_cache(void)
last_cd.cd = 0;
}
+/**
+ * obtain a cached conversion descriptor
+ *
+ * either return the cached conversion descriptor or create one if required
+ */
+static nserror
+get_cached_cd(const char *enc_from, const char *enc_to, iconv_t *cd_out)
+{
+ iconv_t cd;
+ /* we cache the last used conversion descriptor,
+ * so check if we're trying to use it here */
+ if (strncasecmp(last_cd.from, enc_from, sizeof(last_cd.from)) == 0 &&
+ strncasecmp(last_cd.to, enc_to, sizeof(last_cd.to)) == 0 &&
+ last_cd.cd != 0) {
+ *cd_out = last_cd.cd;
+ return NSERROR_OK;
+ }
+
+ /* no match, so create a new cd */
+ cd = iconv_open(enc_to, enc_from);
+ if (cd == (iconv_t) -1) {
+ if (errno == EINVAL) {
+ return NSERROR_BAD_ENCODING;
+ }
+ /* default to no memory */
+ return NSERROR_NOMEM;
+ }
+
+ /* close the last cd - we don't care if this fails */
+ if (last_cd.cd) {
+ iconv_close(last_cd.cd);
+ }
+
+ /* and safely copy the to/from/cd data into last_cd */
+ snprintf(last_cd.from, sizeof(last_cd.from), enc_from);
+ snprintf(last_cd.to, sizeof(last_cd.to), "%s", enc_to);
+ *cd_out = last_cd.cd = cd;
+
+ return NSERROR_OK;
+}
+
/* exported interface documented in utils/utf8.h */
nserror utf8_finalise(void)
{
@@ -187,6 +228,7 @@ utf8_convert(const char *string,
iconv_t cd;
char *temp, *out, *in, *result;
size_t result_len;
+ nserror res;
assert(string && from && to && result_out);
@@ -215,29 +257,9 @@ utf8_convert(const char *string,
in = (char *)string;
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, from, sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, to, sizeof(last_cd.to)) == 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(to, from);
- if (cd == (iconv_t)-1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "%s", from);
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", to);
- last_cd.cd = cd;
+ res = get_cached_cd(from, to, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case = ASCII -> UCS4, so allocate an output buffer
@@ -289,14 +311,14 @@ utf8_convert(const char *string,
/* exported interface documented in utils/utf8.h */
nserror utf8_to_enc(const char *string, const char *encname,
- size_t len, char **result)
+ size_t len, char **result)
{
return utf8_convert(string, len, "UTF-8", encname, result, NULL);
}
/* exported interface documented in utils/utf8.h */
nserror utf8_from_enc(const char *string, const char *encname,
- size_t len, char **result, size_t *result_len)
+ size_t len, char **result, size_t *result_len)
{
return utf8_convert(string, len, encname, "UTF-8", result, result_len);
}
@@ -327,7 +349,7 @@ utf8_convert_html_chunk(iconv_t cd,
esclen = snprintf(escape, sizeof(escape), "&#x%06x;", ucs4);
pescape = escape;
ret = iconv(cd, (void *) &pescape, &esclen,
- (void *) out, outlen);
+ (void *) out, outlen);
if (ret == (size_t) -1)
return NSERROR_NOMEM;
@@ -339,45 +361,26 @@ utf8_convert_html_chunk(iconv_t cd,
return NSERROR_OK;
}
+
+
/* exported interface documented in utils/utf8.h */
nserror
-utf8_to_html(const char *string, const char *encname, size_t len, char **result)
+utf8_to_html(const char *string, const char *encname, size_t len, char **result_out)
{
iconv_t cd;
const char *in;
- char *out, *origout;
+ char *out, *origout, *result;
size_t off, prev_off, inlen, outlen, origoutlen, esclen;
nserror ret;
char *pescape, escape[11];
+ nserror res;
if (len == 0)
len = strlen(string);
- /* we cache the last used conversion descriptor,
- * so check if we're trying to use it here */
- if (strncasecmp(last_cd.from, "UTF-8", sizeof(last_cd.from)) == 0 &&
- strncasecmp(last_cd.to, encname,
- sizeof(last_cd.to)) == 0 &&
- last_cd.cd != 0) {
- cd = last_cd.cd;
- } else {
- /* no match, so create a new cd */
- cd = iconv_open(encname, "UTF-8");
- if (cd == (iconv_t) -1) {
- if (errno == EINVAL)
- return NSERROR_BAD_ENCODING;
- /* default to no memory */
- return NSERROR_NOMEM;
- }
-
- /* close the last cd - we don't care if this fails */
- if (last_cd.cd)
- iconv_close(last_cd.cd);
-
- /* and safely copy the to/from/cd data into last_cd */
- snprintf(last_cd.from, sizeof(last_cd.from), "UTF-8");
- snprintf(last_cd.to, sizeof(last_cd.to), "%s", encname);
- last_cd.cd = cd;
+ res = get_cached_cd("UTF-8", encname, &cd);
+ if (res != NSERROR_OK) {
+ return res;
}
/* Worst case is ASCII -> UCS4, with all characters escaped:
@@ -397,13 +400,13 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
while (off < len) {
/* Must escape '&', '<', and '>' */
if (string[off] == '&' || string[off] == '<' ||
- string[off] == '>') {
+ string[off] == '>') {
if (off - prev_off > 0) {
/* Emit chunk */
in = string + prev_off;
inlen = off - prev_off;
ret = utf8_convert_html_chunk(cd, in, inlen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -414,10 +417,10 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
/* Emit mandatory escape */
esclen = snprintf(escape, sizeof(escape),
- "&#x%06x;", string[off]);
+ "&#x%06x;", string[off]);
pescape = escape;
ret = utf8_convert_html_chunk(cd, pescape, esclen,
- &out, &outlen);
+ &out, &outlen);
if (ret != NSERROR_OK) {
free(origout);
iconv_close(cd);
@@ -449,11 +452,12 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result)
outlen -= 4;
/* Shrink-wrap */
- *result = realloc(origout, origoutlen - outlen);
- if (*result == NULL) {
+ result = realloc(origout, origoutlen - outlen);
+ if (result == NULL) {
free(origout);
return NSERROR_NOMEM;
}
+ *result_out = result;
return NSERROR_OK;
}
--
NetSurf Browser
4 months
netsurf: branch master updated. release/3.10-324-g3d73947
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/3d739479ea760b948a95e...
...commit http://git.netsurf-browser.org/netsurf.git/commit/3d739479ea760b948a95edf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/3d739479ea760b948a95edf75...
The branch, master has been updated
via 3d739479ea760b948a95edf759d0dc080e26b035 (commit)
from 14fba9afdce36db0f4465159ce976f24b6d4916c (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=3d739479ea760b948a9...
commit 3d739479ea760b948a95edf759d0dc080e26b035
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
(duktape): Clear some warnings by adding base data to css rule and stylesheet
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/content/handlers/javascript/duktape/CSSRule.bnd b/content/handlers/javascript/duktape/CSSRule.bnd
new file mode 100644
index 0000000..555023c
--- /dev/null
+++ b/content/handlers/javascript/duktape/CSSRule.bnd
@@ -0,0 +1,22 @@
+/* CSS Rule binding for NetSurf using duktape and libcss/libdom
+ *
+ * Copyright 2022 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+/* Note, for now this exists purely to block warnings, eventually
+ * rules will have to come from stylesheets etc.
+ */
+
+class CSSRule {
+ private bool unused;
+};
+
+init CSSRule()
+%{
+ priv->unused = true;
+%}
diff --git a/content/handlers/javascript/duktape/CSSStyleSheet.bnd b/content/handlers/javascript/duktape/CSSStyleSheet.bnd
new file mode 100644
index 0000000..9167b8a
--- /dev/null
+++ b/content/handlers/javascript/duktape/CSSStyleSheet.bnd
@@ -0,0 +1,22 @@
+/* CSS Stylesheet binding for NetSurf using duktape and libcss/libdom
+ *
+ * Copyright 2022 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+/* Note, for now this exists purely to block warnings, eventually
+ * stylesheets will have to come from documents etc.
+ */
+
+class CSSStyleSheet {
+ private bool unused;
+};
+
+init CSSStyleSheet()
+%{
+ priv->unused = true;
+%}
diff --git a/content/handlers/javascript/duktape/netsurf.bnd b/content/handlers/javascript/duktape/netsurf.bnd
index e47f07d..651c2fd 100644
--- a/content/handlers/javascript/duktape/netsurf.bnd
+++ b/content/handlers/javascript/duktape/netsurf.bnd
@@ -205,3 +205,7 @@ init HTMLPropertiesCollection(struct dom_html_collection *coll);
#include "CanvasRenderingContext2D.bnd"
#include "ImageData.bnd"
+/* CSS Object model */
+
+#include "CSSRule.bnd"
+#include "CSSStyleSheet.bnd"
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/CSSRule.bnd | 22 ++++++++++++++++++++
.../handlers/javascript/duktape/CSSStyleSheet.bnd | 22 ++++++++++++++++++++
content/handlers/javascript/duktape/netsurf.bnd | 4 ++++
3 files changed, 48 insertions(+)
create mode 100644 content/handlers/javascript/duktape/CSSRule.bnd
create mode 100644 content/handlers/javascript/duktape/CSSStyleSheet.bnd
diff --git a/content/handlers/javascript/duktape/CSSRule.bnd b/content/handlers/javascript/duktape/CSSRule.bnd
new file mode 100644
index 0000000..555023c
--- /dev/null
+++ b/content/handlers/javascript/duktape/CSSRule.bnd
@@ -0,0 +1,22 @@
+/* CSS Rule binding for NetSurf using duktape and libcss/libdom
+ *
+ * Copyright 2022 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+/* Note, for now this exists purely to block warnings, eventually
+ * rules will have to come from stylesheets etc.
+ */
+
+class CSSRule {
+ private bool unused;
+};
+
+init CSSRule()
+%{
+ priv->unused = true;
+%}
diff --git a/content/handlers/javascript/duktape/CSSStyleSheet.bnd b/content/handlers/javascript/duktape/CSSStyleSheet.bnd
new file mode 100644
index 0000000..9167b8a
--- /dev/null
+++ b/content/handlers/javascript/duktape/CSSStyleSheet.bnd
@@ -0,0 +1,22 @@
+/* CSS Stylesheet binding for NetSurf using duktape and libcss/libdom
+ *
+ * Copyright 2022 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+/* Note, for now this exists purely to block warnings, eventually
+ * stylesheets will have to come from documents etc.
+ */
+
+class CSSStyleSheet {
+ private bool unused;
+};
+
+init CSSStyleSheet()
+%{
+ priv->unused = true;
+%}
diff --git a/content/handlers/javascript/duktape/netsurf.bnd b/content/handlers/javascript/duktape/netsurf.bnd
index e47f07d..651c2fd 100644
--- a/content/handlers/javascript/duktape/netsurf.bnd
+++ b/content/handlers/javascript/duktape/netsurf.bnd
@@ -205,3 +205,7 @@ init HTMLPropertiesCollection(struct dom_html_collection *coll);
#include "CanvasRenderingContext2D.bnd"
#include "ImageData.bnd"
+/* CSS Object model */
+
+#include "CSSRule.bnd"
+#include "CSSStyleSheet.bnd"
--
NetSurf Browser
4 months
libcss: branch tlsa/calc updated. release/0.9.1-85-g6d58bc4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/6d58bc4e0278c971ba7fc9...
...commit http://git.netsurf-browser.org/libcss.git/commit/6d58bc4e0278c971ba7fc962...
...tree http://git.netsurf-browser.org/libcss.git/tree/6d58bc4e0278c971ba7fc96233...
The branch, tlsa/calc has been updated
via 6d58bc4e0278c971ba7fc9623367d8ea241689ee (commit)
from ad87e675c59bc76a64c445cc89b8cc4522e6f761 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
src/parse/properties/utils.c | 89 +++++++++++++++++++++++++++++++-----------
test/dump.h | 29 ++++++++------
2 files changed, 84 insertions(+), 34 deletions(-)
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index fe5ee6b..fa8ffbe 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1362,16 +1362,17 @@ cleanup:
static css_error
css__parse_calc_sum(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result);
+ parserutils_buffer *result);
static css_error
css__parse_calc_number(
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
const css_token *token;
css_fixed num;
size_t consumed;
+ css_code_t push = CALC_PUSH_NUMBER;
/* Consume the number token */
token = parserutils_vector_iterate(vector, ctx);
@@ -1386,13 +1387,18 @@ css__parse_calc_number(
return CSS_INVALID;
}
- return css__stylesheet_style_vappend(result, 2, (css_code_t) CALC_PUSH_NUMBER, (css_code_t)num);
+ return css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 2,
+ &push, sizeof(push),
+ &num, sizeof(num)
+ )
+ );
}
static css_error
css__parse_calc_value(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error;
int orig_ctx = *ctx;
@@ -1426,6 +1432,7 @@ css__parse_calc_value(css_language *c,
{
css_fixed length = 0;
uint32_t unit = 0;
+ css_code_t push = CALC_PUSH_VALUE;
*ctx = orig_ctx;
error = css__parse_unit_specifier(c, vector, ctx, UNIT_CALC_NUMBER, &length, &unit);
@@ -1434,7 +1441,14 @@ css__parse_calc_value(css_language *c,
return error;
}
- error = css__stylesheet_style_vappend(result, 3, (css_code_t) CALC_PUSH_VALUE, length, unit);
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 3,
+ &push, sizeof(push),
+ &length, sizeof(length),
+ &unit, sizeof(unit)
+ )
+ );
+
}
break;
@@ -1455,12 +1469,11 @@ css__parse_calc_value(css_language *c,
static css_error
css__parse_calc_product(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error = CSS_OK;
const css_token *token;
- bool multiplication;
-
+ css_code_t operator;
/* First parse a value */
error = css__parse_calc_value(c, vector, ctx, result);
@@ -1480,9 +1493,9 @@ css__parse_calc_product(css_language *c,
tokenIsChar(token, '-'))
break;
else if (tokenIsChar(token, '*'))
- multiplication = true;
+ operator = CALC_MULTIPLY;
else if (tokenIsChar(token, '/'))
- multiplication = false;
+ operator = CALC_DIVIDE;
else {
error = CSS_INVALID;
break;
@@ -1492,7 +1505,7 @@ css__parse_calc_product(css_language *c,
consumeWhitespace(vector, ctx);
- if (multiplication) {
+ if (operator == CALC_MULTIPLY) {
/* parse another value */
error = css__parse_calc_value(c, vector, ctx, result);
} else {
@@ -1502,8 +1515,9 @@ css__parse_calc_product(css_language *c,
break;
/* emit the multiplication/division operator */
- error = css__stylesheet_style_append(result,
- (css_code_t) (multiplication ? CALC_MULTIPLY : CALC_DIVIDE));
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
} while (1);
/* We've fallen off, either we had an error or we're left with ')' */
return error;
@@ -1513,12 +1527,11 @@ css__parse_calc_product(css_language *c,
css_error
css__parse_calc_sum(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error = CSS_OK;
const css_token *token;
- bool addition;
-
+ css_code_t operator;
/* First parse a product */
error = css__parse_calc_product(c, vector, ctx, result);
@@ -1535,9 +1548,9 @@ css__parse_calc_sum(css_language *c,
} else if (tokenIsChar(token, ')'))
break;
else if (tokenIsChar(token, '+'))
- addition = true;
+ operator = CALC_ADD;
else if (tokenIsChar(token, '-'))
- addition = false;
+ operator = CALC_SUBTRACT;
else {
error = CSS_INVALID;
break;
@@ -1552,7 +1565,9 @@ css__parse_calc_sum(css_language *c,
break;
/* emit the addition/subtraction operator */
- error = css__stylesheet_style_append(result, (css_code_t) (addition ? CALC_ADD : CALC_SUBTRACT));
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
} while (1);
/* We've fallen off, either we had an error or we're left with ')' */
return error;
@@ -1569,6 +1584,10 @@ css_error css__parse_calc(css_language *c,
const css_token *token;
css_error error = CSS_OK;
css_style *calc_style = NULL;
+ parserutils_buffer *calc_buffer = NULL;
+ lwc_string *calc_expr = NULL;
+ uint32_t expr_index = 0;
+ css_code_t finish = CALC_FINISH;
consumeWhitespace(vector, ctx);
@@ -1578,6 +1597,12 @@ css_error css__parse_calc(css_language *c,
return CSS_INVALID;
}
+ if (parserutils_buffer_create(&calc_buffer) != PARSERUTILS_OK) {
+ /* Since &calc_buffer is valid, the only error case is NONMEM */
+ *ctx = orig_ctx;
+ return CSS_NOMEM;
+ }
+
error = css__stylesheet_style_create(c->sheet, &calc_style);
if (error != CSS_OK)
goto cleanup;
@@ -1585,12 +1610,12 @@ css_error css__parse_calc(css_language *c,
error = css__stylesheet_style_append(calc_style, property);
if (error != CSS_OK)
goto cleanup;
-
+
error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
if (error != CSS_OK)
goto cleanup;
- error = css__parse_calc_sum(c, vector, ctx, calc_style);
+ error = css__parse_calc_sum(c, vector, ctx, calc_buffer);
if (error != CSS_OK)
goto cleanup;
@@ -1602,17 +1627,35 @@ css_error css__parse_calc(css_language *c,
goto cleanup;
}
+ /* Append the indicator that the calc is finished */
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(calc_buffer, (const uint8_t *)&finish, sizeof(finish))
+ );
+ if (error != CSS_OK)
+ goto cleanup;
+
/* Swallow that close paren */
parserutils_vector_iterate(vector, ctx);
- /* Append the indicator that the calc is finished */
- error = css__stylesheet_style_append(calc_style, (css_code_t) CALC_FINISH);
+ /* Create the lwc string representing the calculation and store it in */
+ error = css_error_from_lwc_error(
+ lwc_intern_string((const char *)calc_buffer->data, calc_buffer->length, &calc_expr)
+ );
if (error != CSS_OK)
goto cleanup;
+ /* This always takes ownership of calc_expr, so we should not use after this */
+ error = css__stylesheet_string_add(calc_style->sheet, calc_expr, &expr_index);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ css__stylesheet_style_append(calc_style, (css_code_t) expr_index);
+
error = css__stylesheet_merge_style(result, calc_style);
cleanup:
css__stylesheet_style_destroy(calc_style);
+ parserutils_buffer_destroy(calc_buffer);
+ /* We do not need to clean up calc_expr, it will never leak */
if (error != CSS_OK) {
*ctx = orig_ctx;
}
diff --git a/test/dump.h b/test/dump.h
index a1fdd1f..eac0a9f 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -803,15 +803,23 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
} else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
*ptr += sprintf(*ptr, "unset");
} else if (isCalc(opv)) {
+ lwc_string *calc_expr = NULL;
+ const uint8_t *codeptr = NULL;
+ css_code_t calc_opcode;
+ uint32_t unit, snum;
/* First entry is a unit */
- uint32_t unit = *((uint32_t *)bytecode);
+ unit = *((uint32_t *)bytecode);
ADVANCE(sizeof(unit));
+ /* Second entry is an lwc_string of the expression */
+ snum = *((uint32_t *)bytecode);
+ ADVANCE(sizeof(snum));
+ css__stylesheet_string_get(style->sheet, snum, &calc_expr);
+ codeptr = (const uint8_t *)lwc_string_data(calc_expr);
*ptr += sprintf(*ptr, "/* -> ");
dump_unit(0, unit, ptr);
*ptr += sprintf(*ptr, " */ calc(");
- css_code_t calc_opcode;
- while ((calc_opcode = *((css_code_t *)bytecode)) != CALC_FINISH) {
- ADVANCE(sizeof(calc_opcode));
+ while ((calc_opcode = *((css_code_t *)codeptr)) != CALC_FINISH) {
+ codeptr += sizeof(calc_opcode);
switch (calc_opcode) {
case CALC_ADD:
*ptr += sprintf(*ptr, "+ ");
@@ -826,17 +834,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "/ ");
break;
case CALC_PUSH_VALUE: {
- css_fixed num = *((css_fixed *)bytecode);
- ADVANCE(sizeof(num));
- uint32_t unit = *((uint32_t *)bytecode);
- ADVANCE(sizeof(unit));
+ css_fixed num = *((css_fixed *)codeptr);
+ codeptr += sizeof(num);
+ uint32_t unit = *((uint32_t *)codeptr);
+ codeptr += sizeof(unit);
dump_unit(num, unit, ptr);
*ptr += sprintf(*ptr, " ");
break;
}
case CALC_PUSH_NUMBER: {
- css_fixed num = *((css_fixed *)bytecode);
- ADVANCE(sizeof(num));
+ css_fixed num = *((css_fixed *)codeptr);
+ codeptr += sizeof(num);
dump_number(num, ptr);
*ptr += sprintf(*ptr, " ");
break;
@@ -846,7 +854,6 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
}
- ADVANCE(sizeof(calc_opcode));
*ptr += sprintf(*ptr, "=)");
} else {
value = getValue(opv);
--
Cascading Style Sheets library
4 months
netsurf-wiki: branch master updated. 0ba7a47505bf986f8352e6e6363c9c1c4c059f87
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/0ba7a47505bf986f...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/0ba7a47505bf986f83...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/0ba7a47505bf986f8352...
The branch, master has been updated
via 0ba7a47505bf986f8352e6e6363c9c1c4c059f87 (commit)
from 8fc4263abc997f5b4ec91068fbb8270f73d3362f (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-wiki.git/commit/?id=0ba7a47505bf98...
commit 0ba7a47505bf986f8352e6e6363c9c1c4c059f87
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
(dev-weekends): Add initial Nov 2022
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/developer-weekend/nov-2022.mdwn b/developer-weekend/nov-2022.mdwn
new file mode 100644
index 0000000..83b5433
--- /dev/null
+++ b/developer-weekend/nov-2022.mdwn
@@ -0,0 +1,82 @@
+[[!meta title="Developer Weekend (Nov 2022)"]]
+[[!meta author="NetSurf Developers"]]
+[[!meta date="2022-11-26 09:00:00"]]
+
+[[!toc]]
+
+Attendees
+=========
+
+* Michael Drake
+* Vincent Sanders
+* Daniel Silverstone
+
+Outstanding work (from 2020)
+===========================
+
+* Calc
+
+Activity
+========
+
+Mostly individual activity here
+
+Michael
+-------
+
+* Worked with Daniel on CSS `calc()` support in LibCSS.
+
+Daniel
+------
+
+* Worked with Michael on CSS `calc()` support in LibCSS.
+
+Vince
+-----
+
+* Provided assists on `calc()` support
+* Worked on warnings etc. exposed by more modern gcc
+
+Notes
+=====
+
+Thoughts around `calc()`
+------------------------
+
+(Copied from 2020 for now)
+
+> Currently the `tlsa/calc` branch contains our work-to-date
+
+Remaining work
+
+> Thought:
+>
+> In theory we could make the calculation bytecode be stored as a lwc_string, which means we already have mechanisms for deduplication, identity checking, etc. in libcss.
+
+1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
+ * This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
+ * This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
+ * **Done**: This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
+2. Implementing the cascade
+ * Mostly in the common code.
+ * Should be able to type-check here (property-specific part).
+ * In theory type-check could happen in the parser, but once `var()` gets involved it'll have to be in the cascade, so we may as well put it here from the start.
+3. Reworking the computed style to have a calc section
+ * By this, we mean that the computed styles should have a representation which means "Use calculation N" in the current packed content, and then in the less compact struct we can have calculation bytecode for each unique calculation needed to support the style.
+ * Also consider how this impacts computed style internment / sharing.
+4. Rework API for computed styles to support client functions so that calc can run
+ * This is were we implement doing the calculation.
+ * May need care in the case of invalid results in calc
+ * May permit simplification of things like percentage units.
+ * Maybe the context structure should carry simple values like available width/height viewport width/height, etc. But have a callback for things like relative font sizes etc.
+ * Probably change so all widths emerge from libcss in px.
+5. Write selection tests involving `calc()`
+ * Will involve fixing `dump_computed.h` to the new API
+
+
+After all that, NetSurf needs updating to the new API, which should simplify the CSS client code in NetSurf quite a bit.
+
+Next time
+=========
+
+* Undecided.
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/{oct-2020.mdwn => nov-2022.mdwn} | 22 +++++++-------------
1 file changed, 8 insertions(+), 14 deletions(-)
copy developer-weekend/{oct-2020.mdwn => nov-2022.mdwn} (84%)
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/nov-2022.mdwn
similarity index 84%
copy from developer-weekend/oct-2020.mdwn
copy to developer-weekend/nov-2022.mdwn
index 32ddc0a..83b5433 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/nov-2022.mdwn
@@ -1,6 +1,6 @@
-[[!meta title="Developer Weekend (Oct 2020)"]]
+[[!meta title="Developer Weekend (Nov 2022)"]]
[[!meta author="NetSurf Developers"]]
-[[!meta date="2020-10-22 09:00:00"]]
+[[!meta date="2022-11-26 09:00:00"]]
[[!toc]]
@@ -11,15 +11,10 @@ Attendees
* Vincent Sanders
* Daniel Silverstone
-Outstanding work (from May)
+Outstanding work (from 2020)
===========================
-* General
- - Forms cleanup.
-* Text layout
- - Continue implementing.
-
-Still outstanding after October developer weekend.
+* Calc
Activity
========
@@ -35,15 +30,12 @@ Daniel
------
* Worked with Michael on CSS `calc()` support in LibCSS.
-* Fixed GTK path plotter translation table. (Fixes svgtiny rendering offset.)
-* Fixed LibDOM fuzz testing issue.
-* Fixed various crashes from the long internet tests.
Vince
-----
-* Added support to LibSVGTiny for paths using arcs.
-* Added a chart renderer to NetSurf.
+* Provided assists on `calc()` support
+* Worked on warnings etc. exposed by more modern gcc
Notes
=====
@@ -51,6 +43,8 @@ Notes
Thoughts around `calc()`
------------------------
+(Copied from 2020 for now)
+
> Currently the `tlsa/calc` branch contains our work-to-date
Remaining work
--
NetSurf Developer Wiki Backing Store
4 months
libcss: branch dsilvers/calc created. release/0.9.1-85-g6d58bc4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/6d58bc4e0278c971ba7fc9...
...commit http://git.netsurf-browser.org/libcss.git/commit/6d58bc4e0278c971ba7fc962...
...tree http://git.netsurf-browser.org/libcss.git/tree/6d58bc4e0278c971ba7fc96233...
The branch, dsilvers/calc has been created
at 6d58bc4e0278c971ba7fc9623367d8ea241689ee (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=6d58bc4e0278c971ba7f...
commit 6d58bc4e0278c971ba7fc9623367d8ea241689ee
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
(calc): Update bytecode for calc() to be in an lwc_string
In order to permit us to share calc expressions between styles
and computed styles, without copying, we embed the calc expression
bytecode into an lwc string. This is effectively using lwc_string
as an interned byte buffer, there may be a nicer way to do this in
the future.
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index fe5ee6b..fa8ffbe 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1362,16 +1362,17 @@ cleanup:
static css_error
css__parse_calc_sum(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result);
+ parserutils_buffer *result);
static css_error
css__parse_calc_number(
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
const css_token *token;
css_fixed num;
size_t consumed;
+ css_code_t push = CALC_PUSH_NUMBER;
/* Consume the number token */
token = parserutils_vector_iterate(vector, ctx);
@@ -1386,13 +1387,18 @@ css__parse_calc_number(
return CSS_INVALID;
}
- return css__stylesheet_style_vappend(result, 2, (css_code_t) CALC_PUSH_NUMBER, (css_code_t)num);
+ return css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 2,
+ &push, sizeof(push),
+ &num, sizeof(num)
+ )
+ );
}
static css_error
css__parse_calc_value(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error;
int orig_ctx = *ctx;
@@ -1426,6 +1432,7 @@ css__parse_calc_value(css_language *c,
{
css_fixed length = 0;
uint32_t unit = 0;
+ css_code_t push = CALC_PUSH_VALUE;
*ctx = orig_ctx;
error = css__parse_unit_specifier(c, vector, ctx, UNIT_CALC_NUMBER, &length, &unit);
@@ -1434,7 +1441,14 @@ css__parse_calc_value(css_language *c,
return error;
}
- error = css__stylesheet_style_vappend(result, 3, (css_code_t) CALC_PUSH_VALUE, length, unit);
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 3,
+ &push, sizeof(push),
+ &length, sizeof(length),
+ &unit, sizeof(unit)
+ )
+ );
+
}
break;
@@ -1455,12 +1469,11 @@ css__parse_calc_value(css_language *c,
static css_error
css__parse_calc_product(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error = CSS_OK;
const css_token *token;
- bool multiplication;
-
+ css_code_t operator;
/* First parse a value */
error = css__parse_calc_value(c, vector, ctx, result);
@@ -1480,9 +1493,9 @@ css__parse_calc_product(css_language *c,
tokenIsChar(token, '-'))
break;
else if (tokenIsChar(token, '*'))
- multiplication = true;
+ operator = CALC_MULTIPLY;
else if (tokenIsChar(token, '/'))
- multiplication = false;
+ operator = CALC_DIVIDE;
else {
error = CSS_INVALID;
break;
@@ -1492,7 +1505,7 @@ css__parse_calc_product(css_language *c,
consumeWhitespace(vector, ctx);
- if (multiplication) {
+ if (operator == CALC_MULTIPLY) {
/* parse another value */
error = css__parse_calc_value(c, vector, ctx, result);
} else {
@@ -1502,8 +1515,9 @@ css__parse_calc_product(css_language *c,
break;
/* emit the multiplication/division operator */
- error = css__stylesheet_style_append(result,
- (css_code_t) (multiplication ? CALC_MULTIPLY : CALC_DIVIDE));
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
} while (1);
/* We've fallen off, either we had an error or we're left with ')' */
return error;
@@ -1513,12 +1527,11 @@ css__parse_calc_product(css_language *c,
css_error
css__parse_calc_sum(css_language *c,
const parserutils_vector *vector, int *ctx,
- css_style *result)
+ parserutils_buffer *result)
{
css_error error = CSS_OK;
const css_token *token;
- bool addition;
-
+ css_code_t operator;
/* First parse a product */
error = css__parse_calc_product(c, vector, ctx, result);
@@ -1535,9 +1548,9 @@ css__parse_calc_sum(css_language *c,
} else if (tokenIsChar(token, ')'))
break;
else if (tokenIsChar(token, '+'))
- addition = true;
+ operator = CALC_ADD;
else if (tokenIsChar(token, '-'))
- addition = false;
+ operator = CALC_SUBTRACT;
else {
error = CSS_INVALID;
break;
@@ -1552,7 +1565,9 @@ css__parse_calc_sum(css_language *c,
break;
/* emit the addition/subtraction operator */
- error = css__stylesheet_style_append(result, (css_code_t) (addition ? CALC_ADD : CALC_SUBTRACT));
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
} while (1);
/* We've fallen off, either we had an error or we're left with ')' */
return error;
@@ -1569,6 +1584,10 @@ css_error css__parse_calc(css_language *c,
const css_token *token;
css_error error = CSS_OK;
css_style *calc_style = NULL;
+ parserutils_buffer *calc_buffer = NULL;
+ lwc_string *calc_expr = NULL;
+ uint32_t expr_index = 0;
+ css_code_t finish = CALC_FINISH;
consumeWhitespace(vector, ctx);
@@ -1578,6 +1597,12 @@ css_error css__parse_calc(css_language *c,
return CSS_INVALID;
}
+ if (parserutils_buffer_create(&calc_buffer) != PARSERUTILS_OK) {
+ /* Since &calc_buffer is valid, the only error case is NONMEM */
+ *ctx = orig_ctx;
+ return CSS_NOMEM;
+ }
+
error = css__stylesheet_style_create(c->sheet, &calc_style);
if (error != CSS_OK)
goto cleanup;
@@ -1585,12 +1610,12 @@ css_error css__parse_calc(css_language *c,
error = css__stylesheet_style_append(calc_style, property);
if (error != CSS_OK)
goto cleanup;
-
+
error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
if (error != CSS_OK)
goto cleanup;
- error = css__parse_calc_sum(c, vector, ctx, calc_style);
+ error = css__parse_calc_sum(c, vector, ctx, calc_buffer);
if (error != CSS_OK)
goto cleanup;
@@ -1602,17 +1627,35 @@ css_error css__parse_calc(css_language *c,
goto cleanup;
}
+ /* Append the indicator that the calc is finished */
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(calc_buffer, (const uint8_t *)&finish, sizeof(finish))
+ );
+ if (error != CSS_OK)
+ goto cleanup;
+
/* Swallow that close paren */
parserutils_vector_iterate(vector, ctx);
- /* Append the indicator that the calc is finished */
- error = css__stylesheet_style_append(calc_style, (css_code_t) CALC_FINISH);
+ /* Create the lwc string representing the calculation and store it in */
+ error = css_error_from_lwc_error(
+ lwc_intern_string((const char *)calc_buffer->data, calc_buffer->length, &calc_expr)
+ );
if (error != CSS_OK)
goto cleanup;
+ /* This always takes ownership of calc_expr, so we should not use after this */
+ error = css__stylesheet_string_add(calc_style->sheet, calc_expr, &expr_index);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ css__stylesheet_style_append(calc_style, (css_code_t) expr_index);
+
error = css__stylesheet_merge_style(result, calc_style);
cleanup:
css__stylesheet_style_destroy(calc_style);
+ parserutils_buffer_destroy(calc_buffer);
+ /* We do not need to clean up calc_expr, it will never leak */
if (error != CSS_OK) {
*ctx = orig_ctx;
}
diff --git a/test/dump.h b/test/dump.h
index a1fdd1f..eac0a9f 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -803,15 +803,23 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
} else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
*ptr += sprintf(*ptr, "unset");
} else if (isCalc(opv)) {
+ lwc_string *calc_expr = NULL;
+ const uint8_t *codeptr = NULL;
+ css_code_t calc_opcode;
+ uint32_t unit, snum;
/* First entry is a unit */
- uint32_t unit = *((uint32_t *)bytecode);
+ unit = *((uint32_t *)bytecode);
ADVANCE(sizeof(unit));
+ /* Second entry is an lwc_string of the expression */
+ snum = *((uint32_t *)bytecode);
+ ADVANCE(sizeof(snum));
+ css__stylesheet_string_get(style->sheet, snum, &calc_expr);
+ codeptr = (const uint8_t *)lwc_string_data(calc_expr);
*ptr += sprintf(*ptr, "/* -> ");
dump_unit(0, unit, ptr);
*ptr += sprintf(*ptr, " */ calc(");
- css_code_t calc_opcode;
- while ((calc_opcode = *((css_code_t *)bytecode)) != CALC_FINISH) {
- ADVANCE(sizeof(calc_opcode));
+ while ((calc_opcode = *((css_code_t *)codeptr)) != CALC_FINISH) {
+ codeptr += sizeof(calc_opcode);
switch (calc_opcode) {
case CALC_ADD:
*ptr += sprintf(*ptr, "+ ");
@@ -826,17 +834,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "/ ");
break;
case CALC_PUSH_VALUE: {
- css_fixed num = *((css_fixed *)bytecode);
- ADVANCE(sizeof(num));
- uint32_t unit = *((uint32_t *)bytecode);
- ADVANCE(sizeof(unit));
+ css_fixed num = *((css_fixed *)codeptr);
+ codeptr += sizeof(num);
+ uint32_t unit = *((uint32_t *)codeptr);
+ codeptr += sizeof(unit);
dump_unit(num, unit, ptr);
*ptr += sprintf(*ptr, " ");
break;
}
case CALC_PUSH_NUMBER: {
- css_fixed num = *((css_fixed *)bytecode);
- ADVANCE(sizeof(num));
+ css_fixed num = *((css_fixed *)codeptr);
+ codeptr += sizeof(num);
dump_number(num, ptr);
*ptr += sprintf(*ptr, " ");
break;
@@ -846,7 +854,6 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
}
- ADVANCE(sizeof(calc_opcode));
*ptr += sprintf(*ptr, "=)");
} else {
value = getValue(opv);
-----------------------------------------------------------------------
--
Cascading Style Sheets library
4 months
libparserutils: branch master updated. release/0.2.4-4-g010c5f5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libparserutils.git/shortlog/010c5f5b3c3db4...
...commit http://git.netsurf-browser.org/libparserutils.git/commit/010c5f5b3c3db4c0...
...tree http://git.netsurf-browser.org/libparserutils.git/tree/010c5f5b3c3db4c07c...
The branch, master has been updated
via 010c5f5b3c3db4c07c19e706c9a70c886b614497 (commit)
via 429245749eeb99196d82d140af6522f962fc4601 (commit)
from 02ea538ed08a1b3dd5acc016762e951ff006299f (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/libparserutils.git/commit/?id=010c5f5b3c3d...
commit 010c5f5b3c3db4c07c19e706c9a70c886b614497
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
(buffer): Add parserutils_buffer_appendv()
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/include/parserutils/utils/buffer.h b/include/parserutils/utils/buffer.h
index 5f8f696..5b8b793 100644
--- a/include/parserutils/utils/buffer.h
+++ b/include/parserutils/utils/buffer.h
@@ -30,6 +30,8 @@ parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
const uint8_t *data, size_t len);
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...);
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
size_t offset, const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
diff --git a/src/utils/buffer.c b/src/utils/buffer.c
index 5e0f58c..b568948 100644
--- a/src/utils/buffer.c
+++ b/src/utils/buffer.c
@@ -6,6 +6,7 @@
*/
#include <string.h>
+#include <stdarg.h>
#include <parserutils/utils/buffer.h>
@@ -131,6 +132,38 @@ parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
}
/**
+ * Append multiple data blocks to a memory buffer.
+ *
+ * Each data block must be passed as a pair of const uint8_t* and size_t
+ *
+ * \param buffer The buffer to append to
+ * \param count The number of data blocks to append
+ * \param ... The pairs of pointer and size
+ * \return PARSERUTILS_OK on success, appropriate error otherwise.
+*/
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...)
+{
+ va_list ap;
+ parserutils_error error;
+ const uint8_t *data;
+ size_t len;
+
+ va_start(ap, count);
+ while (count > 0) {
+ data = va_arg(ap, const uint8_t *);
+ len = va_arg(ap, size_t);
+ error = parserutils_buffer_append(buffer, data, len);
+ if (error != PARSERUTILS_OK)
+ break;
+ count--;
+ }
+ va_end(ap);
+
+ return error;
+}
+
+/**
* Insert data into a memory buffer
*
* \param buffer The buffer to insert into
commitdiff http://git.netsurf-browser.org/libparserutils.git/commit/?id=429245749eeb...
commit 429245749eeb99196d82d140af6522f962fc4601
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
(gitignore): Ignore aliases.inc
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/.gitignore b/.gitignore
index d5c7a48..479e8d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
build-*
Makefile.config.override
+src/charset/aliases.inc
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
include/parserutils/utils/buffer.h | 2 ++
src/utils/buffer.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/.gitignore b/.gitignore
index d5c7a48..479e8d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
build-*
Makefile.config.override
+src/charset/aliases.inc
diff --git a/include/parserutils/utils/buffer.h b/include/parserutils/utils/buffer.h
index 5f8f696..5b8b793 100644
--- a/include/parserutils/utils/buffer.h
+++ b/include/parserutils/utils/buffer.h
@@ -30,6 +30,8 @@ parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
const uint8_t *data, size_t len);
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...);
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
size_t offset, const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
diff --git a/src/utils/buffer.c b/src/utils/buffer.c
index 5e0f58c..b568948 100644
--- a/src/utils/buffer.c
+++ b/src/utils/buffer.c
@@ -6,6 +6,7 @@
*/
#include <string.h>
+#include <stdarg.h>
#include <parserutils/utils/buffer.h>
@@ -131,6 +132,38 @@ parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
}
/**
+ * Append multiple data blocks to a memory buffer.
+ *
+ * Each data block must be passed as a pair of const uint8_t* and size_t
+ *
+ * \param buffer The buffer to append to
+ * \param count The number of data blocks to append
+ * \param ... The pairs of pointer and size
+ * \return PARSERUTILS_OK on success, appropriate error otherwise.
+*/
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...)
+{
+ va_list ap;
+ parserutils_error error;
+ const uint8_t *data;
+ size_t len;
+
+ va_start(ap, count);
+ while (count > 0) {
+ data = va_arg(ap, const uint8_t *);
+ len = va_arg(ap, size_t);
+ error = parserutils_buffer_append(buffer, data, len);
+ if (error != PARSERUTILS_OK)
+ break;
+ count--;
+ }
+ va_end(ap);
+
+ return error;
+}
+
+/**
* Insert data into a memory buffer
*
* \param buffer The buffer to insert into
--
Lexer/parser utility functions
4 months
netsurf-wiki: branch master updated. 8fc4263abc997f5b4ec91068fbb8270f73d3362f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/8fc4263abc997f5b...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/8fc4263abc997f5b4e...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/8fc4263abc997f5b4ec9...
The branch, master has been updated
via 8fc4263abc997f5b4ec91068fbb8270f73d3362f (commit)
from b100e6a68d8fc743dad6e7403b729ba97b36f80c (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-wiki.git/commit/?id=8fc4263abc997f...
commit 8fc4263abc997f5b4ec91068fbb8270f73d3362f
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Avoid blockquote
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index fcb110d..32ddc0a 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,7 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
- * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
+ * **Done**: This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/oct-2020.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index fcb110d..32ddc0a 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,7 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
- * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
+ * **Done**: This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
--
NetSurf Developer Wiki Backing Store
4 months
netsurf-wiki: branch master updated. b100e6a68d8fc743dad6e7403b729ba97b36f80c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/b100e6a68d8fc743...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/b100e6a68d8fc743da...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/b100e6a68d8fc743dad6...
The branch, master has been updated
discards 73e33b8aa74476f1d118bb7d75bc30d9116653ca (commit)
via b100e6a68d8fc743dad6e7403b729ba97b36f80c (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (73e33b8aa74476f1d118bb7d75bc30d9116653ca)
\
N -- N -- N (b100e6a68d8fc743dad6e7403b729ba97b36f80c)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
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-wiki.git/commit/?id=b100e6a68d8fc7...
commit b100e6a68d8fc743dad6e7403b729ba97b36f80c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Update calc() progress
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index 2ccab48..fcb110d 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,6 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
+ * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/oct-2020.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index d8aeb2a..fcb110d 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,7 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
- * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks(http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&id....
+ * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks](http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&i....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
--
NetSurf Developer Wiki Backing Store
4 months
netsurf-wiki: branch master updated. 73e33b8aa74476f1d118bb7d75bc30d9116653ca
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/73e33b8aa74476f1...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/73e33b8aa74476f1d1...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/73e33b8aa74476f1d118...
The branch, master has been updated
via 73e33b8aa74476f1d118bb7d75bc30d9116653ca (commit)
from 06242daef2531a08bb3ae433e24ced9263031f1b (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-wiki.git/commit/?id=73e33b8aa74476...
commit 73e33b8aa74476f1d118bb7d75bc30d9116653ca
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Update calc() progress
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index 2ccab48..d8aeb2a 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,6 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
+ * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks(http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&id....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/oct-2020.mdwn | 1 +
1 file changed, 1 insertion(+)
diff --git a/developer-weekend/oct-2020.mdwn b/developer-weekend/oct-2020.mdwn
index 2ccab48..d8aeb2a 100644
--- a/developer-weekend/oct-2020.mdwn
+++ b/developer-weekend/oct-2020.mdwn
@@ -62,6 +62,7 @@ Remaining work
1. Maybe update generator to construct valid/invalid UNIT types for each property as a table for use later.
* This would involve repeating the validation expressions present in `LENGTH_UNIT:()` in `properties.gen` or perhaps reworking that bit too.
* This is probably an array, indexed by property, whose values are a bitfield of permitted unit types.
+ * > This was done after the hack weekend in [parse: properties: Add property-specific unit class masks(http://source.netsurf-browser.org/libcss.git/commit/?h=tlsa/calc&id....
2. Implementing the cascade
* Mostly in the common code.
* Should be able to type-check here (property-specific part).
--
NetSurf Developer Wiki Backing Store
4 months