Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/f00082c6ced97cdcee4098824df47327aae7722c
...commit
http://git.netsurf-browser.org/libcss.git/commit/f00082c6ced97cdcee4098824df47327aae7722c
...tree
http://git.netsurf-browser.org/libcss.git/tree/f00082c6ced97cdcee4098824df47327aae7722c
The branch, tlsa/explicit-defaulting has been updated
via f00082c6ced97cdcee4098824df47327aae7722c (commit)
via 8605fc7b2af0f04d75672cdcf32987341646e7b1 (commit)
via 7b1ca440b5c38855bd9a9add4845ac09564397b9 (commit)
from 04c9a2710057281ac643ba7470c53aac2a6f89a9 (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=f00082c6ced97cdcee4098824df47327aae7722c
commit f00082c6ced97cdcee4098824df47327aae7722c
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Select: Support CSS property-wide 'revert' value
diff --git a/src/select/select.c b/src/select/select.c
index 2de7890..832892a 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1173,6 +1173,27 @@ failed:
}
+static css_error css__select_revert_property(
+ css_select_state *state,
+ css_origin origin,
+ enum css_pseudo_element pele,
+ enum css_properties_e property)
+{
+ css_error error;
+ prop_state *prop = &state->props[property][pele];
+
+ error = prop_dispatch[property].copy(
+ state->results->styles[pele],
+ state->revert[origin][pele].style);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ *prop = state->revert[origin][pele].props[property];
+ return CSS_OK;
+}
+
+
/**
* Select a style for the given node
*
@@ -1344,6 +1365,28 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < CSS_N_PROPERTIES; i++) {
prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ switch (prop->origin) {
+ case CSS_ORIGIN_UA:
+ prop->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_UA, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_USER, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ }
+ }
+
if (prop->explicit_default == FLAG_VALUE_UNSET) {
if (prop_dispatch[i].inherited == true) {
prop->explicit_default = FLAG_VALUE_INHERIT;
@@ -1378,6 +1421,30 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < CSS_N_PROPERTIES; i++) {
prop_state *prop = &state.props[i][j];
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ switch (prop->origin) {
+ case CSS_ORIGIN_UA:
+ prop->explicit_default =
FLAG_VALUE_UNSET;
+ break;
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_UA,
+ j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_USER,
+ j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ }
+ }
+
if (prop->explicit_default == FLAG_VALUE_UNSET) {
if (prop_dispatch[i].inherited == true) {
prop->explicit_default =
FLAG_VALUE_INHERIT;
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=8605fc7b2af0f04d75672cdcf32987341646e7b1
commit 8605fc7b2af0f04d75672cdcf32987341646e7b1
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Select: Clone UA and author styles for revert
diff --git a/src/select/select.c b/src/select/select.c
index 4f41c82..2de7890 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1047,6 +1047,15 @@ static void css_select__finalise_selection_state(
if (state->element.name != NULL){
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][j].style == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(state->revert[i][j].style);
+ }
+ }
}
@@ -1192,6 +1201,7 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
css_select_handler *handler, void *pw,
css_select_results **result)
{
+ css_origin origin = CSS_ORIGIN_UA;
uint32_t i, j, nhints;
css_error error;
css_select_state state;
@@ -1270,9 +1280,27 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
/* Iterate through the top-level stylesheets, selecting styles
* from those which apply to our current media requirements and
* are not disabled */
+ if (ctx->n_sheets > 0) {
+ origin = ctx->sheets[0].origin;
+ }
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
+ if (s.origin != origin) {
+ for (j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state.results->styles[j] == NULL) {
+ continue;
+ }
+ error = css__computed_style_clone(
+ state.results->styles[j],
+ &state.revert[origin][j].style);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+ origin = s.origin;
+ }
+
if (mq__list_match(s.media, unit_ctx, media) &&
s.sheet->disabled == false) {
error = select_from_sheet(ctx, s.sheet,
diff --git a/src/select/select.h b/src/select/select.h
index f449534..56d23b3 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -58,6 +58,11 @@ struct css_node_data {
css_node_flags flags;
};
+struct revert_data {
+ prop_state props[CSS_N_PROPERTIES];
+ css_computed_style *style;
+};
+
/**
* Selection state
*/
@@ -67,6 +72,9 @@ typedef struct css_select_state {
const css_unit_ctx *unit_ctx; /* Unit conversion context. */
css_select_results *results; /* Result set to populate */
+ /** UA and user styles for handling revert property value. */
+ struct revert_data revert[CSS_ORIGIN_AUTHOR][CSS_PSEUDO_ELEMENT_COUNT];
+
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=7b1ca440b5c38855bd9a9add4845ac09564397b9
commit 7b1ca440b5c38855bd9a9add4845ac09564397b9
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Select: Add computed style clone function
diff --git a/src/select/computed.c b/src/select/computed.c
index c019590..89d6efb 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -233,6 +233,37 @@ css_error
css__computed_style_initialise(css_computed_style *style,
}
/**
+ * Clone a computed style
+ *
+ * \param orig Style to copy
+ * \param clone_out Returns cloned style on success
+ * \return CSS_OK on success.
+ */
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out)
+{
+ css_error error;
+ css_computed_style *clone;
+
+ error = css__computed_style_create(&clone);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ for (size_t i = 0; i < CSS_N_PROPERTIES; i++) {
+ error = prop_dispatch[i].copy(orig, clone);
+ if (error != CSS_OK) {
+ css_computed_style_destroy(clone);
+ return error;
+ }
+ }
+
+ *clone_out = clone;
+ return CSS_OK;
+}
+
+/**
* Compose two computed styles
*
* \param parent Parent style
diff --git a/src/select/computed.h b/src/select/computed.h
index a4bd23d..a1e4eed 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -35,6 +35,10 @@ css_error css__computed_style_create(css_computed_style
**result);
css_error css__computed_style_initialise(css_computed_style *style,
struct css_select_handler *handler, void *pw);
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out);
+
css_error css__compute_absolute_values(const css_computed_style *parent,
css_computed_style *style,
const css_unit_ctx *unit_ctx);
-----------------------------------------------------------------------
Summary of changes:
src/select/computed.c | 31 ++++++++++++++++
src/select/computed.h | 4 +++
src/select/select.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++
src/select/select.h | 8 +++++
4 files changed, 138 insertions(+)
diff --git a/src/select/computed.c b/src/select/computed.c
index c019590..89d6efb 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -233,6 +233,37 @@ css_error
css__computed_style_initialise(css_computed_style *style,
}
/**
+ * Clone a computed style
+ *
+ * \param orig Style to copy
+ * \param clone_out Returns cloned style on success
+ * \return CSS_OK on success.
+ */
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out)
+{
+ css_error error;
+ css_computed_style *clone;
+
+ error = css__computed_style_create(&clone);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ for (size_t i = 0; i < CSS_N_PROPERTIES; i++) {
+ error = prop_dispatch[i].copy(orig, clone);
+ if (error != CSS_OK) {
+ css_computed_style_destroy(clone);
+ return error;
+ }
+ }
+
+ *clone_out = clone;
+ return CSS_OK;
+}
+
+/**
* Compose two computed styles
*
* \param parent Parent style
diff --git a/src/select/computed.h b/src/select/computed.h
index a4bd23d..a1e4eed 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -35,6 +35,10 @@ css_error css__computed_style_create(css_computed_style
**result);
css_error css__computed_style_initialise(css_computed_style *style,
struct css_select_handler *handler, void *pw);
+css_error css__computed_style_clone(
+ const css_computed_style *orig,
+ css_computed_style **clone_out);
+
css_error css__compute_absolute_values(const css_computed_style *parent,
css_computed_style *style,
const css_unit_ctx *unit_ctx);
diff --git a/src/select/select.c b/src/select/select.c
index 4f41c82..832892a 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1047,6 +1047,15 @@ static void css_select__finalise_selection_state(
if (state->element.name != NULL){
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][j].style == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(state->revert[i][j].style);
+ }
+ }
}
@@ -1164,6 +1173,27 @@ failed:
}
+static css_error css__select_revert_property(
+ css_select_state *state,
+ css_origin origin,
+ enum css_pseudo_element pele,
+ enum css_properties_e property)
+{
+ css_error error;
+ prop_state *prop = &state->props[property][pele];
+
+ error = prop_dispatch[property].copy(
+ state->results->styles[pele],
+ state->revert[origin][pele].style);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ *prop = state->revert[origin][pele].props[property];
+ return CSS_OK;
+}
+
+
/**
* Select a style for the given node
*
@@ -1192,6 +1222,7 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
css_select_handler *handler, void *pw,
css_select_results **result)
{
+ css_origin origin = CSS_ORIGIN_UA;
uint32_t i, j, nhints;
css_error error;
css_select_state state;
@@ -1270,9 +1301,27 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
/* Iterate through the top-level stylesheets, selecting styles
* from those which apply to our current media requirements and
* are not disabled */
+ if (ctx->n_sheets > 0) {
+ origin = ctx->sheets[0].origin;
+ }
for (i = 0; i < ctx->n_sheets; i++) {
const css_select_sheet s = ctx->sheets[i];
+ if (s.origin != origin) {
+ for (j = 0; j < CSS_PSEUDO_ELEMENT_COUNT; j++) {
+ if (state.results->styles[j] == NULL) {
+ continue;
+ }
+ error = css__computed_style_clone(
+ state.results->styles[j],
+ &state.revert[origin][j].style);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+ origin = s.origin;
+ }
+
if (mq__list_match(s.media, unit_ctx, media) &&
s.sheet->disabled == false) {
error = select_from_sheet(ctx, s.sheet,
@@ -1316,6 +1365,28 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < CSS_N_PROPERTIES; i++) {
prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ switch (prop->origin) {
+ case CSS_ORIGIN_UA:
+ prop->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_UA, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_USER, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ }
+ }
+
if (prop->explicit_default == FLAG_VALUE_UNSET) {
if (prop_dispatch[i].inherited == true) {
prop->explicit_default = FLAG_VALUE_INHERIT;
@@ -1350,6 +1421,30 @@ css_error css_select_style(css_select_ctx *ctx, void
*node,
for (i = 0; i < CSS_N_PROPERTIES; i++) {
prop_state *prop = &state.props[i][j];
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ switch (prop->origin) {
+ case CSS_ORIGIN_UA:
+ prop->explicit_default =
FLAG_VALUE_UNSET;
+ break;
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_UA,
+ j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property(
+ &state, CSS_ORIGIN_USER,
+ j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ break;
+ }
+ }
+
if (prop->explicit_default == FLAG_VALUE_UNSET) {
if (prop_dispatch[i].inherited == true) {
prop->explicit_default =
FLAG_VALUE_INHERIT;
diff --git a/src/select/select.h b/src/select/select.h
index f449534..56d23b3 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -58,6 +58,11 @@ struct css_node_data {
css_node_flags flags;
};
+struct revert_data {
+ prop_state props[CSS_N_PROPERTIES];
+ css_computed_style *style;
+};
+
/**
* Selection state
*/
@@ -67,6 +72,9 @@ typedef struct css_select_state {
const css_unit_ctx *unit_ctx; /* Unit conversion context. */
css_select_results *results; /* Result set to populate */
+ /** UA and user styles for handling revert property value. */
+ struct revert_data revert[CSS_ORIGIN_AUTHOR][CSS_PSEUDO_ELEMENT_COUNT];
+
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
--
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]