libcss: branch tlsa/jmb/mq updated. release/0.7.0-53-g4c6f9d0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/4c6f9d0ee83cfe66bbb715...
...commit http://git.netsurf-browser.org/libcss.git/commit/4c6f9d0ee83cfe66bbb71564...
...tree http://git.netsurf-browser.org/libcss.git/tree/4c6f9d0ee83cfe66bbb7156492...
The branch, tlsa/jmb/mq has been updated
discards 48305a59c08588afd9f454e2bcfdb10048d4cb65 (commit)
discards 6bb6567ddf70c4c185c87983d05bb390fb3c035c (commit)
discards 91448ea87125739ed39d9e4124ee407fa191299c (commit)
via 4c6f9d0ee83cfe66bbb7156492aa7cb5f00e5a64 (commit)
via 3809273bb81e49304d84a0927f0ba619ecef1f8b (commit)
via 4508b6727458892f50e3d61a364fc44c8680036a (commit)
via ce50203db282ba649442a562e774e879a5f3744c (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 (48305a59c08588afd9f454e2bcfdb10048d4cb65)
\
N -- N -- N (4c6f9d0ee83cfe66bbb7156492aa7cb5f00e5a64)
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/libcss.git/commit/?id=4c6f9d0ee83cfe66bbb7...
commit 4c6f9d0ee83cfe66bbb7156492aa7cb5f00e5a64
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Parse only needs propstrings out of css_language.
diff --git a/src/parse/language.c b/src/parse/language.c
index c3b523d..faafcfd 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -426,7 +426,8 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
consumeWhitespace(vector, &ctx);
/* Parse media list */
- error = css__mq_parse_media_list(c, vector, &ctx, &media);
+ error = css__mq_parse_media_list(
+ c->strings, vector, &ctx, &media);
if (error != CSS_OK)
return error;
@@ -532,7 +533,8 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
/* any0 = media query */
- error = css__mq_parse_media_list(c, vector, &ctx, &media);
+ error = css__mq_parse_media_list(
+ c->strings, vector, &ctx, &media);
if (error != CSS_OK)
return error;
diff --git a/src/parse/mq.c b/src/parse/mq.c
index f7b8b6e..2b2164f 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -74,7 +74,7 @@ void css__mq_query_destroy(css_mq_query *media)
}
}
-static css_error mq_parse_condition(css_language *c,
+static css_error mq_parse_condition(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool permit_or, css_mq_cond **cond);
@@ -197,7 +197,7 @@ static css_error mq_parse_op(const css_token *token,
return CSS_OK;
}
-static css_error mq_parse_range(css_language *c,
+static css_error mq_parse_range(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
const css_token *name_or_value,
css_mq_feature **feature)
@@ -237,7 +237,7 @@ static css_error mq_parse_range(css_language *c,
value_is_ratio = true;
} else if (name_or_value->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(name_or_value->idata,
- c->strings[INFINITE], &match) == lwc_error_ok &&
+ strings[INFINITE], &match) == lwc_error_ok &&
match == false) {
/* The only ident permitted for mf-value is 'infinite', thus must have name */
name = name_or_value;
@@ -380,7 +380,7 @@ static css_error mq_parse_range(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_media_feature(css_language *c,
+static css_error mq_parse_media_feature(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_feature **feature)
{
@@ -461,7 +461,8 @@ static css_error mq_parse_media_feature(css_language *c,
consumeWhitespace(vector, ctx);
} else {
/* mf-range */
- error = mq_parse_range(c, vector, ctx, name_or_value, &result);
+ error = mq_parse_range(strings, vector, ctx,
+ name_or_value, &result);
if (error != CSS_OK) {
return error;
}
@@ -470,7 +471,8 @@ static css_error mq_parse_media_feature(css_language *c,
}
} else {
/* mf-range */
- error = mq_parse_range(c, vector, ctx, name_or_value, &result);
+ error = mq_parse_range(strings, vector, ctx,
+ name_or_value, &result);
if (error != CSS_OK) {
return error;
}
@@ -494,7 +496,7 @@ static css_error mq_parse_media_feature(css_language *c,
*
* CSS Syntax Module Level 3: 8.2
*/
-static css_error mq_parse_consume_any_value(css_language *c,
+static css_error mq_parse_consume_any_value(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool until, const char until_char)
{
@@ -526,22 +528,22 @@ static css_error mq_parse_consume_any_value(css_language *c,
}
if (tokenIsChar(token, '(')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, ')');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, ')');
if (error != CSS_OK) {
return error;
}
} else if (tokenIsChar(token, '[')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, ']');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, ']');
if (error != CSS_OK) {
return error;
}
} else if (tokenIsChar(token, '{')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, '}');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, '}');
if (error != CSS_OK) {
return error;
}
@@ -556,7 +558,7 @@ static css_error mq_parse_consume_any_value(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_general_enclosed(css_language *c,
+static css_error mq_parse_general_enclosed(lwc_string **strings,
const parserutils_vector *vector, int *ctx)
{
const css_token *token;
@@ -573,7 +575,8 @@ static css_error mq_parse_general_enclosed(css_language *c,
switch (token->type) {
case CSS_TOKEN_FUNCTION:
- error = mq_parse_consume_any_value(c, vector, ctx, true, ')');
+ error = mq_parse_consume_any_value(strings, vector, ctx,
+ true, ')');
if (error != CSS_OK) {
return error;
}
@@ -585,7 +588,8 @@ static css_error mq_parse_general_enclosed(css_language *c,
break;
case CSS_TOKEN_IDENT:
- error = mq_parse_consume_any_value(c, vector, ctx, false, '\0');
+ error = mq_parse_consume_any_value(strings, vector, ctx,
+ false, '\0');
if (error != CSS_OK) {
return error;
}
@@ -598,7 +602,7 @@ static css_error mq_parse_general_enclosed(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_media_in_parens(css_language *c,
+static css_error mq_parse_media_in_parens(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_cond_or_feature **cond_or_feature)
{
@@ -631,10 +635,10 @@ static css_error mq_parse_media_in_parens(css_language *c,
if (tokenIsChar(token, '(') || (token->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
+ strings[NOT], &match) == lwc_error_ok &&
match)) {
css_mq_cond *cond;
- error = mq_parse_condition(c, vector, ctx, true, &cond);
+ error = mq_parse_condition(strings, vector, ctx, true, &cond);
if (error == CSS_OK) {
token = parserutils_vector_iterate(vector, ctx);
if (tokenIsChar(token, ')') == false) {
@@ -656,7 +660,7 @@ static css_error mq_parse_media_in_parens(css_language *c,
token->type == CSS_TOKEN_NUMBER ||
token->type == CSS_TOKEN_DIMENSION) {
css_mq_feature *feature;
- error = mq_parse_media_feature(c, vector, ctx, &feature);
+ error = mq_parse_media_feature(strings, vector, ctx, &feature);
if (error == CSS_OK) {
result = malloc(sizeof(*result));
if (result == NULL) {
@@ -672,12 +676,12 @@ static css_error mq_parse_media_in_parens(css_language *c,
}
*ctx = old_ctx;
- error = mq_parse_general_enclosed(c, vector, ctx);
+ error = mq_parse_general_enclosed(strings, vector, ctx);
return error;
}
-static css_error mq_parse_condition(css_language *c,
+static css_error mq_parse_condition(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool permit_or, css_mq_cond **cond)
{
@@ -699,7 +703,7 @@ static css_error mq_parse_condition(css_language *c,
if (token == NULL || tokenIsChar(token, '(') == false ||
token->type != CSS_TOKEN_IDENT ||
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) != lwc_error_ok ||
+ strings[NOT], &match) != lwc_error_ok ||
match == false) {
return CSS_INVALID;
}
@@ -721,7 +725,8 @@ static css_error mq_parse_condition(css_language *c,
parserutils_vector_iterate(vector, ctx);
consumeWhitespace(vector, ctx);
- error = mq_parse_media_in_parens(c, vector, ctx, &cond_or_feature);
+ error = mq_parse_media_in_parens(strings,
+ vector, ctx, &cond_or_feature);
if (error != CSS_OK) {
css__mq_cond_destroy(result);
return CSS_INVALID;
@@ -745,7 +750,8 @@ static css_error mq_parse_condition(css_language *c,
/* FOLLOW(media-condition) := RPAREN | COMMA | EOF */
while (token != NULL && tokenIsChar(token, ')') == false &&
tokenIsChar(token, ',') == false) {
- error = mq_parse_media_in_parens(c, vector, ctx, &cond_or_feature);
+ error = mq_parse_media_in_parens(strings, vector, ctx,
+ &cond_or_feature);
if (error != CSS_OK) {
css__mq_cond_destroy(result);
return CSS_INVALID;
@@ -771,7 +777,7 @@ static css_error mq_parse_condition(css_language *c,
css__mq_cond_destroy(result);
return CSS_INVALID;
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[AND], &match) == lwc_error_ok &&
+ strings[AND], &match) == lwc_error_ok &&
match) {
if (op != 0 && op != AND) {
css__mq_cond_destroy(result);
@@ -779,7 +785,7 @@ static css_error mq_parse_condition(css_language *c,
}
op = AND;
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[OR], &match) == lwc_error_ok &&
+ strings[OR], &match) == lwc_error_ok &&
match) {
if (permit_or == false || (op != 0 && op != OR)) {
css__mq_cond_destroy(result);
@@ -809,54 +815,54 @@ static css_error mq_parse_condition(css_language *c,
/**
* Parse a media query type.
*/
-static uint64_t mq_parse_type(css_language *c, lwc_string *type)
+static uint64_t mq_parse_type(lwc_string **strings, lwc_string *type)
{
bool match;
if (type == NULL) {
return CSS_MEDIA_ALL;
} else if (lwc_string_caseless_isequal(
- type, c->strings[AURAL],
+ type, strings[AURAL],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_AURAL;
} else if (lwc_string_caseless_isequal(
- type, c->strings[BRAILLE],
+ type, strings[BRAILLE],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_BRAILLE;
} else if (lwc_string_caseless_isequal(
- type, c->strings[EMBOSSED],
+ type, strings[EMBOSSED],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_EMBOSSED;
} else if (lwc_string_caseless_isequal(
- type, c->strings[HANDHELD],
+ type, strings[HANDHELD],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_HANDHELD;
} else if (lwc_string_caseless_isequal(
- type, c->strings[PRINT],
+ type, strings[PRINT],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_PRINT;
} else if (lwc_string_caseless_isequal(
- type, c->strings[PROJECTION],
+ type, strings[PROJECTION],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_PROJECTION;
} else if (lwc_string_caseless_isequal(
- type, c->strings[SCREEN],
+ type, strings[SCREEN],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_SCREEN;
} else if (lwc_string_caseless_isequal(
- type, c->strings[SPEECH],
+ type, strings[SPEECH],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_SPEECH;
} else if (lwc_string_caseless_isequal(
- type, c->strings[TTY],
+ type, strings[TTY],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_TTY;
} else if (lwc_string_caseless_isequal(
- type, c->strings[TV],
+ type, strings[TV],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_TV;
} else if (lwc_string_caseless_isequal(
- type, c->strings[ALL],
+ type, strings[ALL],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_ALL;
}
@@ -864,7 +870,7 @@ static uint64_t mq_parse_type(css_language *c, lwc_string *type)
return 0;
}
-static css_error mq_parse_media_query(css_language *c,
+static css_error mq_parse_media_query(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **query)
{
@@ -888,7 +894,7 @@ static css_error mq_parse_media_query(css_language *c,
is_condition = true;
} else if (token->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
+ strings[NOT], &match) == lwc_error_ok &&
match) {
int old_ctx = *ctx;
@@ -911,7 +917,8 @@ static css_error mq_parse_media_query(css_language *c,
if (is_condition) {
/* media-condition */
- error = mq_parse_condition(c, vector, ctx, true, &result->cond);
+ error = mq_parse_condition(strings, vector, ctx, true,
+ &result->cond);
if (error != CSS_OK) {
free(result);
return error;
@@ -928,14 +935,12 @@ static css_error mq_parse_media_query(css_language *c,
}
if (lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
- match) {
+ strings[NOT], &match) == lwc_error_ok && match) {
result->negate_type = 1;
consumeWhitespace(vector, ctx);
token = parserutils_vector_iterate(vector, ctx);
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[ONLY], &match) == lwc_error_ok &&
- match) {
+ strings[ONLY], &match) == lwc_error_ok && match) {
consumeWhitespace(vector, ctx);
token = parserutils_vector_iterate(vector, ctx);
}
@@ -945,7 +950,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_INVALID;
}
- result->type = mq_parse_type(c, token->idata);
+ result->type = mq_parse_type(strings, token->idata);
consumeWhitespace(vector, ctx);
@@ -953,7 +958,7 @@ static css_error mq_parse_media_query(css_language *c,
if (token != NULL) {
if (token->type != CSS_TOKEN_IDENT ||
lwc_string_caseless_isequal(token->idata,
- c->strings[AND], &match) != lwc_error_ok ||
+ strings[AND], &match) != lwc_error_ok ||
match == false) {
free(result);
return CSS_INVALID;
@@ -961,7 +966,8 @@ static css_error mq_parse_media_query(css_language *c,
consumeWhitespace(vector, ctx);
- error = mq_parse_condition(c, vector, ctx, false, &result->cond);
+ error = mq_parse_condition(strings, vector, ctx, false,
+ &result->cond);
if (error != CSS_OK) {
free(result);
return error;
@@ -972,7 +978,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_OK;
}
-css_error css__mq_parse_media_list(css_language *c,
+css_error css__mq_parse_media_list(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **media)
{
@@ -993,7 +999,7 @@ css_error css__mq_parse_media_list(css_language *c,
while (token != NULL) {
css_mq_query *query;
- error = mq_parse_media_query(c, vector, ctx, &query);
+ error = mq_parse_media_query(strings, vector, ctx, &query);
if (error != CSS_OK) {
/* TODO: error recovery (see above) */
css__mq_query_destroy(result);
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 381e0f9..2940032 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -87,7 +87,7 @@ typedef struct css_mq_query {
css_mq_cond *cond;
} css_mq_query;
-css_error css__mq_parse_media_list(css_language *c,
+css_error css__mq_parse_media_list(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **media);
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=3809273bb81e49304d84...
commit 3809273bb81e49304d84a0927f0ba619ecef1f8b
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: API for stylesheet import doesn't take media now.
diff --git a/test/css21.c b/test/css21.c
index a29fae1..cdd66f7 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -99,10 +99,8 @@ int main(int argc, char **argv)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 58ccf9a..5f926e3 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -395,10 +395,8 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=4508b6727458892f50e3...
commit 4508b6727458892f50e3d61a364fc44c8680036a
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Update stylesheet import for media query lists.
diff --git a/src/select/select.c b/src/select/select.c
index 644369a..480b9f5 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1847,7 +1847,8 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1954,7 +1955,8 @@ static css_error select_font_faces_from_sheet(
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=ce50203db282ba649442...
commit ce50203db282ba649442a562e774e879a5f3744c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Update rule_good_for_media for new mq struct.
Doesn't currently match media query conditions, only the
media type.
diff --git a/src/select/mq.h b/src/select/mq.h
index a0a9f6d..5aa1404 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,10 +10,47 @@
#define css_select_mq_h_
/**
+ * Match media query conditions.
+ *
+ * \param[in] cond Condition to match.
+ * \return true if condition matches, otherwise false.
+ */
+static inline bool mq_match_condition(css_mq_cond *cond)
+{
+ /* TODO: Implement this. */
+ return cond == NULL;
+}
+
+/**
+ * Test whether media query list matches current media.
+ *
+ * If anything in the list matches, it the list matches. If none match
+ * it doesn't match.
+ *
+ * \param m Media query list.
+ * \meaid media Current media spec, to check against m.
+ * \return true if media query list matches media
+ */
+static inline bool mq__list_match(const css_mq_query *m, uint64_t media)
+{
+ for (; m != NULL; m = m->next) {
+ /* Check type */
+ if (!!(m->type & media) != m->negate_type) {
+ if (mq_match_condition(m->cond)) {
+ /* We have a match, no need to look further. */
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
* Test whether the rule applies for current media.
*
- * \param rule Rule to test
- * \meaid media Current media type(s)
+ * \param rule Rule to test
+ * \param media Current media type(s)
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
@@ -24,10 +61,11 @@ static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
while (ancestor != NULL) {
const css_rule_media *m = (const css_rule_media *) ancestor;
- if (ancestor->type == CSS_RULE_MEDIA &&
- (m->media & media) == 0) {
- applies = false;
- break;
+ if (ancestor->type == CSS_RULE_MEDIA) {
+ applies = mq__list_match(m->media, media);
+ if (applies == false) {
+ break;
+ }
}
if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) {
-----------------------------------------------------------------------
Summary of changes:
src/parse/language.c | 6 ++-
src/parse/mq.c | 108 ++++++++++++++++++++++++++------------------------
src/parse/mq.h | 2 +-
src/select/mq.h | 2 +-
4 files changed, 63 insertions(+), 55 deletions(-)
diff --git a/src/parse/language.c b/src/parse/language.c
index c3b523d..faafcfd 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -426,7 +426,8 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
consumeWhitespace(vector, &ctx);
/* Parse media list */
- error = css__mq_parse_media_list(c, vector, &ctx, &media);
+ error = css__mq_parse_media_list(
+ c->strings, vector, &ctx, &media);
if (error != CSS_OK)
return error;
@@ -532,7 +533,8 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
/* any0 = media query */
- error = css__mq_parse_media_list(c, vector, &ctx, &media);
+ error = css__mq_parse_media_list(
+ c->strings, vector, &ctx, &media);
if (error != CSS_OK)
return error;
diff --git a/src/parse/mq.c b/src/parse/mq.c
index f7b8b6e..2b2164f 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -74,7 +74,7 @@ void css__mq_query_destroy(css_mq_query *media)
}
}
-static css_error mq_parse_condition(css_language *c,
+static css_error mq_parse_condition(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool permit_or, css_mq_cond **cond);
@@ -197,7 +197,7 @@ static css_error mq_parse_op(const css_token *token,
return CSS_OK;
}
-static css_error mq_parse_range(css_language *c,
+static css_error mq_parse_range(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
const css_token *name_or_value,
css_mq_feature **feature)
@@ -237,7 +237,7 @@ static css_error mq_parse_range(css_language *c,
value_is_ratio = true;
} else if (name_or_value->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(name_or_value->idata,
- c->strings[INFINITE], &match) == lwc_error_ok &&
+ strings[INFINITE], &match) == lwc_error_ok &&
match == false) {
/* The only ident permitted for mf-value is 'infinite', thus must have name */
name = name_or_value;
@@ -380,7 +380,7 @@ static css_error mq_parse_range(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_media_feature(css_language *c,
+static css_error mq_parse_media_feature(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_feature **feature)
{
@@ -461,7 +461,8 @@ static css_error mq_parse_media_feature(css_language *c,
consumeWhitespace(vector, ctx);
} else {
/* mf-range */
- error = mq_parse_range(c, vector, ctx, name_or_value, &result);
+ error = mq_parse_range(strings, vector, ctx,
+ name_or_value, &result);
if (error != CSS_OK) {
return error;
}
@@ -470,7 +471,8 @@ static css_error mq_parse_media_feature(css_language *c,
}
} else {
/* mf-range */
- error = mq_parse_range(c, vector, ctx, name_or_value, &result);
+ error = mq_parse_range(strings, vector, ctx,
+ name_or_value, &result);
if (error != CSS_OK) {
return error;
}
@@ -494,7 +496,7 @@ static css_error mq_parse_media_feature(css_language *c,
*
* CSS Syntax Module Level 3: 8.2
*/
-static css_error mq_parse_consume_any_value(css_language *c,
+static css_error mq_parse_consume_any_value(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool until, const char until_char)
{
@@ -526,22 +528,22 @@ static css_error mq_parse_consume_any_value(css_language *c,
}
if (tokenIsChar(token, '(')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, ')');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, ')');
if (error != CSS_OK) {
return error;
}
} else if (tokenIsChar(token, '[')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, ']');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, ']');
if (error != CSS_OK) {
return error;
}
} else if (tokenIsChar(token, '{')) {
/* Need to consume until matching bracket. */
- error = mq_parse_consume_any_value(
- c, vector, ctx, true, '}');
+ error = mq_parse_consume_any_value(strings,
+ vector, ctx, true, '}');
if (error != CSS_OK) {
return error;
}
@@ -556,7 +558,7 @@ static css_error mq_parse_consume_any_value(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_general_enclosed(css_language *c,
+static css_error mq_parse_general_enclosed(lwc_string **strings,
const parserutils_vector *vector, int *ctx)
{
const css_token *token;
@@ -573,7 +575,8 @@ static css_error mq_parse_general_enclosed(css_language *c,
switch (token->type) {
case CSS_TOKEN_FUNCTION:
- error = mq_parse_consume_any_value(c, vector, ctx, true, ')');
+ error = mq_parse_consume_any_value(strings, vector, ctx,
+ true, ')');
if (error != CSS_OK) {
return error;
}
@@ -585,7 +588,8 @@ static css_error mq_parse_general_enclosed(css_language *c,
break;
case CSS_TOKEN_IDENT:
- error = mq_parse_consume_any_value(c, vector, ctx, false, '\0');
+ error = mq_parse_consume_any_value(strings, vector, ctx,
+ false, '\0');
if (error != CSS_OK) {
return error;
}
@@ -598,7 +602,7 @@ static css_error mq_parse_general_enclosed(css_language *c,
return CSS_OK;
}
-static css_error mq_parse_media_in_parens(css_language *c,
+static css_error mq_parse_media_in_parens(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_cond_or_feature **cond_or_feature)
{
@@ -631,10 +635,10 @@ static css_error mq_parse_media_in_parens(css_language *c,
if (tokenIsChar(token, '(') || (token->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
+ strings[NOT], &match) == lwc_error_ok &&
match)) {
css_mq_cond *cond;
- error = mq_parse_condition(c, vector, ctx, true, &cond);
+ error = mq_parse_condition(strings, vector, ctx, true, &cond);
if (error == CSS_OK) {
token = parserutils_vector_iterate(vector, ctx);
if (tokenIsChar(token, ')') == false) {
@@ -656,7 +660,7 @@ static css_error mq_parse_media_in_parens(css_language *c,
token->type == CSS_TOKEN_NUMBER ||
token->type == CSS_TOKEN_DIMENSION) {
css_mq_feature *feature;
- error = mq_parse_media_feature(c, vector, ctx, &feature);
+ error = mq_parse_media_feature(strings, vector, ctx, &feature);
if (error == CSS_OK) {
result = malloc(sizeof(*result));
if (result == NULL) {
@@ -672,12 +676,12 @@ static css_error mq_parse_media_in_parens(css_language *c,
}
*ctx = old_ctx;
- error = mq_parse_general_enclosed(c, vector, ctx);
+ error = mq_parse_general_enclosed(strings, vector, ctx);
return error;
}
-static css_error mq_parse_condition(css_language *c,
+static css_error mq_parse_condition(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
bool permit_or, css_mq_cond **cond)
{
@@ -699,7 +703,7 @@ static css_error mq_parse_condition(css_language *c,
if (token == NULL || tokenIsChar(token, '(') == false ||
token->type != CSS_TOKEN_IDENT ||
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) != lwc_error_ok ||
+ strings[NOT], &match) != lwc_error_ok ||
match == false) {
return CSS_INVALID;
}
@@ -721,7 +725,8 @@ static css_error mq_parse_condition(css_language *c,
parserutils_vector_iterate(vector, ctx);
consumeWhitespace(vector, ctx);
- error = mq_parse_media_in_parens(c, vector, ctx, &cond_or_feature);
+ error = mq_parse_media_in_parens(strings,
+ vector, ctx, &cond_or_feature);
if (error != CSS_OK) {
css__mq_cond_destroy(result);
return CSS_INVALID;
@@ -745,7 +750,8 @@ static css_error mq_parse_condition(css_language *c,
/* FOLLOW(media-condition) := RPAREN | COMMA | EOF */
while (token != NULL && tokenIsChar(token, ')') == false &&
tokenIsChar(token, ',') == false) {
- error = mq_parse_media_in_parens(c, vector, ctx, &cond_or_feature);
+ error = mq_parse_media_in_parens(strings, vector, ctx,
+ &cond_or_feature);
if (error != CSS_OK) {
css__mq_cond_destroy(result);
return CSS_INVALID;
@@ -771,7 +777,7 @@ static css_error mq_parse_condition(css_language *c,
css__mq_cond_destroy(result);
return CSS_INVALID;
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[AND], &match) == lwc_error_ok &&
+ strings[AND], &match) == lwc_error_ok &&
match) {
if (op != 0 && op != AND) {
css__mq_cond_destroy(result);
@@ -779,7 +785,7 @@ static css_error mq_parse_condition(css_language *c,
}
op = AND;
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[OR], &match) == lwc_error_ok &&
+ strings[OR], &match) == lwc_error_ok &&
match) {
if (permit_or == false || (op != 0 && op != OR)) {
css__mq_cond_destroy(result);
@@ -809,54 +815,54 @@ static css_error mq_parse_condition(css_language *c,
/**
* Parse a media query type.
*/
-static uint64_t mq_parse_type(css_language *c, lwc_string *type)
+static uint64_t mq_parse_type(lwc_string **strings, lwc_string *type)
{
bool match;
if (type == NULL) {
return CSS_MEDIA_ALL;
} else if (lwc_string_caseless_isequal(
- type, c->strings[AURAL],
+ type, strings[AURAL],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_AURAL;
} else if (lwc_string_caseless_isequal(
- type, c->strings[BRAILLE],
+ type, strings[BRAILLE],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_BRAILLE;
} else if (lwc_string_caseless_isequal(
- type, c->strings[EMBOSSED],
+ type, strings[EMBOSSED],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_EMBOSSED;
} else if (lwc_string_caseless_isequal(
- type, c->strings[HANDHELD],
+ type, strings[HANDHELD],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_HANDHELD;
} else if (lwc_string_caseless_isequal(
- type, c->strings[PRINT],
+ type, strings[PRINT],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_PRINT;
} else if (lwc_string_caseless_isequal(
- type, c->strings[PROJECTION],
+ type, strings[PROJECTION],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_PROJECTION;
} else if (lwc_string_caseless_isequal(
- type, c->strings[SCREEN],
+ type, strings[SCREEN],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_SCREEN;
} else if (lwc_string_caseless_isequal(
- type, c->strings[SPEECH],
+ type, strings[SPEECH],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_SPEECH;
} else if (lwc_string_caseless_isequal(
- type, c->strings[TTY],
+ type, strings[TTY],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_TTY;
} else if (lwc_string_caseless_isequal(
- type, c->strings[TV],
+ type, strings[TV],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_TV;
} else if (lwc_string_caseless_isequal(
- type, c->strings[ALL],
+ type, strings[ALL],
&match) == lwc_error_ok && match) {
return CSS_MEDIA_ALL;
}
@@ -864,7 +870,7 @@ static uint64_t mq_parse_type(css_language *c, lwc_string *type)
return 0;
}
-static css_error mq_parse_media_query(css_language *c,
+static css_error mq_parse_media_query(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **query)
{
@@ -888,7 +894,7 @@ static css_error mq_parse_media_query(css_language *c,
is_condition = true;
} else if (token->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
+ strings[NOT], &match) == lwc_error_ok &&
match) {
int old_ctx = *ctx;
@@ -911,7 +917,8 @@ static css_error mq_parse_media_query(css_language *c,
if (is_condition) {
/* media-condition */
- error = mq_parse_condition(c, vector, ctx, true, &result->cond);
+ error = mq_parse_condition(strings, vector, ctx, true,
+ &result->cond);
if (error != CSS_OK) {
free(result);
return error;
@@ -928,14 +935,12 @@ static css_error mq_parse_media_query(css_language *c,
}
if (lwc_string_caseless_isequal(token->idata,
- c->strings[NOT], &match) == lwc_error_ok &&
- match) {
+ strings[NOT], &match) == lwc_error_ok && match) {
result->negate_type = 1;
consumeWhitespace(vector, ctx);
token = parserutils_vector_iterate(vector, ctx);
} else if (lwc_string_caseless_isequal(token->idata,
- c->strings[ONLY], &match) == lwc_error_ok &&
- match) {
+ strings[ONLY], &match) == lwc_error_ok && match) {
consumeWhitespace(vector, ctx);
token = parserutils_vector_iterate(vector, ctx);
}
@@ -945,7 +950,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_INVALID;
}
- result->type = mq_parse_type(c, token->idata);
+ result->type = mq_parse_type(strings, token->idata);
consumeWhitespace(vector, ctx);
@@ -953,7 +958,7 @@ static css_error mq_parse_media_query(css_language *c,
if (token != NULL) {
if (token->type != CSS_TOKEN_IDENT ||
lwc_string_caseless_isequal(token->idata,
- c->strings[AND], &match) != lwc_error_ok ||
+ strings[AND], &match) != lwc_error_ok ||
match == false) {
free(result);
return CSS_INVALID;
@@ -961,7 +966,8 @@ static css_error mq_parse_media_query(css_language *c,
consumeWhitespace(vector, ctx);
- error = mq_parse_condition(c, vector, ctx, false, &result->cond);
+ error = mq_parse_condition(strings, vector, ctx, false,
+ &result->cond);
if (error != CSS_OK) {
free(result);
return error;
@@ -972,7 +978,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_OK;
}
-css_error css__mq_parse_media_list(css_language *c,
+css_error css__mq_parse_media_list(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **media)
{
@@ -993,7 +999,7 @@ css_error css__mq_parse_media_list(css_language *c,
while (token != NULL) {
css_mq_query *query;
- error = mq_parse_media_query(c, vector, ctx, &query);
+ error = mq_parse_media_query(strings, vector, ctx, &query);
if (error != CSS_OK) {
/* TODO: error recovery (see above) */
css__mq_query_destroy(result);
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 381e0f9..2940032 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -87,7 +87,7 @@ typedef struct css_mq_query {
css_mq_cond *cond;
} css_mq_query;
-css_error css__mq_parse_media_list(css_language *c,
+css_error css__mq_parse_media_list(lwc_string **strings,
const parserutils_vector *vector, int *ctx,
css_mq_query **media);
diff --git a/src/select/mq.h b/src/select/mq.h
index 3ae987d..5aa1404 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -50,7 +50,7 @@ static inline bool mq__list_match(const css_mq_query *m, uint64_t media)
* Test whether the rule applies for current media.
*
* \param rule Rule to test
- * \meaid media Current media type(s)
+ * \param media Current media type(s)
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
--
Cascading Style Sheets library
5 years, 1 month
libcss: branch tlsa/jmb/mq updated. release/0.7.0-52-g48305a5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/48305a59c08588afd9f454...
...commit http://git.netsurf-browser.org/libcss.git/commit/48305a59c08588afd9f454e2...
...tree http://git.netsurf-browser.org/libcss.git/tree/48305a59c08588afd9f454e2bc...
The branch, tlsa/jmb/mq has been updated
discards 5a8bbc650d55bbf14e9798b018e9a6aa7b2fc920 (commit)
discards 3ffe4302e5526735968c741e2674f15a7731b4f2 (commit)
discards 04b2bcda11a0819037bdfcf9e0ed96b4668568b2 (commit)
discards 211f8ab4f27c526aa29b25afc7d8b382b8491db4 (commit)
via 48305a59c08588afd9f454e2bcfdb10048d4cb65 (commit)
via 6bb6567ddf70c4c185c87983d05bb390fb3c035c (commit)
via 91448ea87125739ed39d9e4124ee407fa191299c (commit)
via cce0123b55e0c911c1405b1d5ec6c5bf2a8d8bba (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 (5a8bbc650d55bbf14e9798b018e9a6aa7b2fc920)
\
N -- N -- N (48305a59c08588afd9f454e2bcfdb10048d4cb65)
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/libcss.git/commit/?id=48305a59c08588afd9f4...
commit 48305a59c08588afd9f454e2bcfdb10048d4cb65
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: API for stylesheet import doesn't take media now.
diff --git a/test/css21.c b/test/css21.c
index a29fae1..cdd66f7 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -99,10 +99,8 @@ int main(int argc, char **argv)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 58ccf9a..5f926e3 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -395,10 +395,8 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=6bb6567ddf70c4c185c8...
commit 6bb6567ddf70c4c185c87983d05bb390fb3c035c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Update stylesheet import for media query lists.
diff --git a/src/select/select.c b/src/select/select.c
index 644369a..480b9f5 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1847,7 +1847,8 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1954,7 +1955,8 @@ static css_error select_font_faces_from_sheet(
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=91448ea87125739ed39d...
commit 91448ea87125739ed39d9e4124ee407fa191299c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Update rule_good_for_media for new mq struct.
Doesn't currently match media query conditions, only the
media type.
diff --git a/src/select/mq.h b/src/select/mq.h
index a0a9f6d..3ae987d 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,10 +10,47 @@
#define css_select_mq_h_
/**
+ * Match media query conditions.
+ *
+ * \param[in] cond Condition to match.
+ * \return true if condition matches, otherwise false.
+ */
+static inline bool mq_match_condition(css_mq_cond *cond)
+{
+ /* TODO: Implement this. */
+ return cond == NULL;
+}
+
+/**
+ * Test whether media query list matches current media.
+ *
+ * If anything in the list matches, it the list matches. If none match
+ * it doesn't match.
+ *
+ * \param m Media query list.
+ * \meaid media Current media spec, to check against m.
+ * \return true if media query list matches media
+ */
+static inline bool mq__list_match(const css_mq_query *m, uint64_t media)
+{
+ for (; m != NULL; m = m->next) {
+ /* Check type */
+ if (!!(m->type & media) != m->negate_type) {
+ if (mq_match_condition(m->cond)) {
+ /* We have a match, no need to look further. */
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
* Test whether the rule applies for current media.
*
- * \param rule Rule to test
- * \meaid media Current media type(s)
+ * \param rule Rule to test
+ * \meaid media Current media type(s)
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
@@ -24,10 +61,11 @@ static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
while (ancestor != NULL) {
const css_rule_media *m = (const css_rule_media *) ancestor;
- if (ancestor->type == CSS_RULE_MEDIA &&
- (m->media & media) == 0) {
- applies = false;
- break;
+ if (ancestor->type == CSS_RULE_MEDIA) {
+ applies = mq__list_match(m->media, media);
+ if (applies == false) {
+ break;
+ }
}
if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=cce0123b55e0c911c140...
commit cce0123b55e0c911c1405b1d5ec6c5bf2a8d8bba
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media Queries: Store type as value, rather than lwc_string.
Otherwise we need to convert it in selection, and select/
doesn't have access to the css_language interned strings
table.
diff --git a/src/parse/mq.c b/src/parse/mq.c
index 8f4391b..f7b8b6e 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -806,6 +806,64 @@ static css_error mq_parse_condition(css_language *c,
return CSS_OK;
}
+/**
+ * Parse a media query type.
+ */
+static uint64_t mq_parse_type(css_language *c, lwc_string *type)
+{
+ bool match;
+
+ if (type == NULL) {
+ return CSS_MEDIA_ALL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[AURAL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_AURAL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[BRAILLE],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_BRAILLE;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[EMBOSSED],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_EMBOSSED;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[HANDHELD],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_HANDHELD;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PRINT],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PRINT;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PROJECTION],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PROJECTION;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SCREEN],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SCREEN;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SPEECH],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SPEECH;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TTY],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TTY;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TV],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TV;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[ALL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_ALL;
+ }
+
+ return 0;
+}
+
static css_error mq_parse_media_query(css_language *c,
const parserutils_vector *vector, int *ctx,
css_mq_query **query)
@@ -887,7 +945,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_INVALID;
}
- result->type = lwc_string_ref(token->idata);
+ result->type = mq_parse_type(c, token->idata);
consumeWhitespace(vector, ctx);
@@ -897,7 +955,6 @@ static css_error mq_parse_media_query(css_language *c,
lwc_string_caseless_isequal(token->idata,
c->strings[AND], &match) != lwc_error_ok ||
match == false) {
- lwc_string_unref(result->type);
free(result);
return CSS_INVALID;
}
@@ -906,7 +963,6 @@ static css_error mq_parse_media_query(css_language *c,
error = mq_parse_condition(c, vector, ctx, false, &result->cond);
if (error != CSS_OK) {
- lwc_string_unref(result->type);
free(result);
return error;
}
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 77f8a8a..381e0f9 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -82,7 +82,7 @@ typedef struct css_mq_query {
struct css_mq_query *next;
uint32_t negate_type : 1; /* set if "not type" */
- lwc_string *type; /* or NULL */
+ uint64_t type; /* or NULL */
css_mq_cond *cond;
} css_mq_query;
-----------------------------------------------------------------------
Summary of changes:
--
Cascading Style Sheets library
5 years, 1 month
libcss: branch tlsa/jmb/mq updated. release/0.7.0-52-g5a8bbc6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/5a8bbc650d55bbf14e9798...
...commit http://git.netsurf-browser.org/libcss.git/commit/5a8bbc650d55bbf14e9798b0...
...tree http://git.netsurf-browser.org/libcss.git/tree/5a8bbc650d55bbf14e9798b018...
The branch, tlsa/jmb/mq has been updated
via 5a8bbc650d55bbf14e9798b018e9a6aa7b2fc920 (commit)
via 3ffe4302e5526735968c741e2674f15a7731b4f2 (commit)
via 04b2bcda11a0819037bdfcf9e0ed96b4668568b2 (commit)
via 211f8ab4f27c526aa29b25afc7d8b382b8491db4 (commit)
from 1441707ce5437784815e2cf97d695a7b0569f800 (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=5a8bbc650d55bbf14e97...
commit 5a8bbc650d55bbf14e9798b018e9a6aa7b2fc920
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media queries: API for stylesheet import doesn't take media now.
diff --git a/test/css21.c b/test/css21.c
index a29fae1..cdd66f7 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -99,10 +99,8 @@ int main(int argc, char **argv)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 58ccf9a..5f926e3 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -395,10 +395,8 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=3ffe4302e5526735968c...
commit 3ffe4302e5526735968c741e2674f15a7731b4f2
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media queries: Update stylesheet import for media query lists.
diff --git a/src/select/select.c b/src/select/select.c
index 644369a..480b9f5 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1847,7 +1847,8 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1954,7 +1955,8 @@ static css_error select_font_faces_from_sheet(
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=04b2bcda11a0819037bd...
commit 04b2bcda11a0819037bdfcf9e0ed96b4668568b2
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media queries: Update rule_good_for_media for new mq struct.
Doesn't currently match media query conditions, only the
media type.
diff --git a/src/select/mq.h b/src/select/mq.h
index a0a9f6d..3ae987d 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,10 +10,47 @@
#define css_select_mq_h_
/**
+ * Match media query conditions.
+ *
+ * \param[in] cond Condition to match.
+ * \return true if condition matches, otherwise false.
+ */
+static inline bool mq_match_condition(css_mq_cond *cond)
+{
+ /* TODO: Implement this. */
+ return cond == NULL;
+}
+
+/**
+ * Test whether media query list matches current media.
+ *
+ * If anything in the list matches, it the list matches. If none match
+ * it doesn't match.
+ *
+ * \param m Media query list.
+ * \meaid media Current media spec, to check against m.
+ * \return true if media query list matches media
+ */
+static inline bool mq__list_match(const css_mq_query *m, uint64_t media)
+{
+ for (; m != NULL; m = m->next) {
+ /* Check type */
+ if (!!(m->type & media) != m->negate_type) {
+ if (mq_match_condition(m->cond)) {
+ /* We have a match, no need to look further. */
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
* Test whether the rule applies for current media.
*
- * \param rule Rule to test
- * \meaid media Current media type(s)
+ * \param rule Rule to test
+ * \meaid media Current media type(s)
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
@@ -24,10 +61,11 @@ static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
while (ancestor != NULL) {
const css_rule_media *m = (const css_rule_media *) ancestor;
- if (ancestor->type == CSS_RULE_MEDIA &&
- (m->media & media) == 0) {
- applies = false;
- break;
+ if (ancestor->type == CSS_RULE_MEDIA) {
+ applies = mq__list_match(m->media, media);
+ if (applies == false) {
+ break;
+ }
}
if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=211f8ab4f27c526aa29b...
commit 211f8ab4f27c526aa29b25afc7d8b382b8491db4
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Media queries: Store type as value, rather than lwc_string.
Otherwise we need to convert it in selection, and select/
doesn't have access to the css_language interned strings
table.
diff --git a/src/parse/mq.c b/src/parse/mq.c
index 8f4391b..f7b8b6e 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -806,6 +806,64 @@ static css_error mq_parse_condition(css_language *c,
return CSS_OK;
}
+/**
+ * Parse a media query type.
+ */
+static uint64_t mq_parse_type(css_language *c, lwc_string *type)
+{
+ bool match;
+
+ if (type == NULL) {
+ return CSS_MEDIA_ALL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[AURAL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_AURAL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[BRAILLE],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_BRAILLE;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[EMBOSSED],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_EMBOSSED;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[HANDHELD],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_HANDHELD;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PRINT],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PRINT;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PROJECTION],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PROJECTION;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SCREEN],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SCREEN;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SPEECH],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SPEECH;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TTY],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TTY;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TV],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TV;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[ALL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_ALL;
+ }
+
+ return 0;
+}
+
static css_error mq_parse_media_query(css_language *c,
const parserutils_vector *vector, int *ctx,
css_mq_query **query)
@@ -887,7 +945,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_INVALID;
}
- result->type = lwc_string_ref(token->idata);
+ result->type = mq_parse_type(c, token->idata);
consumeWhitespace(vector, ctx);
@@ -897,7 +955,6 @@ static css_error mq_parse_media_query(css_language *c,
lwc_string_caseless_isequal(token->idata,
c->strings[AND], &match) != lwc_error_ok ||
match == false) {
- lwc_string_unref(result->type);
free(result);
return CSS_INVALID;
}
@@ -906,7 +963,6 @@ static css_error mq_parse_media_query(css_language *c,
error = mq_parse_condition(c, vector, ctx, false, &result->cond);
if (error != CSS_OK) {
- lwc_string_unref(result->type);
free(result);
return error;
}
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 77f8a8a..381e0f9 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -82,7 +82,7 @@ typedef struct css_mq_query {
struct css_mq_query *next;
uint32_t negate_type : 1; /* set if "not type" */
- lwc_string *type; /* or NULL */
+ uint64_t type; /* or NULL */
css_mq_cond *cond;
} css_mq_query;
-----------------------------------------------------------------------
Summary of changes:
src/parse/mq.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++---
src/parse/mq.h | 2 +-
src/select/mq.h | 50 ++++++++++++++++++++++++++++++++++++-----
src/select/select.c | 6 +++--
test/css21.c | 4 +---
test/parse-auto.c | 4 +---
6 files changed, 110 insertions(+), 18 deletions(-)
diff --git a/src/parse/mq.c b/src/parse/mq.c
index 8f4391b..f7b8b6e 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -806,6 +806,64 @@ static css_error mq_parse_condition(css_language *c,
return CSS_OK;
}
+/**
+ * Parse a media query type.
+ */
+static uint64_t mq_parse_type(css_language *c, lwc_string *type)
+{
+ bool match;
+
+ if (type == NULL) {
+ return CSS_MEDIA_ALL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[AURAL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_AURAL;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[BRAILLE],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_BRAILLE;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[EMBOSSED],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_EMBOSSED;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[HANDHELD],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_HANDHELD;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PRINT],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PRINT;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[PROJECTION],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_PROJECTION;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SCREEN],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SCREEN;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[SPEECH],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_SPEECH;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TTY],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TTY;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[TV],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_TV;
+ } else if (lwc_string_caseless_isequal(
+ type, c->strings[ALL],
+ &match) == lwc_error_ok && match) {
+ return CSS_MEDIA_ALL;
+ }
+
+ return 0;
+}
+
static css_error mq_parse_media_query(css_language *c,
const parserutils_vector *vector, int *ctx,
css_mq_query **query)
@@ -887,7 +945,7 @@ static css_error mq_parse_media_query(css_language *c,
return CSS_INVALID;
}
- result->type = lwc_string_ref(token->idata);
+ result->type = mq_parse_type(c, token->idata);
consumeWhitespace(vector, ctx);
@@ -897,7 +955,6 @@ static css_error mq_parse_media_query(css_language *c,
lwc_string_caseless_isequal(token->idata,
c->strings[AND], &match) != lwc_error_ok ||
match == false) {
- lwc_string_unref(result->type);
free(result);
return CSS_INVALID;
}
@@ -906,7 +963,6 @@ static css_error mq_parse_media_query(css_language *c,
error = mq_parse_condition(c, vector, ctx, false, &result->cond);
if (error != CSS_OK) {
- lwc_string_unref(result->type);
free(result);
return error;
}
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 77f8a8a..381e0f9 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -82,7 +82,7 @@ typedef struct css_mq_query {
struct css_mq_query *next;
uint32_t negate_type : 1; /* set if "not type" */
- lwc_string *type; /* or NULL */
+ uint64_t type; /* or NULL */
css_mq_cond *cond;
} css_mq_query;
diff --git a/src/select/mq.h b/src/select/mq.h
index a0a9f6d..3ae987d 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,10 +10,47 @@
#define css_select_mq_h_
/**
+ * Match media query conditions.
+ *
+ * \param[in] cond Condition to match.
+ * \return true if condition matches, otherwise false.
+ */
+static inline bool mq_match_condition(css_mq_cond *cond)
+{
+ /* TODO: Implement this. */
+ return cond == NULL;
+}
+
+/**
+ * Test whether media query list matches current media.
+ *
+ * If anything in the list matches, it the list matches. If none match
+ * it doesn't match.
+ *
+ * \param m Media query list.
+ * \meaid media Current media spec, to check against m.
+ * \return true if media query list matches media
+ */
+static inline bool mq__list_match(const css_mq_query *m, uint64_t media)
+{
+ for (; m != NULL; m = m->next) {
+ /* Check type */
+ if (!!(m->type & media) != m->negate_type) {
+ if (mq_match_condition(m->cond)) {
+ /* We have a match, no need to look further. */
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
* Test whether the rule applies for current media.
*
- * \param rule Rule to test
- * \meaid media Current media type(s)
+ * \param rule Rule to test
+ * \meaid media Current media type(s)
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
@@ -24,10 +61,11 @@ static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media)
while (ancestor != NULL) {
const css_rule_media *m = (const css_rule_media *) ancestor;
- if (ancestor->type == CSS_RULE_MEDIA &&
- (m->media & media) == 0) {
- applies = false;
- break;
+ if (ancestor->type == CSS_RULE_MEDIA) {
+ applies = mq__list_match(m->media, media);
+ if (applies == false) {
+ break;
+ }
}
if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) {
diff --git a/src/select/select.c b/src/select/select.c
index 644369a..480b9f5 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1847,7 +1847,8 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
@@ -1954,7 +1955,8 @@ static css_error select_font_faces_from_sheet(
(const css_rule_import *) rule;
if (import->sheet != NULL &&
- (import->media & state->media) != 0) {
+ mq__list_match(import->media,
+ state->media)) {
/* It's applicable, so process it */
if (sp >= IMPORT_STACK_SIZE)
return CSS_NOMEM;
diff --git a/test/css21.c b/test/css21.c
index a29fae1..cdd66f7 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -99,10 +99,8 @@ int main(int argc, char **argv)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 58ccf9a..5f926e3 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -395,10 +395,8 @@ void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen)
while (error == CSS_IMPORTS_PENDING) {
lwc_string *url;
- uint64_t media;
- error = css_stylesheet_next_pending_import(sheet,
- &url, &media);
+ error = css_stylesheet_next_pending_import(sheet, &url);
assert(error == CSS_OK || error == CSS_INVALID);
if (error == CSS_OK) {
--
Cascading Style Sheets library
5 years, 1 month
netsurf-wiki: branch master updated. 494f0f23d319b48109f8b6f2bdb2ab2d70f7c702
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/494f0f23d319b481...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/494f0f23d319b48109...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/494f0f23d319b48109f8...
The branch, master has been updated
via 494f0f23d319b48109f8b6f2bdb2ab2d70f7c702 (commit)
from 252c20eac432b042ef720407fb7a753150633e77 (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=494f0f23d319b4...
commit 494f0f23d319b48109f8b6f2bdb2ab2d70f7c702
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Finished
diff --git a/developer-weekend/jul-2018.mdwn b/developer-weekend/jul-2018.mdwn
index 2a7f64c..1d46ba6 100644
--- a/developer-weekend/jul-2018.mdwn
+++ b/developer-weekend/jul-2018.mdwn
@@ -26,7 +26,7 @@ Topics
* Update CI to turn on santizers for builds on supported platforms.
* Update CI to ensure `DEBUG` level _nslog_ stuff is compiled in for CI builds.
* Toolchain patches need examining. Consider if we can build with a more
- modern OS for Atari.
+ modern OS for Atari. _Sadly we missed this one_
Activity
========
@@ -34,6 +34,7 @@ Activity
Bug Triage
----------
+* Group bug for line breaking issues is [[!bug 467]]
Daniel
------
@@ -48,6 +49,11 @@ Daniel
* Added `sanitize` target to the main NetSurf makefiles including nice config
overrides. For main docs, see `Makefile.config.example` but failing that you
can run the test suite in sanitizer mode with: `make sanitize`
+* Made it so that CI builds of NetSurf set the `libnslog` compile-in level to
+ `DEBUG`
+* Make sanitizer changes to `libsvgtiny`, `libnsbmp`, `libnsgif` etc.
+* Made a bunch of changes to `libdom` to clean up, it's still not `sanitize`
+ clean sadly.
Michael
-------
@@ -55,15 +61,12 @@ Michael
* Helped on [[!bug 2606]]
* Looked at sanitizer issues.
-John-Mark Bell
---------------
-
-
Vincent Sanders
---------------
* Added sanitizer targets for some libraries, but....
* Spent quite a while fettling the CI workers so that they will, erm, CI work.
+* Triaged bunch of line-breaking related bugs on the tracker
Frontends
=========
@@ -74,6 +77,6 @@ decided they're all good so we're not changing them for now.
Next time
=========
-We have chosen the next developer weekend to be October 26/27/28 2018.
-It shall be at _undisclosed location_.
+We have chosen the next developer weekend to be November 2/3/4 2018.
+It shall be at Avon Road in Manchester
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/jul-2018.mdwn | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/developer-weekend/jul-2018.mdwn b/developer-weekend/jul-2018.mdwn
index 2a7f64c..1d46ba6 100644
--- a/developer-weekend/jul-2018.mdwn
+++ b/developer-weekend/jul-2018.mdwn
@@ -26,7 +26,7 @@ Topics
* Update CI to turn on santizers for builds on supported platforms.
* Update CI to ensure `DEBUG` level _nslog_ stuff is compiled in for CI builds.
* Toolchain patches need examining. Consider if we can build with a more
- modern OS for Atari.
+ modern OS for Atari. _Sadly we missed this one_
Activity
========
@@ -34,6 +34,7 @@ Activity
Bug Triage
----------
+* Group bug for line breaking issues is [[!bug 467]]
Daniel
------
@@ -48,6 +49,11 @@ Daniel
* Added `sanitize` target to the main NetSurf makefiles including nice config
overrides. For main docs, see `Makefile.config.example` but failing that you
can run the test suite in sanitizer mode with: `make sanitize`
+* Made it so that CI builds of NetSurf set the `libnslog` compile-in level to
+ `DEBUG`
+* Make sanitizer changes to `libsvgtiny`, `libnsbmp`, `libnsgif` etc.
+* Made a bunch of changes to `libdom` to clean up, it's still not `sanitize`
+ clean sadly.
Michael
-------
@@ -55,15 +61,12 @@ Michael
* Helped on [[!bug 2606]]
* Looked at sanitizer issues.
-John-Mark Bell
---------------
-
-
Vincent Sanders
---------------
* Added sanitizer targets for some libraries, but....
* Spent quite a while fettling the CI workers so that they will, erm, CI work.
+* Triaged bunch of line-breaking related bugs on the tracker
Frontends
=========
@@ -74,6 +77,6 @@ decided they're all good so we're not changing them for now.
Next time
=========
-We have chosen the next developer weekend to be October 26/27/28 2018.
-It shall be at _undisclosed location_.
+We have chosen the next developer weekend to be November 2/3/4 2018.
+It shall be at Avon Road in Manchester
--
NetSurf Developer Wiki Backing Store
5 years, 1 month
libdom: branch master updated. release/0.3.2-10-g14e6724
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/14e6724ec71b08a88dca13...
...commit http://git.netsurf-browser.org/libdom.git/commit/14e6724ec71b08a88dca138c...
...tree http://git.netsurf-browser.org/libdom.git/tree/14e6724ec71b08a88dca138c4d...
The branch, master has been updated
via 14e6724ec71b08a88dca138c4de10ad695430dfd (commit)
via 2da4dab86544670377b108ada0d69445d1b09a51 (commit)
via ca9930d02e9534d83542a188011ac9c8b6171965 (commit)
via bf086809f141ba674ddc0cd05f4308b5e6433d12 (commit)
via 200d016f47a3758e74c316941b4b5b24808a6dc3 (commit)
via ce4b94ca443909a31a28e4f127dac0348bbedec1 (commit)
via 082f200f5eb1112268d902ce6761a344cdd64fbe (commit)
via 0e2affea305cbf683144c9dbffe79e1560106d2c (commit)
from 77c5d9f20a3e51b64a065e14449333b7a1e9f00d (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/libdom.git/commit/?id=14e6724ec71b08a88dca...
commit 14e6724ec71b08a88dca138c4de10ad695430dfd
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Cleanups in the DOMTS should be safe
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 5022db9..3cf0b7a 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -1605,7 +1605,7 @@ sub addto_cleanup {
if (exists $unref_prefix{$type}) {
$prefix = $unref_prefix{$type};
}
- push(@{$self->{unref}}, $prefix."_unref(".$var.");\n");
+ push(@{$self->{unref}}, "if (".$var." != NULL) { ".$prefix."_unref(".$var."); ".$var." = NULL; }\n");
}
}
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=2da4dab86544670377b1...
commit 2da4dab86544670377b108ada0d69445d1b09a51
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
More cleanup for iterating in test suite
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 0cf3a56..5022db9 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -1314,6 +1314,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domnamednodemap($coll, \&iterator$iterator_index);\n";
print "while(get_next_domnamednodemap($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
if ($self->{"var"}->{$coll} eq "HTMLCollection") {
@@ -1321,6 +1322,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domhtmlcollection($coll, \&iterator$iterator_index);\n";
print "while(get_next_domhtmlcollection($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
}
}
diff --git a/test/testutils/foreach.c b/test/testutils/foreach.c
index e23192c..533958f 100644
--- a/test/testutils/foreach.c
+++ b/test/testutils/foreach.c
@@ -93,6 +93,7 @@ bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, do
{
dom_exception err;
uint32_t len;
+ dom_node *old = *ret;
err = dom_namednodemap_get_length(map, &len);
if (err != DOM_NO_ERR)
@@ -104,7 +105,10 @@ bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, do
err = dom_namednodemap_item(map, (*iterator), ret);
if (err != DOM_NO_ERR)
return false;
-
+
+ if (old != NULL)
+ dom_node_unref(old);
+
(*iterator)++;
return true;
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=ca9930d02e9534d83542...
commit ca9930d02e9534d83542a188011ac9c8b6171965
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Various extra cleanups in list implementation for test suite
diff --git a/test/testutils/list.c b/test/testutils/list.c
index 09a8cfc..fa43c61 100644
--- a/test/testutils/list.c
+++ b/test/testutils/list.c
@@ -100,6 +100,10 @@ bool list_remove(struct list* list, void* data)
} else {
prevElt->next = nextElt;
}
+ if (list->type == DOM_STRING)
+ dom_string_unref((dom_string *) elt->data);
+ if (list->type == NODE)
+ dom_node_unref(elt->data);
free(elt);
list->size--;
found = true;
@@ -164,7 +168,7 @@ bool list_contains_all(struct list* superList, struct list* subList,
subElt = subElt->next;
}
- free(superListClone);
+ list_destroy(superListClone);
return found;
}
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=bf086809f141ba674ddc...
commit bf086809f141ba674ddc0cd05f4308b5e6433d12
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Make API note that unreffing is up to the caller for dom_nodelist_item()
diff --git a/src/core/nodelist.c b/src/core/nodelist.c
index e2a1435..c549255 100644
--- a/src/core/nodelist.c
+++ b/src/core/nodelist.c
@@ -298,6 +298,9 @@ dom_exception dom_nodelist_get_length(dom_nodelist *list, uint32_t *length)
*
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
+ *
+ * NOTE: If \ref node contains a node pointer already, it will *NOT* be
+ * unreffed. Managing the lifetime of that is up to the caller.
*/
dom_exception _dom_nodelist_item(dom_nodelist *list,
uint32_t index, dom_node **node)
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=200d016f47a3758e74c3...
commit 200d016f47a3758e74c316941b4b5b24808a6dc3
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Unref nodes properly in foreach
diff --git a/test/testutils/foreach.c b/test/testutils/foreach.c
index 05d7f2a..e23192c 100644
--- a/test/testutils/foreach.c
+++ b/test/testutils/foreach.c
@@ -44,6 +44,7 @@ bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node
{
dom_exception err;
uint32_t len;
+ dom_node *old = *ret;
err = dom_nodelist_get_length(list, &len);
if (err != DOM_NO_ERR)
@@ -56,6 +57,12 @@ bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node
if (err != DOM_NO_ERR)
return false;
+ /* NOTE: If we change the API of dom_nodelist_item to release the ref
+ * then we should remove this
+ */
+ if (old != NULL)
+ dom_node_unref(old);
+
(*iterator)++;
return true;
}
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=ce4b94ca443909a31a28...
commit ce4b94ca443909a31a28e4f127dac0348bbedec1
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Clean up nodes and lists
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 09b657e..0cf3a56 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -1306,6 +1306,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domnodelist($coll, \&iterator$iterator_index);\n";
print "while(get_next_domnodelist($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
if ($self->{"var"}->{$coll} eq "NamedNodeMap") {
@@ -1560,6 +1561,12 @@ sub end_half_assertion {
### Enclose an unsed function
##############################################################################################
+sub cleanup_lists {
+ my ($self, $indent) = @_;
+ foreach my $list (keys %{$self->{list_map}}) {
+ print "${indent}if ($list != NULL)\n${indent}\tlist_destroy($list);\n" if ($list ne '');
+ }
+}
sub cleanup_domvar {
my ($self, $indent) = @_;
@@ -1579,6 +1586,7 @@ sub cleanup {
my $self = shift;
print "\n\n";
+ $self->cleanup_lists("\t");
$self->cleanup_domstring("\t");
$self->cleanup_domvar("\t");
print "\n\tprintf(\"PASS\");\n";
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=082f200f5eb1112268d9...
commit 082f200f5eb1112268d902ce6761a344cdd64fbe
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Update libdom python gdb to python 3
diff --git a/gdb/libdom.py b/gdb/libdom.py
index 65286e3..09b1577 100644
--- a/gdb/libdom.py
+++ b/gdb/libdom.py
@@ -49,9 +49,9 @@ def dom_node_pending_offset():
return gdb.parse_and_eval("(int)&((struct dom_node_internal *)0)->pending_list")
def dom_print_node(node, prefix = ""):
- print("%s%s @ %s [%s]%s" % (prefix, dom_node_type(node),
+ print(("%s%s @ %s [%s]%s" % (prefix, dom_node_type(node),
node.address, dom_node_refcnt(node),
- dom_node_name(node)))
+ dom_node_name(node))))
def dom_walk_tree(node, prefix = ""):
dom_print_node(node, prefix)
@@ -61,12 +61,12 @@ def dom_walk_tree(node, prefix = ""):
current = current['next'].dereference()
def dom_document_show(doc):
- print "Node Tree:"
+ print("Node Tree:")
node = dom_node_at(doc.address)
dom_walk_tree(node, " ")
pending = doc['pending_nodes']
if pending['next'] != pending.address:
- print "Pending Node trees:"
+ print("Pending Node trees:")
current_list_entry = pending['next']
while current_list_entry is not None:
voidp = current_list_entry.cast(dom_get_type_ptr("void"))
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=0e2affea305cbf683144...
commit 0e2affea305cbf683144c9dbffe79e1560106d2c
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Ensure we clean up if load_html fails in the test runner
diff --git a/test/testutils/load.c b/test/testutils/load.c
index eba4cb0..ea68fcf 100644
--- a/test/testutils/load.c
+++ b/test/testutils/load.c
@@ -101,7 +101,7 @@ dom_document *load_html(const char *file, bool willBeModified)
int handle;
int readed;
dom_hubbub_error error;
- dom_document *ret;
+ dom_document *ret = NULL;
uint8_t buffer[1024];
dom_hubbub_parser_params params;
@@ -118,6 +118,8 @@ dom_document *load_html(const char *file, bool willBeModified)
error = dom_hubbub_parser_create(¶ms, &parser, &ret);
if (error != DOM_HUBBUB_OK) {
fprintf(stderr, "Can't create Hubbub Parser\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -125,6 +127,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (handle == -1) {
dom_hubbub_parser_destroy(parser);
/* fprintf(stderr, "Can't open test input file: %s\n", file); */
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -133,6 +137,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing errors occur\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -142,6 +148,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing errors occur\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
}
@@ -150,6 +158,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing error when construct DOM\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
-----------------------------------------------------------------------
Summary of changes:
gdb/libdom.py | 8 ++++----
src/core/nodelist.c | 3 +++
test/DOMTSHandler.pm | 12 +++++++++++-
test/testutils/foreach.c | 13 ++++++++++++-
test/testutils/list.c | 6 +++++-
test/testutils/load.c | 12 +++++++++++-
6 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/gdb/libdom.py b/gdb/libdom.py
index 65286e3..09b1577 100644
--- a/gdb/libdom.py
+++ b/gdb/libdom.py
@@ -49,9 +49,9 @@ def dom_node_pending_offset():
return gdb.parse_and_eval("(int)&((struct dom_node_internal *)0)->pending_list")
def dom_print_node(node, prefix = ""):
- print("%s%s @ %s [%s]%s" % (prefix, dom_node_type(node),
+ print(("%s%s @ %s [%s]%s" % (prefix, dom_node_type(node),
node.address, dom_node_refcnt(node),
- dom_node_name(node)))
+ dom_node_name(node))))
def dom_walk_tree(node, prefix = ""):
dom_print_node(node, prefix)
@@ -61,12 +61,12 @@ def dom_walk_tree(node, prefix = ""):
current = current['next'].dereference()
def dom_document_show(doc):
- print "Node Tree:"
+ print("Node Tree:")
node = dom_node_at(doc.address)
dom_walk_tree(node, " ")
pending = doc['pending_nodes']
if pending['next'] != pending.address:
- print "Pending Node trees:"
+ print("Pending Node trees:")
current_list_entry = pending['next']
while current_list_entry is not None:
voidp = current_list_entry.cast(dom_get_type_ptr("void"))
diff --git a/src/core/nodelist.c b/src/core/nodelist.c
index e2a1435..c549255 100644
--- a/src/core/nodelist.c
+++ b/src/core/nodelist.c
@@ -298,6 +298,9 @@ dom_exception dom_nodelist_get_length(dom_nodelist *list, uint32_t *length)
*
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
+ *
+ * NOTE: If \ref node contains a node pointer already, it will *NOT* be
+ * unreffed. Managing the lifetime of that is up to the caller.
*/
dom_exception _dom_nodelist_item(dom_nodelist *list,
uint32_t index, dom_node **node)
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 09b657e..3cf0b7a 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -1306,6 +1306,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domnodelist($coll, \&iterator$iterator_index);\n";
print "while(get_next_domnodelist($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
if ($self->{"var"}->{$coll} eq "NamedNodeMap") {
@@ -1313,6 +1314,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domnamednodemap($coll, \&iterator$iterator_index);\n";
print "while(get_next_domnamednodemap($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
if ($self->{"var"}->{$coll} eq "HTMLCollection") {
@@ -1320,6 +1322,7 @@ sub generate_control_statement {
print "unsigned int iterator$iterator_index = 0;";
print "foreach_initialise_domhtmlcollection($coll, \&iterator$iterator_index);\n";
print "while(get_next_domhtmlcollection($coll, \&iterator$iterator_index, \&$member)) {\n";
+ $self->addto_cleanup($member);
}
}
}
@@ -1560,6 +1563,12 @@ sub end_half_assertion {
### Enclose an unsed function
##############################################################################################
+sub cleanup_lists {
+ my ($self, $indent) = @_;
+ foreach my $list (keys %{$self->{list_map}}) {
+ print "${indent}if ($list != NULL)\n${indent}\tlist_destroy($list);\n" if ($list ne '');
+ }
+}
sub cleanup_domvar {
my ($self, $indent) = @_;
@@ -1579,6 +1588,7 @@ sub cleanup {
my $self = shift;
print "\n\n";
+ $self->cleanup_lists("\t");
$self->cleanup_domstring("\t");
$self->cleanup_domvar("\t");
print "\n\tprintf(\"PASS\");\n";
@@ -1595,7 +1605,7 @@ sub addto_cleanup {
if (exists $unref_prefix{$type}) {
$prefix = $unref_prefix{$type};
}
- push(@{$self->{unref}}, $prefix."_unref(".$var.");\n");
+ push(@{$self->{unref}}, "if (".$var." != NULL) { ".$prefix."_unref(".$var."); ".$var." = NULL; }\n");
}
}
diff --git a/test/testutils/foreach.c b/test/testutils/foreach.c
index 05d7f2a..533958f 100644
--- a/test/testutils/foreach.c
+++ b/test/testutils/foreach.c
@@ -44,6 +44,7 @@ bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node
{
dom_exception err;
uint32_t len;
+ dom_node *old = *ret;
err = dom_nodelist_get_length(list, &len);
if (err != DOM_NO_ERR)
@@ -56,6 +57,12 @@ bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node
if (err != DOM_NO_ERR)
return false;
+ /* NOTE: If we change the API of dom_nodelist_item to release the ref
+ * then we should remove this
+ */
+ if (old != NULL)
+ dom_node_unref(old);
+
(*iterator)++;
return true;
}
@@ -86,6 +93,7 @@ bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, do
{
dom_exception err;
uint32_t len;
+ dom_node *old = *ret;
err = dom_namednodemap_get_length(map, &len);
if (err != DOM_NO_ERR)
@@ -97,7 +105,10 @@ bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, do
err = dom_namednodemap_item(map, (*iterator), ret);
if (err != DOM_NO_ERR)
return false;
-
+
+ if (old != NULL)
+ dom_node_unref(old);
+
(*iterator)++;
return true;
diff --git a/test/testutils/list.c b/test/testutils/list.c
index 09a8cfc..fa43c61 100644
--- a/test/testutils/list.c
+++ b/test/testutils/list.c
@@ -100,6 +100,10 @@ bool list_remove(struct list* list, void* data)
} else {
prevElt->next = nextElt;
}
+ if (list->type == DOM_STRING)
+ dom_string_unref((dom_string *) elt->data);
+ if (list->type == NODE)
+ dom_node_unref(elt->data);
free(elt);
list->size--;
found = true;
@@ -164,7 +168,7 @@ bool list_contains_all(struct list* superList, struct list* subList,
subElt = subElt->next;
}
- free(superListClone);
+ list_destroy(superListClone);
return found;
}
diff --git a/test/testutils/load.c b/test/testutils/load.c
index eba4cb0..ea68fcf 100644
--- a/test/testutils/load.c
+++ b/test/testutils/load.c
@@ -101,7 +101,7 @@ dom_document *load_html(const char *file, bool willBeModified)
int handle;
int readed;
dom_hubbub_error error;
- dom_document *ret;
+ dom_document *ret = NULL;
uint8_t buffer[1024];
dom_hubbub_parser_params params;
@@ -118,6 +118,8 @@ dom_document *load_html(const char *file, bool willBeModified)
error = dom_hubbub_parser_create(¶ms, &parser, &ret);
if (error != DOM_HUBBUB_OK) {
fprintf(stderr, "Can't create Hubbub Parser\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -125,6 +127,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (handle == -1) {
dom_hubbub_parser_destroy(parser);
/* fprintf(stderr, "Can't open test input file: %s\n", file); */
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -133,6 +137,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing errors occur\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
@@ -142,6 +148,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing errors occur\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
}
@@ -150,6 +158,8 @@ dom_document *load_html(const char *file, bool willBeModified)
if (error != DOM_HUBBUB_OK) {
dom_hubbub_parser_destroy(parser);
fprintf(stderr, "Parsing error when construct DOM\n");
+ if (ret != NULL)
+ dom_node_unref(ret);
return NULL;
}
--
Document Object Model library
5 years, 1 month
netsurf-website: branch master updated. afe7502dfb4389ad67d2818cf09ba88148ed9069
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-website.git/shortlog/afe7502dfb438...
...commit http://git.netsurf-browser.org/netsurf-website.git/commit/afe7502dfb4389a...
...tree http://git.netsurf-browser.org/netsurf-website.git/tree/afe7502dfb4389ad6...
The branch, master has been updated
via afe7502dfb4389ad67d2818cf09ba88148ed9069 (commit)
from 1310062609eb9636e8803fa0fc980b2221831ecc (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-website.git/commit/?id=afe7502dfb4...
commit afe7502dfb4389ad67d2818cf09ba88148ed9069
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove reference to linux framebuffer.
This surface type has been removed.
diff --git a/about/index.html b/about/index.html
index 7407d6e..efeeed5 100644
--- a/about/index.html
+++ b/about/index.html
@@ -170,8 +170,6 @@
<p>NetSurf's framebuffer front end has no particular operating system or GUI toolkit requirements. Its mouse pointer, all its widgets etc, are drawn though NetSurf's internal plotters, the same rendering interface used to draw web pages. This makes the framebuffer front end highly portable. Currently the framebuffer front end can target the following framebuffer surface providers:</p>
<dl>
-<dt>The Linux framebuffer</dt>
-<dd>Output to a Linux framebuffer and input from Linux input event device nodes. The output device may be specified and defaults to <code style="color:#46a;">/dev/fb0</code>. The input node search path may also be specified, and defaults to <code style="color:#46a;">/dev/input/</code>.</dd>
<dt>SDL</dt>
<dd>The SDL surface is a straightforward port to the SDL library which is available for many operating systems. This allows the framebuffer NetSurf front end to be run inside a desktop window, making development easier.</dd>
<dt>X</dt>
-----------------------------------------------------------------------
Summary of changes:
about/index.html | 2 --
1 file changed, 2 deletions(-)
diff --git a/about/index.html b/about/index.html
index 7407d6e..efeeed5 100644
--- a/about/index.html
+++ b/about/index.html
@@ -170,8 +170,6 @@
<p>NetSurf's framebuffer front end has no particular operating system or GUI toolkit requirements. Its mouse pointer, all its widgets etc, are drawn though NetSurf's internal plotters, the same rendering interface used to draw web pages. This makes the framebuffer front end highly portable. Currently the framebuffer front end can target the following framebuffer surface providers:</p>
<dl>
-<dt>The Linux framebuffer</dt>
-<dd>Output to a Linux framebuffer and input from Linux input event device nodes. The output device may be specified and defaults to <code style="color:#46a;">/dev/fb0</code>. The input node search path may also be specified, and defaults to <code style="color:#46a;">/dev/input/</code>.</dd>
<dt>SDL</dt>
<dd>The SDL surface is a straightforward port to the SDL library which is available for many operating systems. This allows the framebuffer NetSurf front end to be run inside a desktop window, making development easier.</dd>
<dt>X</dt>
--
NetSurf website source for *.netsurf-browser.org
5 years, 1 month
libnsfb: branch master updated. release/0.1.6-9-gb2bb565
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/b2bb565402143c2b63d00...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/b2bb565402143c2b63d00ac...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/b2bb565402143c2b63d00ac8c...
The branch, master has been updated
via b2bb565402143c2b63d00ac8c89e3197ffe5354f (commit)
from 51d3ee85de73949483af79671fe9075a10e405e3 (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/libnsfb.git/commit/?id=b2bb565402143c2b63d...
commit b2bb565402143c2b63d00ac8c89e3197ffe5354f
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove broken surface handlers for ABLE and linux framebuffer interface
diff --git a/Makefile b/Makefile
index fed9b5d..f956e6a 100644
--- a/Makefile
+++ b/Makefile
@@ -48,14 +48,6 @@ $(eval $(call pkg_config_package_available,NSFB_SDL_AVAILABLE,sdl))
$(eval $(call pkg_config_package_available,NSFB_XCB_AVAILABLE,$(NSFB_XCB_PKG_NAMES)))
$(eval $(call pkg_config_package_available,NSFB_WLD_AVAILABLE,wayland-client))
-# surfaces not detectable via pkg-config
-NSFB_ABLE_AVAILABLE := no
-ifeq ($(findstring linux,$(HOST)),linux)
- NSFB_LINUX_AVAILABLE := yes
-else
- NSFB_LINUX_AVAILABLE := no
-endif
-
# Flags and setup for each support library
ifeq ($(NSFB_SDL_AVAILABLE),yes)
$(eval $(call pkg_config_package_add_flags,sdl,CFLAGS))
diff --git a/README b/README
index 732e850..b4a1685 100644
--- a/README
+++ b/README
@@ -16,10 +16,12 @@ Requirements
+ GNU make or compatible
+ Pkg-config
- Libnsfb also requires the following libraries to be installed:
+ The following libraries may also be installed:
- + SDL 1.2 (for the SDL backend)
- + libxcb* (for the X11 backend)
+ + SDL 1.2 (for the SDL surface)
+ + libxcb* (for the X11 surface)
+ * wayland-client (for wayland surface)
+ * libvncserver (for vnc surface)
Compilation
-----------
diff --git a/src/surface/Makefile b/src/surface/Makefile
index ad23cc4..848c3d4 100644
--- a/src/surface/Makefile
+++ b/src/surface/Makefile
@@ -4,8 +4,6 @@
SURFACE_HANDLER_yes := surface.c ram.c
# optional surface handlers
-SURFACE_HANDLER_$(NSFB_ABLE_AVAILABLE) += able.c
-SURFACE_HANDLER_$(NSFB_LINUX_AVAILABLE) += linux.c
SURFACE_HANDLER_$(NSFB_SDL_AVAILABLE) += sdl.c
SURFACE_HANDLER_$(NSFB_XCB_AVAILABLE) += x.c
SURFACE_HANDLER_$(NSFB_VNC_AVAILABLE) += vnc.c
diff --git a/src/surface/able.c b/src/surface/able.c
deleted file mode 100644
index dd4c340..0000000
--- a/src/surface/able.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2009 Vincent Sanders <vince(a)simtec.co.uk>
- *
- * This file is part of libnsfb, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "libnsfb.h"
-#include "libnsfb_plot.h"
-#include "libnsfb_event.h"
-#include "nsfb.h"
-#include "surface.h"
-
-#define UNUSED(x) ((x) = (x))
-
-static int able_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format)
-{
- if (nsfb->surface_priv != NULL)
- return -1; /* if were already initialised fail */
-
- nsfb->width = width;
- nsfb->height = height;
- nsfb->format = format;
-
- return 0;
-}
-
-static int able_initialise(nsfb_t *nsfb)
-{
- UNUSED(nsfb);
- return 0;
-}
-
-static int able_finalise(nsfb_t *nsfb)
-{
- UNUSED(nsfb);
- return 0;
-}
-
-static bool able_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
-{
- UNUSED(nsfb);
- UNUSED(event);
- UNUSED(timeout);
- return false;
-}
-
-const nsfb_surface_rtns_t able_rtns = {
- .initialise = able_initialise,
- .finalise = able_finalise,
- .input = able_input,
- .geometry = able_set_geometry,
-};
-
-NSFB_SURFACE_DEF(able, NSFB_SURFACE_ABLE, &able_rtns)
diff --git a/src/surface/linux.c b/src/surface/linux.c
deleted file mode 100644
index b5bf8ad..0000000
--- a/src/surface/linux.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince(a)simtec.co.uk>
- *
- * This file is part of libnsfb, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <linux/fb.h>
-
-
-#include "libnsfb.h"
-#include "libnsfb_event.h"
-#include "libnsfb_plot.h"
-#include "libnsfb_plot_util.h"
-
-#include "nsfb.h"
-#include "plot.h"
-#include "surface.h"
-#include "cursor.h"
-
-
-
-#define UNUSED(x) ((x) = (x))
-
-#define FB_NAME "/dev/fb0"
-
-struct lnx_priv {
- struct fb_fix_screeninfo FixInfo;
- struct fb_var_screeninfo VarInfo;
- int fd;
-};
-
-static int linux_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format)
-{
- if (nsfb->surface_priv != NULL) {
- return -1; /* if we are already initialised fail */
- }
-
- nsfb->width = width;
- nsfb->height = height;
- nsfb->format = format;
-
- /* select default sw plotters for bpp */
- if (select_plotters(nsfb) != true) {
- return -1;
- }
-
- return 0;
-}
-
-static enum nsfb_format_e
-format_from_lstate(struct lnx_priv *lstate)
-{
- enum nsfb_format_e fmt = NSFB_FMT_ANY;
-
- switch(lstate->VarInfo.bits_per_pixel) {
- case 32:
- if (lstate->VarInfo.transp.length == 0)
- fmt = NSFB_FMT_XBGR8888;
- else
- fmt = NSFB_FMT_ABGR8888;
- break;
-
- case 24:
- fmt = NSFB_FMT_RGB888;
- break;
-
- case 16:
- fmt = NSFB_FMT_RGB565;
- break;
-
- case 8:
- fmt = NSFB_FMT_I8;
- break;
-
- case 1:
- fmt = NSFB_FMT_RGB565;
- break;
-
- }
-
-
- return fmt;
-}
-
-static int linux_initialise(nsfb_t *nsfb)
-{
- int iFrameBufferSize;
- struct lnx_priv *lstate;
- enum nsfb_format_e lformat;
-
- if (nsfb->surface_priv != NULL)
- return -1;
-
- lstate = calloc(1, sizeof(struct lnx_priv));
- if (lstate == NULL) {
- return -1;
- }
-
- /* Open the framebuffer device in read write */
- lstate->fd = open(FB_NAME, O_RDWR);
- if (lstate->fd < 0) {
- printf("Unable to open %s.\n", FB_NAME);
- free(lstate);
- return -1;
- }
-
- /* Do Ioctl. Retrieve fixed screen info. */
- if (ioctl(lstate->fd, FBIOGET_FSCREENINFO, &lstate->FixInfo) < 0) {
- printf("get fixed screen info failed: %s\n",
- strerror(errno));
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- /* Do Ioctl. Get the variable screen info. */
- if (ioctl(lstate->fd, FBIOGET_VSCREENINFO, &lstate->VarInfo) < 0) {
- printf("Unable to retrieve variable screen info: %s\n",
- strerror(errno));
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- /* Calculate the size to mmap */
- iFrameBufferSize = lstate->FixInfo.line_length * lstate->VarInfo.yres;
-
- /* Now mmap the framebuffer. */
- nsfb->ptr = mmap(NULL, iFrameBufferSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, lstate->fd, 0);
- if (nsfb->ptr == NULL) {
- printf("mmap failed:\n");
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- nsfb->linelen = lstate->FixInfo.line_length;
-
- nsfb->width = lstate->VarInfo.xres;
- nsfb->height = lstate->VarInfo.yres;
-
- lformat = format_from_lstate(lstate);
-
- if (nsfb->format != lformat) {
- nsfb->format = lformat;
-
- /* select default sw plotters for format */
- if (select_plotters(nsfb) != true) {
- munmap(nsfb->ptr, 0);
- close(lstate->fd);
- free(lstate);
- return -1;
- }
- }
-
- nsfb->surface_priv = lstate;
-
- return 0;
-}
-
-static int linux_finalise(nsfb_t *nsfb)
-{
- struct lnx_priv *lstate = nsfb->surface_priv;
-
- if (lstate != NULL) {
- munmap(nsfb->ptr, 0);
- close(lstate->fd);
- free(lstate);
- }
-
- return 0;
-}
-
-static bool linux_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
-{
- UNUSED(nsfb);
- UNUSED(event);
- UNUSED(timeout);
- return false;
-}
-
-static int linux_claim(nsfb_t *nsfb, nsfb_bbox_t *box)
-{
- struct nsfb_cursor_s *cursor = nsfb->cursor;
-
- if ((cursor != NULL) &&
- (cursor->plotted == true) &&
- (nsfb_plot_bbox_intersect(box, &cursor->loc))) {
-
- nsfb->plotter_fns->bitmap(nsfb,
- &cursor->savloc,
- cursor->sav,
- cursor->sav_width,
- cursor->sav_height,
- cursor->sav_width,
- false);
- cursor->plotted = false;
- }
- return 0;
-}
-
-static int linux_cursor(nsfb_t *nsfb, struct nsfb_cursor_s *cursor)
-{
- nsfb_bbox_t sclip;
-
- if ((cursor != NULL) && (cursor->plotted == true)) {
- sclip = nsfb->clip;
-
- nsfb->plotter_fns->set_clip(nsfb, NULL);
-
- nsfb->plotter_fns->bitmap(nsfb,
- &cursor->savloc,
- cursor->sav,
- cursor->sav_width,
- cursor->sav_height,
- cursor->sav_width,
- false);
-
- nsfb_cursor_plot(nsfb, cursor);
-
- nsfb->clip = sclip;
- }
- return true;
-}
-
-
-static int linux_update(nsfb_t *nsfb, nsfb_bbox_t *box)
-{
- struct nsfb_cursor_s *cursor = nsfb->cursor;
-
- UNUSED(box);
-
- if ((cursor != NULL) && (cursor->plotted == false)) {
- nsfb_cursor_plot(nsfb, cursor);
- }
-
- return 0;
-}
-
-const nsfb_surface_rtns_t linux_rtns = {
- .initialise = linux_initialise,
- .finalise = linux_finalise,
- .input = linux_input,
- .claim = linux_claim,
- .update = linux_update,
- .cursor = linux_cursor,
- .geometry = linux_set_geometry,
-};
-
-NSFB_SURFACE_DEF(linux, NSFB_SURFACE_LINUX, &linux_rtns)
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * End:
- */
-----------------------------------------------------------------------
Summary of changes:
Makefile | 8 --
README | 8 +-
src/surface/Makefile | 2 -
src/surface/able.c | 59 -----------
src/surface/linux.c | 272 --------------------------------------------------
5 files changed, 5 insertions(+), 344 deletions(-)
delete mode 100644 src/surface/able.c
delete mode 100644 src/surface/linux.c
diff --git a/Makefile b/Makefile
index fed9b5d..f956e6a 100644
--- a/Makefile
+++ b/Makefile
@@ -48,14 +48,6 @@ $(eval $(call pkg_config_package_available,NSFB_SDL_AVAILABLE,sdl))
$(eval $(call pkg_config_package_available,NSFB_XCB_AVAILABLE,$(NSFB_XCB_PKG_NAMES)))
$(eval $(call pkg_config_package_available,NSFB_WLD_AVAILABLE,wayland-client))
-# surfaces not detectable via pkg-config
-NSFB_ABLE_AVAILABLE := no
-ifeq ($(findstring linux,$(HOST)),linux)
- NSFB_LINUX_AVAILABLE := yes
-else
- NSFB_LINUX_AVAILABLE := no
-endif
-
# Flags and setup for each support library
ifeq ($(NSFB_SDL_AVAILABLE),yes)
$(eval $(call pkg_config_package_add_flags,sdl,CFLAGS))
diff --git a/README b/README
index 732e850..b4a1685 100644
--- a/README
+++ b/README
@@ -16,10 +16,12 @@ Requirements
+ GNU make or compatible
+ Pkg-config
- Libnsfb also requires the following libraries to be installed:
+ The following libraries may also be installed:
- + SDL 1.2 (for the SDL backend)
- + libxcb* (for the X11 backend)
+ + SDL 1.2 (for the SDL surface)
+ + libxcb* (for the X11 surface)
+ * wayland-client (for wayland surface)
+ * libvncserver (for vnc surface)
Compilation
-----------
diff --git a/src/surface/Makefile b/src/surface/Makefile
index ad23cc4..848c3d4 100644
--- a/src/surface/Makefile
+++ b/src/surface/Makefile
@@ -4,8 +4,6 @@
SURFACE_HANDLER_yes := surface.c ram.c
# optional surface handlers
-SURFACE_HANDLER_$(NSFB_ABLE_AVAILABLE) += able.c
-SURFACE_HANDLER_$(NSFB_LINUX_AVAILABLE) += linux.c
SURFACE_HANDLER_$(NSFB_SDL_AVAILABLE) += sdl.c
SURFACE_HANDLER_$(NSFB_XCB_AVAILABLE) += x.c
SURFACE_HANDLER_$(NSFB_VNC_AVAILABLE) += vnc.c
diff --git a/src/surface/able.c b/src/surface/able.c
deleted file mode 100644
index dd4c340..0000000
--- a/src/surface/able.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2009 Vincent Sanders <vince(a)simtec.co.uk>
- *
- * This file is part of libnsfb, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "libnsfb.h"
-#include "libnsfb_plot.h"
-#include "libnsfb_event.h"
-#include "nsfb.h"
-#include "surface.h"
-
-#define UNUSED(x) ((x) = (x))
-
-static int able_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format)
-{
- if (nsfb->surface_priv != NULL)
- return -1; /* if were already initialised fail */
-
- nsfb->width = width;
- nsfb->height = height;
- nsfb->format = format;
-
- return 0;
-}
-
-static int able_initialise(nsfb_t *nsfb)
-{
- UNUSED(nsfb);
- return 0;
-}
-
-static int able_finalise(nsfb_t *nsfb)
-{
- UNUSED(nsfb);
- return 0;
-}
-
-static bool able_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
-{
- UNUSED(nsfb);
- UNUSED(event);
- UNUSED(timeout);
- return false;
-}
-
-const nsfb_surface_rtns_t able_rtns = {
- .initialise = able_initialise,
- .finalise = able_finalise,
- .input = able_input,
- .geometry = able_set_geometry,
-};
-
-NSFB_SURFACE_DEF(able, NSFB_SURFACE_ABLE, &able_rtns)
diff --git a/src/surface/linux.c b/src/surface/linux.c
deleted file mode 100644
index b5bf8ad..0000000
--- a/src/surface/linux.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince(a)simtec.co.uk>
- *
- * This file is part of libnsfb, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <linux/fb.h>
-
-
-#include "libnsfb.h"
-#include "libnsfb_event.h"
-#include "libnsfb_plot.h"
-#include "libnsfb_plot_util.h"
-
-#include "nsfb.h"
-#include "plot.h"
-#include "surface.h"
-#include "cursor.h"
-
-
-
-#define UNUSED(x) ((x) = (x))
-
-#define FB_NAME "/dev/fb0"
-
-struct lnx_priv {
- struct fb_fix_screeninfo FixInfo;
- struct fb_var_screeninfo VarInfo;
- int fd;
-};
-
-static int linux_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format)
-{
- if (nsfb->surface_priv != NULL) {
- return -1; /* if we are already initialised fail */
- }
-
- nsfb->width = width;
- nsfb->height = height;
- nsfb->format = format;
-
- /* select default sw plotters for bpp */
- if (select_plotters(nsfb) != true) {
- return -1;
- }
-
- return 0;
-}
-
-static enum nsfb_format_e
-format_from_lstate(struct lnx_priv *lstate)
-{
- enum nsfb_format_e fmt = NSFB_FMT_ANY;
-
- switch(lstate->VarInfo.bits_per_pixel) {
- case 32:
- if (lstate->VarInfo.transp.length == 0)
- fmt = NSFB_FMT_XBGR8888;
- else
- fmt = NSFB_FMT_ABGR8888;
- break;
-
- case 24:
- fmt = NSFB_FMT_RGB888;
- break;
-
- case 16:
- fmt = NSFB_FMT_RGB565;
- break;
-
- case 8:
- fmt = NSFB_FMT_I8;
- break;
-
- case 1:
- fmt = NSFB_FMT_RGB565;
- break;
-
- }
-
-
- return fmt;
-}
-
-static int linux_initialise(nsfb_t *nsfb)
-{
- int iFrameBufferSize;
- struct lnx_priv *lstate;
- enum nsfb_format_e lformat;
-
- if (nsfb->surface_priv != NULL)
- return -1;
-
- lstate = calloc(1, sizeof(struct lnx_priv));
- if (lstate == NULL) {
- return -1;
- }
-
- /* Open the framebuffer device in read write */
- lstate->fd = open(FB_NAME, O_RDWR);
- if (lstate->fd < 0) {
- printf("Unable to open %s.\n", FB_NAME);
- free(lstate);
- return -1;
- }
-
- /* Do Ioctl. Retrieve fixed screen info. */
- if (ioctl(lstate->fd, FBIOGET_FSCREENINFO, &lstate->FixInfo) < 0) {
- printf("get fixed screen info failed: %s\n",
- strerror(errno));
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- /* Do Ioctl. Get the variable screen info. */
- if (ioctl(lstate->fd, FBIOGET_VSCREENINFO, &lstate->VarInfo) < 0) {
- printf("Unable to retrieve variable screen info: %s\n",
- strerror(errno));
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- /* Calculate the size to mmap */
- iFrameBufferSize = lstate->FixInfo.line_length * lstate->VarInfo.yres;
-
- /* Now mmap the framebuffer. */
- nsfb->ptr = mmap(NULL, iFrameBufferSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, lstate->fd, 0);
- if (nsfb->ptr == NULL) {
- printf("mmap failed:\n");
- close(lstate->fd);
- free(lstate);
- return -1;
- }
-
- nsfb->linelen = lstate->FixInfo.line_length;
-
- nsfb->width = lstate->VarInfo.xres;
- nsfb->height = lstate->VarInfo.yres;
-
- lformat = format_from_lstate(lstate);
-
- if (nsfb->format != lformat) {
- nsfb->format = lformat;
-
- /* select default sw plotters for format */
- if (select_plotters(nsfb) != true) {
- munmap(nsfb->ptr, 0);
- close(lstate->fd);
- free(lstate);
- return -1;
- }
- }
-
- nsfb->surface_priv = lstate;
-
- return 0;
-}
-
-static int linux_finalise(nsfb_t *nsfb)
-{
- struct lnx_priv *lstate = nsfb->surface_priv;
-
- if (lstate != NULL) {
- munmap(nsfb->ptr, 0);
- close(lstate->fd);
- free(lstate);
- }
-
- return 0;
-}
-
-static bool linux_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
-{
- UNUSED(nsfb);
- UNUSED(event);
- UNUSED(timeout);
- return false;
-}
-
-static int linux_claim(nsfb_t *nsfb, nsfb_bbox_t *box)
-{
- struct nsfb_cursor_s *cursor = nsfb->cursor;
-
- if ((cursor != NULL) &&
- (cursor->plotted == true) &&
- (nsfb_plot_bbox_intersect(box, &cursor->loc))) {
-
- nsfb->plotter_fns->bitmap(nsfb,
- &cursor->savloc,
- cursor->sav,
- cursor->sav_width,
- cursor->sav_height,
- cursor->sav_width,
- false);
- cursor->plotted = false;
- }
- return 0;
-}
-
-static int linux_cursor(nsfb_t *nsfb, struct nsfb_cursor_s *cursor)
-{
- nsfb_bbox_t sclip;
-
- if ((cursor != NULL) && (cursor->plotted == true)) {
- sclip = nsfb->clip;
-
- nsfb->plotter_fns->set_clip(nsfb, NULL);
-
- nsfb->plotter_fns->bitmap(nsfb,
- &cursor->savloc,
- cursor->sav,
- cursor->sav_width,
- cursor->sav_height,
- cursor->sav_width,
- false);
-
- nsfb_cursor_plot(nsfb, cursor);
-
- nsfb->clip = sclip;
- }
- return true;
-}
-
-
-static int linux_update(nsfb_t *nsfb, nsfb_bbox_t *box)
-{
- struct nsfb_cursor_s *cursor = nsfb->cursor;
-
- UNUSED(box);
-
- if ((cursor != NULL) && (cursor->plotted == false)) {
- nsfb_cursor_plot(nsfb, cursor);
- }
-
- return 0;
-}
-
-const nsfb_surface_rtns_t linux_rtns = {
- .initialise = linux_initialise,
- .finalise = linux_finalise,
- .input = linux_input,
- .claim = linux_claim,
- .update = linux_update,
- .cursor = linux_cursor,
- .geometry = linux_set_geometry,
-};
-
-NSFB_SURFACE_DEF(linux, NSFB_SURFACE_LINUX, &linux_rtns)
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * End:
- */
--
NetSurf Framebuffer library
5 years, 1 month
libnsfb: branch master updated. release/0.1.6-8-g51d3ee8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/51d3ee85de73949483af7...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/51d3ee85de73949483af796...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/51d3ee85de73949483af79671...
The branch, master has been updated
via 51d3ee85de73949483af79671fe9075a10e405e3 (commit)
from a7fd674ed8be30f50795f3feeace3e1626b67c56 (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/libnsfb.git/commit/?id=51d3ee85de73949483a...
commit 51d3ee85de73949483af79671fe9075a10e405e3
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
try fixing the mkostemp header issue differently
diff --git a/src/surface/wld.c b/src/surface/wld.c
index 01bea75..51389b4 100644
--- a/src/surface/wld.c
+++ b/src/surface/wld.c
@@ -8,17 +8,14 @@
#define _XOPEN_SOURCE 500
-#include <stdbool.h>
-
/* deal with using -std=c99 and glibc changed to no have mkostemp with it set */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#include <stdlib.h>
-#undef _GNU_SOURCE
-#else
-#include <stdlib.h>
#endif
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-----------------------------------------------------------------------
Summary of changes:
src/surface/wld.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/surface/wld.c b/src/surface/wld.c
index 01bea75..51389b4 100644
--- a/src/surface/wld.c
+++ b/src/surface/wld.c
@@ -8,17 +8,14 @@
#define _XOPEN_SOURCE 500
-#include <stdbool.h>
-
/* deal with using -std=c99 and glibc changed to no have mkostemp with it set */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#include <stdlib.h>
-#undef _GNU_SOURCE
-#else
-#include <stdlib.h>
#endif
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
--
NetSurf Framebuffer library
5 years, 1 month
libnsfb: branch master updated. release/0.1.6-7-ga7fd674
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/a7fd674ed8be30f50795f...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/a7fd674ed8be30f50795f3f...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/a7fd674ed8be30f50795f3fee...
The branch, master has been updated
via a7fd674ed8be30f50795f3feeace3e1626b67c56 (commit)
from 7bb4955f3fc64627c4c3f93b28173e7fc853e775 (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/libnsfb.git/commit/?id=a7fd674ed8be30f5079...
commit a7fd674ed8be30f50795f3feeace3e1626b67c56
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
deal with feature macro oddity for mkostemp
diff --git a/src/surface/wld.c b/src/surface/wld.c
index cc543da..01bea75 100644
--- a/src/surface/wld.c
+++ b/src/surface/wld.c
@@ -9,7 +9,16 @@
#define _XOPEN_SOURCE 500
#include <stdbool.h>
+
+/* deal with using -std=c99 and glibc changed to no have mkostemp with it set */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#include <stdlib.h>
+#undef _GNU_SOURCE
+#else
#include <stdlib.h>
+#endif
+
#include <stdio.h>
#include <string.h>
-----------------------------------------------------------------------
Summary of changes:
src/surface/wld.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/surface/wld.c b/src/surface/wld.c
index cc543da..01bea75 100644
--- a/src/surface/wld.c
+++ b/src/surface/wld.c
@@ -9,7 +9,16 @@
#define _XOPEN_SOURCE 500
#include <stdbool.h>
+
+/* deal with using -std=c99 and glibc changed to no have mkostemp with it set */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#include <stdlib.h>
+#undef _GNU_SOURCE
+#else
#include <stdlib.h>
+#endif
+
#include <stdio.h>
#include <string.h>
--
NetSurf Framebuffer library
5 years, 1 month
librosprite: branch master updated. release/0.1.2-2-gf8cae93
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/librosprite.git/shortlog/f8cae937dd67a7bca...
...commit http://git.netsurf-browser.org/librosprite.git/commit/f8cae937dd67a7bca39...
...tree http://git.netsurf-browser.org/librosprite.git/tree/f8cae937dd67a7bca3940...
The branch, master has been updated
via f8cae937dd67a7bca394000854b7c5f38330022b (commit)
from c8f5b9a37174f7184db1e3e57c0f588a59306c90 (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/librosprite.git/commit/?id=f8cae937dd67a7b...
commit f8cae937dd67a7bca394000854b7c5f38330022b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Decode: Fix undefined shifts found by ubsan.
runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
diff --git a/src/librosprite.c b/src/librosprite.c
index b382ce0..7cfcaaa 100644
--- a/src/librosprite.c
+++ b/src/librosprite.c
@@ -21,7 +21,11 @@
/**
* Reads four bytes, 00, 11, 22 and 33, of a byte array b to give 0x33221100.
*/
-#define BTUINT(b) (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24))
+#define BTUINT(b) \
+ ((unsigned)b[0] | \
+ ((unsigned)b[1] << 8) | \
+ ((unsigned)b[2] << 16) | \
+ ((unsigned)b[3] << 24))
/**
* Reverse the byte order of a word such that 0xAABBCCDD becomes 0xDDCCBBAA.
@@ -559,7 +563,7 @@ static rosprite_error rosprite_load_high_color(uint8_t* image_in, uint8_t* mask,
uint32_t currentByteIndex = 0;
uint32_t j, x, y, x_pixels, pixel;
bool has_alpha_pixel_data = false;
- uint8_t b;
+ uint32_t b;
bool old_has_alpha;
if (sprite->has_mask) {
@@ -809,9 +813,9 @@ static uint32_t rosprite_upscale_color(uint32_t pixel, struct rosprite_mode* mod
assert(green < 32);
assert(blue < 32);
- pixel = (sprite_16bpp_translate[red] << 24)
- | (sprite_16bpp_translate[green] << 16)
- | (sprite_16bpp_translate[blue] << 8);
+ pixel = ((uint32_t)sprite_16bpp_translate[red] << 24)|
+ ((uint32_t)sprite_16bpp_translate[green] << 16)|
+ ((uint32_t)sprite_16bpp_translate[blue] << 8);
}
break;
case 8:
-----------------------------------------------------------------------
Summary of changes:
src/librosprite.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/librosprite.c b/src/librosprite.c
index b382ce0..7cfcaaa 100644
--- a/src/librosprite.c
+++ b/src/librosprite.c
@@ -21,7 +21,11 @@
/**
* Reads four bytes, 00, 11, 22 and 33, of a byte array b to give 0x33221100.
*/
-#define BTUINT(b) (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24))
+#define BTUINT(b) \
+ ((unsigned)b[0] | \
+ ((unsigned)b[1] << 8) | \
+ ((unsigned)b[2] << 16) | \
+ ((unsigned)b[3] << 24))
/**
* Reverse the byte order of a word such that 0xAABBCCDD becomes 0xDDCCBBAA.
@@ -559,7 +563,7 @@ static rosprite_error rosprite_load_high_color(uint8_t* image_in, uint8_t* mask,
uint32_t currentByteIndex = 0;
uint32_t j, x, y, x_pixels, pixel;
bool has_alpha_pixel_data = false;
- uint8_t b;
+ uint32_t b;
bool old_has_alpha;
if (sprite->has_mask) {
@@ -809,9 +813,9 @@ static uint32_t rosprite_upscale_color(uint32_t pixel, struct rosprite_mode* mod
assert(green < 32);
assert(blue < 32);
- pixel = (sprite_16bpp_translate[red] << 24)
- | (sprite_16bpp_translate[green] << 16)
- | (sprite_16bpp_translate[blue] << 8);
+ pixel = ((uint32_t)sprite_16bpp_translate[red] << 24)|
+ ((uint32_t)sprite_16bpp_translate[green] << 16)|
+ ((uint32_t)sprite_16bpp_translate[blue] << 8);
}
break;
case 8:
--
NetSurf RISC OS Sprite decoder
5 years, 1 month