Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/b60246562708b36f79fd34d26d440999f6599806
...commit
http://git.netsurf-browser.org/libcss.git/commit/b60246562708b36f79fd34d26d440999f6599806
...tree
http://git.netsurf-browser.org/libcss.git/tree/b60246562708b36f79fd34d26d440999f6599806
The branch, tlsa/explicit-defaulting has been updated
via b60246562708b36f79fd34d26d440999f6599806 (commit)
via 81b35acfc1aba461f6213218de2979e389c78fc4 (commit)
via 3a3733e8ac6f15576f9ae7929473f8655dae4315 (commit)
from 9019cfb6452744121c76911cc682c1c924f207bc (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=b60246562708b36f79fd34d26d440999f6599806
commit b60246562708b36f79fd34d26d440999f6599806
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Select: Only store UA and USER origin styles if revert is used
diff --git a/src/select/select.c b/src/select/select.c
index f7dc098..0735641 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -53,6 +53,8 @@ struct css_select_ctx {
void *pw; /**< Client's private selection context */
+ bool uses_revert; /**< A sheet used revert property value */
+
css_select_strings str;
/* Interned default style */
@@ -355,6 +357,8 @@ css_error css_select_ctx_insert_sheet(css_select_ctx *ctx,
ctx->sheets[index].origin = origin;
ctx->sheets[index].media = mq;
+ ctx->uses_revert |= sheet->uses_revert;
+
ctx->n_sheets++;
return CSS_OK;
@@ -1289,10 +1293,14 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
#endif
/* Not sharing; need to select. */
- state.revert = calloc(CSS_ORIGIN_AUTHOR, sizeof(*state.revert));
- if (state.revert == NULL) {
- error = CSS_NOMEM;
- goto cleanup;
+ if (ctx->uses_revert ||
+ (inline_style != NULL && inline_style->uses_revert)) {
+ /* Need to track UA and USER origin styles for revert. */
+ state.revert = calloc(CSS_ORIGIN_AUTHOR, sizeof(*state.revert));
+ if (state.revert == NULL) {
+ error = CSS_NOMEM;
+ goto cleanup;
+ }
}
/* Base element style is guaranteed to exist
@@ -1326,7 +1334,7 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
- if (s.origin != origin) {
+ if (state.revert != NULL && s.origin != origin) {
for (j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
if (state.results->styles[j] == NULL) {
continue;
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=81b35acfc1aba461f6213218de2979e389c78fc4
commit 81b35acfc1aba461f6213218de2979e389c78fc4
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Stylesheet: Track whether stylesheet used revert property value
diff --git a/src/stylesheet.h b/src/stylesheet.h
index 45d7b7e..070508f 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -188,6 +188,8 @@ struct css_stylesheet {
bool quirks_allowed; /**< Quirks permitted */
bool quirks_used; /**< Quirks actually used */
+ bool uses_revert; /**< Uses 'revert' property
value */
+
bool inline_style; /**< Is an inline style */
size_t size; /**< Size, in bytes */
@@ -226,6 +228,9 @@ css_error css__stylesheet_merge_style(css_style *target,
css_style *style);
static inline css_error css__stylesheet_style_appendOPV(css_style *style,
opcode_t opcode, uint8_t flags, uint16_t value)
{
+ if ((flags & (0x7 << 1)) == FLAG_REVERT) {
+ style->sheet->uses_revert = true;
+ }
return css__stylesheet_style_append(style,
buildOPV(opcode, flags, value));
}
@@ -250,6 +255,7 @@ static inline css_error
css_stylesheet_style_initial(css_style *style,
static inline css_error css_stylesheet_style_revert(css_style *style,
opcode_t opcode)
{
+ style->sheet->uses_revert = true;
return css__stylesheet_style_append(style,
buildOPV(opcode, FLAG_REVERT, 0));
}
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=3a3733e8ac6f15576f9ae7929473f8655dae4315
commit 3a3733e8ac6f15576f9ae7929473f8655dae4315
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Select: Move revert style tracking to separate allocation
It's pretty big and the selection state lives on the stack.
diff --git a/src/select/select.c b/src/select/select.c
index e1f7883..f7dc098 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1020,13 +1020,17 @@ static void css_select__finalise_selection_state(
lwc_string_unref(state->element.name);
}
- for (size_t i = 0; i < CSS_ORIGIN_AUTHOR; i++) {
- for (size_t j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
- if (state->revert[i].style[j] == NULL) {
- continue;
+ if (state->revert != NULL) {
+ for (size_t i = 0; i < CSS_ORIGIN_AUTHOR; i++) {
+ for (size_t j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state->revert[i].style[j] == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(
+ state->revert[i].style[j]);
}
- css_computed_style_destroy(state->revert[i].style[j]);
}
+ free(state->revert);
}
}
@@ -1284,8 +1288,14 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
printf("style:\t%s\tSELECTED\n", lwc_string_data(state.element.name));
#endif
- /* Not sharing; need to select.
- * Base element style is guaranteed to exist
+ /* Not sharing; need to select. */
+ state.revert = calloc(CSS_ORIGIN_AUTHOR, sizeof(*state.revert));
+ if (state.revert == NULL) {
+ error = CSS_NOMEM;
+ goto cleanup;
+ }
+
+ /* Base element style is guaranteed to exist
*/
error = css__computed_style_create(
&state.results->styles[CSS_PSEUDO_ELEMENT_NONE]);
diff --git a/src/select/select.h b/src/select/select.h
index 69bf4d8..5170e58 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -73,7 +73,7 @@ typedef struct css_select_state {
css_select_results *results; /* Result set to populate */
/** UA and user styles for handling revert property value. */
- struct revert_data revert[CSS_ORIGIN_AUTHOR];
+ struct revert_data *revert; /* Length: CSS_ORIGIN_AUTHOR */
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
-----------------------------------------------------------------------
Summary of changes:
src/select/select.c | 34 ++++++++++++++++++++++++++--------
src/select/select.h | 2 +-
src/stylesheet.h | 6 ++++++
3 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/src/select/select.c b/src/select/select.c
index e1f7883..0735641 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -53,6 +53,8 @@ struct css_select_ctx {
void *pw; /**< Client's private selection context */
+ bool uses_revert; /**< A sheet used revert property value */
+
css_select_strings str;
/* Interned default style */
@@ -355,6 +357,8 @@ css_error css_select_ctx_insert_sheet(css_select_ctx *ctx,
ctx->sheets[index].origin = origin;
ctx->sheets[index].media = mq;
+ ctx->uses_revert |= sheet->uses_revert;
+
ctx->n_sheets++;
return CSS_OK;
@@ -1020,13 +1024,17 @@ static void css_select__finalise_selection_state(
lwc_string_unref(state->element.name);
}
- for (size_t i = 0; i < CSS_ORIGIN_AUTHOR; i++) {
- for (size_t j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
- if (state->revert[i].style[j] == NULL) {
- continue;
+ if (state->revert != NULL) {
+ for (size_t i = 0; i < CSS_ORIGIN_AUTHOR; i++) {
+ for (size_t j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state->revert[i].style[j] == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(
+ state->revert[i].style[j]);
}
- css_computed_style_destroy(state->revert[i].style[j]);
}
+ free(state->revert);
}
}
@@ -1284,8 +1292,18 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
printf("style:\t%s\tSELECTED\n", lwc_string_data(state.element.name));
#endif
- /* Not sharing; need to select.
- * Base element style is guaranteed to exist
+ /* Not sharing; need to select. */
+ if (ctx->uses_revert ||
+ (inline_style != NULL && inline_style->uses_revert)) {
+ /* Need to track UA and USER origin styles for revert. */
+ state.revert = calloc(CSS_ORIGIN_AUTHOR, sizeof(*state.revert));
+ if (state.revert == NULL) {
+ error = CSS_NOMEM;
+ goto cleanup;
+ }
+ }
+
+ /* Base element style is guaranteed to exist
*/
error = css__computed_style_create(
&state.results->styles[CSS_PSEUDO_ELEMENT_NONE]);
@@ -1316,7 +1334,7 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
- if (s.origin != origin) {
+ if (state.revert != NULL && s.origin != origin) {
for (j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
if (state.results->styles[j] == NULL) {
continue;
diff --git a/src/select/select.h b/src/select/select.h
index 69bf4d8..5170e58 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -73,7 +73,7 @@ typedef struct css_select_state {
css_select_results *results; /* Result set to populate */
/** UA and user styles for handling revert property value. */
- struct revert_data revert[CSS_ORIGIN_AUTHOR];
+ struct revert_data *revert; /* Length: CSS_ORIGIN_AUTHOR */
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
diff --git a/src/stylesheet.h b/src/stylesheet.h
index 45d7b7e..070508f 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -188,6 +188,8 @@ struct css_stylesheet {
bool quirks_allowed; /**< Quirks permitted */
bool quirks_used; /**< Quirks actually used */
+ bool uses_revert; /**< Uses 'revert' property
value */
+
bool inline_style; /**< Is an inline style */
size_t size; /**< Size, in bytes */
@@ -226,6 +228,9 @@ css_error css__stylesheet_merge_style(css_style *target,
css_style *style);
static inline css_error css__stylesheet_style_appendOPV(css_style *style,
opcode_t opcode, uint8_t flags, uint16_t value)
{
+ if ((flags & (0x7 << 1)) == FLAG_REVERT) {
+ style->sheet->uses_revert = true;
+ }
return css__stylesheet_style_append(style,
buildOPV(opcode, flags, value));
}
@@ -250,6 +255,7 @@ static inline css_error
css_stylesheet_style_initial(css_style *style,
static inline css_error css_stylesheet_style_revert(css_style *style,
opcode_t opcode)
{
+ style->sheet->uses_revert = true;
return css__stylesheet_style_append(style,
buildOPV(opcode, FLAG_REVERT, 0));
}
--
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]