libcss: branch master updated. release/0.9.1-65-g5926dfd
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/5926dfdd6fa9053ed40d9b...
...commit http://git.netsurf-browser.org/libcss.git/commit/5926dfdd6fa9053ed40d9b02...
...tree http://git.netsurf-browser.org/libcss.git/tree/5926dfdd6fa9053ed40d9b0207...
The branch, master has been updated
via 5926dfdd6fa9053ed40d9b0207b563cf3aec48d1 (commit)
via ef1cbdb7299b20f404e97e88872a229e35f8413b (commit)
via 832b819d8bec7a517ee0ecccbf05beaccb1205fc (commit)
via 6453a903d912b594fc45de9122289510cca221be (commit)
via 7e21db9a7a7e4b27f2423cca182f189599269315 (commit)
via 9cf3fc5bf2e20de413c15db04cf83c49601638d4 (commit)
via c14f3c4e05d3a6f38fbd84a2bee78895d8120619 (commit)
via 668aaa731a4e3fcb8ad49aa08b694aefe3f7e606 (commit)
via fbea34894d58c202f1bc436511ac7ba61791c8d9 (commit)
via 8d4c3080202d5c9cb1ffe0b67448c0392c53028b (commit)
via 9a4646ccb841105404f153cfc5f76cfe3d61b35f (commit)
via 010b9a79ece709d364dbf3930b72d2a7e0bac045 (commit)
via 51f108c9fa28758a0adbd91571e19f795c21ea2e (commit)
via 166581e23cb6e1e6279f450635cd16a12f8b0ef2 (commit)
via 2504bb6f6414ae36c036a84d21f7821178dc58ee (commit)
via 0997e85ec5f14bd0d6959b9201fcd3845b224747 (commit)
via 508971b0eed673d4f3c7ac780d5423a3f1ecf7ed (commit)
via 1338ceef5c2ff3cccbf288d39162a50b03491497 (commit)
via 2dfdb62e3af0bc3a6b74efeb8af1df6b87491e6f (commit)
via 4ff73dab98b1659dbfd6f53281f337381e82dda4 (commit)
via 1815b305ea226fa8a9cf8582df259e0bde76bbdf (commit)
via 65f56b6d7aa73040a87eab240628eecbab9e7504 (commit)
via 37712968049ba48e2212d1c324727c6a68c381ca (commit)
from bc2b312c42d7d8eee32bf615e24533a0756db152 (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=5926dfdd6fa9053ed40d...
commit 5926dfdd6fa9053ed40d9b0207b563cf3aec48d1
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
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=ef1cbdb7299b20f404e9...
commit ef1cbdb7299b20f404e97e88872a229e35f8413b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
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=832b819d8bec7a517ee0...
commit 832b819d8bec7a517ee0ecccbf05beaccb1205fc
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
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 */
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=6453a903d912b594fc45...
commit 6453a903d912b594fc45de9122289510cca221be
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Tests: Add tests for explicit defaulting
diff --git a/test/data/select/INDEX b/test/data/select/INDEX
index fb15ad4..c05567a 100644
--- a/test/data/select/INDEX
+++ b/test/data/select/INDEX
@@ -3,3 +3,4 @@
# Test Description
tests1.dat Basic tests
+defaulting.dat Explicit defaulting tests
diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat
new file mode 100644
index 0000000..4242e30
--- /dev/null
+++ b/test/data/select/defaulting.dat
@@ -0,0 +1,1452 @@
+#tree screen
+| div*
+#ua
+div { display: block; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: initial; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: inherit; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: table-cell; }
+p { display: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { font-style: italic; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+#user
+p { font-style: oblique; }
+p { font-style: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: table-cell; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: table-cell
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+p { font-style: oblique; }
+p { font-style: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+p { display: table-cell; }
+p { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline-block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: revert; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=7e21db9a7a7e4b27f242...
commit 7e21db9a7a7e4b27f2423cca182f189599269315
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Split out duplicated revert handling
diff --git a/src/select/select.c b/src/select/select.c
index bd2af96..e1f7883 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1144,8 +1144,7 @@ failed:
return error;
}
-
-static css_error css__select_revert_property(
+static css_error css__select_revert_property_to_origin(
css_select_state *select_state,
prop_state *prop_state,
css_origin origin,
@@ -1165,6 +1164,44 @@ static css_error css__select_revert_property(
return CSS_OK;
}
+static css_error css__select_revert_property(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ switch (prop_state->origin) {
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_USER,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_UA,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_UA:
+ prop_state->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ }
+
+ return CSS_OK;
+}
/**
* Select a style for the given node
@@ -1340,30 +1377,10 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
if (prop->explicit_default == FLAG_VALUE_REVERT) {
- switch (prop->origin) {
- case CSS_ORIGIN_AUTHOR:
- error = css__select_revert_property(&state,
- prop, CSS_ORIGIN_USER, 0, i);
- if (error != CSS_OK) {
- goto cleanup;
- }
- if (prop->explicit_default != FLAG_VALUE_REVERT) {
- break;
- }
- /* Fall-through */
- case CSS_ORIGIN_USER:
- error = css__select_revert_property(&state,
- prop, CSS_ORIGIN_UA, 0, i);
- if (error != CSS_OK) {
- goto cleanup;
- }
- if (prop->explicit_default != FLAG_VALUE_REVERT) {
- break;
- }
- /* Fall-through */
- case CSS_ORIGIN_UA:
- prop->explicit_default = FLAG_VALUE_UNSET;
- break;
+ error = css__select_revert_property(&state, prop,
+ CSS_PSEUDO_ELEMENT_NONE, i);
+ if (error != CSS_OK) {
+ goto cleanup;
}
}
@@ -1402,32 +1419,10 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
prop_state *prop = &state.props[i][j];
if (prop->explicit_default == FLAG_VALUE_REVERT) {
- switch (prop->origin) {
- case CSS_ORIGIN_AUTHOR:
- error = css__select_revert_property(
- &state, prop,
- CSS_ORIGIN_USER, j, i);
- if (error != CSS_OK) {
- goto cleanup;
- }
- if (prop->explicit_default != FLAG_VALUE_REVERT) {
- break;
- }
- /* Fall-through */
- case CSS_ORIGIN_USER:
- error = css__select_revert_property(
- &state, prop,
- CSS_ORIGIN_UA, j, i);
- if (error != CSS_OK) {
- goto cleanup;
- }
- if (prop->explicit_default != FLAG_VALUE_REVERT) {
- break;
- }
- /* Fall-through */
- case CSS_ORIGIN_UA:
- prop->explicit_default = FLAG_VALUE_UNSET;
- break;
+ error = css__select_revert_property(&state,
+ prop, j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
}
}
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=9cf3fc5bf2e20de413c1...
commit 9cf3fc5bf2e20de413c15db04cf83c49601638d4
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Support CSS property-wide 'revert' value
diff --git a/src/select/select.c b/src/select/select.c
index c7d59b7..bd2af96 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1145,6 +1145,27 @@ failed:
}
+static css_error css__select_revert_property(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ css_origin origin,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ error = prop_dispatch[property].copy(
+ select_state->revert[origin].style[pseudo],
+ select_state->results->styles[pseudo]);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ *prop_state = select_state->revert[origin].props[property][pseudo];
+ return CSS_OK;
+}
+
+
/**
* Select a style for the given node
*
@@ -1318,6 +1339,34 @@ 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_AUTHOR:
+ error = css__select_revert_property(&state,
+ prop, CSS_ORIGIN_USER, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ if (prop->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(&state,
+ prop, CSS_ORIGIN_UA, 0, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ if (prop->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_UA:
+ prop->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ }
+ }
+
if (prop->explicit_default == FLAG_VALUE_UNSET) {
if (prop_dispatch[i].inherited == true) {
prop->explicit_default = FLAG_VALUE_INHERIT;
@@ -1352,6 +1401,36 @@ 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_AUTHOR:
+ error = css__select_revert_property(
+ &state, prop,
+ CSS_ORIGIN_USER, j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ if (prop->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property(
+ &state, prop,
+ CSS_ORIGIN_UA, j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ if (prop->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_UA:
+ prop->explicit_default = FLAG_VALUE_UNSET;
+ 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=c14f3c4e05d3a6f38fbd...
commit c14f3c4e05d3a6f38fbd84a2bee78895d8120619
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Clone UA and author styles for revert
diff --git a/src/select/select.c b/src/select/select.c
index 7b5b71a..c7d59b7 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1019,6 +1019,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].style[j] == NULL) {
+ continue;
+ }
+ css_computed_style_destroy(state->revert[i].style[j]);
+ }
+ }
}
@@ -1164,6 +1173,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;
@@ -1242,9 +1252,29 @@ 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].style[j]);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ memcpy(state.revert[origin].props,
+ state.props, sizeof(state.props));
+ }
+ origin = s.origin;
+ }
+
if (mq__list_match(s.media, unit_ctx, media, &ctx->str) &&
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..69bf4d8 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_PSEUDO_ELEMENT_COUNT];
+ css_computed_style *style[CSS_PSEUDO_ELEMENT_COUNT];
+};
+
/**
* 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 current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=668aaa731a4e3fcb8ad4...
commit 668aaa731a4e3fcb8ad49aa08b694aefe3f7e606
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
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);
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=fbea34894d58c202f1bc...
commit fbea34894d58c202f1bc436511ac7ba61791c8d9
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Properties: Add copy hander to dispatch table
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index 30bba25..a6c868d 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -15,6 +15,7 @@
css__cascade_##pname, \
css__set_##pname##_from_hint, \
css__initial_##pname, \
+ css__copy_##pname, \
css__compose_##pname
struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
diff --git a/src/select/dispatch.h b/src/select/dispatch.h
index e3f93a3..8ddf4f9 100644
--- a/src/select/dispatch.h
+++ b/src/select/dispatch.h
@@ -23,6 +23,8 @@ extern struct prop_table {
css_error (*set_from_hint)(const css_hint *hint,
css_computed_style *style);
css_error (*initial)(css_select_state *state);
+ css_error (*copy)(const css_computed_style *from,
+ css_computed_style *to);
css_error (*compose)(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result);
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=8d4c3080202d5c9cb1ff...
commit 8d4c3080202d5c9cb1ffe0b67448c0392c53028b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Properties: Implement copy handler for complex properties
diff --git a/src/select/properties/content.c b/src/select/properties/content.c
index df79fe1..32af49f 100644
--- a/src/select/properties/content.c
+++ b/src/select/properties/content.c
@@ -199,39 +199,40 @@ css_error css__initial_content(css_select_state *state)
return set_content(state->computed, CSS_CONTENT_NORMAL, NULL);
}
-css_error css__compose_content(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_content(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_content_item *copy = NULL;
const css_computed_content_item *items = NULL;
- uint8_t type = get_content(child, &items);
+ uint8_t type = get_content(from, &items);
- if (type == CSS_CONTENT_INHERIT) {
- type = get_content(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_CONTENT_SET) {
- size_t n_items = 0;
- const css_computed_content_item *i;
-
- for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
- i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_content_item));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_content_item));
+ error = css__copy_computed_content_item_array(false, items, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_content(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_content(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_content(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_content_item *items = NULL;
+ uint8_t type = get_content(child, &items);
+
+ return css__copy_content(
+ type == CSS_CONTENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_increment.c b/src/select/properties/counter_increment.c
index 1b75c25..2638838 100644
--- a/src/select/properties/counter_increment.c
+++ b/src/select/properties/counter_increment.c
@@ -48,38 +48,40 @@ css_error css__initial_counter_increment(css_select_state *state)
CSS_COUNTER_INCREMENT_NONE, NULL);
}
-css_error css__compose_counter_increment(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_increment(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_increment(child, &items);
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(from, &counter_increment);
- if (type == CSS_COUNTER_INCREMENT_INHERIT) {
- type = get_counter_increment(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_increment, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_increment(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_increment(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_increment(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(child, &counter_increment);
+
+ return css__copy_counter_increment(
+ type == CSS_COUNTER_INCREMENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_reset.c b/src/select/properties/counter_reset.c
index e4ec8bf..fcb39a3 100644
--- a/src/select/properties/counter_reset.c
+++ b/src/select/properties/counter_reset.c
@@ -47,38 +47,40 @@ css_error css__initial_counter_reset(css_select_state *state)
return set_counter_reset(state->computed, CSS_COUNTER_RESET_NONE, NULL);
}
-css_error css__compose_counter_reset(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_reset(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_reset(child, &items);
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(from, &counter_reset);
- if (type == CSS_COUNTER_RESET_INHERIT) {
- type = get_counter_reset(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_RESET_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_reset, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_reset(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_reset(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_reset(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(child, &counter_reset);
+
+ return css__copy_counter_reset(
+ type == CSS_COUNTER_RESET_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c
index 7b1e39b..09955c6 100644
--- a/src/select/properties/cursor.c
+++ b/src/select/properties/cursor.c
@@ -164,38 +164,40 @@ css_error css__initial_cursor(css_select_state *state)
return set_cursor(state->computed, CSS_CURSOR_AUTO, NULL);
}
-css_error css__compose_cursor(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_cursor(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
lwc_string **copy = NULL;
- lwc_string **urls = NULL;
- uint8_t type = get_cursor(child, &urls);
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(from, &cursor);
- if (type == CSS_CURSOR_INHERIT) {
- type = get_cursor(parent, &urls);
+ if (from == to) {
+ return CSS_OK;
}
- if (urls != NULL) {
- lwc_string **i;
- size_t n_urls = 0;
-
- for (i = urls; (*i) != NULL; i++)
- n_urls++;
-
- copy = malloc((n_urls + 1) *
- sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, urls, (n_urls + 1) *
- sizeof(lwc_string *));
+ error = css__copy_lwc_string_array(false, cursor, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_cursor(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_cursor(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_cursor(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(child, &cursor);
+
+ return css__copy_cursor(
+ type == CSS_CURSOR_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c
index 30e746c..b0183e2 100644
--- a/src/select/properties/font_family.c
+++ b/src/select/properties/font_family.c
@@ -182,42 +182,41 @@ css_error css__initial_font_family(css_select_state *state)
return css__set_font_family_from_hint(&hint, state->computed);
}
-css_error css__compose_font_family(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_font_family(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
- lwc_string **names = NULL;
- uint8_t type = get_font_family(child, &names);
-
- if (type == CSS_FONT_FAMILY_INHERIT || result != child) {
- size_t n_names = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_FONT_FAMILY_INHERIT)
- type = get_font_family(parent, &names);
+ lwc_string **copy = NULL;
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(from, &font_family);
- if (names != NULL) {
- lwc_string **i;
-
- for (i = names; (*i) != NULL; i++)
- n_names++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_names + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, font_family, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, names, (n_names + 1) *
- sizeof(lwc_string *));
- }
+ error = set_font_family(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_font_family(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_font_family(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(child, &font_family);
- return CSS_OK;
+ return css__copy_font_family(
+ type == CSS_FONT_FAMILY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/helpers.h b/src/select/properties/helpers.h
index 60e5b4c..16c5d7a 100644
--- a/src/select/properties/helpers.h
+++ b/src/select/properties/helpers.h
@@ -59,4 +59,137 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_error (*fun)(css_computed_style *, uint8_t,
css_computed_counter *));
+/** Copy NULL terminated array of lwc_string pointers. */
+static inline css_error css__copy_lwc_string_array(
+ bool ref,
+ lwc_string *const*orig,
+ lwc_string ***copy_out)
+{
+ size_t count = 0;
+ lwc_string **copy = NULL;
+
+ if (orig != NULL) {
+ for (lwc_string *const*i = orig; (*i) != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i] = lwc_string_ref(orig[i]);
+ }
+ copy[count] = NULL;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy NULL-name terminated array of css_computed_counter items. */
+static inline css_error css__copy_computed_counter_array(
+ bool ref,
+ const css_computed_counter *orig,
+ css_computed_counter **copy_out)
+{
+ size_t count = 0;
+ css_computed_counter *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_counter *i = orig;
+ i->name != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i].name = lwc_string_ref(orig[i].name);
+ copy[i].value = orig[i].value;
+ }
+ copy[count].name = NULL;
+ copy[count].value = 0;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy type:none terminated array of css_computed_content_item items. */
+static inline css_error css__copy_computed_content_item_array(
+ bool ref,
+ const css_computed_content_item *orig,
+ css_computed_content_item **copy_out)
+{
+ size_t count = 0;
+ css_computed_content_item *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_content_item *i = orig;
+ i->type != CSS_COMPUTED_CONTENT_NONE; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ switch (orig[i].type) {
+ case CSS_COMPUTED_CONTENT_STRING:
+ copy[i].data.string = lwc_string_ref(
+ orig[i].data.string);
+ break;
+ case CSS_COMPUTED_CONTENT_URI:
+ copy[i].data.uri = lwc_string_ref(
+ orig[i].data.uri);
+ break;
+ case CSS_COMPUTED_CONTENT_ATTR:
+ copy[i].data.attr = lwc_string_ref(
+ orig[i].data.attr);
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTER:
+ copy[i].data.counter.name = lwc_string_ref(
+ orig[i].data.counter.name);
+ copy[i].data.counter.style =
+ orig[i].data.counter.style;
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTERS:
+ copy[i].data.counters.name = lwc_string_ref(
+ orig[i].data.counters.name);
+ copy[i].data.counters.sep = lwc_string_ref(
+ orig[i].data.counters.sep);
+ copy[i].data.counters.style =
+ orig[i].data.counters.style;
+ break;
+ default:
+ break;
+ }
+ copy[i].type = orig[i].type;
+ }
+ copy[count].type = CSS_COMPUTED_CONTENT_NONE;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
#endif
diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c
index 9152f84..57fc48c 100644
--- a/src/select/properties/quotes.c
+++ b/src/select/properties/quotes.c
@@ -123,43 +123,41 @@ css_error css__initial_quotes(css_select_state *state)
return css__set_quotes_from_hint(&hint, state->computed);
}
-css_error css__compose_quotes(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_quotes(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
+ lwc_string **copy = NULL;
lwc_string **quotes = NULL;
- uint8_t type = get_quotes(child, "es);
-
- if (type == CSS_QUOTES_INHERIT || result != child) {
- size_t n_quotes = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_QUOTES_INHERIT) {
- type = get_quotes(parent, "es);
- }
-
- if (quotes != NULL) {
- lwc_string **i;
+ uint8_t type = get_quotes(from, "es);
- for (i = quotes; (*i) != NULL; i++)
- n_quotes++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_quotes + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, quotes, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, quotes, (n_quotes + 1) *
- sizeof(lwc_string *));
- }
+ error = set_quotes(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_quotes(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_quotes(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **quotes = NULL;
+ uint8_t type = get_quotes(child, "es);
- return CSS_OK;
+ return css__copy_quotes(
+ type == CSS_QUOTES_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c
index f2ba4e6..303f8f5 100644
--- a/src/select/properties/text_align.c
+++ b/src/select/properties/text_align.c
@@ -66,15 +66,24 @@ css_error css__initial_text_align(css_select_state *state)
return set_text_align(state->computed, CSS_TEXT_ALIGN_DEFAULT);
}
+css_error css__copy_text_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_align(to, get_text_align(from));
+}
+
css_error css__compose_text_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_align(child);
- if (type == CSS_TEXT_ALIGN_INHERIT) {
- type = get_text_align(parent);
- } else if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
+ if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
/* This is purely for the benefit of HTML tables */
type = get_text_align(parent);
@@ -83,10 +92,15 @@ css_error css__compose_text_align(const css_computed_style *parent,
* inherit as normal. */
if (type == CSS_TEXT_ALIGN_LIBCSS_LEFT ||
type == CSS_TEXT_ALIGN_LIBCSS_CENTER ||
- type == CSS_TEXT_ALIGN_LIBCSS_RIGHT)
+ type == CSS_TEXT_ALIGN_LIBCSS_RIGHT) {
type = CSS_TEXT_ALIGN_DEFAULT;
+ }
+
+ return set_text_align(result, type);
}
- return set_text_align(result, type);
+ return css__copy_text_align(
+ type == CSS_TEXT_ALIGN_INHERIT ? parent : child,
+ result);
}
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=9a4646ccb841105404f1...
commit 9a4646ccb841105404f153cfc5f76cfe3d61b35f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Properties: Add copy handler for simple properties
diff --git a/src/select/properties/align_content.c b/src/select/properties/align_content.c
index 7d791b8..d432879 100644
--- a/src/select/properties/align_content.c
+++ b/src/select/properties/align_content.c
@@ -66,16 +66,25 @@ css_error css__initial_align_content(css_select_state *state)
return set_align_content(state->computed, CSS_ALIGN_CONTENT_STRETCH);
}
+css_error css__copy_align_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_content(to, get_align_content(from));
+}
+
css_error css__compose_align_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_content(child);
- if (type == CSS_ALIGN_CONTENT_INHERIT) {
- type = get_align_content(parent);
- }
-
- return set_align_content(result, type);
+ return css__copy_align_content(
+ type == CSS_ALIGN_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_items.c b/src/select/properties/align_items.c
index 007fd70..52ca094 100644
--- a/src/select/properties/align_items.c
+++ b/src/select/properties/align_items.c
@@ -60,16 +60,25 @@ css_error css__initial_align_items(css_select_state *state)
return set_align_items(state->computed, CSS_ALIGN_ITEMS_STRETCH);
}
+css_error css__copy_align_items(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_items(to, get_align_items(from));
+}
+
css_error css__compose_align_items(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_items(child);
- if (type == CSS_ALIGN_ITEMS_INHERIT) {
- type = get_align_items(parent);
- }
-
- return set_align_items(result, type);
+ return css__copy_align_items(
+ type == CSS_ALIGN_ITEMS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_self.c b/src/select/properties/align_self.c
index b8ce46d..abdb3fe 100644
--- a/src/select/properties/align_self.c
+++ b/src/select/properties/align_self.c
@@ -63,16 +63,25 @@ css_error css__initial_align_self(css_select_state *state)
return set_align_self(state->computed, CSS_ALIGN_SELF_AUTO);
}
+css_error css__copy_align_self(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_self(to, get_align_self(from));
+}
+
css_error css__compose_align_self(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_self(child);
- if (type == CSS_ALIGN_SELF_INHERIT) {
- type = get_align_self(parent);
- }
-
- return set_align_self(result, type);
+ return css__copy_align_self(
+ type == CSS_ALIGN_SELF_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c
index 1d3e1c2..bbbb48d 100644
--- a/src/select/properties/azimuth.c
+++ b/src/select/properties/azimuth.c
@@ -70,6 +70,16 @@ css_error css__initial_azimuth(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_azimuth(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_azimuth(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c
index 7e59557..49194cc 100644
--- a/src/select/properties/background_attachment.c
+++ b/src/select/properties/background_attachment.c
@@ -52,16 +52,25 @@ css_error css__initial_background_attachment(css_select_state *state)
CSS_BACKGROUND_ATTACHMENT_SCROLL);
}
+css_error css__copy_background_attachment(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_attachment(to, get_background_attachment(from));
+}
+
css_error css__compose_background_attachment(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_attachment(child);
- if (type == CSS_BACKGROUND_ATTACHMENT_INHERIT) {
- type = get_background_attachment(parent);
- }
-
- return set_background_attachment(result, type);
+ return css__copy_background_attachment(
+ type == CSS_BACKGROUND_ATTACHMENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_color.c b/src/select/properties/background_color.c
index bb90604..1ab61e6 100644
--- a/src/select/properties/background_color.c
+++ b/src/select/properties/background_color.c
@@ -32,6 +32,20 @@ css_error css__initial_background_color(css_select_state *state)
CSS_BACKGROUND_COLOR_COLOR, 0);
}
+css_error css__copy_background_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_background_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_color(to, type, color);
+}
+
css_error css__compose_background_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -39,10 +53,8 @@ css_error css__compose_background_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_background_color(child, &color);
- if (type == CSS_BACKGROUND_COLOR_INHERIT) {
- type = get_background_color(parent, &color);
- }
-
- return set_background_color(result, type, color);
+ return css__copy_background_color(
+ type == CSS_BACKGROUND_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_image.c b/src/select/properties/background_image.c
index 96f7409..68b1e0f 100644
--- a/src/select/properties/background_image.c
+++ b/src/select/properties/background_image.c
@@ -39,6 +39,20 @@ css_error css__initial_background_image(css_select_state *state)
CSS_BACKGROUND_IMAGE_NONE, NULL);
}
+css_error css__copy_background_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_background_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_image(to, type, url);
+}
+
css_error css__compose_background_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_background_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_background_image(child, &url);
- if (type == CSS_BACKGROUND_IMAGE_INHERIT) {
- type = get_background_image(parent, &url);
- }
-
- return set_background_image(result, type, url);
+ return css__copy_background_image(
+ type == CSS_BACKGROUND_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c
index 1d959d0..f3fe47c 100644
--- a/src/select/properties/background_position.c
+++ b/src/select/properties/background_position.c
@@ -96,6 +96,22 @@ css_error css__initial_background_position(css_select_state *state)
0, CSS_UNIT_PCT, 0, CSS_UNIT_PCT);
}
+css_error css__copy_background_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_background_position(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_position(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_background_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -105,12 +121,8 @@ css_error css__compose_background_position(const css_computed_style *parent,
uint8_t type = get_background_position(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BACKGROUND_POSITION_INHERIT) {
- type = get_background_position(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_background_position(result, type, hlength, hunit,
- vlength, vunit);
+ return css__copy_background_position(
+ type == CSS_BACKGROUND_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c
index cf1b8fc..7104bfb 100644
--- a/src/select/properties/background_repeat.c
+++ b/src/select/properties/background_repeat.c
@@ -58,16 +58,25 @@ css_error css__initial_background_repeat(css_select_state *state)
CSS_BACKGROUND_REPEAT_REPEAT);
}
+css_error css__copy_background_repeat(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_repeat(to, get_background_repeat(from));
+}
+
css_error css__compose_background_repeat(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_repeat(child);
- if (type == CSS_BACKGROUND_REPEAT_INHERIT) {
- type = get_background_repeat(parent);
- }
-
- return set_background_repeat(result, type);
+ return css__copy_background_repeat(
+ type == CSS_BACKGROUND_REPEAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_color.c b/src/select/properties/border_bottom_color.c
index bdbecb7..1996d71 100644
--- a/src/select/properties/border_bottom_color.c
+++ b/src/select/properties/border_bottom_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_bottom_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_bottom_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_bottom_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_color(to, type, color);
+}
+
css_error css__compose_border_bottom_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_bottom_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_bottom_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_bottom_color(parent, &color);
- }
-
- return set_border_bottom_color(result, type, color);
+ return css__copy_border_bottom_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_style.c b/src/select/properties/border_bottom_style.c
index b5caccb..3451c65 100644
--- a/src/select/properties/border_bottom_style.c
+++ b/src/select/properties/border_bottom_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_bottom_style(css_select_state *state)
return set_border_bottom_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_bottom_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_style(to, get_border_bottom_style(from));
+}
+
css_error css__compose_border_bottom_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_bottom_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_bottom_style(parent);
- }
-
- return set_border_bottom_style(result, type);
+ return css__copy_border_bottom_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_width.c b/src/select/properties/border_bottom_width.c
index b071fba..19f4304 100644
--- a/src/select/properties/border_bottom_width.c
+++ b/src/select/properties/border_bottom_width.c
@@ -14,16 +14,16 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_border_bottom_width(uint32_t opv, css_style *style,
+css_error css__cascade_border_bottom_width(uint32_t opv, css_style *width,
css_select_state *state)
{
- return css__cascade_border_width(opv, style, state, set_border_bottom_width);
+ return css__cascade_border_width(opv, width, state, set_border_bottom_width);
}
css_error css__set_border_bottom_width_from_hint(const css_hint *hint,
- css_computed_style *style)
+ css_computed_style *width)
{
- return set_border_bottom_width(style, hint->status,
+ return set_border_bottom_width(width, hint->status,
hint->data.length.value, hint->data.length.unit);
}
@@ -33,6 +33,21 @@ css_error css__initial_border_bottom_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_bottom_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_bottom_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_width(to, type, length, unit);
+}
+
css_error css__compose_border_bottom_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_bottom_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_bottom_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_bottom_width(parent, &length, &unit);
- }
-
- return set_border_bottom_width(result, type, length, unit);
+ return css__copy_border_bottom_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c
index b923de6..8868e6b 100644
--- a/src/select/properties/border_collapse.c
+++ b/src/select/properties/border_collapse.c
@@ -51,16 +51,25 @@ css_error css__initial_border_collapse(css_select_state *state)
return set_border_collapse(state->computed, CSS_BORDER_COLLAPSE_SEPARATE);
}
+css_error css__copy_border_collapse(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_collapse(to, get_border_collapse(from));
+}
+
css_error css__compose_border_collapse(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_collapse(child);
- if (type == CSS_BORDER_COLLAPSE_INHERIT) {
- type = get_border_collapse(parent);
- }
-
- return set_border_collapse(result, type);
+ return css__copy_border_collapse(
+ type == CSS_BORDER_COLLAPSE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_color.c b/src/select/properties/border_left_color.c
index 2880751..60b81ae 100644
--- a/src/select/properties/border_left_color.c
+++ b/src/select/properties/border_left_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_left_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_left_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_left_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_color(to, type, color);
+}
+
css_error css__compose_border_left_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_left_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_left_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_left_color(parent, &color);
- }
-
- return set_border_left_color(result, type, color);
+ return css__copy_border_left_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_style.c b/src/select/properties/border_left_style.c
index e6472b3..99b5494 100644
--- a/src/select/properties/border_left_style.c
+++ b/src/select/properties/border_left_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_left_style(css_select_state *state)
return set_border_left_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_left_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_style(to, get_border_left_style(from));
+}
+
css_error css__compose_border_left_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_left_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_left_style(parent);
- }
-
- return set_border_left_style(result, type);
+ return css__copy_border_left_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_width.c b/src/select/properties/border_left_width.c
index 1278fa9..e1fc822 100644
--- a/src/select/properties/border_left_width.c
+++ b/src/select/properties/border_left_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_left_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_left_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_left_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_width(to, type, length, unit);
+}
+
css_error css__compose_border_left_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_left_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_left_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_left_width(parent, &length, &unit);
- }
-
- return set_border_left_width(result, type, length, unit);
+ return css__copy_border_left_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_color.c b/src/select/properties/border_right_color.c
index b8563e6..815ca9c 100644
--- a/src/select/properties/border_right_color.c
+++ b/src/select/properties/border_right_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_right_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_right_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_right_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_color(to, type, color);
+}
+
css_error css__compose_border_right_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_right_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_right_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_right_color(parent, &color);
- }
-
- return set_border_right_color(result, type, color);
+ return css__copy_border_right_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_style.c b/src/select/properties/border_right_style.c
index d75a99e..d14fbfb 100644
--- a/src/select/properties/border_right_style.c
+++ b/src/select/properties/border_right_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_right_style(css_select_state *state)
return set_border_right_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_right_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_style(to, get_border_right_style(from));
+}
+
css_error css__compose_border_right_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_right_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_right_style(parent);
- }
-
- return set_border_right_style(result, type);
+ return css__copy_border_right_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_width.c b/src/select/properties/border_right_width.c
index 18cacd2..93e8f19 100644
--- a/src/select/properties/border_right_width.c
+++ b/src/select/properties/border_right_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_right_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_right_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_right_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_width(to, type, length, unit);
+}
+
css_error css__compose_border_right_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_right_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_right_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_right_width(parent, &length, &unit);
- }
-
- return set_border_right_width(result, type, length, unit);
+ return css__copy_border_right_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c
index 8eb01cb..1f70aff 100644
--- a/src/select/properties/border_spacing.c
+++ b/src/select/properties/border_spacing.c
@@ -62,6 +62,22 @@ css_error css__initial_border_spacing(css_select_state *state)
0, CSS_UNIT_PX, 0, CSS_UNIT_PX);
}
+css_error css__copy_border_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_border_spacing(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_spacing(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_border_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -71,10 +87,7 @@ css_error css__compose_border_spacing(const css_computed_style *parent,
uint8_t type = get_border_spacing(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BORDER_SPACING_INHERIT) {
- type = get_border_spacing(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_border_spacing(result, type, hlength, hunit, vlength, vunit);
+ return css__copy_border_spacing(
+ type == CSS_BORDER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_color.c b/src/select/properties/border_top_color.c
index fd2ced4..ee3feb1 100644
--- a/src/select/properties/border_top_color.c
+++ b/src/select/properties/border_top_color.c
@@ -31,6 +31,20 @@ css_error css__initial_border_top_color(css_select_state *state)
return set_border_top_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_top_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_top_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_color(to, type, color);
+}
+
css_error css__compose_border_top_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_border_top_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_top_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_top_color(parent, &color);
- }
-
- return set_border_top_color(result, type, color);
+ return css__copy_border_top_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_style.c b/src/select/properties/border_top_style.c
index 48d6b6d..1d2dc91 100644
--- a/src/select/properties/border_top_style.c
+++ b/src/select/properties/border_top_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_top_style(css_select_state *state)
return set_border_top_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_top_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_style(to, get_border_top_style(from));
+}
+
css_error css__compose_border_top_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_top_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_top_style(parent);
- }
-
- return set_border_top_style(result, type);
+ return css__copy_border_top_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_width.c b/src/select/properties/border_top_width.c
index c0fb7da..18e60cb 100644
--- a/src/select/properties/border_top_width.c
+++ b/src/select/properties/border_top_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_top_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_top_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_top_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_width(to, type, length, unit);
+}
+
css_error css__compose_border_top_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_top_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_top_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_top_width(parent, &length, &unit);
- }
-
- return set_border_top_width(result, type, length, unit);
+ return css__copy_border_top_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/bottom.c b/src/select/properties/bottom.c
index 82754f1..fd65ed3 100644
--- a/src/select/properties/bottom.c
+++ b/src/select/properties/bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_bottom(css_select_state *state)
return set_bottom(state->computed, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_bottom(to, type, length, unit);
+}
+
css_error css__compose_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_bottom(child, &length, &unit);
- if (type == CSS_BOTTOM_INHERIT) {
- type = get_bottom(parent, &length, &unit);
- }
-
- return set_bottom(result, type, length, unit);
+ return css__copy_bottom(
+ type == CSS_BOTTOM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c
index 5bfb43e..471f8a7 100644
--- a/src/select/properties/box_sizing.c
+++ b/src/select/properties/box_sizing.c
@@ -51,17 +51,25 @@ css_error css__initial_box_sizing(css_select_state *state)
return set_box_sizing(state->computed, CSS_BOX_SIZING_CONTENT_BOX);
}
-css_error css__compose_box_sizing(
- const css_computed_style *parent,
+css_error css__copy_box_sizing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_box_sizing(to, get_box_sizing(from));
+}
+
+css_error css__compose_box_sizing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_box_sizing(child);
- if (type == CSS_BOX_SIZING_INHERIT) {
- type = get_box_sizing(parent);
- }
-
- return set_box_sizing(result, type);
+ return css__copy_box_sizing(
+ type == CSS_BOX_SIZING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_after.c b/src/select/properties/break_after.c
index 1f253aa..cb382e0 100644
--- a/src/select/properties/break_after.c
+++ b/src/select/properties/break_after.c
@@ -32,16 +32,25 @@ css_error css__initial_break_after(css_select_state *state)
return set_break_after(state->computed, CSS_BREAK_AFTER_AUTO);
}
+css_error css__copy_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_after(to, get_break_after(from));
+}
+
css_error css__compose_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_after(child);
- if (type == CSS_BREAK_AFTER_INHERIT) {
- type = get_break_after(parent);
- }
-
- return set_break_after(result, type);
+ return css__copy_break_after(
+ type == CSS_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_before.c b/src/select/properties/break_before.c
index 3dcda76..91b0612 100644
--- a/src/select/properties/break_before.c
+++ b/src/select/properties/break_before.c
@@ -32,16 +32,25 @@ css_error css__initial_break_before(css_select_state *state)
return set_break_before(state->computed, CSS_BREAK_BEFORE_AUTO);
}
+css_error css__copy_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_before(to, get_break_before(from));
+}
+
css_error css__compose_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_before(child);
- if (type == CSS_BREAK_BEFORE_INHERIT) {
- type = get_break_before(parent);
- }
-
- return set_break_before(result, type);
+ return css__copy_break_before(
+ type == CSS_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c
index 58ba25e..d5b8aef 100644
--- a/src/select/properties/break_inside.c
+++ b/src/select/properties/break_inside.c
@@ -57,16 +57,25 @@ css_error css__initial_break_inside(css_select_state *state)
return set_break_inside(state->computed, CSS_BREAK_INSIDE_AUTO);
}
+css_error css__copy_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_inside(to, get_break_inside(from));
+}
+
css_error css__compose_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_inside(child);
- if (type == CSS_BREAK_INSIDE_INHERIT) {
- type = get_break_inside(parent);
- }
-
- return set_break_inside(result, type);
+ return css__copy_break_inside(
+ type == CSS_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c
index e1b7930..f0e7693 100644
--- a/src/select/properties/caption_side.c
+++ b/src/select/properties/caption_side.c
@@ -51,16 +51,25 @@ css_error css__initial_caption_side(css_select_state *state)
return set_caption_side(state->computed, CSS_CAPTION_SIDE_TOP);
}
+css_error css__copy_caption_side(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_caption_side(to, get_caption_side(from));
+}
+
css_error css__compose_caption_side(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_caption_side(child);
- if (type == CSS_CAPTION_SIDE_INHERIT) {
- type = get_caption_side(parent);
- }
-
- return set_caption_side(result, type);
+ return css__copy_caption_side(
+ type == CSS_CAPTION_SIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c
index a753218..1fbc48e 100644
--- a/src/select/properties/clear.c
+++ b/src/select/properties/clear.c
@@ -57,16 +57,25 @@ css_error css__initial_clear(css_select_state *state)
return set_clear(state->computed, CSS_CLEAR_NONE);
}
+css_error css__copy_clear(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clear(to, get_clear(from));
+}
+
css_error css__compose_clear(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_clear(child);
- if (type == CSS_CLEAR_INHERIT) {
- type = get_clear(parent);
- }
-
- return set_clear(result, type);
+ return css__copy_clear(
+ type == CSS_CLEAR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c
index c82c1af..c0b9c2b 100644
--- a/src/select/properties/clip.c
+++ b/src/select/properties/clip.c
@@ -93,6 +93,22 @@ css_error css__initial_clip(css_select_state *state)
return set_clip(state->computed, CSS_CLIP_AUTO, &rect);
}
+css_error css__copy_clip(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_computed_clip_rect rect = { 0, 0, 0, 0,
+ CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
+ false, false, false, false };
+ uint8_t type = get_clip(from, &rect);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clip(to, type, &rect);
+}
+
css_error css__compose_clip(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -102,9 +118,7 @@ css_error css__compose_clip(const css_computed_style *parent,
false, false, false, false };
uint8_t type = get_clip(child, &rect);
- if (type == CSS_CLIP_INHERIT) {
- type = get_clip(parent, &rect);
- }
-
- return set_clip(result, type, &rect);
+ return css__copy_clip(
+ type == CSS_CLIP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/color.c b/src/select/properties/color.c
index c455fb9..6424436 100644
--- a/src/select/properties/color.c
+++ b/src/select/properties/color.c
@@ -66,6 +66,20 @@ css_error css__initial_color(css_select_state *state)
return css__set_color_from_hint(&hint, state->computed);
}
+css_error css__copy_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_color(to, type, color);
+}
+
css_error css__compose_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -73,10 +87,8 @@ css_error css__compose_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_color(child, &color);
- if (type == CSS_COLOR_INHERIT) {
- type = get_color(parent, &color);
- }
-
- return set_color(result, type, color);
+ return css__copy_color(
+ type == CSS_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index 3fdd43a..4adadd6 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -52,6 +52,20 @@ css_error css__initial_column_count(css_select_state *state)
return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0);
}
+css_error css__copy_column_count(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_column_count(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_count(to, type, count);
+}
+
css_error css__compose_column_count(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -59,9 +73,7 @@ css_error css__compose_column_count(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_column_count(child, &count);
- if (type == CSS_COLUMN_COUNT_INHERIT) {
- type = get_column_count(parent, &count);
- }
-
- return set_column_count(result, type, count);
+ return css__copy_column_count(
+ type == CSS_COLUMN_COUNT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index c4c23c3..f49946c 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -51,16 +51,25 @@ css_error css__initial_column_fill(css_select_state *state)
return set_column_fill(state->computed, CSS_COLUMN_FILL_BALANCE);
}
+css_error css__copy_column_fill(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_fill(to, get_column_fill(from));
+}
+
css_error css__compose_column_fill(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_fill(child);
- if (type == CSS_COLUMN_FILL_INHERIT) {
- type = get_column_fill(parent);
- }
-
- return set_column_fill(result, type);
+ return css__copy_column_fill(
+ type == CSS_COLUMN_FILL_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 087eb0f..5776dc9 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -33,6 +33,21 @@ css_error css__initial_column_gap(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_gap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_gap(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_gap(to, type, length, unit);
+}
+
css_error css__compose_column_gap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_column_gap(const css_computed_style *parent,
css_unit unit = CSS_UNIT_EM;
uint8_t type = get_column_gap(child, &length, &unit);
- if (type == CSS_COLUMN_GAP_INHERIT) {
- type = get_column_gap(parent, &length, &unit);
- }
-
- return set_column_gap(result, type, length, unit);
+ return css__copy_column_gap(
+ type == CSS_COLUMN_GAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index 047cef9..0b7ec9d 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -58,6 +58,20 @@ css_error css__initial_column_rule_color(css_select_state *state)
CSS_COLUMN_RULE_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_column_rule_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_column_rule_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_color(to, type, color);
+}
+
css_error css__compose_column_rule_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -65,10 +79,8 @@ css_error css__compose_column_rule_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_column_rule_color(child, &color);
- if (type == CSS_COLUMN_RULE_COLOR_INHERIT) {
- type = get_column_rule_color(parent, &color);
- }
-
- return set_column_rule_color(result, type, color);
+ return css__copy_column_rule_color(
+ type == CSS_COLUMN_RULE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c
index 1d9a41e..be9579c 100644
--- a/src/select/properties/column_rule_style.c
+++ b/src/select/properties/column_rule_style.c
@@ -33,16 +33,25 @@ css_error css__initial_column_rule_style(css_select_state *state)
CSS_COLUMN_RULE_STYLE_NONE);
}
+css_error css__copy_column_rule_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_style(to, get_column_rule_style(from));
+}
+
css_error css__compose_column_rule_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_rule_style(child);
- if (type == CSS_COLUMN_RULE_STYLE_INHERIT) {
- type = get_column_rule_style(parent);
- }
-
- return set_column_rule_style(result, type);
+ return css__copy_column_rule_style(
+ type == CSS_COLUMN_RULE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 3ca9367..c18f26c 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -34,6 +34,21 @@ css_error css__initial_column_rule_width(css_select_state *state)
CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
+css_error css__copy_column_rule_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_rule_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_width(to, type, length, unit);
+}
+
css_error css__compose_column_rule_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -42,10 +57,8 @@ css_error css__compose_column_rule_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_rule_width(child, &length, &unit);
- if (type == CSS_COLUMN_RULE_WIDTH_INHERIT) {
- type = get_column_rule_width(parent, &length, &unit);
- }
-
- return set_column_rule_width(result, type, length, unit);
+ return css__copy_column_rule_width(
+ type == CSS_COLUMN_RULE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index d17b3ed..340150f 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -51,16 +51,25 @@ css_error css__initial_column_span(css_select_state *state)
return set_column_span(state->computed, CSS_COLUMN_SPAN_NONE);
}
+css_error css__copy_column_span(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_span(to, get_column_span(from));
+}
+
css_error css__compose_column_span(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_span(child);
- if (type == CSS_COLUMN_SPAN_INHERIT) {
- type = get_column_span(parent);
- }
-
- return set_column_span(result, type);
+ return css__copy_column_span(
+ type == CSS_COLUMN_SPAN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index e739ade..d88d022 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -33,17 +33,30 @@ css_error css__initial_column_width(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_width(to, type, length, unit);
+}
+
css_error css__compose_column_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- css_fixed length = INTTOFIX(1);
- css_unit unit = CSS_UNIT_EM;
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_width(child, &length, &unit);
- if (type == CSS_COLUMN_WIDTH_INHERIT) {
- type = get_column_width(parent, &length, &unit);
- }
-
- return set_column_width(result, type, length, unit);
+ return css__copy_column_width(
+ type == CSS_COLUMN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/cue_after.c b/src/select/properties/cue_after.c
index e1c09e8..67a2c73 100644
--- a/src/select/properties/cue_after.c
+++ b/src/select/properties/cue_after.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/cue_before.c b/src/select/properties/cue_before.c
index d562b3b..7c24822 100644
--- a/src/select/properties/cue_before.c
+++ b/src/select/properties/cue_before.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c
index 6baa58b..32bd31e 100644
--- a/src/select/properties/direction.c
+++ b/src/select/properties/direction.c
@@ -51,16 +51,25 @@ css_error css__initial_direction(css_select_state *state)
return set_direction(state->computed, CSS_DIRECTION_LTR);
}
+css_error css__copy_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_direction(to, get_direction(from));
+}
+
css_error css__compose_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_direction(child);
- if (type == CSS_DIRECTION_INHERIT) {
- type = get_direction(parent);
- }
-
- return set_direction(result, type);
+ return css__copy_direction(
+ type == CSS_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 3e15d5f..bfe0a5f 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -99,16 +99,25 @@ css_error css__initial_display(css_select_state *state)
return set_display(state->computed, CSS_DISPLAY_INLINE);
}
+css_error css__copy_display(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_display(to, get_display(from));
+}
+
css_error css__compose_display(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_display(child);
- if (type == CSS_DISPLAY_INHERIT) {
- type = get_display(parent);
- }
-
- return set_display(result, type);
+ return css__copy_display(
+ type == CSS_DISPLAY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c
index 2df207a..1368ef8 100644
--- a/src/select/properties/elevation.c
+++ b/src/select/properties/elevation.c
@@ -65,6 +65,16 @@ css_error css__initial_elevation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_elevation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_elevation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c
index cd46b3f..559fbde 100644
--- a/src/select/properties/empty_cells.c
+++ b/src/select/properties/empty_cells.c
@@ -51,16 +51,25 @@ css_error css__initial_empty_cells(css_select_state *state)
return set_empty_cells(state->computed, CSS_EMPTY_CELLS_SHOW);
}
+css_error css__copy_empty_cells(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_empty_cells(to, get_empty_cells(from));
+}
+
css_error css__compose_empty_cells(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_empty_cells(child);
- if (type == CSS_EMPTY_CELLS_INHERIT) {
- type = get_empty_cells(parent);
- }
-
- return set_empty_cells(result, type);
+ return css__copy_empty_cells(
+ type == CSS_EMPTY_CELLS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_basis.c b/src/select/properties/flex_basis.c
index e5acb3c..a3141bc 100644
--- a/src/select/properties/flex_basis.c
+++ b/src/select/properties/flex_basis.c
@@ -62,6 +62,21 @@ css_error css__initial_flex_basis(css_select_state *state)
CSS_UNIT_PX);
}
+css_error css__copy_flex_basis(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_flex_basis(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_basis(to, type, length, unit);
+}
+
css_error css__compose_flex_basis(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -70,10 +85,8 @@ css_error css__compose_flex_basis(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_flex_basis(child, &length, &unit);
- if (type == CSS_FLEX_BASIS_INHERIT) {
- type = get_flex_basis(parent, &length, &unit);
- }
-
- return set_flex_basis(result, type, length, unit);
+ return css__copy_flex_basis(
+ type == CSS_FLEX_BASIS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 7dc46db..1d979be 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -57,16 +57,25 @@ css_error css__initial_flex_direction(css_select_state *state)
return set_flex_direction(state->computed, CSS_FLEX_DIRECTION_ROW);
}
+css_error css__copy_flex_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_direction(to, get_flex_direction(from));
+}
+
css_error css__compose_flex_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_direction(child);
- if (type == CSS_FLEX_DIRECTION_INHERIT) {
- type = get_flex_direction(parent);
- }
-
- return set_flex_direction(result, type);
+ return css__copy_flex_direction(
+ type == CSS_FLEX_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c
index fe4fa4d..4650cef 100644
--- a/src/select/properties/flex_grow.c
+++ b/src/select/properties/flex_grow.c
@@ -46,6 +46,20 @@ css_error css__initial_flex_grow(css_select_state *state)
return set_flex_grow(state->computed, CSS_FLEX_GROW_SET, INTTOFIX(0));
}
+css_error css__copy_flex_grow(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_grow = 0;
+ uint8_t type = get_flex_grow(from, &flex_grow);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_grow(to, type, flex_grow);
+}
+
css_error css__compose_flex_grow(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_grow(const css_computed_style *parent,
css_fixed flex_grow = 0;
uint8_t type = get_flex_grow(child, &flex_grow);
- if (type == CSS_FLEX_GROW_INHERIT) {
- type = get_flex_grow(parent, &flex_grow);
- }
-
- return set_flex_grow(result, type, flex_grow);
+ return css__copy_flex_grow(
+ type == CSS_FLEX_GROW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c
index 26aaa8f..9b39ed0 100644
--- a/src/select/properties/flex_shrink.c
+++ b/src/select/properties/flex_shrink.c
@@ -46,6 +46,20 @@ css_error css__initial_flex_shrink(css_select_state *state)
return set_flex_shrink(state->computed, CSS_FLEX_SHRINK_SET, INTTOFIX(1));
}
+css_error css__copy_flex_shrink(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_shrink = 0;
+ uint8_t type = get_flex_shrink(from, &flex_shrink);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_shrink(to, type, flex_shrink);
+}
+
css_error css__compose_flex_shrink(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_shrink(const css_computed_style *parent,
css_fixed flex_shrink = 0;
uint8_t type = get_flex_shrink(child, &flex_shrink);
- if (type == CSS_FLEX_SHRINK_INHERIT) {
- type = get_flex_shrink(parent, &flex_shrink);
- }
-
- return set_flex_shrink(result, type, flex_shrink);
+ return css__copy_flex_shrink(
+ type == CSS_FLEX_SHRINK_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_wrap.c b/src/select/properties/flex_wrap.c
index 55034d7..3ca9b74 100644
--- a/src/select/properties/flex_wrap.c
+++ b/src/select/properties/flex_wrap.c
@@ -54,16 +54,27 @@ css_error css__initial_flex_wrap(css_select_state *state)
return set_flex_wrap(state->computed, CSS_FLEX_WRAP_NOWRAP);
}
+css_error css__copy_flex_wrap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ uint8_t type = get_flex_wrap(from);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_wrap(to, type);
+}
+
css_error css__compose_flex_wrap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_wrap(child);
- if (type == CSS_FLEX_WRAP_INHERIT) {
- type = get_flex_wrap(parent);
- }
-
- return set_flex_wrap(result, type);
+ return css__copy_flex_wrap(
+ type == CSS_FLEX_WRAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/float.c b/src/select/properties/float.c
index 87732f6..6d009bb 100644
--- a/src/select/properties/float.c
+++ b/src/select/properties/float.c
@@ -54,16 +54,25 @@ css_error css__initial_float(css_select_state *state)
return set_float(state->computed, CSS_FLOAT_NONE);
}
+css_error css__copy_float(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_float(to, get_float(from));
+}
+
css_error css__compose_float(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_float(child);
- if (type == CSS_FLOAT_INHERIT) {
- type = get_float(parent);
- }
-
- return set_float(result, type);
+ return css__copy_float(
+ type == CSS_FLOAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index a361ee0..3ee9ce0 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -85,6 +85,21 @@ css_error css__initial_font_size(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_font_size(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed size = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_font_size(from, &size, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_size(to, type, size, unit);
+}
+
css_error css__compose_font_size(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -93,10 +108,8 @@ css_error css__compose_font_size(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_font_size(child, &size, &unit);
- if (type == CSS_FONT_SIZE_INHERIT) {
- type = get_font_size(parent, &size, &unit);
- }
-
- return set_font_size(result, type, size, unit);
+ return css__copy_font_size(
+ type == CSS_FONT_SIZE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c
index 6c240ec..fe605b8 100644
--- a/src/select/properties/font_style.c
+++ b/src/select/properties/font_style.c
@@ -54,16 +54,25 @@ css_error css__initial_font_style(css_select_state *state)
return set_font_style(state->computed, CSS_FONT_STYLE_NORMAL);
}
+css_error css__copy_font_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_style(to, get_font_style(from));
+}
+
css_error css__compose_font_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_style(child);
- if (type == CSS_FONT_STYLE_INHERIT) {
- type= get_font_style(parent);
- }
-
- return set_font_style(result, type);
+ return css__copy_font_style(
+ type == CSS_FONT_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c
index 1666153..9668fc3 100644
--- a/src/select/properties/font_variant.c
+++ b/src/select/properties/font_variant.c
@@ -51,16 +51,25 @@ css_error css__initial_font_variant(css_select_state *state)
return set_font_variant(state->computed, CSS_FONT_VARIANT_NORMAL);
}
+css_error css__copy_font_variant(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_variant(to, get_font_variant(from));
+}
+
css_error css__compose_font_variant(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_variant(child);
- if (type == CSS_FONT_VARIANT_INHERIT) {
- type = get_font_variant(parent);
- }
-
- return set_font_variant(result, type);
+ return css__copy_font_variant(
+ type == CSS_FONT_VARIANT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c
index d9dffc9..da918a1 100644
--- a/src/select/properties/font_weight.c
+++ b/src/select/properties/font_weight.c
@@ -84,16 +84,25 @@ css_error css__initial_font_weight(css_select_state *state)
return set_font_weight(state->computed, CSS_FONT_WEIGHT_NORMAL);
}
+css_error css__copy_font_weight(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_weight(to, get_font_weight(from));
+}
+
css_error css__compose_font_weight(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_weight(child);
- if (type == CSS_FONT_WEIGHT_INHERIT) {
- type = get_font_weight(parent);
- }
-
- return set_font_weight(result, type);
+ return css__copy_font_weight(
+ type == CSS_FONT_WEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/height.c b/src/select/properties/height.c
index 1d74c4a..d449e72 100644
--- a/src/select/properties/height.c
+++ b/src/select/properties/height.c
@@ -32,6 +32,21 @@ css_error css__initial_height(css_select_state *state)
return set_height(state->computed, CSS_HEIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_height(to, type, length, unit);
+}
+
css_error css__compose_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_height(child, &length, &unit);
- if (type == CSS_HEIGHT_INHERIT) {
- type = get_height(parent, &length, &unit);
- }
-
- return set_height(result, type, length, unit);
+ return css__copy_height(
+ type == CSS_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c
index 03c8bb4..385bab7 100644
--- a/src/select/properties/justify_content.c
+++ b/src/select/properties/justify_content.c
@@ -64,16 +64,25 @@ css_error css__initial_justify_content(css_select_state *state)
CSS_JUSTIFY_CONTENT_FLEX_START);
}
+css_error css__copy_justify_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_justify_content(to, get_justify_content(from));
+}
+
css_error css__compose_justify_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_justify_content(child);
- if (type == CSS_JUSTIFY_CONTENT_INHERIT) {
- type = get_justify_content(parent);
- }
-
- return set_justify_content(result, type);
+ return css__copy_justify_content(
+ type == CSS_JUSTIFY_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/left.c b/src/select/properties/left.c
index 4baa324..ca8c844 100644
--- a/src/select/properties/left.c
+++ b/src/select/properties/left.c
@@ -32,6 +32,21 @@ css_error css__initial_left(css_select_state *state)
return set_left(state->computed, CSS_LEFT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_left(to, type, length, unit);
+}
+
css_error css__compose_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_left(child, &length, &unit);
- if (type == CSS_LEFT_INHERIT) {
- type = get_left(parent, &length, &unit);
- }
-
- return set_left(result, type, length, unit);
+ return css__copy_left(
+ type == CSS_LEFT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/letter_spacing.c b/src/select/properties/letter_spacing.c
index 27ea04b..9c8e50c 100644
--- a/src/select/properties/letter_spacing.c
+++ b/src/select/properties/letter_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_letter_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_letter_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_letter_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_letter_spacing(to, type, length, unit);
+}
+
css_error css__compose_letter_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_letter_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_letter_spacing(child, &length, &unit);
- if (type == CSS_LETTER_SPACING_INHERIT) {
- type = get_letter_spacing(parent, &length, &unit);
- }
-
- return set_letter_spacing(result, type, length, unit);
+ return css__copy_letter_spacing(
+ type == CSS_LETTER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index b43ebdd..7300b5d 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -64,6 +64,21 @@ css_error css__initial_line_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_line_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_line_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_line_height(to, type, length, unit);
+}
+
css_error css__compose_line_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -72,10 +87,8 @@ css_error css__compose_line_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_line_height(child, &length, &unit);
- if (type == CSS_LINE_HEIGHT_INHERIT) {
- type = get_line_height(parent, &length, &unit);
- }
-
- return set_line_height(result, type, length, unit);
+ return css__copy_line_height(
+ type == CSS_LINE_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_image.c b/src/select/properties/list_style_image.c
index cc77eb4..7a41c3a 100644
--- a/src/select/properties/list_style_image.c
+++ b/src/select/properties/list_style_image.c
@@ -39,6 +39,20 @@ css_error css__initial_list_style_image(css_select_state *state)
CSS_LIST_STYLE_IMAGE_NONE, NULL);
}
+css_error css__copy_list_style_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_list_style_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_image(to, type, url);
+}
+
css_error css__compose_list_style_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_list_style_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_list_style_image(child, &url);
- if (type == CSS_LIST_STYLE_IMAGE_INHERIT) {
- type = get_list_style_image(parent, &url);
- }
-
- return set_list_style_image(result, type, url);
+ return css__copy_list_style_image(
+ type == CSS_LIST_STYLE_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c
index 0231c10..ca46850 100644
--- a/src/select/properties/list_style_position.c
+++ b/src/select/properties/list_style_position.c
@@ -52,16 +52,25 @@ css_error css__initial_list_style_position(css_select_state *state)
CSS_LIST_STYLE_POSITION_OUTSIDE);
}
+css_error css__copy_list_style_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_position(to, get_list_style_position(from));
+}
+
css_error css__compose_list_style_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_position(child);
- if (type == CSS_LIST_STYLE_POSITION_INHERIT) {
- type = get_list_style_position(parent);
- }
-
- return set_list_style_position(result, type);
+ return css__copy_list_style_position(
+ type == CSS_LIST_STYLE_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c
index 19cde9b..9d809e6 100644
--- a/src/select/properties/list_style_type.c
+++ b/src/select/properties/list_style_type.c
@@ -201,15 +201,24 @@ css_error css__initial_list_style_type(css_select_state *state)
return set_list_style_type(state->computed, CSS_LIST_STYLE_TYPE_DISC);
}
+css_error css__copy_list_style_type(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_type(to, get_list_style_type(from));
+}
+
css_error css__compose_list_style_type(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_type(child);
- if (type == CSS_LIST_STYLE_TYPE_INHERIT) {
- type = get_list_style_type(parent);
- }
-
- return set_list_style_type(result, type);
+ return css__copy_list_style_type(
+ type == CSS_LIST_STYLE_TYPE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_bottom.c b/src/select/properties/margin_bottom.c
index 3b1d8a1..a0ffd89 100644
--- a/src/select/properties/margin_bottom.c
+++ b/src/select/properties/margin_bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_bottom(css_select_state *state)
return set_margin_bottom(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_bottom(to, type, length, unit);
+}
+
css_error css__compose_margin_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_bottom(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_bottom(parent, &length, &unit);
- }
-
- return set_margin_bottom(result, type, length, unit);
+ return css__copy_margin_bottom(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_left.c b/src/select/properties/margin_left.c
index 240285a..b163fba 100644
--- a/src/select/properties/margin_left.c
+++ b/src/select/properties/margin_left.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_left(css_select_state *state)
return set_margin_left(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_left(to, type, length, unit);
+}
+
css_error css__compose_margin_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_left(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_left(parent, &length, &unit);
- }
-
- return set_margin_left(result, type, length, unit);
+ return css__copy_margin_left(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_right.c b/src/select/properties/margin_right.c
index 737fbee..2c15b54 100644
--- a/src/select/properties/margin_right.c
+++ b/src/select/properties/margin_right.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_right(css_select_state *state)
return set_margin_right(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_right(to, type, length, unit);
+}
+
css_error css__compose_margin_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_right(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_right(parent, &length, &unit);
- }
-
- return set_margin_right(result, type, length, unit);
+ return css__copy_margin_right(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_top.c b/src/select/properties/margin_top.c
index 5563a48..1df811d 100644
--- a/src/select/properties/margin_top.c
+++ b/src/select/properties/margin_top.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_top(css_select_state *state)
return set_margin_top(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_top(to, type, length, unit);
+}
+
css_error css__compose_margin_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_top(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_top(parent, &length, &unit);
- }
-
- return set_margin_top(result, type, length, unit);
+ return css__copy_margin_top(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_height.c b/src/select/properties/max_height.c
index e03c8da..1dcf09d 100644
--- a/src/select/properties/max_height.c
+++ b/src/select/properties/max_height.c
@@ -33,6 +33,21 @@ css_error css__initial_max_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_max_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_height(to, type, length, unit);
+}
+
css_error css__compose_max_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_max_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_height(child, &length, &unit);
- if (type == CSS_MAX_HEIGHT_INHERIT) {
- type = get_max_height(parent, &length, &unit);
- }
-
- return set_max_height(result, type, length, unit);
+ return css__copy_max_height(
+ type == CSS_MAX_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_width.c b/src/select/properties/max_width.c
index ec98712..11d8ade 100644
--- a/src/select/properties/max_width.c
+++ b/src/select/properties/max_width.c
@@ -32,6 +32,21 @@ css_error css__initial_max_width(css_select_state *state)
return set_max_width(state->computed, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX);
}
+css_error css__copy_max_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_width(to, type, length, unit);
+}
+
css_error css__compose_max_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_max_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_width(child, &length, &unit);
- if (type == CSS_MAX_WIDTH_INHERIT) {
- type = get_max_width(parent, &length, &unit);
- }
-
- return set_max_width(result, type, length, unit);
+ return css__copy_max_width(
+ type == CSS_MAX_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_height.c b/src/select/properties/min_height.c
index a5389ce..d05655c 100644
--- a/src/select/properties/min_height.c
+++ b/src/select/properties/min_height.c
@@ -33,6 +33,21 @@ css_error css__initial_min_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_height(to, type, length, unit);
+}
+
css_error css__compose_min_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_height(child, &length, &unit);
- if (type == CSS_MIN_HEIGHT_INHERIT) {
- type = get_min_height(parent, &length, &unit);
- }
-
- return set_min_height(result, type, length, unit);
+ return css__copy_min_height(
+ type == CSS_MIN_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_width.c b/src/select/properties/min_width.c
index 8460e01..af709d3 100644
--- a/src/select/properties/min_width.c
+++ b/src/select/properties/min_width.c
@@ -33,6 +33,21 @@ css_error css__initial_min_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_width(to, type, length, unit);
+}
+
css_error css__compose_min_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_width(child, &length, &unit);
- if (type == CSS_MIN_WIDTH_INHERIT) {
- type = get_min_width(parent, &length, &unit);
- }
-
- return set_min_width(result, type, length, unit);
+ return css__copy_min_width(
+ type == CSS_MIN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c
index c202d36..818af62 100644
--- a/src/select/properties/opacity.c
+++ b/src/select/properties/opacity.c
@@ -46,6 +46,20 @@ css_error css__initial_opacity(css_select_state *state)
return set_opacity(state->computed, CSS_OPACITY_SET, INTTOFIX(1));
}
+css_error css__copy_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed opacity = 0;
+ uint8_t type = get_opacity(from, &opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_opacity(to, type, opacity);
+}
+
css_error css__compose_opacity(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_opacity(const css_computed_style *parent,
css_fixed opacity = 0;
uint8_t type = get_opacity(child, &opacity);
- if (type == CSS_OPACITY_INHERIT) {
- type = get_opacity(parent, &opacity);
- }
-
- return set_opacity(result, type, opacity);
+ return css__copy_opacity(
+ type == CSS_OPACITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/order.c b/src/select/properties/order.c
index 7e447f1..4004c0e 100644
--- a/src/select/properties/order.c
+++ b/src/select/properties/order.c
@@ -46,6 +46,20 @@ css_error css__initial_order(css_select_state *state)
return set_order(state->computed, CSS_ORDER_SET, 0);
}
+css_error css__copy_order(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t order = 0;
+ uint8_t type = get_order(from, &order);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_order(to, type, order);
+}
+
css_error css__compose_order(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_order(const css_computed_style *parent,
int32_t order = 0;
uint8_t type = get_order(child, &order);
- if (type == CSS_ORDER_INHERIT) {
- type = get_order(parent, &order);
- }
-
- return set_order(result, type, order);
+ return css__copy_order(
+ type == CSS_ORDER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/orphans.c b/src/select/properties/orphans.c
index f169b81..b0fee43 100644
--- a/src/select/properties/orphans.c
+++ b/src/select/properties/orphans.c
@@ -31,6 +31,20 @@ css_error css__initial_orphans(css_select_state *state)
return set_orphans(state->computed, CSS_ORPHANS_SET, 2);
}
+css_error css__copy_orphans(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_orphans(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_orphans(to, type, count);
+}
+
css_error css__compose_orphans(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_orphans(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_orphans(child, &count);
- if (type == CSS_ORPHANS_INHERIT) {
- type = get_orphans(parent, &count);
- }
-
- return set_orphans(result, type, count);
+ return css__copy_orphans(
+ type == CSS_ORPHANS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c
index 707dd7b..359960f 100644
--- a/src/select/properties/outline_color.c
+++ b/src/select/properties/outline_color.c
@@ -58,6 +58,20 @@ css_error css__initial_outline_color(css_select_state *state)
return set_outline_color(state->computed, CSS_OUTLINE_COLOR_INVERT, 0);
}
+css_error css__copy_outline_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color = 0;
+ uint8_t type = get_outline_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_color(to, type, color);
+}
+
css_error css__compose_outline_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -65,9 +79,7 @@ css_error css__compose_outline_color(const css_computed_style *parent,
css_color color = 0;
uint8_t type = get_outline_color(child, &color);
- if (type == CSS_OUTLINE_COLOR_INHERIT) {
- type = get_outline_color(parent, &color);
- }
-
- return set_outline_color(result, type, color);
+ return css__copy_outline_color(
+ type == CSS_OUTLINE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_style.c b/src/select/properties/outline_style.c
index 5c30735..acdab03 100644
--- a/src/select/properties/outline_style.c
+++ b/src/select/properties/outline_style.c
@@ -31,16 +31,25 @@ css_error css__initial_outline_style(css_select_state *state)
return set_outline_style(state->computed, CSS_OUTLINE_STYLE_NONE);
}
+css_error css__copy_outline_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_style(to, get_outline_style(from));
+}
+
css_error css__compose_outline_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_outline_style(child);
- if (type == CSS_OUTLINE_STYLE_INHERIT) {
- type = get_outline_style(parent);
- }
-
- return set_outline_style(result, type);
+ return css__copy_outline_style(
+ type == CSS_OUTLINE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_width.c b/src/select/properties/outline_width.c
index 0289c57..dbc0298 100644
--- a/src/select/properties/outline_width.c
+++ b/src/select/properties/outline_width.c
@@ -33,6 +33,21 @@ css_error css__initial_outline_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_outline_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_outline_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_width(to, type, length, unit);
+}
+
css_error css__compose_outline_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_outline_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_outline_width(child, &length, &unit);
- if (type == CSS_OUTLINE_WIDTH_INHERIT) {
- type = get_outline_width(parent, &length, &unit);
- }
-
- return set_outline_width(result, type, length, unit);
+ return css__copy_outline_width(
+ type == CSS_OUTLINE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c
index 29ce7f7..98dfba5 100644
--- a/src/select/properties/overflow_x.c
+++ b/src/select/properties/overflow_x.c
@@ -57,16 +57,25 @@ css_error css__initial_overflow_x(css_select_state *state)
return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_x(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_x(to, get_overflow_x(from));
+}
+
css_error css__compose_overflow_x(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_x(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_x(parent);
- }
-
- return set_overflow_x(result, type);
+ return css__copy_overflow_x(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c
index 398225b..d7795a2 100644
--- a/src/select/properties/overflow_y.c
+++ b/src/select/properties/overflow_y.c
@@ -57,16 +57,25 @@ css_error css__initial_overflow_y(css_select_state *state)
return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_y(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_y(to, get_overflow_y(from));
+}
+
css_error css__compose_overflow_y(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_y(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_y(parent);
- }
-
- return set_overflow_y(result, type);
+ return css__copy_overflow_y(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_bottom.c b/src/select/properties/padding_bottom.c
index e3b36f7..53c749c 100644
--- a/src/select/properties/padding_bottom.c
+++ b/src/select/properties/padding_bottom.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_bottom(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_bottom(to, type, length, unit);
+}
+
css_error css__compose_padding_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_bottom(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_bottom(parent, &length, &unit);
- }
-
- return set_padding_bottom(result, type, length, unit);
+ return css__copy_padding_bottom(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_left.c b/src/select/properties/padding_left.c
index bdea11e..b61ca83 100644
--- a/src/select/properties/padding_left.c
+++ b/src/select/properties/padding_left.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_left(css_select_state *state)
return set_padding_left(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_left(to, type, length, unit);
+}
+
css_error css__compose_padding_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_left(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_left(parent, &length, &unit);
- }
-
- return set_padding_left(result, type, length, unit);
+ return css__copy_padding_left(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_right.c b/src/select/properties/padding_right.c
index 82c1ed3..35417d6 100644
--- a/src/select/properties/padding_right.c
+++ b/src/select/properties/padding_right.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_right(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_right(to, type, length, unit);
+}
+
css_error css__compose_padding_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_right(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_right(parent, &length, &unit);
- }
-
- return set_padding_right(result, type, length, unit);
+ return css__copy_padding_right(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_top.c b/src/select/properties/padding_top.c
index f6d8b3e..a2cec95 100644
--- a/src/select/properties/padding_top.c
+++ b/src/select/properties/padding_top.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_top(css_select_state *state)
return set_padding_top(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_top(to, type, length, unit);
+}
+
css_error css__compose_padding_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_top(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_top(parent, &length, &unit);
- }
-
- return set_padding_top(result, type, length, unit);
+ return css__copy_padding_top(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_after.c b/src/select/properties/page_break_after.c
index fdb6774..4065a17 100644
--- a/src/select/properties/page_break_after.c
+++ b/src/select/properties/page_break_after.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_after(css_select_state *state)
CSS_PAGE_BREAK_AFTER_AUTO);
}
+css_error css__copy_page_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_after(to, get_page_break_after(from));
+}
+
css_error css__compose_page_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_after(child);
- if (type == CSS_PAGE_BREAK_AFTER_INHERIT) {
- type = get_page_break_after(parent);
- }
-
- return set_page_break_after(result, type);
+ return css__copy_page_break_after(
+ type == CSS_PAGE_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_before.c b/src/select/properties/page_break_before.c
index 1491997..d8fdd93 100644
--- a/src/select/properties/page_break_before.c
+++ b/src/select/properties/page_break_before.c
@@ -33,15 +33,24 @@ css_error css__initial_page_break_before(css_select_state *state)
CSS_PAGE_BREAK_BEFORE_AUTO);
}
+css_error css__copy_page_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_before(to, get_page_break_before(from));
+}
+
css_error css__compose_page_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_before(child);
- if (type == CSS_PAGE_BREAK_BEFORE_INHERIT) {
- type = get_page_break_before(parent);
- }
-
- return set_page_break_before(result, type);
+ return css__copy_page_break_before(
+ type == CSS_PAGE_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_inside.c b/src/select/properties/page_break_inside.c
index ddcb19f..8655c40 100644
--- a/src/select/properties/page_break_inside.c
+++ b/src/select/properties/page_break_inside.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_inside(css_select_state *state)
CSS_PAGE_BREAK_INSIDE_AUTO);
}
+css_error css__copy_page_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_inside(to, get_page_break_inside(from));
+}
+
css_error css__compose_page_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_inside(child);
- if (type == CSS_PAGE_BREAK_INSIDE_INHERIT) {
- type = get_page_break_inside(parent);
- }
-
- return set_page_break_inside(result, type);
+ return css__copy_page_break_inside(
+ type == CSS_PAGE_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/pause_after.c b/src/select/properties/pause_after.c
index 16bbefe..b8bf968 100644
--- a/src/select/properties/pause_after.c
+++ b/src/select/properties/pause_after.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pause_before.c b/src/select/properties/pause_before.c
index 7770615..74cb565 100644
--- a/src/select/properties/pause_before.c
+++ b/src/select/properties/pause_before.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c
index cdff1d6..c0c5c88 100644
--- a/src/select/properties/pitch.c
+++ b/src/select/properties/pitch.c
@@ -64,6 +64,16 @@ css_error css__initial_pitch(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch_range.c b/src/select/properties/pitch_range.c
index 52a5751..c8f7526 100644
--- a/src/select/properties/pitch_range.c
+++ b/src/select/properties/pitch_range.c
@@ -37,6 +37,16 @@ css_error css__initial_pitch_range(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch_range(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch_range(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c
index d397b82..0f38f74 100644
--- a/src/select/properties/play_during.c
+++ b/src/select/properties/play_during.c
@@ -58,6 +58,16 @@ css_error css__initial_play_during(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_play_during(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_play_during(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/position.c b/src/select/properties/position.c
index c7cc6bf..738dbff 100644
--- a/src/select/properties/position.c
+++ b/src/select/properties/position.c
@@ -57,16 +57,25 @@ css_error css__initial_position(css_select_state *state)
return set_position(state->computed, CSS_POSITION_STATIC);
}
+css_error css__copy_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_position(to, get_position(from));
+}
+
css_error css__compose_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_position(child);
- if (type == CSS_POSITION_INHERIT) {
- type = get_position(parent);
- }
-
- return set_position(result, type);
+ return css__copy_position(
+ type == CSS_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index 6eac397..be31d0b 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -18,6 +18,7 @@
css_error css__cascade_##pname (uint32_t opv, css_style *style, css_select_state *state); \
css_error css__set_##pname##_from_hint(const css_hint *hint, css_computed_style *style); \
css_error css__initial_##pname (css_select_state *state); \
+ css_error css__copy_##pname (const css_computed_style *from, css_computed_style *to); \
css_error css__compose_##pname (const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); \
uint32_t destroy_##pname (void *bytecode)
diff --git a/src/select/properties/richness.c b/src/select/properties/richness.c
index 9656486..cd62d5c 100644
--- a/src/select/properties/richness.c
+++ b/src/select/properties/richness.c
@@ -37,6 +37,16 @@ css_error css__initial_richness(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_richness(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_richness(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/right.c b/src/select/properties/right.c
index 142e7e8..ee4f4a0 100644
--- a/src/select/properties/right.c
+++ b/src/select/properties/right.c
@@ -32,6 +32,21 @@ css_error css__initial_right(css_select_state *state)
return set_right(state->computed, CSS_RIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_right(to, type, length, unit);
+}
+
css_error css__compose_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_right(child, &length, &unit);
- if (type == CSS_RIGHT_INHERIT) {
- type = get_right(parent, &length, &unit);
- }
-
- return set_right(result, type, length, unit);
+ return css__copy_right(
+ type == CSS_RIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c
index 87e77d9..7b0d014 100644
--- a/src/select/properties/speak.c
+++ b/src/select/properties/speak.c
@@ -53,6 +53,16 @@ css_error css__initial_speak(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c
index 9d74228..88ad0d7 100644
--- a/src/select/properties/speak_header.c
+++ b/src/select/properties/speak_header.c
@@ -52,6 +52,16 @@ css_error css__initial_speak_header(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_header(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_header(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c
index ae94d2e..1cd6e98 100644
--- a/src/select/properties/speak_numeral.c
+++ b/src/select/properties/speak_numeral.c
@@ -52,6 +52,16 @@ css_error css__initial_speak_numeral(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_numeral(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_numeral(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c
index e9f8575..916d530 100644
--- a/src/select/properties/speak_punctuation.c
+++ b/src/select/properties/speak_punctuation.c
@@ -52,6 +52,16 @@ css_error css__initial_speak_punctuation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_punctuation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_punctuation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speech_rate.c b/src/select/properties/speech_rate.c
index ac9d300..296c248 100644
--- a/src/select/properties/speech_rate.c
+++ b/src/select/properties/speech_rate.c
@@ -61,6 +61,16 @@ css_error css__initial_speech_rate(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speech_rate(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speech_rate(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/stress.c b/src/select/properties/stress.c
index c9d61dd..0320fd0 100644
--- a/src/select/properties/stress.c
+++ b/src/select/properties/stress.c
@@ -37,6 +37,16 @@ css_error css__initial_stress(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_stress(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_stress(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c
index 013ae47..255ce37 100644
--- a/src/select/properties/table_layout.c
+++ b/src/select/properties/table_layout.c
@@ -51,16 +51,25 @@ css_error css__initial_table_layout(css_select_state *state)
return set_table_layout(state->computed, CSS_TABLE_LAYOUT_AUTO);
}
+css_error css__copy_table_layout(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_table_layout(to, get_table_layout(from));
+}
+
css_error css__compose_table_layout(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_table_layout(child);
- if (type == CSS_TABLE_LAYOUT_INHERIT) {
- type = get_table_layout(parent);
- }
-
- return set_table_layout(result, type);
+ return css__copy_table_layout(
+ type == CSS_TABLE_LAYOUT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c
index 759009c..bfea8a8 100644
--- a/src/select/properties/text_decoration.c
+++ b/src/select/properties/text_decoration.c
@@ -59,16 +59,25 @@ css_error css__initial_text_decoration(css_select_state *state)
return set_text_decoration(state->computed, CSS_TEXT_DECORATION_NONE);
}
+css_error css__copy_text_decoration(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_decoration(to, get_text_decoration(from));
+}
+
css_error css__compose_text_decoration(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_decoration(child);
- if (type == CSS_TEXT_DECORATION_INHERIT) {
- type = get_text_decoration(parent);
- }
-
- return set_text_decoration(result, type);
+ return css__copy_text_decoration(
+ type == CSS_TEXT_DECORATION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_indent.c b/src/select/properties/text_indent.c
index 787c0be..3708130 100644
--- a/src/select/properties/text_indent.c
+++ b/src/select/properties/text_indent.c
@@ -33,6 +33,21 @@ css_error css__initial_text_indent(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_text_indent(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_text_indent(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_indent(to, type, length, unit);
+}
+
css_error css__compose_text_indent(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_text_indent(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_text_indent(child, &length, &unit);
- if (type == CSS_TEXT_INDENT_INHERIT) {
- type = get_text_indent(parent, &length, &unit);
- }
-
- return set_text_indent(result, type, length, unit);
+ return css__copy_text_indent(
+ type == CSS_TEXT_INDENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c
index f3fac38..3bc5757 100644
--- a/src/select/properties/text_transform.c
+++ b/src/select/properties/text_transform.c
@@ -57,16 +57,25 @@ css_error css__initial_text_transform(css_select_state *state)
return set_text_transform(state->computed, CSS_TEXT_TRANSFORM_NONE);
}
+css_error css__copy_text_transform(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_transform(to, get_text_transform(from));
+}
+
css_error css__compose_text_transform(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_transform(child);
- if (type == CSS_TEXT_TRANSFORM_INHERIT) {
- type = get_text_transform(parent);
- }
-
- return set_text_transform(result, type);
+ return css__copy_text_transform(
+ type == CSS_TEXT_TRANSFORM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/top.c b/src/select/properties/top.c
index 72129aa..473a105 100644
--- a/src/select/properties/top.c
+++ b/src/select/properties/top.c
@@ -32,6 +32,21 @@ css_error css__initial_top(css_select_state *state)
return set_top(state->computed, CSS_TOP_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_top(to, type, length, unit);
+}
+
css_error css__compose_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_top(child, &length, &unit);
- if (type == CSS_TOP_INHERIT) {
- type = get_top(parent, &length, &unit);
- }
-
- return set_top(result, type, length, unit);
+ return css__copy_top(
+ type == CSS_TOP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c
index 0a4c0d1..ae0f4ad 100644
--- a/src/select/properties/unicode_bidi.c
+++ b/src/select/properties/unicode_bidi.c
@@ -54,16 +54,25 @@ css_error css__initial_unicode_bidi(css_select_state *state)
return set_unicode_bidi(state->computed, CSS_UNICODE_BIDI_NORMAL);
}
+css_error css__copy_unicode_bidi(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_unicode_bidi(to, get_unicode_bidi(from));
+}
+
css_error css__compose_unicode_bidi(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_unicode_bidi(child);
- if (type == CSS_UNICODE_BIDI_INHERIT) {
- type = get_unicode_bidi(parent);
- }
-
- return set_unicode_bidi(result, type);
+ return css__copy_unicode_bidi(
+ type == CSS_UNICODE_BIDI_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c
index 18b8b55..9fbffe6 100644
--- a/src/select/properties/vertical_align.c
+++ b/src/select/properties/vertical_align.c
@@ -81,6 +81,21 @@ css_error css__initial_vertical_align(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_vertical_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_vertical_align(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_vertical_align(to, type, length, unit);
+}
+
css_error css__compose_vertical_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -89,10 +104,8 @@ css_error css__compose_vertical_align(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_vertical_align(child, &length, &unit);
- if (type == CSS_VERTICAL_ALIGN_INHERIT) {
- type = get_vertical_align(parent, &length, &unit);
- }
-
- return set_vertical_align(result, type, length, unit);
+ return css__copy_vertical_align(
+ type == CSS_VERTICAL_ALIGN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c
index 901700d..674e433 100644
--- a/src/select/properties/visibility.c
+++ b/src/select/properties/visibility.c
@@ -54,16 +54,25 @@ css_error css__initial_visibility(css_select_state *state)
return set_visibility(state->computed, CSS_VISIBILITY_VISIBLE);
}
+css_error css__copy_visibility(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_visibility(to, get_visibility(from));
+}
+
css_error css__compose_visibility(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_visibility(child);
- if (type == CSS_VISIBILITY_INHERIT) {
- type = get_visibility(parent);
- }
-
- return set_visibility(result, type);
+ return css__copy_visibility(
+ type == CSS_VISIBILITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c
index ff0324c..66e3123 100644
--- a/src/select/properties/voice_family.c
+++ b/src/select/properties/voice_family.c
@@ -120,6 +120,16 @@ css_error css__initial_voice_family(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_voice_family(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_voice_family(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c
index 65bf979..65bdd03 100644
--- a/src/select/properties/volume.c
+++ b/src/select/properties/volume.c
@@ -69,6 +69,16 @@ css_error css__initial_volume(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_volume(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_volume(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c
index 1c22f9d..edc35cd 100644
--- a/src/select/properties/white_space.c
+++ b/src/select/properties/white_space.c
@@ -60,16 +60,25 @@ css_error css__initial_white_space(css_select_state *state)
return set_white_space(state->computed, CSS_WHITE_SPACE_NORMAL);
}
+css_error css__copy_white_space(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_white_space(to, get_white_space(from));
+}
+
css_error css__compose_white_space(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_white_space(child);
- if (type == CSS_WHITE_SPACE_INHERIT) {
- type = get_white_space(parent);
- }
-
- return set_white_space(result, type);
+ return css__copy_white_space(
+ type == CSS_WHITE_SPACE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/widows.c b/src/select/properties/widows.c
index 61126c2..853c08d 100644
--- a/src/select/properties/widows.c
+++ b/src/select/properties/widows.c
@@ -31,6 +31,20 @@ css_error css__initial_widows(css_select_state *state)
return set_widows(state->computed, CSS_WIDOWS_SET, 2);
}
+css_error css__copy_widows(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_widows(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_widows(to, type, count);
+}
+
css_error css__compose_widows(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_widows(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_widows(child, &count);
- if (type == CSS_WIDOWS_INHERIT) {
- type = get_widows(parent, &count);
- }
-
- return set_widows(result, type, count);
+ return css__copy_widows(
+ type == CSS_WIDOWS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/width.c b/src/select/properties/width.c
index 829df91..c6d33ff 100644
--- a/src/select/properties/width.c
+++ b/src/select/properties/width.c
@@ -32,6 +32,21 @@ css_error css__initial_width(css_select_state *state)
return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_width(to, type, length, unit);
+}
+
css_error css__compose_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_width(child, &length, &unit);
- if (type == CSS_WIDTH_INHERIT) {
- type = get_width(parent, &length, &unit);
- }
-
- return set_width(result, type, length, unit);
+ return css__copy_width(
+ type == CSS_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/word_spacing.c b/src/select/properties/word_spacing.c
index eb39b50..c1c6782 100644
--- a/src/select/properties/word_spacing.c
+++ b/src/select/properties/word_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_word_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_word_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_word_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_word_spacing(to, type, length, unit);
+}
+
css_error css__compose_word_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_word_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_word_spacing(child, &length, &unit);
- if (type == CSS_WORD_SPACING_INHERIT) {
- type = get_word_spacing(parent, &length, &unit);
- }
-
- return set_word_spacing(result, type, length, unit);
+ return css__copy_word_spacing(
+ type == CSS_WORD_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/writing_mode.c b/src/select/properties/writing_mode.c
index 99ebd9e..05c0b26 100644
--- a/src/select/properties/writing_mode.c
+++ b/src/select/properties/writing_mode.c
@@ -55,16 +55,25 @@ css_error css__initial_writing_mode(css_select_state *state)
CSS_WRITING_MODE_HORIZONTAL_TB);
}
+css_error css__copy_writing_mode(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_writing_mode(to, get_writing_mode(from));
+}
+
css_error css__compose_writing_mode(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- uint8_t writing_mode = get_writing_mode(child);
-
- if (writing_mode == CSS_WRITING_MODE_INHERIT) {
- writing_mode = get_writing_mode(parent);
- }
+ uint8_t type = get_writing_mode(child);
- return set_writing_mode(result, writing_mode);
+ return css__copy_writing_mode(
+ type == CSS_WRITING_MODE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c
index 32a952d..e5159e5 100644
--- a/src/select/properties/z_index.c
+++ b/src/select/properties/z_index.c
@@ -53,6 +53,20 @@ css_error css__initial_z_index(css_select_state *state)
return set_z_index(state->computed, CSS_Z_INDEX_AUTO, 0);
}
+css_error css__copy_z_index(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t index = 0;
+ uint8_t type = get_z_index(from, &index);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_z_index(to, type, index);
+}
+
css_error css__compose_z_index(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -60,10 +74,8 @@ css_error css__compose_z_index(const css_computed_style *parent,
int32_t index = 0;
uint8_t type = get_z_index(child, &index);
- if (type == CSS_Z_INDEX_INHERIT) {
- type = get_z_index(parent, &index);
- }
-
- return set_z_index(result, type, index);
+ return css__copy_z_index(
+ type == CSS_Z_INDEX_INHERIT ? parent : child,
+ result);
}
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=010b9a79ece709d364db...
commit 010b9a79ece709d364dbf3930b72d2a7e0bac045
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Support CSS property-wide 'unset' value
diff --git a/src/select/select.c b/src/select/select.c
index 955dcce..7b5b71a 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1286,8 +1286,15 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE;
state.computed = state.results->styles[CSS_PSEUDO_ELEMENT_NONE];
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop =
- &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+ prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset or it's set to inherit
* and we're the root element, then set it to its initial
@@ -1313,7 +1320,15 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
continue;
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop = &state.props[i][j];
+ prop_state *prop = &state.props[i][j];
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset then set it
* to its initial value. */
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=51f108c9fa28758a0adb...
commit 51f108c9fa28758a0adbd91571e19f795c21ea2e
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Support CSS property-wide 'initial' value
diff --git a/src/select/select.c b/src/select/select.c
index 855a5cc..955dcce 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1292,7 +1292,8 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
/* If the property is still unset or it's set to inherit
* and we're the root element, then set it to its initial
* value. */
- if (prop->set == false ||
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false ||
(parent == NULL &&
prop->explicit_default == FLAG_VALUE_INHERIT)) {
error = set_initial(&state, i,
@@ -1316,7 +1317,8 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
/* If the property is still unset then set it
* to its initial value. */
- if (prop->set == false) {
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false) {
error = set_initial(&state, i, j, parent);
if (error != CSS_OK)
goto cleanup;
@@ -1566,7 +1568,8 @@ css_error set_initial(css_select_state *state,
* If the node is tree root and we're dealing with the base element,
* everything should be defaulted.
*/
- if (prop_dispatch[prop].inherited == false ||
+ if (state->props[prop][pseudo].explicit_default == FLAG_VALUE_INITIAL ||
+ prop_dispatch[prop].inherited == false ||
(pseudo == CSS_PSEUDO_ELEMENT_NONE && parent == NULL)) {
error = prop_dispatch[prop].initial(state);
if (error != CSS_OK)
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=166581e23cb6e1e6279f...
commit 166581e23cb6e1e6279f450635cd16a12f8b0ef2
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Select: Make inherit flag handling aware of other default values
diff --git a/src/select/properties/align_content.c b/src/select/properties/align_content.c
index f43cd8e..7d791b8 100644
--- a/src/select/properties/align_content.c
+++ b/src/select/properties/align_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_CONTENT_STRETCH:
value = CSS_ALIGN_CONTENT_STRETCH;
@@ -48,7 +48,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_content(state->computed, value);
}
diff --git a/src/select/properties/align_items.c b/src/select/properties/align_items.c
index ad69c81..007fd70 100644
--- a/src/select/properties/align_items.c
+++ b/src/select/properties/align_items.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_ITEMS_STRETCH:
value = CSS_ALIGN_ITEMS_STRETCH;
@@ -42,7 +42,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_items(state->computed, value);
}
diff --git a/src/select/properties/align_self.c b/src/select/properties/align_self.c
index e8e469e..b8ce46d 100644
--- a/src/select/properties/align_self.c
+++ b/src/select/properties/align_self.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_SELF_STRETCH:
value = CSS_ALIGN_SELF_STRETCH;
@@ -45,7 +45,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_self(state->computed, value);
}
diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c
index d52110f..1d3e1c2 100644
--- a/src/select/properties/azimuth.c
+++ b/src/select/properties/azimuth.c
@@ -18,7 +18,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & ~AZIMUTH_BEHIND) {
case AZIMUTH_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -47,7 +47,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed azimuth */
}
diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c
index 834c830..7e59557 100644
--- a/src/select/properties/background_attachment.c
+++ b/src/select/properties/background_attachment.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_ATTACHMENT_FIXED:
value = CSS_BACKGROUND_ATTACHMENT_FIXED;
@@ -33,7 +33,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_attachment(state->computed, value);
}
diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c
index d925b9c..1d959d0 100644
--- a/src/select/properties/background_position.c
+++ b/src/select/properties/background_position.c
@@ -23,7 +23,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BACKGROUND_POSITION_SET;
switch (getValue(opv) & 0xf0) {
@@ -73,7 +73,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_position(state->computed, value,
hlength, hunit, vlength, vunit);
}
diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c
index 3881573..cf1b8fc 100644
--- a/src/select/properties/background_repeat.c
+++ b/src/select/properties/background_repeat.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_REPEAT_NO_REPEAT:
value = CSS_BACKGROUND_REPEAT_NO_REPEAT;
@@ -39,7 +39,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_repeat(state->computed, value);
}
diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c
index 1363c7c..b923de6 100644
--- a/src/select/properties/border_collapse.c
+++ b/src/select/properties/border_collapse.c
@@ -21,7 +21,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_COLLAPSE_SEPARATE:
value = CSS_BORDER_COLLAPSE_SEPARATE;
@@ -33,7 +33,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_collapse(state->computed, value);
}
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c
index 0077aac..8eb01cb 100644
--- a/src/select/properties/border_spacing.c
+++ b/src/select/properties/border_spacing.c
@@ -23,7 +23,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BORDER_SPACING_SET;
hlength = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(hlength));
@@ -40,7 +40,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_spacing(state->computed, value,
hlength, hunit, vlength, vunit);
}
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c
index 2d19c95..5bfb43e 100644
--- a/src/select/properties/box_sizing.c
+++ b/src/select/properties/box_sizing.c
@@ -21,7 +21,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOX_SIZING_CONTENT_BOX:
value = CSS_BOX_SIZING_CONTENT_BOX;
@@ -33,7 +33,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_box_sizing(state->computed, value);
}
diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c
index fdc44c1..58ba25e 100644
--- a/src/select/properties/break_inside.c
+++ b/src/select/properties/break_inside.c
@@ -21,7 +21,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_INSIDE_AUTO:
value = CSS_BREAK_INSIDE_AUTO;
@@ -39,7 +39,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_break_inside(state->computed, value);
}
diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c
index ecccc1d..e1b7930 100644
--- a/src/select/properties/caption_side.c
+++ b/src/select/properties/caption_side.c
@@ -21,7 +21,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CAPTION_SIDE_TOP:
value = CSS_CAPTION_SIDE_TOP;
@@ -33,7 +33,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_caption_side(state->computed, value);
}
diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c
index bbb2673..a753218 100644
--- a/src/select/properties/clear.c
+++ b/src/select/properties/clear.c
@@ -21,7 +21,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CLEAR_NONE:
value = CSS_CLEAR_NONE;
@@ -39,7 +39,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clear(state->computed, value);
}
diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c
index 2785afb..c82c1af 100644
--- a/src/select/properties/clip.c
+++ b/src/select/properties/clip.c
@@ -22,7 +22,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
false, false, false, false };
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & CLIP_SHAPE_MASK) {
case CLIP_SHAPE_RECT:
if (getValue(opv) & CLIP_RECT_TOP_AUTO) {
@@ -71,7 +71,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
rect.lunit = css__to_css_unit(rect.lunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clip(state->computed, value, &rect);
}
diff --git a/src/select/properties/color.c b/src/select/properties/color.c
index 806f2cc..c455fb9 100644
--- a/src/select/properties/color.c
+++ b/src/select/properties/color.c
@@ -17,11 +17,11 @@
css_error css__cascade_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLOR_INHERIT;
css_color color = 0;
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLOR_TRANSPARENT:
value = CSS_COLOR_COLOR;
@@ -29,7 +29,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
case COLOR_CURRENT_COLOR:
/* color: currentColor always computes to inherit */
value = CSS_COLOR_INHERIT;
- inherit = true;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLOR_SET:
value = CSS_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_color(state->computed, value, color);
}
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index efd1243..3fdd43a 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -20,7 +20,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
uint16_t value = CSS_COLUMN_COUNT_INHERIT;
css_fixed count = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_COUNT_SET:
value = CSS_COLUMN_COUNT_SET;
@@ -34,7 +34,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_count(state->computed, value, count);
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index 31f19f0..c4c23c3 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
value = CSS_COLUMN_FILL_BALANCE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_fill(state->computed, value);
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index f54c2ab..047cef9 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -17,17 +17,18 @@
css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLUMN_RULE_COLOR_TRANSPARENT:
value = CSS_COLUMN_RULE_COLOR_COLOR;
break;
case COLUMN_RULE_COLOR_CURRENT_COLOR:
value = CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLUMN_RULE_COLOR_SET:
value = CSS_COLUMN_RULE_COLOR_COLOR;
@@ -38,7 +39,7 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_column_rule_color(state->computed, value, color);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index 2c870d3..d17b3ed 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_SPAN_NONE:
value = CSS_COLUMN_SPAN_NONE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_span(state->computed, value);
}
diff --git a/src/select/properties/content.c b/src/select/properties/content.c
index f75743d..df79fe1 100644
--- a/src/select/properties/content.c
+++ b/src/select/properties/content.c
@@ -21,7 +21,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
css_computed_content_item *content = NULL;
uint32_t n_contents = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
if (v == CONTENT_NORMAL) {
@@ -140,7 +140,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_content(state->computed, value, content);
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c
index c5e50c6..7b1e39b 100644
--- a/src/select/properties/cursor.c
+++ b/src/select/properties/cursor.c
@@ -21,7 +21,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
lwc_string **uris = NULL;
uint32_t n_uris = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v == CURSOR_URI) {
@@ -124,7 +124,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_cursor(state->computed, value, uris);
diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c
index f4a5c46..6baa58b 100644
--- a/src/select/properties/direction.c
+++ b/src/select/properties/direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DIRECTION_LTR:
value = CSS_DIRECTION_LTR;
@@ -33,7 +33,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_direction(state->computed, value);
}
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 510d24a..3e15d5f 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -21,7 +21,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DISPLAY_INLINE:
value = CSS_DISPLAY_INLINE;
@@ -81,7 +81,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_display(state->computed, value);
}
diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c
index ee7d036..2df207a 100644
--- a/src/select/properties/elevation.c
+++ b/src/select/properties/elevation.c
@@ -20,7 +20,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ELEVATION_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -42,7 +42,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed elevation */
}
diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c
index fecdbdc..cd46b3f 100644
--- a/src/select/properties/empty_cells.c
+++ b/src/select/properties/empty_cells.c
@@ -21,7 +21,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case EMPTY_CELLS_SHOW:
value = CSS_EMPTY_CELLS_SHOW;
@@ -33,7 +33,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_empty_cells(state->computed, value);
}
diff --git a/src/select/properties/flex_basis.c b/src/select/properties/flex_basis.c
index 1a92a6b..e5acb3c 100644
--- a/src/select/properties/flex_basis.c
+++ b/src/select/properties/flex_basis.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_BASIS_AUTO:
value = CSS_FLEX_BASIS_AUTO;
@@ -42,7 +42,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_basis(state->computed, value, length, unit);
}
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 79703be..7dc46db 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_DIRECTION_ROW:
value = CSS_FLEX_DIRECTION_ROW;
@@ -39,7 +39,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_direction(state->computed, value);
}
diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c
index 7f37cfe..fe4fa4d 100644
--- a/src/select/properties/flex_grow.c
+++ b/src/select/properties/flex_grow.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_GROW_INHERIT;
css_fixed flex_grow = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_GROW_SET;
flex_grow = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_grow(state->computed, value, flex_grow);
}
diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c
index d1acd2a..26aaa8f 100644
--- a/src/select/properties/flex_shrink.c
+++ b/src/select/properties/flex_shrink.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_SHRINK_INHERIT;
css_fixed flex_shrink = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_SHRINK_SET;
flex_shrink = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_shrink(state->computed, value, flex_shrink);
}
diff --git a/src/select/properties/flex_wrap.c b/src/select/properties/flex_wrap.c
index 688a9b6..55034d7 100644
--- a/src/select/properties/flex_wrap.c
+++ b/src/select/properties/flex_wrap.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_WRAP_NOWRAP:
value = CSS_FLEX_WRAP_NOWRAP;
@@ -36,7 +36,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_wrap(state->computed, value);
}
diff --git a/src/select/properties/float.c b/src/select/properties/float.c
index c3ba909..87732f6 100644
--- a/src/select/properties/float.c
+++ b/src/select/properties/float.c
@@ -21,7 +21,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLOAT_LEFT:
value = CSS_FLOAT_LEFT;
@@ -36,7 +36,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_float(state->computed, value);
}
diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c
index f853fcc..30e746c 100644
--- a/src/select/properties/font_family.c
+++ b/src/select/properties/font_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
lwc_string **fonts = NULL;
uint32_t n_fonts = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != FONT_FAMILY_END) {
@@ -134,7 +134,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_font_family(state->computed, value, fonts);
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index a0269be..a361ee0 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
css_fixed size = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_SIZE_DIMENSION:
value = CSS_FONT_SIZE_DIMENSION;
@@ -65,7 +65,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_size(state->computed, value, size, unit);
}
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c
index 0ba1fdd..6c240ec 100644
--- a/src/select/properties/font_style.c
+++ b/src/select/properties/font_style.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_STYLE_NORMAL:
value = CSS_FONT_STYLE_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_style(state->computed, value);
}
diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c
index a9b6e56..1666153 100644
--- a/src/select/properties/font_variant.c
+++ b/src/select/properties/font_variant.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_VARIANT_NORMAL:
value = CSS_FONT_VARIANT_NORMAL;
@@ -33,7 +33,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_variant(state->computed, value);
}
diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c
index c0c2f2b..d9dffc9 100644
--- a/src/select/properties/font_weight.c
+++ b/src/select/properties/font_weight.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_WEIGHT_NORMAL:
value = CSS_FONT_WEIGHT_NORMAL;
@@ -66,7 +66,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_weight(state->computed, value);
}
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c
index 40936dd..10ff228 100644
--- a/src/select/properties/helpers.c
+++ b/src/select/properties/helpers.c
@@ -33,7 +33,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
assert(CSS_BACKGROUND_COLOR_CURRENT_COLOR ==
(enum css_background_color_e)CSS_BORDER_COLOR_CURRENT_COLOR);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_COLOR_TRANSPARENT:
value = CSS_BACKGROUND_COLOR_COLOR;
@@ -50,7 +50,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, color);
}
@@ -65,7 +65,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT;
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_IMAGE_NONE:
value = CSS_BACKGROUND_IMAGE_NONE;
@@ -80,7 +80,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, uri);
}
@@ -95,7 +95,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_STYLE_NONE:
value = CSS_BORDER_STYLE_NONE;
@@ -131,7 +131,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -147,7 +147,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_WIDTH_SET:
value = CSS_BORDER_WIDTH_WIDTH;
@@ -171,7 +171,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -187,7 +187,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOTTOM_SET:
value = CSS_BOTTOM_SET;
@@ -205,7 +205,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -221,7 +221,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LETTER_SPACING_SET:
value = CSS_LETTER_SPACING_SET;
@@ -239,7 +239,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -255,7 +255,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case MAX_HEIGHT_SET:
value = CSS_MAX_HEIGHT_SET;
@@ -273,7 +273,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -289,7 +289,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_MIN_HEIGHT_SET;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -301,7 +301,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -317,7 +317,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo values */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = 0;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -325,7 +325,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length);
}
@@ -340,7 +340,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PAGE_BREAK_AFTER_AUTO:
value = CSS_PAGE_BREAK_AFTER_AUTO;
@@ -362,7 +362,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -377,7 +377,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_AFTER_AUTO:
value = CSS_BREAK_AFTER_AUTO;
@@ -411,7 +411,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -427,7 +427,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_computed_counter *counters = NULL;
uint32_t n_counters = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COUNTER_INCREMENT_NAMED:
{
@@ -490,7 +490,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = fun(state->computed, value, counters);
diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c
index 2e17ca5..03c8bb4 100644
--- a/src/select/properties/justify_content.c
+++ b/src/select/properties/justify_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case JUSTIFY_CONTENT_FLEX_START:
value = CSS_JUSTIFY_CONTENT_FLEX_START;
@@ -45,7 +45,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_justify_content(state->computed, value);
}
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index 091a575..b43ebdd 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -21,7 +21,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LINE_HEIGHT_NUMBER:
value = CSS_LINE_HEIGHT_NUMBER;
@@ -44,7 +44,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_line_height(state->computed, value, val, unit);
}
diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c
index 02d7651..0231c10 100644
--- a/src/select/properties/list_style_position.c
+++ b/src/select/properties/list_style_position.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_POSITION_INSIDE:
value = CSS_LIST_STYLE_POSITION_INSIDE;
@@ -33,7 +33,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_position(state->computed, value);
}
diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c
index e32d1b1..19cde9b 100644
--- a/src/select/properties/list_style_type.c
+++ b/src/select/properties/list_style_type.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_TYPE_DISC:
value = CSS_LIST_STYLE_TYPE_DISC;
@@ -183,7 +183,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_type(state->computed, value);
}
diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c
index aadab0b..c202d36 100644
--- a/src/select/properties/opacity.c
+++ b/src/select/properties/opacity.c
@@ -20,7 +20,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
uint16_t value = CSS_OPACITY_INHERIT;
css_fixed opacity = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_Z_INDEX_SET;
opacity = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_opacity(state->computed, value, opacity);
}
diff --git a/src/select/properties/order.c b/src/select/properties/order.c
index 0366537..7e447f1 100644
--- a/src/select/properties/order.c
+++ b/src/select/properties/order.c
@@ -20,7 +20,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
uint16_t value = CSS_ORDER_INHERIT;
css_fixed order = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_ORDER_SET;
order = FIXTOINT(*((css_fixed *) style->bytecode));
@@ -28,7 +28,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_order(state->computed, value, order);
}
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c
index 97846ac..707dd7b 100644
--- a/src/select/properties/outline_color.c
+++ b/src/select/properties/outline_color.c
@@ -20,7 +20,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
uint16_t value = CSS_OUTLINE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OUTLINE_COLOR_TRANSPARENT:
value = CSS_OUTLINE_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_outline_color(state->computed, value, color);
}
diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c
index 817d1d2..29ce7f7 100644
--- a/src/select/properties/overflow_x.c
+++ b/src/select/properties/overflow_x.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_x(state->computed, value);
}
diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c
index b54c4c8..398225b 100644
--- a/src/select/properties/overflow_y.c
+++ b/src/select/properties/overflow_y.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_y(state->computed, value);
}
diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c
index c5484d9..cdff1d6 100644
--- a/src/select/properties/pitch.c
+++ b/src/select/properties/pitch.c
@@ -20,7 +20,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
css_fixed freq = 0;
uint32_t unit = UNIT_HZ;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PITCH_FREQUENCY:
freq = *((css_fixed *) style->bytecode);
@@ -41,7 +41,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo pitch */
}
diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c
index 413d75a..d397b82 100644
--- a/src/select/properties/play_during.c
+++ b/src/select/properties/play_during.c
@@ -19,7 +19,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
{
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PLAY_DURING_URI:
css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri);
@@ -35,7 +35,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo play-during */
}
diff --git a/src/select/properties/position.c b/src/select/properties/position.c
index 9f9658f..c7cc6bf 100644
--- a/src/select/properties/position.c
+++ b/src/select/properties/position.c
@@ -21,7 +21,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case POSITION_STATIC:
value = CSS_POSITION_STATIC;
@@ -39,7 +39,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_position(state->computed, value);
}
diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c
index 4144d8e..9152f84 100644
--- a/src/select/properties/quotes.c
+++ b/src/select/properties/quotes.c
@@ -21,7 +21,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
lwc_string **quotes = NULL;
uint32_t n_quotes = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
value = CSS_QUOTES_STRING;
@@ -75,7 +75,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_quotes(state->computed, value, quotes);
diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c
index eb5528b..87e77d9 100644
--- a/src/select/properties/speak.c
+++ b/src/select/properties/speak.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NORMAL:
case SPEAK_NONE:
@@ -30,7 +30,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak */
}
diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c
index 0935528..9d74228 100644
--- a/src/select/properties/speak_header.c
+++ b/src/select/properties/speak_header.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_HEADER_ONCE:
case SPEAK_HEADER_ALWAYS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-header */
}
diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c
index fc54caf..ae94d2e 100644
--- a/src/select/properties/speak_numeral.c
+++ b/src/select/properties/speak_numeral.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NUMERAL_DIGITS:
case SPEAK_NUMERAL_CONTINUOUS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-numeral */
}
diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c
index 67cbdaf..e9f8575 100644
--- a/src/select/properties/speak_punctuation.c
+++ b/src/select/properties/speak_punctuation.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_punctuation(
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_PUNCTUATION_CODE:
case SPEAK_PUNCTUATION_NONE:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_punctuation(
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-punctuation */
}
diff --git a/src/select/properties/speech_rate.c b/src/select/properties/speech_rate.c
index 5cec19b..ac9d300 100644
--- a/src/select/properties/speech_rate.c
+++ b/src/select/properties/speech_rate.c
@@ -19,7 +19,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
{
css_fixed rate = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEECH_RATE_SET:
rate = *((css_fixed *) style->bytecode);
@@ -38,7 +38,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speech-rate */
}
diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c
index c911e10..013ae47 100644
--- a/src/select/properties/table_layout.c
+++ b/src/select/properties/table_layout.c
@@ -21,7 +21,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TABLE_LAYOUT_AUTO:
value = CSS_TABLE_LAYOUT_AUTO;
@@ -33,7 +33,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_table_layout(state->computed, value);
}
diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c
index 808107f..f2ba4e6 100644
--- a/src/select/properties/text_align.c
+++ b/src/select/properties/text_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_ALIGN_LEFT:
value = CSS_TEXT_ALIGN_LEFT;
@@ -48,7 +48,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_align(state->computed, value);
}
diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c
index 0e7544d..759009c 100644
--- a/src/select/properties/text_decoration.c
+++ b/src/select/properties/text_decoration.c
@@ -23,7 +23,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
if (getValue(opv) == TEXT_DECORATION_NONE) {
value = CSS_TEXT_DECORATION_NONE;
} else {
@@ -41,7 +41,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_decoration(state->computed, value);
}
diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c
index 38cb427..f3fac38 100644
--- a/src/select/properties/text_transform.c
+++ b/src/select/properties/text_transform.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_TRANSFORM_CAPITALIZE:
value = CSS_TEXT_TRANSFORM_CAPITALIZE;
@@ -39,7 +39,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_transform(state->computed, value);
}
diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c
index 5b91df1..0a4c0d1 100644
--- a/src/select/properties/unicode_bidi.c
+++ b/src/select/properties/unicode_bidi.c
@@ -21,7 +21,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case UNICODE_BIDI_NORMAL:
value = CSS_UNICODE_BIDI_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_unicode_bidi(state->computed, value);
}
diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c
index 9fb7143..18b8b55 100644
--- a/src/select/properties/vertical_align.c
+++ b/src/select/properties/vertical_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VERTICAL_ALIGN_SET:
value = CSS_VERTICAL_ALIGN_SET;
@@ -61,7 +61,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_vertical_align(state->computed, value, length, unit);
}
diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c
index ef95252..901700d 100644
--- a/src/select/properties/visibility.c
+++ b/src/select/properties/visibility.c
@@ -21,7 +21,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VISIBILITY_VISIBLE:
value = CSS_VISIBILITY_VISIBLE;
@@ -36,7 +36,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_visibility(state->computed, value);
}
diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c
index b370a2b..ff0324c 100644
--- a/src/select/properties/voice_family.c
+++ b/src/select/properties/voice_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
lwc_string **voices = NULL;
uint32_t n_voices = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != VOICE_FAMILY_END) {
@@ -92,7 +92,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo voice-family */
if (n_voices > 0)
free(voices);
diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c
index 96787fa..65bf979 100644
--- a/src/select/properties/volume.c
+++ b/src/select/properties/volume.c
@@ -20,7 +20,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PCT;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VOLUME_NUMBER:
val = *((css_fixed *) style->bytecode);
@@ -46,7 +46,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo volume */
}
diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c
index b8d2e02..1c22f9d 100644
--- a/src/select/properties/white_space.c
+++ b/src/select/properties/white_space.c
@@ -21,7 +21,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case WHITE_SPACE_NORMAL:
value = CSS_WHITE_SPACE_NORMAL;
@@ -42,7 +42,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_white_space(state->computed, value);
}
diff --git a/src/select/properties/writing_mode.c b/src/select/properties/writing_mode.c
index bbd3753..99ebd9e 100644
--- a/src/select/properties/writing_mode.c
+++ b/src/select/properties/writing_mode.c
@@ -17,11 +17,11 @@
css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t writing_mode = CSS_WRITING_MODE_INHERIT;
UNUSED(style);
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case WRITING_MODE_HORIZONTAL_TB:
writing_mode = CSS_WRITING_MODE_HORIZONTAL_TB;
@@ -36,7 +36,7 @@ css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_writing_mode(state->computed, writing_mode);
}
diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c
index 59cf242..32a952d 100644
--- a/src/select/properties/z_index.c
+++ b/src/select/properties/z_index.c
@@ -20,7 +20,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
uint16_t value = CSS_Z_INDEX_INHERIT;
css_fixed index = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case Z_INDEX_SET:
value = CSS_Z_INDEX_SET;
@@ -35,7 +35,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_z_index(state->computed, value, index);
}
diff --git a/src/select/select.c b/src/select/select.c
index 7d8195f..855a5cc 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1294,7 +1294,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
* value. */
if (prop->set == false ||
(parent == NULL &&
- prop->inherit == true)) {
+ prop->explicit_default == FLAG_VALUE_INHERIT)) {
error = set_initial(&state, i,
CSS_PSEUDO_ELEMENT_NONE, parent);
if (error != CSS_OK)
@@ -1548,7 +1548,8 @@ css_error set_hint(css_select_state *state, css_hint *hint)
existing->specificity = 0;
existing->origin = CSS_ORIGIN_AUTHOR;
existing->important = 0;
- existing->inherit = (hint->status == 0);
+ existing->explicit_default = (hint->status == 0) ?
+ FLAG_VALUE_INHERIT : FLAG_VALUE__NONE;
return CSS_OK;
}
@@ -2600,7 +2601,7 @@ css_error cascade_style(const css_style *style, css_select_state *state)
}
bool css__outranks_existing(uint16_t op, bool important, css_select_state *state,
- bool inherit)
+ enum flag_value explicit_default)
{
prop_state *existing = &state->props[op][state->current_pseudo];
bool outranks = false;
@@ -2695,7 +2696,7 @@ bool css__outranks_existing(uint16_t op, bool important, css_select_state *state
existing->specificity = state->current_specificity;
existing->origin = state->current_origin;
existing->important = important;
- existing->inherit = inherit;
+ existing->explicit_default = explicit_default;
}
return outranks;
diff --git a/src/select/select.h b/src/select/select.h
index 0a16b12..f449534 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -24,11 +24,11 @@ typedef struct reject_item {
} reject_item;
typedef struct prop_state {
- uint32_t specificity; /* Specificity of property in result */
- unsigned int set : 1, /* Whether property is set in result */
- origin : 2, /* Origin of property in result */
- important : 1, /* Importance of property in result */
- inherit : 1; /* Property is set to inherit */
+ uint32_t specificity; /* Specificity of property in result */
+ unsigned int set : 1, /* Whether property is set in result */
+ origin : 2, /* Origin of property in result */
+ important : 1; /* Importance of property in result */
+ enum flag_value explicit_default : 3; /* Property is set to inherit */
} prop_state;
@@ -98,7 +98,7 @@ static inline void advance_bytecode(css_style *style, uint32_t n_bytes)
}
bool css__outranks_existing(uint16_t op, bool important,
- css_select_state *state, bool inherit);
+ css_select_state *state, enum flag_value explicit_default);
#endif
diff --git a/test/dump.h b/test/dump.h
index acfd8b0..f585788 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -788,8 +788,14 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*((*ptr)++) = ' ';
*ptr += sprintf(*ptr, "%s: ", opcode_names[op]);
- if (isInherit(opv)) {
+ if (getFlagValue(opv) == FLAG_VALUE_INHERIT) {
*ptr += sprintf(*ptr, "inherit");
+ } else if (getFlagValue(opv) == FLAG_VALUE_INITIAL) {
+ *ptr += sprintf(*ptr, "initial");
+ } else if (getFlagValue(opv) == FLAG_VALUE_REVERT) {
+ *ptr += sprintf(*ptr, "revert");
+ } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
+ *ptr += sprintf(*ptr, "unset");
} else {
value = getValue(opv);
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=2504bb6f6414ae36c036...
commit 2504bb6f6414ae36c036a84d21f7821178dc58ee
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Nongenerated properties: Explicit defaults
diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c
index f54189b..c1ff9ae 100644
--- a/src/parse/properties/azimuth.c
+++ b/src/parse/properties/azimuth.c
@@ -53,11 +53,30 @@ css_error css__parse_azimuth(css_language *c,
}
if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT],
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(token->idata, c->strings[LEFTWARDS],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 01b995e..e11fcc9 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -45,31 +45,38 @@ css_error css__parse_background(css_language *c,
css_style * image_style;
css_style * position_style;
css_style * repeat_style;
-
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_ATTACHMENT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_REPEAT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c
index 6932c05..534950c 100644
--- a/src/parse/properties/background_position.c
+++ b/src/parse/properties/background_position.c
@@ -54,6 +54,24 @@ css_error css__parse_background_position(css_language *c,
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
} else {
int i;
diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c
index 28d30b7..41dbc2a 100644
--- a/src/parse/properties/border_color.c
+++ b/src/parse/properties/border_color.c
@@ -37,6 +37,7 @@ css_error css__parse_border_color(css_language *c,
uint16_t side_val[4];
uint32_t side_color[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_border_color(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_COLOR);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c
index 2322a5a..b931eda 100644
--- a/src/parse/properties/border_spacing.c
+++ b/src/parse/properties/border_spacing.c
@@ -36,7 +36,7 @@ css_error css__parse_border_spacing(css_language *c,
const css_token *token;
css_fixed length[2] = { 0 };
uint32_t unit[2] = { 0 };
- bool match;
+ enum flag_value flag_value;
/* length length? | IDENT(inherit) */
token = parserutils_vector_peek(vector, *ctx);
@@ -45,16 +45,13 @@ css_error css__parse_border_spacing(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
parserutils_vector_iterate(vector, ctx);
/* inherit */
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_BORDER_SPACING,
- FLAG_INHERIT,
- 0);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_SPACING);
} else {
int num_lengths = 0;
diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c
index a0d264d..7be1f8d 100644
--- a/src/parse/properties/border_style.c
+++ b/src/parse/properties/border_style.c
@@ -38,26 +38,33 @@ css_error css__parse_border_style(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_STYLE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c
index bc911c9..90bd4cc 100644
--- a/src/parse/properties/border_width.c
+++ b/src/parse/properties/border_width.c
@@ -40,26 +40,33 @@ css_error css__parse_border_width(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c
index 7862d4a..76fa364 100644
--- a/src/parse/properties/clip.c
+++ b/src/parse/properties/clip.c
@@ -37,6 +37,7 @@ css_error css__parse_clip(css_language *c,
int num_lengths = 0;
css_fixed length[4] = { 0 };
uint32_t unit[4] = { 0 };
+ enum flag_value flag_value;
bool match;
/* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3}
@@ -48,14 +49,12 @@ css_error css__parse_clip(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_CLIP,
- FLAG_INHERIT,
- 0);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result,
+ flag_value, CSS_PROP_CLIP);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c
index ba57565..146783c 100644
--- a/src/parse/properties/column_rule.c
+++ b/src/parse/properties/column_rule.c
@@ -41,26 +41,28 @@ css_error css__parse_column_rule(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_WIDTH);
-
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c
index b245740..edc7ee6 100644
--- a/src/parse/properties/columns.c
+++ b/src/parse/properties/columns.c
@@ -39,19 +39,22 @@ css_error css__parse_columns(css_language *c,
bool count = true;
css_style *width_style;
css_style *count_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_COUNT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c
index 10f221f..186abcc 100644
--- a/src/parse/properties/content.c
+++ b/src/parse/properties/content.c
@@ -35,6 +35,7 @@ css_error css__parse_content(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT(normal, none, inherit) | [ ... ]+ */
@@ -44,12 +45,11 @@ css_error css__parse_content(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CONTENT);
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CONTENT);
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NORMAL],
diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c
index eef10d1..98844bd 100644
--- a/src/parse/properties/cue.c
+++ b/src/parse/properties/cue.c
@@ -57,15 +57,23 @@ css_error css__parse_cue(css_language *c,
error = css__parse_cue_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another inherit which is bogus */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_cue_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c
index ad3ac47..ad2200c 100644
--- a/src/parse/properties/cursor.c
+++ b/src/parse/properties/cursor.c
@@ -33,6 +33,7 @@ css_error css__parse_cursor(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize,
@@ -48,11 +49,11 @@ css_error css__parse_cursor(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CURSOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CURSOR);
} else {
bool first = true;
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index fea35a3..7fe5bf2 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -55,6 +55,24 @@ css_error css__parse_elevation(css_language *c,
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[BELOW],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
index 9e284d9..d8f3848 100644
--- a/src/parse/properties/flex.c
+++ b/src/parse/properties/flex.c
@@ -44,29 +44,30 @@ css_error css__parse_flex(css_language *c,
css_style *basis_style;
bool short_auto = false;
bool short_none = false;
+ enum flag_value flag_value;
bool match;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_GROW);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_SHRINK);
-
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_BASIS);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
index e2d0e0c..2d9c60a 100644
--- a/src/parse/properties/flex_flow.c
+++ b/src/parse/properties/flex_flow.c
@@ -40,26 +40,28 @@ css_error css__parse_flex_flow(css_language *c,
bool wrap = true;
css_style *direction_style;
css_style *wrap_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_DIRECTION);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_WRAP);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
- }
+ }
/* allocate styles */
error = css__stylesheet_style_create(c->sheet, &direction_style);
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 5010242..7ce9701 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -243,6 +243,7 @@ css_error css__parse_font(css_language *c,
css_style *size_style;
css_style *line_height_style;
css_style *family_style;
+ enum flag_value flag_value;
int svw;
/* Firstly, handle inherit */
@@ -250,28 +251,36 @@ css_error css__parse_font(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_VARIANT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_WEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_SIZE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LINE_HEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_FAMILY);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c
index 23c080b..b309f45 100644
--- a/src/parse/properties/font_family.c
+++ b/src/parse/properties/font_family.c
@@ -127,7 +127,30 @@ css_error css__parse_font_family(css_language *c,
(lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_initial(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_revert(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_unset(result,
+ CSS_PROP_FONT_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c
index 8e57e5f..abe0b78 100644
--- a/src/parse/properties/font_weight.c
+++ b/src/parse/properties/font_weight.c
@@ -47,10 +47,29 @@ css_error css__parse_font_weight(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if (token->type == CSS_TOKEN_NUMBER) {
size_t consumed = 0;
css_fixed num = css__number_from_lwc_string(token->idata,
diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c
index b2c8de3..e6e8eae 100644
--- a/src/parse/properties/list_style.c
+++ b/src/parse/properties/list_style.c
@@ -41,23 +41,28 @@ css_error css__parse_list_style(css_language *c,
css_style *image_style;
css_style *position_style;
css_style *type_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_TYPE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c
index ccaa133..fe66bcb 100644
--- a/src/parse/properties/list_style_type.c
+++ b/src/parse/properties/list_style_type.c
@@ -49,10 +49,26 @@ css_error css__parse_list_style_type(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
ident->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_INITIAL;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_REVERT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_UNSET;
} else {
error = css__parse_list_style_type_value(c, ident, &value);
if (error != CSS_OK) {
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 7817d50..63adddc 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -40,26 +40,33 @@ css_error css__parse_margin(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
@@ -70,7 +77,9 @@ css_error css__parse_margin(css_language *c,
do {
prev_ctx = *ctx;
- if ((token != NULL) && is_css_inherit(c, token)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if ((token != NULL) && flag_value != FLAG_VALUE__NONE) {
*ctx = orig_ctx;
return CSS_INVALID;
}
diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c
index e8b7c3e..5d7b176 100644
--- a/src/parse/properties/opacity.c
+++ b/src/parse/properties/opacity.c
@@ -33,7 +33,7 @@ css_error css__parse_opacity(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
token = parserutils_vector_iterate(vector, ctx);
if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
@@ -41,8 +41,12 @@ css_error css__parse_opacity(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OPACITY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OPACITY);
+
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c
index 4d4fbf0..8ceac8a 100644
--- a/src/parse/properties/outline.c
+++ b/src/parse/properties/outline.c
@@ -41,23 +41,28 @@ css_error css__parse_outline(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c
index ca133ed..7bc1938 100644
--- a/src/parse/properties/overflow.c
+++ b/src/parse/properties/overflow.c
@@ -34,6 +34,7 @@ css_error css__parse_overflow(css_language *c,
int orig_ctx = *ctx;
css_error error1, error2 = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
token = parserutils_vector_iterate(vector, ctx);
@@ -42,12 +43,12 @@ css_error css__parse_overflow(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT], &match) == lwc_error_ok &&
- match)) {
- error1 = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error1 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_X);
- error2 = css_stylesheet_style_inherit(result,
+ error2 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_Y);
} else if ((lwc_string_caseless_isequal(token->idata,
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index 7f5b9f6..bef3607 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -37,6 +37,7 @@ css_error css__parse_padding(css_language *c,
css_fixed side_length[4];
uint32_t side_unit[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_padding(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c
index e45a8f4..b238d20 100644
--- a/src/parse/properties/pause.c
+++ b/src/parse/properties/pause.c
@@ -57,15 +57,23 @@ css_error css__parse_pause(css_language *c,
error = css__parse_pause_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another bogus inherit */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_pause_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c
index 109ae64..54e048f 100644
--- a/src/parse/properties/play_during.c
+++ b/src/parse/properties/play_during.c
@@ -54,14 +54,32 @@ css_error css__parse_play_during(css_language *c,
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[NONE],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_NONE;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_AUTO;
+
} else {
*ctx = orig_ctx;
return CSS_INVALID;
diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c
index 9d3c4c9..b71158f 100644
--- a/src/parse/properties/quotes.c
+++ b/src/parse/properties/quotes.c
@@ -34,6 +34,7 @@ css_error css__parse_quotes(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ STRING STRING ]+ | IDENT(none,inherit) */
@@ -45,11 +46,12 @@ css_error css__parse_quotes(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_QUOTES);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_QUOTES);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c
index a7bae24..1345b8e 100644
--- a/src/parse/properties/text_decoration.c
+++ b/src/parse/properties/text_decoration.c
@@ -34,6 +34,7 @@ css_error css__parse_text_decoration(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT([ underline || overline || line-through || blink ])
@@ -44,10 +45,14 @@ css_error css__parse_text_decoration(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
+
if (lwc_string_caseless_isequal(token->idata,
c->strings[INHERIT],
&match) == lwc_error_ok && match) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_TEXT_DECORATION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_TEXT_DECORATION);
+
} else if (lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
&match) == lwc_error_ok && match) {
diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c
index 193cb6b..f62ba15 100644
--- a/src/parse/properties/voice_family.c
+++ b/src/parse/properties/voice_family.c
@@ -90,7 +90,7 @@ css_error css__parse_voice_family(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
/* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit)
*
@@ -105,11 +105,12 @@ css_error css__parse_voice_family(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_VOICE_FAMILY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_VOICE_FAMILY);
+
} else {
*ctx = orig_ctx;
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=0997e85ec5f14bd0d695...
commit 0997e85ec5f14bd0d6959b9201fcd3845b224747
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Important: Handle new explicit defaulting values
diff --git a/src/parse/important.c b/src/parse/important.c
index e0e8620..1066d90 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -87,7 +87,7 @@ void css__make_style_important(css_style *style)
offset++;
/* Advance past any property-specific data */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (op) {
case CSS_PROP_AZIMUTH:
if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE)
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=508971b0eed673d4f3c7...
commit 508971b0eed673d4f3c7ac780d5423a3f1ecf7ed
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Explicit default support for generated properties
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index e729285..4fd8ba0 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -1,56 +1,56 @@
##Common templates
#
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:)
-#property:CSS_PROP_ENUM IDENT:INHERIT NUMBER:( false: RANGE: NUMBER:)
-#property:CSS_PROP_ENUM IDENT:INHERIT LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false: RANGE: NUMBER:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
#property:CSS_PROP_ENUM WRAP:
-background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
+background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
-border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
+border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
-cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
+cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
-cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
+cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
-direction:CSS_PROP_DIRECTION IDENT:( INHERIT: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
+direction:CSS_PROP_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
-display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
+display:CSS_PROP_DISPLAY IDENT:( INHERIT: INITIAL: REVERT: UNSET: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
-empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
+empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: REVERT: UNSET: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
-float:CSS_PROP_FLOAT IDENT:( INHERIT: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
+float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
-font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
+font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
-font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
+font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
-color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET
+color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLOR_SET
#generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +59,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side
#generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -67,7 +67,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side
margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side
#generic for {top, bottom, left, right}.c
-side:op GENERIC: IDENT:( INHERIT: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
top:CSS_PROP_TOP WRAP:css__parse_side
bottom:CSS_PROP_BOTTOM WRAP:css__parse_side
@@ -76,7 +76,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
#generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width
@@ -85,7 +85,7 @@ border_right_width:CSS_PROP_BORDER_RIGHT_WIDTH WRAP:css__parse_border_side_width
#generic for border_{top, bottom, left, right}_style.c
-border_side_style:op GENERIC: IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+border_side_style:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
border_top_style:CSS_PROP_BORDER_TOP_STYLE WRAP:css__parse_border_side_style
border_bottom_style:CSS_PROP_BORDER_BOTTOM_STYLE WRAP:css__parse_border_side_style
@@ -93,7 +93,7 @@ border_left_style:CSS_PROP_BORDER_LEFT_STYLE WRAP:css__parse_border_side_style
border_right_style:CSS_PROP_BORDER_RIGHT_STYLE WRAP:css__parse_border_side_style
#generic for border_{top, bottom, left, right}_color.c
-border_side_color:op GENERIC: IDENT:( INHERIT: IDENT:) COLOR:BORDER_COLOR_SET
+border_side_color:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BORDER_COLOR_SET
border_top_color:CSS_PROP_BORDER_TOP_COLOR WRAP:css__parse_border_side_color
border_bottom_color:CSS_PROP_BORDER_BOTTOM_COLOR WRAP:css__parse_border_side_color
@@ -101,139 +101,139 @@ border_left_color:CSS_PROP_BORDER_LEFT_COLOR WRAP:css__parse_border_side_color
border_right_color:CSS_PROP_BORDER_RIGHT_COLOR WRAP:css__parse_border_side_color
-counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
+counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
-counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
+counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
-background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
+background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
-background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: IDENT:) COLOR:BACKGROUND_COLOR_SET
+background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BACKGROUND_COLOR_SET
-caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
+caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
-clear:CSS_PROP_CLEAR IDENT:( INHERIT: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
+clear:CSS_PROP_CLEAR IDENT:( INHERIT: INITIAL: REVERT: UNSET: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
-background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
+background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
-list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
+list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
-list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
+list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
-orphans:CSS_PROP_ORPHANS IDENT:INHERIT NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
+orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
-outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
+outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
-outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
outline_width:CSS_PROP_OUTLINE_WIDTH WRAP:css__parse_border_side_width
-overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
+page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
-page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
+page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
-page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
+page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
-pitch_range:CSS_PROP_PITCH_RANGE IDENT:INHERIT NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
+pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
-position:CSS_PROP_POSITION IDENT:( INHERIT: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:)
+position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:)
-richness:CSS_PROP_RICHNESS IDENT:INHERIT NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
+richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
-speak:CSS_PROP_SPEAK IDENT:( INHERIT: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
+speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
-speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
+speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: INITIAL: REVERT: UNSET: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
-speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
+speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: INITIAL: REVERT: UNSET: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
-speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
+speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
-speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
+speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
-stress:CSS_PROP_STRESS IDENT:INHERIT NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
+stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
-table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
+table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
-text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
+text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
-text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
-text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
+text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
-unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
+unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
-visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
+visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
-white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
+white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
-widows:CSS_PROP_WIDOWS IDENT:INHERIT NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
+widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
-z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
+z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
-break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
+break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
-break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
+break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
-break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
+break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
-column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
+column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
-column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
+column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
-column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
+column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
-column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width
-column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
+column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
-writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
+writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
-box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
+box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: INITIAL: REVERT: UNSET: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
-align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
+align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
-align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
+align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
-align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
+align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
-flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
+flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
-flex_grow:CSS_PROP_FLEX_GROW IDENT:INHERIT NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
-flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
-flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
+flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
-justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
+justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
-order:CSS_PROP_ORDER IDENT:INHERIT NUMBER:( true:ORDER_SET NUMBER:)
+order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:)
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=1338ceef5c2ff3cccbf2...
commit 1338ceef5c2ff3cccbf288d39162a50b03491497
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Update code generator to support new values
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 24cc536..1e8b007 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -169,18 +169,38 @@ void output_ident(FILE *outputf, bool only_ident, struct keyval *parseid, struct
"if (");
if (!only_ident) {
fprintf(outputf,
- "(token->type == CSS_TOKEN_IDENT) && ");
+ "(token->type == CSS_TOKEN_IDENT) &&\n\t\t\t");
}
fprintf(outputf,
- "(lwc_string_caseless_isequal(token->idata, c->strings[%s], &match) == lwc_error_ok && match)) {\n",
+ "(lwc_string_caseless_isequal(\n"
+ "\t\t\ttoken->idata, c->strings[%s],\n"
+ "\t\t\t&match) == lwc_error_ok && match)) {\n",
ckv->key);
if (strcmp(ckv->key,"INHERIT") == 0) {
fprintf(outputf,
- "\t\t\terror = css_stylesheet_style_inherit(result, %s);\n",
+ "\t\terror = css_stylesheet_style_inherit(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"INITIAL") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_initial(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"REVERT") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_revert(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"UNSET") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_unset(result,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val);
} else {
fprintf(outputf,
- "\t\t\terror = css__stylesheet_style_appendOPV(result, %s, %s);\n",
+ "\t\terror = css__stylesheet_style_appendOPV(result,\n"
+ "\t\t\t\t%s,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val,
ckv->val);
}
@@ -466,10 +486,22 @@ void output_wrap(FILE *outputf, struct keyval *parseid, struct keyval_list *WRAP
}
char str_INHERIT[] = "INHERIT";
+char str_INITIAL[] = "INITIAL";
+char str_REVERT[] = "REVERT";
+char str_UNSET[] = "UNSET";
struct keyval ident_inherit = {
.key = str_INHERIT,
};
+struct keyval ident_initial = {
+ .key = str_INITIAL,
+};
+struct keyval ident_unset = {
+ .key = str_UNSET,
+};
+struct keyval ident_revert = {
+ .key = str_REVERT,
+};
int main(int argc, char **argv)
{
@@ -554,6 +586,12 @@ int main(int argc, char **argv)
curlist = &base;
} else if (strcmp(rkv->val, str_INHERIT) == 0) {
IDENT.item[IDENT.count++] = &ident_inherit;
+ } else if (strcmp(rkv->val, str_INITIAL) == 0) {
+ IDENT.item[IDENT.count++] = &ident_initial;
+ } else if (strcmp(rkv->val, str_REVERT) == 0) {
+ IDENT.item[IDENT.count++] = &ident_revert;
+ } else if (strcmp(rkv->val, str_UNSET) == 0) {
+ IDENT.item[IDENT.count++] = &ident_unset;
}
} else if (strcmp(rkv->key, "IDENT_LIST") == 0) {
if (rkv->val[0] == '(') {
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=2dfdb62e3af0bc3a6b74...
commit 2dfdb62e3af0bc3a6b74efeb8af1df6b87491e6f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Stylesheet: Helpers for all default property values
diff --git a/src/stylesheet.h b/src/stylesheet.h
index a71fca6..45d7b7e 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -230,7 +230,7 @@ static inline css_error css__stylesheet_style_appendOPV(css_style *style,
buildOPV(opcode, flags, value));
}
-/** Helper function to set inherit flag */
+/** Helper function to set inherit generic value */
static inline css_error css_stylesheet_style_inherit(css_style *style,
opcode_t opcode)
{
@@ -238,6 +238,38 @@ static inline css_error css_stylesheet_style_inherit(css_style *style,
buildOPV(opcode, FLAG_INHERIT, 0));
}
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_initial(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_INITIAL, 0));
+}
+
+/** Helper function to set inherit generic value */
+static inline css_error css_stylesheet_style_revert(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_REVERT, 0));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_unset(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_UNSET, 0));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_flag_value(css_style *style,
+ enum flag_value flag_value, opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, flag_value << 1, 0));
+}
+
css_error css__stylesheet_selector_create(css_stylesheet *sheet,
css_qname *qname, css_selector **selector);
css_error css__stylesheet_selector_destroy(css_stylesheet *sheet,
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=4ff73dab98b1659dbfd6...
commit 4ff73dab98b1659dbfd6f53281f337381e82dda4
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Utils: Helper to get any value from flags
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index e4c97c7..54a3fd1 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -19,6 +19,35 @@ static inline bool is_css_inherit(css_language *c, const css_token *token)
&match) == lwc_error_ok && match));
}
+static inline enum flag_value get_css_flag_value(
+ css_language *c,
+ const css_token *token)
+{
+ if (token->type == CSS_TOKEN_IDENT) {
+ bool match;
+
+ if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INHERIT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INITIAL;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_REVERT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_UNSET;
+ }
+ }
+
+ return FLAG_VALUE__NONE;
+}
+
enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOTTOM = 2, BORDER_SIDE_LEFT = 3 };
/**
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=1815b305ea226fa8a9cf...
commit 1815b305ea226fa8a9cf8582df259e0bde76bbdf
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Bytecode: Flag values for explicit defaulting
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7f5ea9d..ccfdcac 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -18,9 +18,20 @@ typedef uint32_t css_code_t;
typedef enum css_properties_e opcode_t;
+enum flag_value {
+ FLAG_VALUE__NONE = 0,
+ FLAG_VALUE_INHERIT = 1,
+ FLAG_VALUE_INITIAL = 2,
+ FLAG_VALUE_REVERT = 3,
+ FLAG_VALUE_UNSET = 4,
+};
+
enum flag {
- FLAG_IMPORTANT = (1<<0),
- FLAG_INHERIT = (1<<1)
+ FLAG_IMPORTANT = (1 << 0),
+ FLAG_INHERIT = (FLAG_VALUE_INHERIT << 1),
+ FLAG_INITIAL = (FLAG_VALUE_INITIAL << 1),
+ FLAG_REVERT = (FLAG_VALUE_REVERT << 1),
+ FLAG_UNSET = (FLAG_VALUE_UNSET << 1),
};
@@ -95,12 +106,22 @@ static inline uint16_t getValue(css_code_t OPV)
static inline bool isImportant(css_code_t OPV)
{
- return getFlags(OPV) & 0x1;
+ return getFlags(OPV) & FLAG_IMPORTANT;
+}
+
+static inline enum flag_value getFlagValue(css_code_t OPV)
+{
+ return (getFlags(OPV) >> 1) & 0x7;
+}
+
+static inline bool hasFlagValue(css_code_t OPV)
+{
+ return getFlagValue(OPV) != FLAG_VALUE__NONE;
}
static inline bool isInherit(css_code_t OPV)
{
- return getFlags(OPV) & 0x2;
+ return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
}
#endif
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=65f56b6d7aa73040a87e...
commit 65f56b6d7aa73040a87eab240628eecbab9e7504
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Docs: Bytecode: Add all CSS-wide property values
diff --git a/docs/Bytecode b/docs/Bytecode
index 4914e65..02ef8f0 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -12,8 +12,13 @@ Format
bits 0-9 : opcode
The 8 bits of flag data are defined as follows:
- bits 2-7: Must Be Zero (MBZ)
- bit 1 : value is inherit
+ bits 4-7: Must Be Zero (MBZ)
+ bits 1-3: Generic value
+ 000 => no generic value
+ 001 => inherit
+ 010 => initial
+ 011 => revert
+ 100 => unset
bit 0 : value is important
The 14 bits of value are opcode-specific.
@@ -353,10 +358,11 @@ Opcodes
0000101 => no-close-quote,
other => rffe.
- If the value is not "normal", "none", or "inherit", then there is
- a parameter list. Each item is preceded by a <value> word which
- declares the type of the next item. The list is terminated by a
- word with all bits set to zero (the encoding for "normal").
+ If the value is not "normal", "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter list.
+ Each item is preceded by a <value> word which declares the type of
+ the next item. The list is terminated by a word with all bits set
+ to zero (the encoding for "normal").
For example,
content: open-quote url('http://example.com/')
@@ -385,7 +391,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
@@ -401,7 +408,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=37712968049ba48e2212...
commit 37712968049ba48e2212d1c324727c6a68c381ca
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
Parse: Propstrings: Add unset and revert
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 7d723e1..dd579f1 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -233,6 +233,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("z-index"),
SMAP("inherit"),
+ SMAP("unset"),
SMAP("important"),
SMAP("none"),
SMAP("both"),
@@ -453,6 +454,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("src"),
SMAP("local"),
SMAP("initial"),
+ SMAP("revert"),
SMAP("format"),
SMAP("woff"),
SMAP("truetype"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index fd24a47..df3bcf1 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -71,7 +71,7 @@ enum {
LAST_PROP = Z_INDEX,
/* Other keywords */
- INHERIT, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
+ INHERIT, UNSET, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
NO_REPEAT, REPEAT_X, REPEAT_Y, REPEAT, HIDDEN, DOTTED, DASHED,
SOLID, LIBCSS_DOUBLE, GROOVE, RIDGE, INSET, OUTSET, THIN, MEDIUM, THICK,
COLLAPSE, SEPARATE, AUTO, LTR, RTL, INLINE, BLOCK, LIST_ITEM, RUN_IN,
@@ -103,7 +103,7 @@ enum {
W_RESIZE, LIBCSS_TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE,
FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE,
LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER,
- LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL,
+ LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, REVERT,
FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN,
AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL,
VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START,
-----------------------------------------------------------------------
Summary of changes:
docs/Bytecode | 24 +-
src/bytecode/bytecode.h | 29 +-
src/parse/important.c | 2 +-
src/parse/properties/azimuth.c | 21 +-
src/parse/properties/background.c | 21 +-
src/parse/properties/background_position.c | 18 +
src/parse/properties/border_color.c | 17 +-
src/parse/properties/border_spacing.c | 15 +-
src/parse/properties/border_style.c | 17 +-
src/parse/properties/border_width.c | 17 +-
src/parse/properties/clip.c | 15 +-
src/parse/properties/column_rule.c | 12 +-
src/parse/properties/columns.c | 9 +-
src/parse/properties/content.c | 10 +-
src/parse/properties/css_property_parser_gen.c | 46 +-
src/parse/properties/cue.c | 16 +-
src/parse/properties/cursor.c | 11 +-
src/parse/properties/elevation.c | 18 +
src/parse/properties/flex.c | 21 +-
src/parse/properties/flex_flow.c | 18 +-
src/parse/properties/font.c | 23 +-
src/parse/properties/font_family.c | 25 +-
src/parse/properties/font_weight.c | 21 +-
src/parse/properties/list_style.c | 15 +-
src/parse/properties/list_style_type.c | 18 +-
src/parse/properties/margin.c | 21 +-
src/parse/properties/opacity.c | 10 +-
src/parse/properties/outline.c | 15 +-
src/parse/properties/overflow.c | 11 +-
src/parse/properties/padding.c | 17 +-
src/parse/properties/pause.c | 16 +-
src/parse/properties/play_during.c | 18 +
src/parse/properties/properties.gen | 186 +--
src/parse/properties/quotes.c | 12 +-
src/parse/properties/text_decoration.c | 7 +-
src/parse/properties/utils.h | 29 +
src/parse/properties/voice_family.c | 13 +-
src/parse/propstrings.c | 2 +
src/parse/propstrings.h | 4 +-
src/select/computed.c | 31 +
src/select/computed.h | 4 +
src/select/dispatch.c | 1 +
src/select/dispatch.h | 2 +
src/select/properties/align_content.c | 23 +-
src/select/properties/align_items.c | 23 +-
src/select/properties/align_self.c | 23 +-
src/select/properties/azimuth.c | 14 +-
src/select/properties/background_attachment.c | 23 +-
src/select/properties/background_color.c | 22 +-
src/select/properties/background_image.c | 22 +-
src/select/properties/background_position.c | 30 +-
src/select/properties/background_repeat.c | 23 +-
src/select/properties/border_bottom_color.c | 22 +-
src/select/properties/border_bottom_style.c | 19 +-
src/select/properties/border_bottom_width.c | 31 +-
src/select/properties/border_collapse.c | 23 +-
src/select/properties/border_left_color.c | 22 +-
src/select/properties/border_left_style.c | 19 +-
src/select/properties/border_left_width.c | 23 +-
src/select/properties/border_right_color.c | 22 +-
src/select/properties/border_right_style.c | 19 +-
src/select/properties/border_right_width.c | 23 +-
src/select/properties/border_spacing.c | 29 +-
src/select/properties/border_top_color.c | 22 +-
src/select/properties/border_top_style.c | 19 +-
src/select/properties/border_top_width.c | 23 +-
src/select/properties/bottom.c | 23 +-
src/select/properties/box_sizing.c | 26 +-
src/select/properties/break_after.c | 19 +-
src/select/properties/break_before.c | 19 +-
src/select/properties/break_inside.c | 23 +-
src/select/properties/caption_side.c | 23 +-
src/select/properties/clear.c | 23 +-
src/select/properties/clip.c | 28 +-
src/select/properties/color.c | 30 +-
src/select/properties/column_count.c | 26 +-
src/select/properties/column_fill.c | 23 +-
src/select/properties/column_gap.c | 23 +-
src/select/properties/column_rule_color.c | 29 +-
src/select/properties/column_rule_style.c | 19 +-
src/select/properties/column_rule_width.c | 23 +-
src/select/properties/column_span.c | 23 +-
src/select/properties/column_width.c | 27 +-
src/select/properties/content.c | 51 +-
src/select/properties/counter_increment.c | 48 +-
src/select/properties/counter_reset.c | 48 +-
src/select/properties/cue_after.c | 10 +
src/select/properties/cue_before.c | 10 +
src/select/properties/cursor.c | 52 +-
src/select/properties/direction.c | 23 +-
src/select/properties/display.c | 23 +-
src/select/properties/elevation.c | 14 +-
src/select/properties/empty_cells.c | 23 +-
src/select/properties/flex_basis.c | 27 +-
src/select/properties/flex_direction.c | 23 +-
src/select/properties/flex_grow.c | 26 +-
src/select/properties/flex_shrink.c | 26 +-
src/select/properties/flex_wrap.c | 25 +-
src/select/properties/float.c | 23 +-
src/select/properties/font_family.c | 61 +-
src/select/properties/font_size.c | 27 +-
src/select/properties/font_style.c | 23 +-
src/select/properties/font_variant.c | 23 +-
src/select/properties/font_weight.c | 23 +-
src/select/properties/height.c | 23 +-
src/select/properties/helpers.c | 48 +-
src/select/properties/helpers.h | 133 +++
src/select/properties/justify_content.c | 23 +-
src/select/properties/left.c | 23 +-
src/select/properties/letter_spacing.c | 23 +-
src/select/properties/line_height.c | 27 +-
src/select/properties/list_style_image.c | 22 +-
src/select/properties/list_style_position.c | 23 +-
src/select/properties/list_style_type.c | 23 +-
src/select/properties/margin_bottom.c | 23 +-
src/select/properties/margin_left.c | 23 +-
src/select/properties/margin_right.c | 23 +-
src/select/properties/margin_top.c | 23 +-
src/select/properties/max_height.c | 23 +-
src/select/properties/max_width.c | 23 +-
src/select/properties/min_height.c | 23 +-
src/select/properties/min_width.c | 23 +-
src/select/properties/opacity.c | 26 +-
src/select/properties/order.c | 26 +-
src/select/properties/orphans.c | 22 +-
src/select/properties/outline_color.c | 26 +-
src/select/properties/outline_style.c | 19 +-
src/select/properties/outline_width.c | 23 +-
src/select/properties/overflow_x.c | 23 +-
src/select/properties/overflow_y.c | 23 +-
src/select/properties/padding_bottom.c | 23 +-
src/select/properties/padding_left.c | 23 +-
src/select/properties/padding_right.c | 23 +-
src/select/properties/padding_top.c | 23 +-
src/select/properties/page_break_after.c | 19 +-
src/select/properties/page_break_before.c | 19 +-
src/select/properties/page_break_inside.c | 19 +-
src/select/properties/pause_after.c | 10 +
src/select/properties/pause_before.c | 10 +
src/select/properties/pitch.c | 14 +-
src/select/properties/pitch_range.c | 10 +
src/select/properties/play_during.c | 14 +-
src/select/properties/position.c | 23 +-
src/select/properties/properties.h | 1 +
src/select/properties/quotes.c | 60 +-
src/select/properties/richness.c | 10 +
src/select/properties/right.c | 23 +-
src/select/properties/speak.c | 14 +-
src/select/properties/speak_header.c | 14 +-
src/select/properties/speak_numeral.c | 14 +-
src/select/properties/speak_punctuation.c | 14 +-
src/select/properties/speech_rate.c | 14 +-
src/select/properties/stress.c | 10 +
src/select/properties/table_layout.c | 23 +-
src/select/properties/text_align.c | 28 +-
src/select/properties/text_decoration.c | 23 +-
src/select/properties/text_indent.c | 23 +-
src/select/properties/text_transform.c | 23 +-
src/select/properties/top.c | 23 +-
src/select/properties/unicode_bidi.c | 23 +-
src/select/properties/vertical_align.c | 27 +-
src/select/properties/visibility.c | 23 +-
src/select/properties/voice_family.c | 14 +-
src/select/properties/volume.c | 14 +-
src/select/properties/white_space.c | 23 +-
src/select/properties/widows.c | 22 +-
src/select/properties/width.c | 23 +-
src/select/properties/word_spacing.c | 23 +-
src/select/properties/writing_mode.c | 27 +-
src/select/properties/z_index.c | 26 +-
src/select/select.c | 165 ++-
src/select/select.h | 20 +-
src/stylesheet.h | 40 +-
test/data/select/INDEX | 1 +
test/data/select/defaulting.dat | 1452 ++++++++++++++++++++++++
test/dump.h | 8 +-
176 files changed, 4522 insertions(+), 1089 deletions(-)
create mode 100644 test/data/select/defaulting.dat
diff --git a/docs/Bytecode b/docs/Bytecode
index 4914e65..02ef8f0 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -12,8 +12,13 @@ Format
bits 0-9 : opcode
The 8 bits of flag data are defined as follows:
- bits 2-7: Must Be Zero (MBZ)
- bit 1 : value is inherit
+ bits 4-7: Must Be Zero (MBZ)
+ bits 1-3: Generic value
+ 000 => no generic value
+ 001 => inherit
+ 010 => initial
+ 011 => revert
+ 100 => unset
bit 0 : value is important
The 14 bits of value are opcode-specific.
@@ -353,10 +358,11 @@ Opcodes
0000101 => no-close-quote,
other => rffe.
- If the value is not "normal", "none", or "inherit", then there is
- a parameter list. Each item is preceded by a <value> word which
- declares the type of the next item. The list is terminated by a
- word with all bits set to zero (the encoding for "normal").
+ If the value is not "normal", "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter list.
+ Each item is preceded by a <value> word which declares the type of
+ the next item. The list is terminated by a word with all bits set
+ to zero (the encoding for "normal").
For example,
content: open-quote url('http://example.com/')
@@ -385,7 +391,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
@@ -401,7 +408,8 @@ Opcodes
bits 0-6: 0000000 => none,
other => rffe.
- If the value is not "none", or "inherit", then there is a parameter
+ If the value is not "none", or a generic value ("inherit",
+ "initial", "unset", or "revert"), then there is a parameter
list. Each item is preceded by a <value> word which declares the type
of the next item. The list is terminated by a word with all bits set to
zero (the encoding for "none").
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7f5ea9d..ccfdcac 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -18,9 +18,20 @@ typedef uint32_t css_code_t;
typedef enum css_properties_e opcode_t;
+enum flag_value {
+ FLAG_VALUE__NONE = 0,
+ FLAG_VALUE_INHERIT = 1,
+ FLAG_VALUE_INITIAL = 2,
+ FLAG_VALUE_REVERT = 3,
+ FLAG_VALUE_UNSET = 4,
+};
+
enum flag {
- FLAG_IMPORTANT = (1<<0),
- FLAG_INHERIT = (1<<1)
+ FLAG_IMPORTANT = (1 << 0),
+ FLAG_INHERIT = (FLAG_VALUE_INHERIT << 1),
+ FLAG_INITIAL = (FLAG_VALUE_INITIAL << 1),
+ FLAG_REVERT = (FLAG_VALUE_REVERT << 1),
+ FLAG_UNSET = (FLAG_VALUE_UNSET << 1),
};
@@ -95,12 +106,22 @@ static inline uint16_t getValue(css_code_t OPV)
static inline bool isImportant(css_code_t OPV)
{
- return getFlags(OPV) & 0x1;
+ return getFlags(OPV) & FLAG_IMPORTANT;
+}
+
+static inline enum flag_value getFlagValue(css_code_t OPV)
+{
+ return (getFlags(OPV) >> 1) & 0x7;
+}
+
+static inline bool hasFlagValue(css_code_t OPV)
+{
+ return getFlagValue(OPV) != FLAG_VALUE__NONE;
}
static inline bool isInherit(css_code_t OPV)
{
- return getFlags(OPV) & 0x2;
+ return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
}
#endif
diff --git a/src/parse/important.c b/src/parse/important.c
index e0e8620..1066d90 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -87,7 +87,7 @@ void css__make_style_important(css_style *style)
offset++;
/* Advance past any property-specific data */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (op) {
case CSS_PROP_AZIMUTH:
if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE)
diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c
index f54189b..c1ff9ae 100644
--- a/src/parse/properties/azimuth.c
+++ b/src/parse/properties/azimuth.c
@@ -53,11 +53,30 @@ css_error css__parse_azimuth(css_language *c,
}
if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT],
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(token->idata, c->strings[LEFTWARDS],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 01b995e..e11fcc9 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -45,31 +45,38 @@ css_error css__parse_background(css_language *c,
css_style * image_style;
css_style * position_style;
css_style * repeat_style;
-
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_ATTACHMENT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_REPEAT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c
index 6932c05..534950c 100644
--- a/src/parse/properties/background_position.c
+++ b/src/parse/properties/background_position.c
@@ -54,6 +54,24 @@ css_error css__parse_background_position(css_language *c,
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
} else {
int i;
diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c
index 28d30b7..41dbc2a 100644
--- a/src/parse/properties/border_color.c
+++ b/src/parse/properties/border_color.c
@@ -37,6 +37,7 @@ css_error css__parse_border_color(css_language *c,
uint16_t side_val[4];
uint32_t side_color[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_border_color(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_COLOR);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c
index 2322a5a..b931eda 100644
--- a/src/parse/properties/border_spacing.c
+++ b/src/parse/properties/border_spacing.c
@@ -36,7 +36,7 @@ css_error css__parse_border_spacing(css_language *c,
const css_token *token;
css_fixed length[2] = { 0 };
uint32_t unit[2] = { 0 };
- bool match;
+ enum flag_value flag_value;
/* length length? | IDENT(inherit) */
token = parserutils_vector_peek(vector, *ctx);
@@ -45,16 +45,13 @@ css_error css__parse_border_spacing(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
parserutils_vector_iterate(vector, ctx);
/* inherit */
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_BORDER_SPACING,
- FLAG_INHERIT,
- 0);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_SPACING);
} else {
int num_lengths = 0;
diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c
index a0d264d..7be1f8d 100644
--- a/src/parse/properties/border_style.c
+++ b/src/parse/properties/border_style.c
@@ -38,26 +38,33 @@ css_error css__parse_border_style(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_STYLE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c
index bc911c9..90bd4cc 100644
--- a/src/parse/properties/border_width.c
+++ b/src/parse/properties/border_width.c
@@ -40,26 +40,33 @@ css_error css__parse_border_width(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c
index 7862d4a..76fa364 100644
--- a/src/parse/properties/clip.c
+++ b/src/parse/properties/clip.c
@@ -37,6 +37,7 @@ css_error css__parse_clip(css_language *c,
int num_lengths = 0;
css_fixed length[4] = { 0 };
uint32_t unit[4] = { 0 };
+ enum flag_value flag_value;
bool match;
/* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3}
@@ -48,14 +49,12 @@ css_error css__parse_clip(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_CLIP,
- FLAG_INHERIT,
- 0);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result,
+ flag_value, CSS_PROP_CLIP);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c
index ba57565..146783c 100644
--- a/src/parse/properties/column_rule.c
+++ b/src/parse/properties/column_rule.c
@@ -41,26 +41,28 @@ css_error css__parse_column_rule(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_WIDTH);
-
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c
index b245740..edc7ee6 100644
--- a/src/parse/properties/columns.c
+++ b/src/parse/properties/columns.c
@@ -39,19 +39,22 @@ css_error css__parse_columns(css_language *c,
bool count = true;
css_style *width_style;
css_style *count_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_COUNT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c
index 10f221f..186abcc 100644
--- a/src/parse/properties/content.c
+++ b/src/parse/properties/content.c
@@ -35,6 +35,7 @@ css_error css__parse_content(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT(normal, none, inherit) | [ ... ]+ */
@@ -44,12 +45,11 @@ css_error css__parse_content(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CONTENT);
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CONTENT);
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NORMAL],
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 24cc536..1e8b007 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -169,18 +169,38 @@ void output_ident(FILE *outputf, bool only_ident, struct keyval *parseid, struct
"if (");
if (!only_ident) {
fprintf(outputf,
- "(token->type == CSS_TOKEN_IDENT) && ");
+ "(token->type == CSS_TOKEN_IDENT) &&\n\t\t\t");
}
fprintf(outputf,
- "(lwc_string_caseless_isequal(token->idata, c->strings[%s], &match) == lwc_error_ok && match)) {\n",
+ "(lwc_string_caseless_isequal(\n"
+ "\t\t\ttoken->idata, c->strings[%s],\n"
+ "\t\t\t&match) == lwc_error_ok && match)) {\n",
ckv->key);
if (strcmp(ckv->key,"INHERIT") == 0) {
fprintf(outputf,
- "\t\t\terror = css_stylesheet_style_inherit(result, %s);\n",
+ "\t\terror = css_stylesheet_style_inherit(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"INITIAL") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_initial(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"REVERT") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_revert(result,\n"
+ "\t\t\t\t%s);\n\n",
+ parseid->val);
+ } else if (strcmp(ckv->key,"UNSET") == 0) {
+ fprintf(outputf,
+ "\t\terror = css_stylesheet_style_unset(result,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val);
} else {
fprintf(outputf,
- "\t\t\terror = css__stylesheet_style_appendOPV(result, %s, %s);\n",
+ "\t\terror = css__stylesheet_style_appendOPV(result,\n"
+ "\t\t\t\t%s,\n"
+ "\t\t\t\t%s);\n\n",
parseid->val,
ckv->val);
}
@@ -466,10 +486,22 @@ void output_wrap(FILE *outputf, struct keyval *parseid, struct keyval_list *WRAP
}
char str_INHERIT[] = "INHERIT";
+char str_INITIAL[] = "INITIAL";
+char str_REVERT[] = "REVERT";
+char str_UNSET[] = "UNSET";
struct keyval ident_inherit = {
.key = str_INHERIT,
};
+struct keyval ident_initial = {
+ .key = str_INITIAL,
+};
+struct keyval ident_unset = {
+ .key = str_UNSET,
+};
+struct keyval ident_revert = {
+ .key = str_REVERT,
+};
int main(int argc, char **argv)
{
@@ -554,6 +586,12 @@ int main(int argc, char **argv)
curlist = &base;
} else if (strcmp(rkv->val, str_INHERIT) == 0) {
IDENT.item[IDENT.count++] = &ident_inherit;
+ } else if (strcmp(rkv->val, str_INITIAL) == 0) {
+ IDENT.item[IDENT.count++] = &ident_initial;
+ } else if (strcmp(rkv->val, str_REVERT) == 0) {
+ IDENT.item[IDENT.count++] = &ident_revert;
+ } else if (strcmp(rkv->val, str_UNSET) == 0) {
+ IDENT.item[IDENT.count++] = &ident_unset;
}
} else if (strcmp(rkv->key, "IDENT_LIST") == 0) {
if (rkv->val[0] == '(') {
diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c
index eef10d1..98844bd 100644
--- a/src/parse/properties/cue.c
+++ b/src/parse/properties/cue.c
@@ -57,15 +57,23 @@ css_error css__parse_cue(css_language *c,
error = css__parse_cue_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another inherit which is bogus */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_cue_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c
index ad3ac47..ad2200c 100644
--- a/src/parse/properties/cursor.c
+++ b/src/parse/properties/cursor.c
@@ -33,6 +33,7 @@ css_error css__parse_cursor(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize,
@@ -48,11 +49,11 @@ css_error css__parse_cursor(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CURSOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CURSOR);
} else {
bool first = true;
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index fea35a3..7fe5bf2 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -55,6 +55,24 @@ css_error css__parse_elevation(css_language *c,
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[BELOW],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
index 9e284d9..d8f3848 100644
--- a/src/parse/properties/flex.c
+++ b/src/parse/properties/flex.c
@@ -44,29 +44,30 @@ css_error css__parse_flex(css_language *c,
css_style *basis_style;
bool short_auto = false;
bool short_none = false;
+ enum flag_value flag_value;
bool match;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_GROW);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_SHRINK);
-
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_BASIS);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
index e2d0e0c..2d9c60a 100644
--- a/src/parse/properties/flex_flow.c
+++ b/src/parse/properties/flex_flow.c
@@ -40,26 +40,28 @@ css_error css__parse_flex_flow(css_language *c,
bool wrap = true;
css_style *direction_style;
css_style *wrap_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_DIRECTION);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_WRAP);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
- }
+ }
/* allocate styles */
error = css__stylesheet_style_create(c->sheet, &direction_style);
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 5010242..7ce9701 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -243,6 +243,7 @@ css_error css__parse_font(css_language *c,
css_style *size_style;
css_style *line_height_style;
css_style *family_style;
+ enum flag_value flag_value;
int svw;
/* Firstly, handle inherit */
@@ -250,28 +251,36 @@ css_error css__parse_font(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_VARIANT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_WEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_SIZE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LINE_HEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_FAMILY);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c
index 23c080b..b309f45 100644
--- a/src/parse/properties/font_family.c
+++ b/src/parse/properties/font_family.c
@@ -127,7 +127,30 @@ css_error css__parse_font_family(css_language *c,
(lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_initial(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_revert(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_unset(result,
+ CSS_PROP_FONT_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c
index 8e57e5f..abe0b78 100644
--- a/src/parse/properties/font_weight.c
+++ b/src/parse/properties/font_weight.c
@@ -47,10 +47,29 @@ css_error css__parse_font_weight(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if (token->type == CSS_TOKEN_NUMBER) {
size_t consumed = 0;
css_fixed num = css__number_from_lwc_string(token->idata,
diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c
index b2c8de3..e6e8eae 100644
--- a/src/parse/properties/list_style.c
+++ b/src/parse/properties/list_style.c
@@ -41,23 +41,28 @@ css_error css__parse_list_style(css_language *c,
css_style *image_style;
css_style *position_style;
css_style *type_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_TYPE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c
index ccaa133..fe66bcb 100644
--- a/src/parse/properties/list_style_type.c
+++ b/src/parse/properties/list_style_type.c
@@ -49,10 +49,26 @@ css_error css__parse_list_style_type(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
ident->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_INITIAL;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_REVERT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_UNSET;
} else {
error = css__parse_list_style_type_value(c, ident, &value);
if (error != CSS_OK) {
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 7817d50..63adddc 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -40,26 +40,33 @@ css_error css__parse_margin(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
@@ -70,7 +77,9 @@ css_error css__parse_margin(css_language *c,
do {
prev_ctx = *ctx;
- if ((token != NULL) && is_css_inherit(c, token)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if ((token != NULL) && flag_value != FLAG_VALUE__NONE) {
*ctx = orig_ctx;
return CSS_INVALID;
}
diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c
index e8b7c3e..5d7b176 100644
--- a/src/parse/properties/opacity.c
+++ b/src/parse/properties/opacity.c
@@ -33,7 +33,7 @@ css_error css__parse_opacity(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
token = parserutils_vector_iterate(vector, ctx);
if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
@@ -41,8 +41,12 @@ css_error css__parse_opacity(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OPACITY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OPACITY);
+
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c
index 4d4fbf0..8ceac8a 100644
--- a/src/parse/properties/outline.c
+++ b/src/parse/properties/outline.c
@@ -41,23 +41,28 @@ css_error css__parse_outline(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c
index ca133ed..7bc1938 100644
--- a/src/parse/properties/overflow.c
+++ b/src/parse/properties/overflow.c
@@ -34,6 +34,7 @@ css_error css__parse_overflow(css_language *c,
int orig_ctx = *ctx;
css_error error1, error2 = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
token = parserutils_vector_iterate(vector, ctx);
@@ -42,12 +43,12 @@ css_error css__parse_overflow(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT], &match) == lwc_error_ok &&
- match)) {
- error1 = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error1 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_X);
- error2 = css_stylesheet_style_inherit(result,
+ error2 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_Y);
} else if ((lwc_string_caseless_isequal(token->idata,
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index 7f5b9f6..bef3607 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -37,6 +37,7 @@ css_error css__parse_padding(css_language *c,
css_fixed side_length[4];
uint32_t side_unit[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_padding(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c
index e45a8f4..b238d20 100644
--- a/src/parse/properties/pause.c
+++ b/src/parse/properties/pause.c
@@ -57,15 +57,23 @@ css_error css__parse_pause(css_language *c,
error = css__parse_pause_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another bogus inherit */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_pause_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c
index 109ae64..54e048f 100644
--- a/src/parse/properties/play_during.c
+++ b/src/parse/properties/play_during.c
@@ -54,14 +54,32 @@ css_error css__parse_play_during(css_language *c,
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[NONE],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_NONE;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_AUTO;
+
} else {
*ctx = orig_ctx;
return CSS_INVALID;
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index e729285..4fd8ba0 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -1,56 +1,56 @@
##Common templates
#
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:)
-#property:CSS_PROP_ENUM IDENT:INHERIT NUMBER:( false: RANGE: NUMBER:)
-#property:CSS_PROP_ENUM IDENT:INHERIT LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
-#property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false: RANGE: NUMBER:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
+#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
#property:CSS_PROP_ENUM WRAP:
-background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
+background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
-border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
+border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
-cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
+cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI
-cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
+cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI
-direction:CSS_PROP_DIRECTION IDENT:( INHERIT: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
+direction:CSS_PROP_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
-display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
+display:CSS_PROP_DISPLAY IDENT:( INHERIT: INITIAL: REVERT: UNSET: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
-empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
+empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: REVERT: UNSET: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
-float:CSS_PROP_FLOAT IDENT:( INHERIT: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
+float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
-font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
+font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
-font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
+font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
-color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET
+color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLOR_SET
#generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +59,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side
#generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -67,7 +67,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side
margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side
#generic for {top, bottom, left, right}.c
-side:op GENERIC: IDENT:( INHERIT: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
top:CSS_PROP_TOP WRAP:css__parse_side
bottom:CSS_PROP_BOTTOM WRAP:css__parse_side
@@ -76,7 +76,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
#generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width
@@ -85,7 +85,7 @@ border_right_width:CSS_PROP_BORDER_RIGHT_WIDTH WRAP:css__parse_border_side_width
#generic for border_{top, bottom, left, right}_style.c
-border_side_style:op GENERIC: IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+border_side_style:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
border_top_style:CSS_PROP_BORDER_TOP_STYLE WRAP:css__parse_border_side_style
border_bottom_style:CSS_PROP_BORDER_BOTTOM_STYLE WRAP:css__parse_border_side_style
@@ -93,7 +93,7 @@ border_left_style:CSS_PROP_BORDER_LEFT_STYLE WRAP:css__parse_border_side_style
border_right_style:CSS_PROP_BORDER_RIGHT_STYLE WRAP:css__parse_border_side_style
#generic for border_{top, bottom, left, right}_color.c
-border_side_color:op GENERIC: IDENT:( INHERIT: IDENT:) COLOR:BORDER_COLOR_SET
+border_side_color:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BORDER_COLOR_SET
border_top_color:CSS_PROP_BORDER_TOP_COLOR WRAP:css__parse_border_side_color
border_bottom_color:CSS_PROP_BORDER_BOTTOM_COLOR WRAP:css__parse_border_side_color
@@ -101,139 +101,139 @@ border_left_color:CSS_PROP_BORDER_LEFT_COLOR WRAP:css__parse_border_side_color
border_right_color:CSS_PROP_BORDER_RIGHT_COLOR WRAP:css__parse_border_side_color
-counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
+counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:)
-counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
+counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:)
-background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
+background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:)
-background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: IDENT:) COLOR:BACKGROUND_COLOR_SET
+background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:BACKGROUND_COLOR_SET
-caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
+caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:)
-clear:CSS_PROP_CLEAR IDENT:( INHERIT: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
+clear:CSS_PROP_CLEAR IDENT:( INHERIT: INITIAL: REVERT: UNSET: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:)
-background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
+background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI
-list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
+list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI
-list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
+list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
-orphans:CSS_PROP_ORPHANS IDENT:INHERIT NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
+orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
-outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
+outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
-outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
outline_width:CSS_PROP_OUTLINE_WIDTH WRAP:css__parse_border_side_width
-overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
+overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
+page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
-page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
+page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
-page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
+page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
-pitch_range:CSS_PROP_PITCH_RANGE IDENT:INHERIT NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
+pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
-position:CSS_PROP_POSITION IDENT:( INHERIT: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:)
+position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:)
-richness:CSS_PROP_RICHNESS IDENT:INHERIT NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
+richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
-speak:CSS_PROP_SPEAK IDENT:( INHERIT: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
+speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
-speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
+speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: INITIAL: REVERT: UNSET: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:)
-speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
+speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: INITIAL: REVERT: UNSET: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:)
-speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
+speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
-speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
+speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
-stress:CSS_PROP_STRESS IDENT:INHERIT NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
+stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
-table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
+table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
-text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
+text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
-text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
-text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
+text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
-unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
+unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
-visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
+visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
-white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
+white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
-widows:CSS_PROP_WIDOWS IDENT:INHERIT NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
+widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
-z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
+z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
-break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
+break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
-break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
+break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:)
-break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
+break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
-column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
+column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
-column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
+column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
-column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
+column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
-column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
+column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width
-column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
+column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
-writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
+writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
-box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
+box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: INITIAL: REVERT: UNSET: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
-align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
+align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
-align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
+align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
-align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
+align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
-flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
+flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
-flex_grow:CSS_PROP_FLEX_GROW IDENT:INHERIT NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
-flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
-flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
+flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
-justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
+justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
-order:CSS_PROP_ORDER IDENT:INHERIT NUMBER:( true:ORDER_SET NUMBER:)
+order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:)
diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c
index 9d3c4c9..b71158f 100644
--- a/src/parse/properties/quotes.c
+++ b/src/parse/properties/quotes.c
@@ -34,6 +34,7 @@ css_error css__parse_quotes(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ STRING STRING ]+ | IDENT(none,inherit) */
@@ -45,11 +46,12 @@ css_error css__parse_quotes(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_QUOTES);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_QUOTES);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c
index a7bae24..1345b8e 100644
--- a/src/parse/properties/text_decoration.c
+++ b/src/parse/properties/text_decoration.c
@@ -34,6 +34,7 @@ css_error css__parse_text_decoration(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT([ underline || overline || line-through || blink ])
@@ -44,10 +45,14 @@ css_error css__parse_text_decoration(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
+
if (lwc_string_caseless_isequal(token->idata,
c->strings[INHERIT],
&match) == lwc_error_ok && match) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_TEXT_DECORATION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_TEXT_DECORATION);
+
} else if (lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
&match) == lwc_error_ok && match) {
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index e4c97c7..54a3fd1 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -19,6 +19,35 @@ static inline bool is_css_inherit(css_language *c, const css_token *token)
&match) == lwc_error_ok && match));
}
+static inline enum flag_value get_css_flag_value(
+ css_language *c,
+ const css_token *token)
+{
+ if (token->type == CSS_TOKEN_IDENT) {
+ bool match;
+
+ if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INHERIT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_INITIAL;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_REVERT;
+ } else if (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match) {
+ return FLAG_VALUE_UNSET;
+ }
+ }
+
+ return FLAG_VALUE__NONE;
+}
+
enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOTTOM = 2, BORDER_SIDE_LEFT = 3 };
/**
diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c
index 193cb6b..f62ba15 100644
--- a/src/parse/properties/voice_family.c
+++ b/src/parse/properties/voice_family.c
@@ -90,7 +90,7 @@ css_error css__parse_voice_family(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
/* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit)
*
@@ -105,11 +105,12 @@ css_error css__parse_voice_family(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_VOICE_FAMILY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_VOICE_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 7d723e1..dd579f1 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -233,6 +233,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("z-index"),
SMAP("inherit"),
+ SMAP("unset"),
SMAP("important"),
SMAP("none"),
SMAP("both"),
@@ -453,6 +454,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("src"),
SMAP("local"),
SMAP("initial"),
+ SMAP("revert"),
SMAP("format"),
SMAP("woff"),
SMAP("truetype"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index fd24a47..df3bcf1 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -71,7 +71,7 @@ enum {
LAST_PROP = Z_INDEX,
/* Other keywords */
- INHERIT, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
+ INHERIT, UNSET, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
NO_REPEAT, REPEAT_X, REPEAT_Y, REPEAT, HIDDEN, DOTTED, DASHED,
SOLID, LIBCSS_DOUBLE, GROOVE, RIDGE, INSET, OUTSET, THIN, MEDIUM, THICK,
COLLAPSE, SEPARATE, AUTO, LTR, RTL, INLINE, BLOCK, LIST_ITEM, RUN_IN,
@@ -103,7 +103,7 @@ enum {
W_RESIZE, LIBCSS_TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE,
FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE,
LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER,
- LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL,
+ LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, REVERT,
FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN,
AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL,
VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START,
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/dispatch.c b/src/select/dispatch.c
index 30bba25..a6c868d 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -15,6 +15,7 @@
css__cascade_##pname, \
css__set_##pname##_from_hint, \
css__initial_##pname, \
+ css__copy_##pname, \
css__compose_##pname
struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
diff --git a/src/select/dispatch.h b/src/select/dispatch.h
index e3f93a3..8ddf4f9 100644
--- a/src/select/dispatch.h
+++ b/src/select/dispatch.h
@@ -23,6 +23,8 @@ extern struct prop_table {
css_error (*set_from_hint)(const css_hint *hint,
css_computed_style *style);
css_error (*initial)(css_select_state *state);
+ css_error (*copy)(const css_computed_style *from,
+ css_computed_style *to);
css_error (*compose)(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result);
diff --git a/src/select/properties/align_content.c b/src/select/properties/align_content.c
index f43cd8e..d432879 100644
--- a/src/select/properties/align_content.c
+++ b/src/select/properties/align_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_CONTENT_STRETCH:
value = CSS_ALIGN_CONTENT_STRETCH;
@@ -48,7 +48,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_content(state->computed, value);
}
@@ -66,16 +66,25 @@ css_error css__initial_align_content(css_select_state *state)
return set_align_content(state->computed, CSS_ALIGN_CONTENT_STRETCH);
}
+css_error css__copy_align_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_content(to, get_align_content(from));
+}
+
css_error css__compose_align_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_content(child);
- if (type == CSS_ALIGN_CONTENT_INHERIT) {
- type = get_align_content(parent);
- }
-
- return set_align_content(result, type);
+ return css__copy_align_content(
+ type == CSS_ALIGN_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_items.c b/src/select/properties/align_items.c
index ad69c81..52ca094 100644
--- a/src/select/properties/align_items.c
+++ b/src/select/properties/align_items.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_ITEMS_STRETCH:
value = CSS_ALIGN_ITEMS_STRETCH;
@@ -42,7 +42,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_items(state->computed, value);
}
@@ -60,16 +60,25 @@ css_error css__initial_align_items(css_select_state *state)
return set_align_items(state->computed, CSS_ALIGN_ITEMS_STRETCH);
}
+css_error css__copy_align_items(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_items(to, get_align_items(from));
+}
+
css_error css__compose_align_items(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_items(child);
- if (type == CSS_ALIGN_ITEMS_INHERIT) {
- type = get_align_items(parent);
- }
-
- return set_align_items(result, type);
+ return css__copy_align_items(
+ type == CSS_ALIGN_ITEMS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/align_self.c b/src/select/properties/align_self.c
index e8e469e..abdb3fe 100644
--- a/src/select/properties/align_self.c
+++ b/src/select/properties/align_self.c
@@ -21,7 +21,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ALIGN_SELF_STRETCH:
value = CSS_ALIGN_SELF_STRETCH;
@@ -45,7 +45,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_align_self(state->computed, value);
}
@@ -63,16 +63,25 @@ css_error css__initial_align_self(css_select_state *state)
return set_align_self(state->computed, CSS_ALIGN_SELF_AUTO);
}
+css_error css__copy_align_self(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_align_self(to, get_align_self(from));
+}
+
css_error css__compose_align_self(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_align_self(child);
- if (type == CSS_ALIGN_SELF_INHERIT) {
- type = get_align_self(parent);
- }
-
- return set_align_self(result, type);
+ return css__copy_align_self(
+ type == CSS_ALIGN_SELF_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c
index d52110f..bbbb48d 100644
--- a/src/select/properties/azimuth.c
+++ b/src/select/properties/azimuth.c
@@ -18,7 +18,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & ~AZIMUTH_BEHIND) {
case AZIMUTH_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -47,7 +47,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed azimuth */
}
@@ -70,6 +70,16 @@ css_error css__initial_azimuth(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_azimuth(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_azimuth(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c
index 834c830..49194cc 100644
--- a/src/select/properties/background_attachment.c
+++ b/src/select/properties/background_attachment.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_ATTACHMENT_FIXED:
value = CSS_BACKGROUND_ATTACHMENT_FIXED;
@@ -33,7 +33,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_attachment(state->computed, value);
}
@@ -52,16 +52,25 @@ css_error css__initial_background_attachment(css_select_state *state)
CSS_BACKGROUND_ATTACHMENT_SCROLL);
}
+css_error css__copy_background_attachment(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_attachment(to, get_background_attachment(from));
+}
+
css_error css__compose_background_attachment(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_attachment(child);
- if (type == CSS_BACKGROUND_ATTACHMENT_INHERIT) {
- type = get_background_attachment(parent);
- }
-
- return set_background_attachment(result, type);
+ return css__copy_background_attachment(
+ type == CSS_BACKGROUND_ATTACHMENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_color.c b/src/select/properties/background_color.c
index bb90604..1ab61e6 100644
--- a/src/select/properties/background_color.c
+++ b/src/select/properties/background_color.c
@@ -32,6 +32,20 @@ css_error css__initial_background_color(css_select_state *state)
CSS_BACKGROUND_COLOR_COLOR, 0);
}
+css_error css__copy_background_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_background_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_color(to, type, color);
+}
+
css_error css__compose_background_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -39,10 +53,8 @@ css_error css__compose_background_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_background_color(child, &color);
- if (type == CSS_BACKGROUND_COLOR_INHERIT) {
- type = get_background_color(parent, &color);
- }
-
- return set_background_color(result, type, color);
+ return css__copy_background_color(
+ type == CSS_BACKGROUND_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_image.c b/src/select/properties/background_image.c
index 96f7409..68b1e0f 100644
--- a/src/select/properties/background_image.c
+++ b/src/select/properties/background_image.c
@@ -39,6 +39,20 @@ css_error css__initial_background_image(css_select_state *state)
CSS_BACKGROUND_IMAGE_NONE, NULL);
}
+css_error css__copy_background_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_background_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_image(to, type, url);
+}
+
css_error css__compose_background_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_background_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_background_image(child, &url);
- if (type == CSS_BACKGROUND_IMAGE_INHERIT) {
- type = get_background_image(parent, &url);
- }
-
- return set_background_image(result, type, url);
+ return css__copy_background_image(
+ type == CSS_BACKGROUND_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c
index d925b9c..f3fe47c 100644
--- a/src/select/properties/background_position.c
+++ b/src/select/properties/background_position.c
@@ -23,7 +23,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BACKGROUND_POSITION_SET;
switch (getValue(opv) & 0xf0) {
@@ -73,7 +73,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_position(state->computed, value,
hlength, hunit, vlength, vunit);
}
@@ -96,6 +96,22 @@ css_error css__initial_background_position(css_select_state *state)
0, CSS_UNIT_PCT, 0, CSS_UNIT_PCT);
}
+css_error css__copy_background_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_background_position(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_position(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_background_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -105,12 +121,8 @@ css_error css__compose_background_position(const css_computed_style *parent,
uint8_t type = get_background_position(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BACKGROUND_POSITION_INHERIT) {
- type = get_background_position(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_background_position(result, type, hlength, hunit,
- vlength, vunit);
+ return css__copy_background_position(
+ type == CSS_BACKGROUND_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c
index 3881573..7104bfb 100644
--- a/src/select/properties/background_repeat.c
+++ b/src/select/properties/background_repeat.c
@@ -21,7 +21,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_REPEAT_NO_REPEAT:
value = CSS_BACKGROUND_REPEAT_NO_REPEAT;
@@ -39,7 +39,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_background_repeat(state->computed, value);
}
@@ -58,16 +58,25 @@ css_error css__initial_background_repeat(css_select_state *state)
CSS_BACKGROUND_REPEAT_REPEAT);
}
+css_error css__copy_background_repeat(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_background_repeat(to, get_background_repeat(from));
+}
+
css_error css__compose_background_repeat(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_background_repeat(child);
- if (type == CSS_BACKGROUND_REPEAT_INHERIT) {
- type = get_background_repeat(parent);
- }
-
- return set_background_repeat(result, type);
+ return css__copy_background_repeat(
+ type == CSS_BACKGROUND_REPEAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_color.c b/src/select/properties/border_bottom_color.c
index bdbecb7..1996d71 100644
--- a/src/select/properties/border_bottom_color.c
+++ b/src/select/properties/border_bottom_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_bottom_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_bottom_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_bottom_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_color(to, type, color);
+}
+
css_error css__compose_border_bottom_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_bottom_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_bottom_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_bottom_color(parent, &color);
- }
-
- return set_border_bottom_color(result, type, color);
+ return css__copy_border_bottom_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_style.c b/src/select/properties/border_bottom_style.c
index b5caccb..3451c65 100644
--- a/src/select/properties/border_bottom_style.c
+++ b/src/select/properties/border_bottom_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_bottom_style(css_select_state *state)
return set_border_bottom_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_bottom_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_style(to, get_border_bottom_style(from));
+}
+
css_error css__compose_border_bottom_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_bottom_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_bottom_style(parent);
- }
-
- return set_border_bottom_style(result, type);
+ return css__copy_border_bottom_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_bottom_width.c b/src/select/properties/border_bottom_width.c
index b071fba..19f4304 100644
--- a/src/select/properties/border_bottom_width.c
+++ b/src/select/properties/border_bottom_width.c
@@ -14,16 +14,16 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_border_bottom_width(uint32_t opv, css_style *style,
+css_error css__cascade_border_bottom_width(uint32_t opv, css_style *width,
css_select_state *state)
{
- return css__cascade_border_width(opv, style, state, set_border_bottom_width);
+ return css__cascade_border_width(opv, width, state, set_border_bottom_width);
}
css_error css__set_border_bottom_width_from_hint(const css_hint *hint,
- css_computed_style *style)
+ css_computed_style *width)
{
- return set_border_bottom_width(style, hint->status,
+ return set_border_bottom_width(width, hint->status,
hint->data.length.value, hint->data.length.unit);
}
@@ -33,6 +33,21 @@ css_error css__initial_border_bottom_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_bottom_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_bottom_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_bottom_width(to, type, length, unit);
+}
+
css_error css__compose_border_bottom_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_bottom_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_bottom_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_bottom_width(parent, &length, &unit);
- }
-
- return set_border_bottom_width(result, type, length, unit);
+ return css__copy_border_bottom_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c
index 1363c7c..8868e6b 100644
--- a/src/select/properties/border_collapse.c
+++ b/src/select/properties/border_collapse.c
@@ -21,7 +21,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_COLLAPSE_SEPARATE:
value = CSS_BORDER_COLLAPSE_SEPARATE;
@@ -33,7 +33,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_collapse(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_border_collapse(css_select_state *state)
return set_border_collapse(state->computed, CSS_BORDER_COLLAPSE_SEPARATE);
}
+css_error css__copy_border_collapse(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_collapse(to, get_border_collapse(from));
+}
+
css_error css__compose_border_collapse(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_collapse(child);
- if (type == CSS_BORDER_COLLAPSE_INHERIT) {
- type = get_border_collapse(parent);
- }
-
- return set_border_collapse(result, type);
+ return css__copy_border_collapse(
+ type == CSS_BORDER_COLLAPSE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_color.c b/src/select/properties/border_left_color.c
index 2880751..60b81ae 100644
--- a/src/select/properties/border_left_color.c
+++ b/src/select/properties/border_left_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_left_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_left_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_left_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_color(to, type, color);
+}
+
css_error css__compose_border_left_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_left_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_left_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_left_color(parent, &color);
- }
-
- return set_border_left_color(result, type, color);
+ return css__copy_border_left_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_style.c b/src/select/properties/border_left_style.c
index e6472b3..99b5494 100644
--- a/src/select/properties/border_left_style.c
+++ b/src/select/properties/border_left_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_left_style(css_select_state *state)
return set_border_left_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_left_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_style(to, get_border_left_style(from));
+}
+
css_error css__compose_border_left_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_left_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_left_style(parent);
- }
-
- return set_border_left_style(result, type);
+ return css__copy_border_left_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_left_width.c b/src/select/properties/border_left_width.c
index 1278fa9..e1fc822 100644
--- a/src/select/properties/border_left_width.c
+++ b/src/select/properties/border_left_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_left_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_left_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_left_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_left_width(to, type, length, unit);
+}
+
css_error css__compose_border_left_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_left_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_left_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_left_width(parent, &length, &unit);
- }
-
- return set_border_left_width(result, type, length, unit);
+ return css__copy_border_left_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_color.c b/src/select/properties/border_right_color.c
index b8563e6..815ca9c 100644
--- a/src/select/properties/border_right_color.c
+++ b/src/select/properties/border_right_color.c
@@ -33,6 +33,20 @@ css_error css__initial_border_right_color(css_select_state *state)
CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_right_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_right_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_color(to, type, color);
+}
+
css_error css__compose_border_right_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +54,8 @@ css_error css__compose_border_right_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_right_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_right_color(parent, &color);
- }
-
- return set_border_right_color(result, type, color);
+ return css__copy_border_right_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_style.c b/src/select/properties/border_right_style.c
index d75a99e..d14fbfb 100644
--- a/src/select/properties/border_right_style.c
+++ b/src/select/properties/border_right_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_right_style(css_select_state *state)
return set_border_right_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_right_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_style(to, get_border_right_style(from));
+}
+
css_error css__compose_border_right_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_right_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_right_style(parent);
- }
-
- return set_border_right_style(result, type);
+ return css__copy_border_right_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_right_width.c b/src/select/properties/border_right_width.c
index 18cacd2..93e8f19 100644
--- a/src/select/properties/border_right_width.c
+++ b/src/select/properties/border_right_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_right_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_right_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_right_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_right_width(to, type, length, unit);
+}
+
css_error css__compose_border_right_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_right_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_right_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_right_width(parent, &length, &unit);
- }
-
- return set_border_right_width(result, type, length, unit);
+ return css__copy_border_right_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c
index 0077aac..1f70aff 100644
--- a/src/select/properties/border_spacing.c
+++ b/src/select/properties/border_spacing.c
@@ -23,7 +23,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
uint32_t hunit = UNIT_PX;
uint32_t vunit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_BORDER_SPACING_SET;
hlength = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(hlength));
@@ -40,7 +40,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style,
vunit = css__to_css_unit(vunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_border_spacing(state->computed, value,
hlength, hunit, vlength, vunit);
}
@@ -62,6 +62,22 @@ css_error css__initial_border_spacing(css_select_state *state)
0, CSS_UNIT_PX, 0, CSS_UNIT_PX);
}
+css_error css__copy_border_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed hlength = 0, vlength = 0;
+ css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
+ uint8_t type = get_border_spacing(from, &hlength, &hunit,
+ &vlength, &vunit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_spacing(to, type, hlength, hunit, vlength, vunit);
+}
+
css_error css__compose_border_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -71,10 +87,7 @@ css_error css__compose_border_spacing(const css_computed_style *parent,
uint8_t type = get_border_spacing(child, &hlength, &hunit,
&vlength, &vunit);
- if (type == CSS_BORDER_SPACING_INHERIT) {
- type = get_border_spacing(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_border_spacing(result, type, hlength, hunit, vlength, vunit);
+ return css__copy_border_spacing(
+ type == CSS_BORDER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_color.c b/src/select/properties/border_top_color.c
index fd2ced4..ee3feb1 100644
--- a/src/select/properties/border_top_color.c
+++ b/src/select/properties/border_top_color.c
@@ -31,6 +31,20 @@ css_error css__initial_border_top_color(css_select_state *state)
return set_border_top_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_border_top_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_border_top_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_color(to, type, color);
+}
+
css_error css__compose_border_top_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_border_top_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_border_top_color(child, &color);
- if (type == CSS_BORDER_COLOR_INHERIT) {
- type = get_border_top_color(parent, &color);
- }
-
- return set_border_top_color(result, type, color);
+ return css__copy_border_top_color(
+ type == CSS_BORDER_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_style.c b/src/select/properties/border_top_style.c
index 48d6b6d..1d2dc91 100644
--- a/src/select/properties/border_top_style.c
+++ b/src/select/properties/border_top_style.c
@@ -31,16 +31,25 @@ css_error css__initial_border_top_style(css_select_state *state)
return set_border_top_style(state->computed, CSS_BORDER_STYLE_NONE);
}
+css_error css__copy_border_top_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_style(to, get_border_top_style(from));
+}
+
css_error css__compose_border_top_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_border_top_style(child);
- if (type == CSS_BORDER_STYLE_INHERIT) {
- type = get_border_top_style(parent);
- }
-
- return set_border_top_style(result, type);
+ return css__copy_border_top_style(
+ type == CSS_BORDER_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/border_top_width.c b/src/select/properties/border_top_width.c
index c0fb7da..18e60cb 100644
--- a/src/select/properties/border_top_width.c
+++ b/src/select/properties/border_top_width.c
@@ -33,6 +33,21 @@ css_error css__initial_border_top_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_border_top_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_border_top_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_border_top_width(to, type, length, unit);
+}
+
css_error css__compose_border_top_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_border_top_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_border_top_width(child, &length, &unit);
- if (type == CSS_BORDER_WIDTH_INHERIT) {
- type = get_border_top_width(parent, &length, &unit);
- }
-
- return set_border_top_width(result, type, length, unit);
+ return css__copy_border_top_width(
+ type == CSS_BORDER_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/bottom.c b/src/select/properties/bottom.c
index 82754f1..fd65ed3 100644
--- a/src/select/properties/bottom.c
+++ b/src/select/properties/bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_bottom(css_select_state *state)
return set_bottom(state->computed, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_bottom(to, type, length, unit);
+}
+
css_error css__compose_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_bottom(child, &length, &unit);
- if (type == CSS_BOTTOM_INHERIT) {
- type = get_bottom(parent, &length, &unit);
- }
-
- return set_bottom(result, type, length, unit);
+ return css__copy_bottom(
+ type == CSS_BOTTOM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c
index 2d19c95..471f8a7 100644
--- a/src/select/properties/box_sizing.c
+++ b/src/select/properties/box_sizing.c
@@ -21,7 +21,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOX_SIZING_CONTENT_BOX:
value = CSS_BOX_SIZING_CONTENT_BOX;
@@ -33,7 +33,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_box_sizing(state->computed, value);
}
@@ -51,17 +51,25 @@ css_error css__initial_box_sizing(css_select_state *state)
return set_box_sizing(state->computed, CSS_BOX_SIZING_CONTENT_BOX);
}
-css_error css__compose_box_sizing(
- const css_computed_style *parent,
+css_error css__copy_box_sizing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_box_sizing(to, get_box_sizing(from));
+}
+
+css_error css__compose_box_sizing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_box_sizing(child);
- if (type == CSS_BOX_SIZING_INHERIT) {
- type = get_box_sizing(parent);
- }
-
- return set_box_sizing(result, type);
+ return css__copy_box_sizing(
+ type == CSS_BOX_SIZING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_after.c b/src/select/properties/break_after.c
index 1f253aa..cb382e0 100644
--- a/src/select/properties/break_after.c
+++ b/src/select/properties/break_after.c
@@ -32,16 +32,25 @@ css_error css__initial_break_after(css_select_state *state)
return set_break_after(state->computed, CSS_BREAK_AFTER_AUTO);
}
+css_error css__copy_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_after(to, get_break_after(from));
+}
+
css_error css__compose_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_after(child);
- if (type == CSS_BREAK_AFTER_INHERIT) {
- type = get_break_after(parent);
- }
-
- return set_break_after(result, type);
+ return css__copy_break_after(
+ type == CSS_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_before.c b/src/select/properties/break_before.c
index 3dcda76..91b0612 100644
--- a/src/select/properties/break_before.c
+++ b/src/select/properties/break_before.c
@@ -32,16 +32,25 @@ css_error css__initial_break_before(css_select_state *state)
return set_break_before(state->computed, CSS_BREAK_BEFORE_AUTO);
}
+css_error css__copy_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_before(to, get_break_before(from));
+}
+
css_error css__compose_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_before(child);
- if (type == CSS_BREAK_BEFORE_INHERIT) {
- type = get_break_before(parent);
- }
-
- return set_break_before(result, type);
+ return css__copy_break_before(
+ type == CSS_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c
index fdc44c1..d5b8aef 100644
--- a/src/select/properties/break_inside.c
+++ b/src/select/properties/break_inside.c
@@ -21,7 +21,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_INSIDE_AUTO:
value = CSS_BREAK_INSIDE_AUTO;
@@ -39,7 +39,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_break_inside(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_break_inside(css_select_state *state)
return set_break_inside(state->computed, CSS_BREAK_INSIDE_AUTO);
}
+css_error css__copy_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_break_inside(to, get_break_inside(from));
+}
+
css_error css__compose_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_break_inside(child);
- if (type == CSS_BREAK_INSIDE_INHERIT) {
- type = get_break_inside(parent);
- }
-
- return set_break_inside(result, type);
+ return css__copy_break_inside(
+ type == CSS_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c
index ecccc1d..f0e7693 100644
--- a/src/select/properties/caption_side.c
+++ b/src/select/properties/caption_side.c
@@ -21,7 +21,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CAPTION_SIDE_TOP:
value = CSS_CAPTION_SIDE_TOP;
@@ -33,7 +33,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_caption_side(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_caption_side(css_select_state *state)
return set_caption_side(state->computed, CSS_CAPTION_SIDE_TOP);
}
+css_error css__copy_caption_side(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_caption_side(to, get_caption_side(from));
+}
+
css_error css__compose_caption_side(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_caption_side(child);
- if (type == CSS_CAPTION_SIDE_INHERIT) {
- type = get_caption_side(parent);
- }
-
- return set_caption_side(result, type);
+ return css__copy_caption_side(
+ type == CSS_CAPTION_SIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c
index bbb2673..1fbc48e 100644
--- a/src/select/properties/clear.c
+++ b/src/select/properties/clear.c
@@ -21,7 +21,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case CLEAR_NONE:
value = CSS_CLEAR_NONE;
@@ -39,7 +39,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clear(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_clear(css_select_state *state)
return set_clear(state->computed, CSS_CLEAR_NONE);
}
+css_error css__copy_clear(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clear(to, get_clear(from));
+}
+
css_error css__compose_clear(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_clear(child);
- if (type == CSS_CLEAR_INHERIT) {
- type = get_clear(parent);
- }
-
- return set_clear(result, type);
+ return css__copy_clear(
+ type == CSS_CLEAR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c
index 2785afb..c0b9c2b 100644
--- a/src/select/properties/clip.c
+++ b/src/select/properties/clip.c
@@ -22,7 +22,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
false, false, false, false };
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv) & CLIP_SHAPE_MASK) {
case CLIP_SHAPE_RECT:
if (getValue(opv) & CLIP_RECT_TOP_AUTO) {
@@ -71,7 +71,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style,
rect.lunit = css__to_css_unit(rect.lunit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_clip(state->computed, value, &rect);
}
@@ -93,6 +93,22 @@ css_error css__initial_clip(css_select_state *state)
return set_clip(state->computed, CSS_CLIP_AUTO, &rect);
}
+css_error css__copy_clip(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_computed_clip_rect rect = { 0, 0, 0, 0,
+ CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
+ false, false, false, false };
+ uint8_t type = get_clip(from, &rect);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_clip(to, type, &rect);
+}
+
css_error css__compose_clip(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -102,9 +118,7 @@ css_error css__compose_clip(const css_computed_style *parent,
false, false, false, false };
uint8_t type = get_clip(child, &rect);
- if (type == CSS_CLIP_INHERIT) {
- type = get_clip(parent, &rect);
- }
-
- return set_clip(result, type, &rect);
+ return css__copy_clip(
+ type == CSS_CLIP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/color.c b/src/select/properties/color.c
index 806f2cc..6424436 100644
--- a/src/select/properties/color.c
+++ b/src/select/properties/color.c
@@ -17,11 +17,11 @@
css_error css__cascade_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLOR_INHERIT;
css_color color = 0;
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLOR_TRANSPARENT:
value = CSS_COLOR_COLOR;
@@ -29,7 +29,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
case COLOR_CURRENT_COLOR:
/* color: currentColor always computes to inherit */
value = CSS_COLOR_INHERIT;
- inherit = true;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLOR_SET:
value = CSS_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_color(state->computed, value, color);
}
@@ -66,6 +66,20 @@ css_error css__initial_color(css_select_state *state)
return css__set_color_from_hint(&hint, state->computed);
}
+css_error css__copy_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_color(to, type, color);
+}
+
css_error css__compose_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -73,10 +87,8 @@ css_error css__compose_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_color(child, &color);
- if (type == CSS_COLOR_INHERIT) {
- type = get_color(parent, &color);
- }
-
- return set_color(result, type, color);
+ return css__copy_color(
+ type == CSS_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index efd1243..4adadd6 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -20,7 +20,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
uint16_t value = CSS_COLUMN_COUNT_INHERIT;
css_fixed count = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_COUNT_SET:
value = CSS_COLUMN_COUNT_SET;
@@ -34,7 +34,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_count(state->computed, value, count);
}
@@ -52,6 +52,20 @@ css_error css__initial_column_count(css_select_state *state)
return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0);
}
+css_error css__copy_column_count(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_column_count(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_count(to, type, count);
+}
+
css_error css__compose_column_count(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -59,9 +73,7 @@ css_error css__compose_column_count(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_column_count(child, &count);
- if (type == CSS_COLUMN_COUNT_INHERIT) {
- type = get_column_count(parent, &count);
- }
-
- return set_column_count(result, type, count);
+ return css__copy_column_count(
+ type == CSS_COLUMN_COUNT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index 31f19f0..f49946c 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
value = CSS_COLUMN_FILL_BALANCE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_fill(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_column_fill(css_select_state *state)
return set_column_fill(state->computed, CSS_COLUMN_FILL_BALANCE);
}
+css_error css__copy_column_fill(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_fill(to, get_column_fill(from));
+}
+
css_error css__compose_column_fill(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_fill(child);
- if (type == CSS_COLUMN_FILL_INHERIT) {
- type = get_column_fill(parent);
- }
-
- return set_column_fill(result, type);
+ return css__copy_column_fill(
+ type == CSS_COLUMN_FILL_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 087eb0f..5776dc9 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -33,6 +33,21 @@ css_error css__initial_column_gap(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_gap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_gap(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_gap(to, type, length, unit);
+}
+
css_error css__compose_column_gap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_column_gap(const css_computed_style *parent,
css_unit unit = CSS_UNIT_EM;
uint8_t type = get_column_gap(child, &length, &unit);
- if (type == CSS_COLUMN_GAP_INHERIT) {
- type = get_column_gap(parent, &length, &unit);
- }
-
- return set_column_gap(result, type, length, unit);
+ return css__copy_column_gap(
+ type == CSS_COLUMN_GAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index f54c2ab..0b7ec9d 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -17,17 +17,18 @@
css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case COLUMN_RULE_COLOR_TRANSPARENT:
value = CSS_COLUMN_RULE_COLOR_COLOR;
break;
case COLUMN_RULE_COLOR_CURRENT_COLOR:
value = CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
+ flag_value = FLAG_VALUE_INHERIT;
break;
case COLUMN_RULE_COLOR_SET:
value = CSS_COLUMN_RULE_COLOR_COLOR;
@@ -38,7 +39,7 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_column_rule_color(state->computed, value, color);
}
@@ -57,6 +58,20 @@ css_error css__initial_column_rule_color(css_select_state *state)
CSS_COLUMN_RULE_COLOR_CURRENT_COLOR, 0);
}
+css_error css__copy_column_rule_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color;
+ uint8_t type = get_column_rule_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_color(to, type, color);
+}
+
css_error css__compose_column_rule_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -64,10 +79,8 @@ css_error css__compose_column_rule_color(const css_computed_style *parent,
css_color color;
uint8_t type = get_column_rule_color(child, &color);
- if (type == CSS_COLUMN_RULE_COLOR_INHERIT) {
- type = get_column_rule_color(parent, &color);
- }
-
- return set_column_rule_color(result, type, color);
+ return css__copy_column_rule_color(
+ type == CSS_COLUMN_RULE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c
index 1d9a41e..be9579c 100644
--- a/src/select/properties/column_rule_style.c
+++ b/src/select/properties/column_rule_style.c
@@ -33,16 +33,25 @@ css_error css__initial_column_rule_style(css_select_state *state)
CSS_COLUMN_RULE_STYLE_NONE);
}
+css_error css__copy_column_rule_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_style(to, get_column_rule_style(from));
+}
+
css_error css__compose_column_rule_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_rule_style(child);
- if (type == CSS_COLUMN_RULE_STYLE_INHERIT) {
- type = get_column_rule_style(parent);
- }
-
- return set_column_rule_style(result, type);
+ return css__copy_column_rule_style(
+ type == CSS_COLUMN_RULE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 3ca9367..c18f26c 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -34,6 +34,21 @@ css_error css__initial_column_rule_width(css_select_state *state)
CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
+css_error css__copy_column_rule_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_rule_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_rule_width(to, type, length, unit);
+}
+
css_error css__compose_column_rule_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -42,10 +57,8 @@ css_error css__compose_column_rule_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_rule_width(child, &length, &unit);
- if (type == CSS_COLUMN_RULE_WIDTH_INHERIT) {
- type = get_column_rule_width(parent, &length, &unit);
- }
-
- return set_column_rule_width(result, type, length, unit);
+ return css__copy_column_rule_width(
+ type == CSS_COLUMN_RULE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index 2c870d3..340150f 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -21,7 +21,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COLUMN_SPAN_NONE:
value = CSS_COLUMN_SPAN_NONE;
@@ -33,7 +33,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_column_span(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_column_span(css_select_state *state)
return set_column_span(state->computed, CSS_COLUMN_SPAN_NONE);
}
+css_error css__copy_column_span(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_span(to, get_column_span(from));
+}
+
css_error css__compose_column_span(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_column_span(child);
- if (type == CSS_COLUMN_SPAN_INHERIT) {
- type = get_column_span(parent);
- }
-
- return set_column_span(result, type);
+ return css__copy_column_span(
+ type == CSS_COLUMN_SPAN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index e739ade..d88d022 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -33,17 +33,30 @@ css_error css__initial_column_width(css_select_state *state)
INTTOFIX(1), CSS_UNIT_EM);
}
+css_error css__copy_column_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_column_width(to, type, length, unit);
+}
+
css_error css__compose_column_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- css_fixed length = INTTOFIX(1);
- css_unit unit = CSS_UNIT_EM;
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
uint8_t type = get_column_width(child, &length, &unit);
- if (type == CSS_COLUMN_WIDTH_INHERIT) {
- type = get_column_width(parent, &length, &unit);
- }
-
- return set_column_width(result, type, length, unit);
+ return css__copy_column_width(
+ type == CSS_COLUMN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/content.c b/src/select/properties/content.c
index f75743d..32af49f 100644
--- a/src/select/properties/content.c
+++ b/src/select/properties/content.c
@@ -21,7 +21,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
css_computed_content_item *content = NULL;
uint32_t n_contents = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
if (v == CONTENT_NORMAL) {
@@ -140,7 +140,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_content(state->computed, value, content);
@@ -199,39 +199,40 @@ css_error css__initial_content(css_select_state *state)
return set_content(state->computed, CSS_CONTENT_NORMAL, NULL);
}
-css_error css__compose_content(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_content(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_content_item *copy = NULL;
const css_computed_content_item *items = NULL;
- uint8_t type = get_content(child, &items);
+ uint8_t type = get_content(from, &items);
- if (type == CSS_CONTENT_INHERIT) {
- type = get_content(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_CONTENT_SET) {
- size_t n_items = 0;
- const css_computed_content_item *i;
-
- for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
- i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_content_item));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_content_item));
+ error = css__copy_computed_content_item_array(false, items, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_content(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_content(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_content(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_content_item *items = NULL;
+ uint8_t type = get_content(child, &items);
+
+ return css__copy_content(
+ type == CSS_CONTENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_increment.c b/src/select/properties/counter_increment.c
index 1b75c25..2638838 100644
--- a/src/select/properties/counter_increment.c
+++ b/src/select/properties/counter_increment.c
@@ -48,38 +48,40 @@ css_error css__initial_counter_increment(css_select_state *state)
CSS_COUNTER_INCREMENT_NONE, NULL);
}
-css_error css__compose_counter_increment(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_increment(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_increment(child, &items);
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(from, &counter_increment);
- if (type == CSS_COUNTER_INCREMENT_INHERIT) {
- type = get_counter_increment(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_increment, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_increment(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_increment(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_increment(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_increment = NULL;
+ uint8_t type = get_counter_increment(child, &counter_increment);
+
+ return css__copy_counter_increment(
+ type == CSS_COUNTER_INCREMENT_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/counter_reset.c b/src/select/properties/counter_reset.c
index e4ec8bf..fcb39a3 100644
--- a/src/select/properties/counter_reset.c
+++ b/src/select/properties/counter_reset.c
@@ -47,38 +47,40 @@ css_error css__initial_counter_reset(css_select_state *state)
return set_counter_reset(state->computed, CSS_COUNTER_RESET_NONE, NULL);
}
-css_error css__compose_counter_reset(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_counter_reset(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
css_computed_counter *copy = NULL;
- const css_computed_counter *items = NULL;
- uint8_t type = get_counter_reset(child, &items);
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(from, &counter_reset);
- if (type == CSS_COUNTER_RESET_INHERIT) {
- type = get_counter_reset(parent, &items);
+ if (from == to) {
+ return CSS_OK;
}
- if (type == CSS_COUNTER_RESET_NAMED && items != NULL) {
- size_t n_items = 0;
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
-
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
+ error = css__copy_computed_counter_array(false, counter_reset, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_counter_reset(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_counter_reset(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_counter_reset(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ const css_computed_counter *counter_reset = NULL;
+ uint8_t type = get_counter_reset(child, &counter_reset);
+
+ return css__copy_counter_reset(
+ type == CSS_COUNTER_RESET_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/cue_after.c b/src/select/properties/cue_after.c
index e1c09e8..67a2c73 100644
--- a/src/select/properties/cue_after.c
+++ b/src/select/properties/cue_after.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/cue_before.c b/src/select/properties/cue_before.c
index d562b3b..7c24822 100644
--- a/src/select/properties/cue_before.c
+++ b/src/select/properties/cue_before.c
@@ -37,6 +37,16 @@ css_error css__initial_cue_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_cue_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_cue_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c
index c5e50c6..09955c6 100644
--- a/src/select/properties/cursor.c
+++ b/src/select/properties/cursor.c
@@ -21,7 +21,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
lwc_string **uris = NULL;
uint32_t n_uris = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v == CURSOR_URI) {
@@ -124,7 +124,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_cursor(state->computed, value, uris);
@@ -164,38 +164,40 @@ css_error css__initial_cursor(css_select_state *state)
return set_cursor(state->computed, CSS_CURSOR_AUTO, NULL);
}
-css_error css__compose_cursor(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_cursor(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
lwc_string **copy = NULL;
- lwc_string **urls = NULL;
- uint8_t type = get_cursor(child, &urls);
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(from, &cursor);
- if (type == CSS_CURSOR_INHERIT) {
- type = get_cursor(parent, &urls);
+ if (from == to) {
+ return CSS_OK;
}
- if (urls != NULL) {
- lwc_string **i;
- size_t n_urls = 0;
-
- for (i = urls; (*i) != NULL; i++)
- n_urls++;
-
- copy = malloc((n_urls + 1) *
- sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
-
- memcpy(copy, urls, (n_urls + 1) *
- sizeof(lwc_string *));
+ error = css__copy_lwc_string_array(false, cursor, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
}
- error = set_cursor(result, type, copy);
- if (error != CSS_OK && copy != NULL)
+ error = set_cursor(to, type, copy);
+ if (error != CSS_OK) {
free(copy);
+ }
return error;
}
+
+css_error css__compose_cursor(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **cursor = NULL;
+ uint8_t type = get_cursor(child, &cursor);
+
+ return css__copy_cursor(
+ type == CSS_CURSOR_INHERIT ? parent : child,
+ result);
+}
diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c
index f4a5c46..32bd31e 100644
--- a/src/select/properties/direction.c
+++ b/src/select/properties/direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DIRECTION_LTR:
value = CSS_DIRECTION_LTR;
@@ -33,7 +33,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_direction(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_direction(css_select_state *state)
return set_direction(state->computed, CSS_DIRECTION_LTR);
}
+css_error css__copy_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_direction(to, get_direction(from));
+}
+
css_error css__compose_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_direction(child);
- if (type == CSS_DIRECTION_INHERIT) {
- type = get_direction(parent);
- }
-
- return set_direction(result, type);
+ return css__copy_direction(
+ type == CSS_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 510d24a..bfe0a5f 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -21,7 +21,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case DISPLAY_INLINE:
value = CSS_DISPLAY_INLINE;
@@ -81,7 +81,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_display(state->computed, value);
}
@@ -99,16 +99,25 @@ css_error css__initial_display(css_select_state *state)
return set_display(state->computed, CSS_DISPLAY_INLINE);
}
+css_error css__copy_display(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_display(to, get_display(from));
+}
+
css_error css__compose_display(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_display(child);
- if (type == CSS_DISPLAY_INHERIT) {
- type = get_display(parent);
- }
-
- return set_display(result, type);
+ return css__copy_display(
+ type == CSS_DISPLAY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c
index ee7d036..1368ef8 100644
--- a/src/select/properties/elevation.c
+++ b/src/select/properties/elevation.c
@@ -20,7 +20,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_DEG;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case ELEVATION_ANGLE:
val = *((css_fixed *) style->bytecode);
@@ -42,7 +42,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo set computed elevation */
}
@@ -65,6 +65,16 @@ css_error css__initial_elevation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_elevation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_elevation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c
index fecdbdc..559fbde 100644
--- a/src/select/properties/empty_cells.c
+++ b/src/select/properties/empty_cells.c
@@ -21,7 +21,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case EMPTY_CELLS_SHOW:
value = CSS_EMPTY_CELLS_SHOW;
@@ -33,7 +33,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_empty_cells(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_empty_cells(css_select_state *state)
return set_empty_cells(state->computed, CSS_EMPTY_CELLS_SHOW);
}
+css_error css__copy_empty_cells(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_empty_cells(to, get_empty_cells(from));
+}
+
css_error css__compose_empty_cells(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_empty_cells(child);
- if (type == CSS_EMPTY_CELLS_INHERIT) {
- type = get_empty_cells(parent);
- }
-
- return set_empty_cells(result, type);
+ return css__copy_empty_cells(
+ type == CSS_EMPTY_CELLS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_basis.c b/src/select/properties/flex_basis.c
index 1a92a6b..a3141bc 100644
--- a/src/select/properties/flex_basis.c
+++ b/src/select/properties/flex_basis.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_BASIS_AUTO:
value = CSS_FLEX_BASIS_AUTO;
@@ -42,7 +42,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_basis(state->computed, value, length, unit);
}
@@ -62,6 +62,21 @@ css_error css__initial_flex_basis(css_select_state *state)
CSS_UNIT_PX);
}
+css_error css__copy_flex_basis(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_flex_basis(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_basis(to, type, length, unit);
+}
+
css_error css__compose_flex_basis(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -70,10 +85,8 @@ css_error css__compose_flex_basis(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_flex_basis(child, &length, &unit);
- if (type == CSS_FLEX_BASIS_INHERIT) {
- type = get_flex_basis(parent, &length, &unit);
- }
-
- return set_flex_basis(result, type, length, unit);
+ return css__copy_flex_basis(
+ type == CSS_FLEX_BASIS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 79703be..1d979be 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_DIRECTION_ROW:
value = CSS_FLEX_DIRECTION_ROW;
@@ -39,7 +39,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_direction(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_flex_direction(css_select_state *state)
return set_flex_direction(state->computed, CSS_FLEX_DIRECTION_ROW);
}
+css_error css__copy_flex_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_direction(to, get_flex_direction(from));
+}
+
css_error css__compose_flex_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_direction(child);
- if (type == CSS_FLEX_DIRECTION_INHERIT) {
- type = get_flex_direction(parent);
- }
-
- return set_flex_direction(result, type);
+ return css__copy_flex_direction(
+ type == CSS_FLEX_DIRECTION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c
index 7f37cfe..4650cef 100644
--- a/src/select/properties/flex_grow.c
+++ b/src/select/properties/flex_grow.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_GROW_INHERIT;
css_fixed flex_grow = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_GROW_SET;
flex_grow = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_grow(state->computed, value, flex_grow);
}
@@ -46,6 +46,20 @@ css_error css__initial_flex_grow(css_select_state *state)
return set_flex_grow(state->computed, CSS_FLEX_GROW_SET, INTTOFIX(0));
}
+css_error css__copy_flex_grow(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_grow = 0;
+ uint8_t type = get_flex_grow(from, &flex_grow);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_grow(to, type, flex_grow);
+}
+
css_error css__compose_flex_grow(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_grow(const css_computed_style *parent,
css_fixed flex_grow = 0;
uint8_t type = get_flex_grow(child, &flex_grow);
- if (type == CSS_FLEX_GROW_INHERIT) {
- type = get_flex_grow(parent, &flex_grow);
- }
-
- return set_flex_grow(result, type, flex_grow);
+ return css__copy_flex_grow(
+ type == CSS_FLEX_GROW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c
index d1acd2a..9b39ed0 100644
--- a/src/select/properties/flex_shrink.c
+++ b/src/select/properties/flex_shrink.c
@@ -20,7 +20,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
uint16_t value = CSS_FLEX_SHRINK_INHERIT;
css_fixed flex_shrink = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_FLEX_SHRINK_SET;
flex_shrink = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_shrink(state->computed, value, flex_shrink);
}
@@ -46,6 +46,20 @@ css_error css__initial_flex_shrink(css_select_state *state)
return set_flex_shrink(state->computed, CSS_FLEX_SHRINK_SET, INTTOFIX(1));
}
+css_error css__copy_flex_shrink(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed flex_shrink = 0;
+ uint8_t type = get_flex_shrink(from, &flex_shrink);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_shrink(to, type, flex_shrink);
+}
+
css_error css__compose_flex_shrink(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_flex_shrink(const css_computed_style *parent,
css_fixed flex_shrink = 0;
uint8_t type = get_flex_shrink(child, &flex_shrink);
- if (type == CSS_FLEX_SHRINK_INHERIT) {
- type = get_flex_shrink(parent, &flex_shrink);
- }
-
- return set_flex_shrink(result, type, flex_shrink);
+ return css__copy_flex_shrink(
+ type == CSS_FLEX_SHRINK_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/flex_wrap.c b/src/select/properties/flex_wrap.c
index 688a9b6..3ca9b74 100644
--- a/src/select/properties/flex_wrap.c
+++ b/src/select/properties/flex_wrap.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_WRAP_NOWRAP:
value = CSS_FLEX_WRAP_NOWRAP;
@@ -36,7 +36,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_wrap(state->computed, value);
}
@@ -54,16 +54,27 @@ css_error css__initial_flex_wrap(css_select_state *state)
return set_flex_wrap(state->computed, CSS_FLEX_WRAP_NOWRAP);
}
+css_error css__copy_flex_wrap(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ uint8_t type = get_flex_wrap(from);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_wrap(to, type);
+}
+
css_error css__compose_flex_wrap(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_wrap(child);
- if (type == CSS_FLEX_WRAP_INHERIT) {
- type = get_flex_wrap(parent);
- }
-
- return set_flex_wrap(result, type);
+ return css__copy_flex_wrap(
+ type == CSS_FLEX_WRAP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/float.c b/src/select/properties/float.c
index c3ba909..6d009bb 100644
--- a/src/select/properties/float.c
+++ b/src/select/properties/float.c
@@ -21,7 +21,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLOAT_LEFT:
value = CSS_FLOAT_LEFT;
@@ -36,7 +36,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_float(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_float(css_select_state *state)
return set_float(state->computed, CSS_FLOAT_NONE);
}
+css_error css__copy_float(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_float(to, get_float(from));
+}
+
css_error css__compose_float(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_float(child);
- if (type == CSS_FLOAT_INHERIT) {
- type = get_float(parent);
- }
-
- return set_float(result, type);
+ return css__copy_float(
+ type == CSS_FLOAT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c
index f853fcc..b0183e2 100644
--- a/src/select/properties/font_family.c
+++ b/src/select/properties/font_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
lwc_string **fonts = NULL;
uint32_t n_fonts = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != FONT_FAMILY_END) {
@@ -134,7 +134,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_font_family(state->computed, value, fonts);
@@ -182,42 +182,41 @@ css_error css__initial_font_family(css_select_state *state)
return css__set_font_family_from_hint(&hint, state->computed);
}
-css_error css__compose_font_family(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_font_family(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
- lwc_string **names = NULL;
- uint8_t type = get_font_family(child, &names);
-
- if (type == CSS_FONT_FAMILY_INHERIT || result != child) {
- size_t n_names = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_FONT_FAMILY_INHERIT)
- type = get_font_family(parent, &names);
+ lwc_string **copy = NULL;
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(from, &font_family);
- if (names != NULL) {
- lwc_string **i;
-
- for (i = names; (*i) != NULL; i++)
- n_names++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_names + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, font_family, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, names, (n_names + 1) *
- sizeof(lwc_string *));
- }
+ error = set_font_family(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_font_family(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_font_family(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **font_family = NULL;
+ uint8_t type = get_font_family(child, &font_family);
- return CSS_OK;
+ return css__copy_font_family(
+ type == CSS_FONT_FAMILY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index a0269be..3ee9ce0 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
css_fixed size = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_SIZE_DIMENSION:
value = CSS_FONT_SIZE_DIMENSION;
@@ -65,7 +65,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_size(state->computed, value, size, unit);
}
@@ -85,6 +85,21 @@ css_error css__initial_font_size(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_font_size(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed size = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_font_size(from, &size, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_size(to, type, size, unit);
+}
+
css_error css__compose_font_size(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -93,10 +108,8 @@ css_error css__compose_font_size(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_font_size(child, &size, &unit);
- if (type == CSS_FONT_SIZE_INHERIT) {
- type = get_font_size(parent, &size, &unit);
- }
-
- return set_font_size(result, type, size, unit);
+ return css__copy_font_size(
+ type == CSS_FONT_SIZE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c
index 0ba1fdd..fe605b8 100644
--- a/src/select/properties/font_style.c
+++ b/src/select/properties/font_style.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_STYLE_NORMAL:
value = CSS_FONT_STYLE_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_style(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_font_style(css_select_state *state)
return set_font_style(state->computed, CSS_FONT_STYLE_NORMAL);
}
+css_error css__copy_font_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_style(to, get_font_style(from));
+}
+
css_error css__compose_font_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_style(child);
- if (type == CSS_FONT_STYLE_INHERIT) {
- type= get_font_style(parent);
- }
-
- return set_font_style(result, type);
+ return css__copy_font_style(
+ type == CSS_FONT_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c
index a9b6e56..9668fc3 100644
--- a/src/select/properties/font_variant.c
+++ b/src/select/properties/font_variant.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_VARIANT_NORMAL:
value = CSS_FONT_VARIANT_NORMAL;
@@ -33,7 +33,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_variant(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_font_variant(css_select_state *state)
return set_font_variant(state->computed, CSS_FONT_VARIANT_NORMAL);
}
+css_error css__copy_font_variant(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_variant(to, get_font_variant(from));
+}
+
css_error css__compose_font_variant(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_variant(child);
- if (type == CSS_FONT_VARIANT_INHERIT) {
- type = get_font_variant(parent);
- }
-
- return set_font_variant(result, type);
+ return css__copy_font_variant(
+ type == CSS_FONT_VARIANT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c
index c0c2f2b..da918a1 100644
--- a/src/select/properties/font_weight.c
+++ b/src/select/properties/font_weight.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_WEIGHT_NORMAL:
value = CSS_FONT_WEIGHT_NORMAL;
@@ -66,7 +66,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_weight(state->computed, value);
}
@@ -84,16 +84,25 @@ css_error css__initial_font_weight(css_select_state *state)
return set_font_weight(state->computed, CSS_FONT_WEIGHT_NORMAL);
}
+css_error css__copy_font_weight(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_weight(to, get_font_weight(from));
+}
+
css_error css__compose_font_weight(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_weight(child);
- if (type == CSS_FONT_WEIGHT_INHERIT) {
- type = get_font_weight(parent);
- }
-
- return set_font_weight(result, type);
+ return css__copy_font_weight(
+ type == CSS_FONT_WEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/height.c b/src/select/properties/height.c
index 1d74c4a..d449e72 100644
--- a/src/select/properties/height.c
+++ b/src/select/properties/height.c
@@ -32,6 +32,21 @@ css_error css__initial_height(css_select_state *state)
return set_height(state->computed, CSS_HEIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_height(to, type, length, unit);
+}
+
css_error css__compose_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_height(child, &length, &unit);
- if (type == CSS_HEIGHT_INHERIT) {
- type = get_height(parent, &length, &unit);
- }
-
- return set_height(result, type, length, unit);
+ return css__copy_height(
+ type == CSS_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c
index 40936dd..10ff228 100644
--- a/src/select/properties/helpers.c
+++ b/src/select/properties/helpers.c
@@ -33,7 +33,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
assert(CSS_BACKGROUND_COLOR_CURRENT_COLOR ==
(enum css_background_color_e)CSS_BORDER_COLOR_CURRENT_COLOR);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_COLOR_TRANSPARENT:
value = CSS_BACKGROUND_COLOR_COLOR;
@@ -50,7 +50,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, color);
}
@@ -65,7 +65,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT;
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BACKGROUND_IMAGE_NONE:
value = CSS_BACKGROUND_IMAGE_NONE;
@@ -80,7 +80,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, uri);
}
@@ -95,7 +95,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_STYLE_NONE:
value = CSS_BORDER_STYLE_NONE;
@@ -131,7 +131,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -147,7 +147,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BORDER_WIDTH_SET:
value = CSS_BORDER_WIDTH_WIDTH;
@@ -171,7 +171,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -187,7 +187,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOTTOM_SET:
value = CSS_BOTTOM_SET;
@@ -205,7 +205,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -221,7 +221,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LETTER_SPACING_SET:
value = CSS_LETTER_SPACING_SET;
@@ -239,7 +239,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -255,7 +255,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case MAX_HEIGHT_SET:
value = CSS_MAX_HEIGHT_SET;
@@ -273,7 +273,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -289,7 +289,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_MIN_HEIGHT_SET;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -301,7 +301,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length, unit);
}
@@ -317,7 +317,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo values */
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = 0;
length = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(length));
@@ -325,7 +325,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo lose fun != NULL once all properties have set routines */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value, length);
}
@@ -340,7 +340,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PAGE_BREAK_AFTER_AUTO:
value = CSS_PAGE_BREAK_AFTER_AUTO;
@@ -362,7 +362,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -377,7 +377,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BREAK_AFTER_AUTO:
value = CSS_BREAK_AFTER_AUTO;
@@ -411,7 +411,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv,
/** \todo lose fun != NULL */
if (fun != NULL && css__outranks_existing(getOpcode(opv),
- isImportant(opv), state, isInherit(opv))) {
+ isImportant(opv), state, getFlagValue(opv))) {
return fun(state->computed, value);
}
@@ -427,7 +427,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_computed_counter *counters = NULL;
uint32_t n_counters = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case COUNTER_INCREMENT_NAMED:
{
@@ -490,7 +490,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = fun(state->computed, value, counters);
diff --git a/src/select/properties/helpers.h b/src/select/properties/helpers.h
index 60e5b4c..16c5d7a 100644
--- a/src/select/properties/helpers.h
+++ b/src/select/properties/helpers.h
@@ -59,4 +59,137 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_error (*fun)(css_computed_style *, uint8_t,
css_computed_counter *));
+/** Copy NULL terminated array of lwc_string pointers. */
+static inline css_error css__copy_lwc_string_array(
+ bool ref,
+ lwc_string *const*orig,
+ lwc_string ***copy_out)
+{
+ size_t count = 0;
+ lwc_string **copy = NULL;
+
+ if (orig != NULL) {
+ for (lwc_string *const*i = orig; (*i) != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i] = lwc_string_ref(orig[i]);
+ }
+ copy[count] = NULL;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy NULL-name terminated array of css_computed_counter items. */
+static inline css_error css__copy_computed_counter_array(
+ bool ref,
+ const css_computed_counter *orig,
+ css_computed_counter **copy_out)
+{
+ size_t count = 0;
+ css_computed_counter *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_counter *i = orig;
+ i->name != NULL; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ copy[i].name = lwc_string_ref(orig[i].name);
+ copy[i].value = orig[i].value;
+ }
+ copy[count].name = NULL;
+ copy[count].value = 0;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
+/** Copy type:none terminated array of css_computed_content_item items. */
+static inline css_error css__copy_computed_content_item_array(
+ bool ref,
+ const css_computed_content_item *orig,
+ css_computed_content_item **copy_out)
+{
+ size_t count = 0;
+ css_computed_content_item *copy = NULL;
+
+ if (orig != NULL) {
+ for (const css_computed_content_item *i = orig;
+ i->type != CSS_COMPUTED_CONTENT_NONE; i++) {
+ count++;
+ }
+
+ copy = malloc((count + 1) * sizeof(*copy));
+ if (copy == NULL) {
+ return CSS_NOMEM;
+ }
+
+ if (ref) {
+ for (size_t i = 0; i < count; i++) {
+ switch (orig[i].type) {
+ case CSS_COMPUTED_CONTENT_STRING:
+ copy[i].data.string = lwc_string_ref(
+ orig[i].data.string);
+ break;
+ case CSS_COMPUTED_CONTENT_URI:
+ copy[i].data.uri = lwc_string_ref(
+ orig[i].data.uri);
+ break;
+ case CSS_COMPUTED_CONTENT_ATTR:
+ copy[i].data.attr = lwc_string_ref(
+ orig[i].data.attr);
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTER:
+ copy[i].data.counter.name = lwc_string_ref(
+ orig[i].data.counter.name);
+ copy[i].data.counter.style =
+ orig[i].data.counter.style;
+ break;
+ case CSS_COMPUTED_CONTENT_COUNTERS:
+ copy[i].data.counters.name = lwc_string_ref(
+ orig[i].data.counters.name);
+ copy[i].data.counters.sep = lwc_string_ref(
+ orig[i].data.counters.sep);
+ copy[i].data.counters.style =
+ orig[i].data.counters.style;
+ break;
+ default:
+ break;
+ }
+ copy[i].type = orig[i].type;
+ }
+ copy[count].type = CSS_COMPUTED_CONTENT_NONE;
+ } else {
+ memcpy(copy, orig, (count + 1) * sizeof(*copy));
+ }
+ }
+
+ *copy_out = copy;
+ return CSS_OK;
+}
+
#endif
diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c
index 2e17ca5..385bab7 100644
--- a/src/select/properties/justify_content.c
+++ b/src/select/properties/justify_content.c
@@ -21,7 +21,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case JUSTIFY_CONTENT_FLEX_START:
value = CSS_JUSTIFY_CONTENT_FLEX_START;
@@ -45,7 +45,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_justify_content(state->computed, value);
}
@@ -64,16 +64,25 @@ css_error css__initial_justify_content(css_select_state *state)
CSS_JUSTIFY_CONTENT_FLEX_START);
}
+css_error css__copy_justify_content(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_justify_content(to, get_justify_content(from));
+}
+
css_error css__compose_justify_content(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_justify_content(child);
- if (type == CSS_JUSTIFY_CONTENT_INHERIT) {
- type = get_justify_content(parent);
- }
-
- return set_justify_content(result, type);
+ return css__copy_justify_content(
+ type == CSS_JUSTIFY_CONTENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/left.c b/src/select/properties/left.c
index 4baa324..ca8c844 100644
--- a/src/select/properties/left.c
+++ b/src/select/properties/left.c
@@ -32,6 +32,21 @@ css_error css__initial_left(css_select_state *state)
return set_left(state->computed, CSS_LEFT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_left(to, type, length, unit);
+}
+
css_error css__compose_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_left(child, &length, &unit);
- if (type == CSS_LEFT_INHERIT) {
- type = get_left(parent, &length, &unit);
- }
-
- return set_left(result, type, length, unit);
+ return css__copy_left(
+ type == CSS_LEFT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/letter_spacing.c b/src/select/properties/letter_spacing.c
index 27ea04b..9c8e50c 100644
--- a/src/select/properties/letter_spacing.c
+++ b/src/select/properties/letter_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_letter_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_letter_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_letter_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_letter_spacing(to, type, length, unit);
+}
+
css_error css__compose_letter_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_letter_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_letter_spacing(child, &length, &unit);
- if (type == CSS_LETTER_SPACING_INHERIT) {
- type = get_letter_spacing(parent, &length, &unit);
- }
-
- return set_letter_spacing(result, type, length, unit);
+ return css__copy_letter_spacing(
+ type == CSS_LETTER_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index 091a575..7300b5d 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -21,7 +21,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LINE_HEIGHT_NUMBER:
value = CSS_LINE_HEIGHT_NUMBER;
@@ -44,7 +44,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_line_height(state->computed, value, val, unit);
}
@@ -64,6 +64,21 @@ css_error css__initial_line_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_line_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_line_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_line_height(to, type, length, unit);
+}
+
css_error css__compose_line_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -72,10 +87,8 @@ css_error css__compose_line_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_line_height(child, &length, &unit);
- if (type == CSS_LINE_HEIGHT_INHERIT) {
- type = get_line_height(parent, &length, &unit);
- }
-
- return set_line_height(result, type, length, unit);
+ return css__copy_line_height(
+ type == CSS_LINE_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_image.c b/src/select/properties/list_style_image.c
index cc77eb4..7a41c3a 100644
--- a/src/select/properties/list_style_image.c
+++ b/src/select/properties/list_style_image.c
@@ -39,6 +39,20 @@ css_error css__initial_list_style_image(css_select_state *state)
CSS_LIST_STYLE_IMAGE_NONE, NULL);
}
+css_error css__copy_list_style_image(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ lwc_string *url;
+ uint8_t type = get_list_style_image(from, &url);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_image(to, type, url);
+}
+
css_error css__compose_list_style_image(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -46,10 +60,8 @@ css_error css__compose_list_style_image(const css_computed_style *parent,
lwc_string *url;
uint8_t type = get_list_style_image(child, &url);
- if (type == CSS_LIST_STYLE_IMAGE_INHERIT) {
- type = get_list_style_image(parent, &url);
- }
-
- return set_list_style_image(result, type, url);
+ return css__copy_list_style_image(
+ type == CSS_LIST_STYLE_IMAGE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c
index 02d7651..ca46850 100644
--- a/src/select/properties/list_style_position.c
+++ b/src/select/properties/list_style_position.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_POSITION_INSIDE:
value = CSS_LIST_STYLE_POSITION_INSIDE;
@@ -33,7 +33,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_position(state->computed, value);
}
@@ -52,16 +52,25 @@ css_error css__initial_list_style_position(css_select_state *state)
CSS_LIST_STYLE_POSITION_OUTSIDE);
}
+css_error css__copy_list_style_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_position(to, get_list_style_position(from));
+}
+
css_error css__compose_list_style_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_position(child);
- if (type == CSS_LIST_STYLE_POSITION_INHERIT) {
- type = get_list_style_position(parent);
- }
-
- return set_list_style_position(result, type);
+ return css__copy_list_style_position(
+ type == CSS_LIST_STYLE_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c
index e32d1b1..9d809e6 100644
--- a/src/select/properties/list_style_type.c
+++ b/src/select/properties/list_style_type.c
@@ -21,7 +21,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LIST_STYLE_TYPE_DISC:
value = CSS_LIST_STYLE_TYPE_DISC;
@@ -183,7 +183,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_list_style_type(state->computed, value);
}
@@ -201,15 +201,24 @@ css_error css__initial_list_style_type(css_select_state *state)
return set_list_style_type(state->computed, CSS_LIST_STYLE_TYPE_DISC);
}
+css_error css__copy_list_style_type(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_list_style_type(to, get_list_style_type(from));
+}
+
css_error css__compose_list_style_type(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_list_style_type(child);
- if (type == CSS_LIST_STYLE_TYPE_INHERIT) {
- type = get_list_style_type(parent);
- }
-
- return set_list_style_type(result, type);
+ return css__copy_list_style_type(
+ type == CSS_LIST_STYLE_TYPE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_bottom.c b/src/select/properties/margin_bottom.c
index 3b1d8a1..a0ffd89 100644
--- a/src/select/properties/margin_bottom.c
+++ b/src/select/properties/margin_bottom.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_bottom(css_select_state *state)
return set_margin_bottom(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_bottom(to, type, length, unit);
+}
+
css_error css__compose_margin_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_bottom(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_bottom(parent, &length, &unit);
- }
-
- return set_margin_bottom(result, type, length, unit);
+ return css__copy_margin_bottom(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_left.c b/src/select/properties/margin_left.c
index 240285a..b163fba 100644
--- a/src/select/properties/margin_left.c
+++ b/src/select/properties/margin_left.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_left(css_select_state *state)
return set_margin_left(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_left(to, type, length, unit);
+}
+
css_error css__compose_margin_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_left(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_left(parent, &length, &unit);
- }
-
- return set_margin_left(result, type, length, unit);
+ return css__copy_margin_left(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_right.c b/src/select/properties/margin_right.c
index 737fbee..2c15b54 100644
--- a/src/select/properties/margin_right.c
+++ b/src/select/properties/margin_right.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_right(css_select_state *state)
return set_margin_right(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_right(to, type, length, unit);
+}
+
css_error css__compose_margin_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_right(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_right(parent, &length, &unit);
- }
-
- return set_margin_right(result, type, length, unit);
+ return css__copy_margin_right(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/margin_top.c b/src/select/properties/margin_top.c
index 5563a48..1df811d 100644
--- a/src/select/properties/margin_top.c
+++ b/src/select/properties/margin_top.c
@@ -32,6 +32,21 @@ css_error css__initial_margin_top(css_select_state *state)
return set_margin_top(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_margin_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_margin_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_margin_top(to, type, length, unit);
+}
+
css_error css__compose_margin_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_margin_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_margin_top(child, &length, &unit);
- if (type == CSS_MARGIN_INHERIT) {
- type = get_margin_top(parent, &length, &unit);
- }
-
- return set_margin_top(result, type, length, unit);
+ return css__copy_margin_top(
+ type == CSS_MARGIN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_height.c b/src/select/properties/max_height.c
index e03c8da..1dcf09d 100644
--- a/src/select/properties/max_height.c
+++ b/src/select/properties/max_height.c
@@ -33,6 +33,21 @@ css_error css__initial_max_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_max_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_height(to, type, length, unit);
+}
+
css_error css__compose_max_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_max_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_height(child, &length, &unit);
- if (type == CSS_MAX_HEIGHT_INHERIT) {
- type = get_max_height(parent, &length, &unit);
- }
-
- return set_max_height(result, type, length, unit);
+ return css__copy_max_height(
+ type == CSS_MAX_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/max_width.c b/src/select/properties/max_width.c
index ec98712..11d8ade 100644
--- a/src/select/properties/max_width.c
+++ b/src/select/properties/max_width.c
@@ -32,6 +32,21 @@ css_error css__initial_max_width(css_select_state *state)
return set_max_width(state->computed, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX);
}
+css_error css__copy_max_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_max_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_max_width(to, type, length, unit);
+}
+
css_error css__compose_max_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_max_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_max_width(child, &length, &unit);
- if (type == CSS_MAX_WIDTH_INHERIT) {
- type = get_max_width(parent, &length, &unit);
- }
-
- return set_max_width(result, type, length, unit);
+ return css__copy_max_width(
+ type == CSS_MAX_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_height.c b/src/select/properties/min_height.c
index a5389ce..d05655c 100644
--- a/src/select/properties/min_height.c
+++ b/src/select/properties/min_height.c
@@ -33,6 +33,21 @@ css_error css__initial_min_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_height(to, type, length, unit);
+}
+
css_error css__compose_min_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_height(child, &length, &unit);
- if (type == CSS_MIN_HEIGHT_INHERIT) {
- type = get_min_height(parent, &length, &unit);
- }
-
- return set_min_height(result, type, length, unit);
+ return css__copy_min_height(
+ type == CSS_MIN_HEIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/min_width.c b/src/select/properties/min_width.c
index 8460e01..af709d3 100644
--- a/src/select/properties/min_width.c
+++ b/src/select/properties/min_width.c
@@ -33,6 +33,21 @@ css_error css__initial_min_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_min_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_min_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_min_width(to, type, length, unit);
+}
+
css_error css__compose_min_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_min_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_min_width(child, &length, &unit);
- if (type == CSS_MIN_WIDTH_INHERIT) {
- type = get_min_width(parent, &length, &unit);
- }
-
- return set_min_width(result, type, length, unit);
+ return css__copy_min_width(
+ type == CSS_MIN_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c
index aadab0b..818af62 100644
--- a/src/select/properties/opacity.c
+++ b/src/select/properties/opacity.c
@@ -20,7 +20,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
uint16_t value = CSS_OPACITY_INHERIT;
css_fixed opacity = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_Z_INDEX_SET;
opacity = *((css_fixed *) style->bytecode);
@@ -28,7 +28,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_opacity(state->computed, value, opacity);
}
@@ -46,6 +46,20 @@ css_error css__initial_opacity(css_select_state *state)
return set_opacity(state->computed, CSS_OPACITY_SET, INTTOFIX(1));
}
+css_error css__copy_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed opacity = 0;
+ uint8_t type = get_opacity(from, &opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_opacity(to, type, opacity);
+}
+
css_error css__compose_opacity(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_opacity(const css_computed_style *parent,
css_fixed opacity = 0;
uint8_t type = get_opacity(child, &opacity);
- if (type == CSS_OPACITY_INHERIT) {
- type = get_opacity(parent, &opacity);
- }
-
- return set_opacity(result, type, opacity);
+ return css__copy_opacity(
+ type == CSS_OPACITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/order.c b/src/select/properties/order.c
index 0366537..4004c0e 100644
--- a/src/select/properties/order.c
+++ b/src/select/properties/order.c
@@ -20,7 +20,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
uint16_t value = CSS_ORDER_INHERIT;
css_fixed order = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
value = CSS_ORDER_SET;
order = FIXTOINT(*((css_fixed *) style->bytecode));
@@ -28,7 +28,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_order(state->computed, value, order);
}
@@ -46,6 +46,20 @@ css_error css__initial_order(css_select_state *state)
return set_order(state->computed, CSS_ORDER_SET, 0);
}
+css_error css__copy_order(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t order = 0;
+ uint8_t type = get_order(from, &order);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_order(to, type, order);
+}
+
css_error css__compose_order(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -53,10 +67,8 @@ css_error css__compose_order(const css_computed_style *parent,
int32_t order = 0;
uint8_t type = get_order(child, &order);
- if (type == CSS_ORDER_INHERIT) {
- type = get_order(parent, &order);
- }
-
- return set_order(result, type, order);
+ return css__copy_order(
+ type == CSS_ORDER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/orphans.c b/src/select/properties/orphans.c
index f169b81..b0fee43 100644
--- a/src/select/properties/orphans.c
+++ b/src/select/properties/orphans.c
@@ -31,6 +31,20 @@ css_error css__initial_orphans(css_select_state *state)
return set_orphans(state->computed, CSS_ORPHANS_SET, 2);
}
+css_error css__copy_orphans(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_orphans(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_orphans(to, type, count);
+}
+
css_error css__compose_orphans(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_orphans(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_orphans(child, &count);
- if (type == CSS_ORPHANS_INHERIT) {
- type = get_orphans(parent, &count);
- }
-
- return set_orphans(result, type, count);
+ return css__copy_orphans(
+ type == CSS_ORPHANS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c
index 97846ac..359960f 100644
--- a/src/select/properties/outline_color.c
+++ b/src/select/properties/outline_color.c
@@ -20,7 +20,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
uint16_t value = CSS_OUTLINE_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OUTLINE_COLOR_TRANSPARENT:
value = CSS_OUTLINE_COLOR_COLOR;
@@ -40,7 +40,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_outline_color(state->computed, value, color);
}
@@ -58,6 +58,20 @@ css_error css__initial_outline_color(css_select_state *state)
return set_outline_color(state->computed, CSS_OUTLINE_COLOR_INVERT, 0);
}
+css_error css__copy_outline_color(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_color color = 0;
+ uint8_t type = get_outline_color(from, &color);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_color(to, type, color);
+}
+
css_error css__compose_outline_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -65,9 +79,7 @@ css_error css__compose_outline_color(const css_computed_style *parent,
css_color color = 0;
uint8_t type = get_outline_color(child, &color);
- if (type == CSS_OUTLINE_COLOR_INHERIT) {
- type = get_outline_color(parent, &color);
- }
-
- return set_outline_color(result, type, color);
+ return css__copy_outline_color(
+ type == CSS_OUTLINE_COLOR_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_style.c b/src/select/properties/outline_style.c
index 5c30735..acdab03 100644
--- a/src/select/properties/outline_style.c
+++ b/src/select/properties/outline_style.c
@@ -31,16 +31,25 @@ css_error css__initial_outline_style(css_select_state *state)
return set_outline_style(state->computed, CSS_OUTLINE_STYLE_NONE);
}
+css_error css__copy_outline_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_style(to, get_outline_style(from));
+}
+
css_error css__compose_outline_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_outline_style(child);
- if (type == CSS_OUTLINE_STYLE_INHERIT) {
- type = get_outline_style(parent);
- }
-
- return set_outline_style(result, type);
+ return css__copy_outline_style(
+ type == CSS_OUTLINE_STYLE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/outline_width.c b/src/select/properties/outline_width.c
index 0289c57..dbc0298 100644
--- a/src/select/properties/outline_width.c
+++ b/src/select/properties/outline_width.c
@@ -33,6 +33,21 @@ css_error css__initial_outline_width(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_outline_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_outline_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_outline_width(to, type, length, unit);
+}
+
css_error css__compose_outline_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_outline_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_outline_width(child, &length, &unit);
- if (type == CSS_OUTLINE_WIDTH_INHERIT) {
- type = get_outline_width(parent, &length, &unit);
- }
-
- return set_outline_width(result, type, length, unit);
+ return css__copy_outline_width(
+ type == CSS_OUTLINE_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c
index 817d1d2..98dfba5 100644
--- a/src/select/properties/overflow_x.c
+++ b/src/select/properties/overflow_x.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_x(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_overflow_x(css_select_state *state)
return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_x(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_x(to, get_overflow_x(from));
+}
+
css_error css__compose_overflow_x(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_x(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_x(parent);
- }
-
- return set_overflow_x(result, type);
+ return css__copy_overflow_x(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c
index b54c4c8..d7795a2 100644
--- a/src/select/properties/overflow_y.c
+++ b/src/select/properties/overflow_y.c
@@ -21,7 +21,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case OVERFLOW_VISIBLE:
value = CSS_OVERFLOW_VISIBLE;
@@ -39,7 +39,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_overflow_y(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_overflow_y(css_select_state *state)
return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE);
}
+css_error css__copy_overflow_y(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_overflow_y(to, get_overflow_y(from));
+}
+
css_error css__compose_overflow_y(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_overflow_y(child);
- if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow_y(parent);
- }
-
- return set_overflow_y(result, type);
+ return css__copy_overflow_y(
+ type == CSS_OVERFLOW_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_bottom.c b/src/select/properties/padding_bottom.c
index e3b36f7..53c749c 100644
--- a/src/select/properties/padding_bottom.c
+++ b/src/select/properties/padding_bottom.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_bottom(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_bottom(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_bottom(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_bottom(to, type, length, unit);
+}
+
css_error css__compose_padding_bottom(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_bottom(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_bottom(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_bottom(parent, &length, &unit);
- }
-
- return set_padding_bottom(result, type, length, unit);
+ return css__copy_padding_bottom(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_left.c b/src/select/properties/padding_left.c
index bdea11e..b61ca83 100644
--- a/src/select/properties/padding_left.c
+++ b/src/select/properties/padding_left.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_left(css_select_state *state)
return set_padding_left(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_left(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_left(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_left(to, type, length, unit);
+}
+
css_error css__compose_padding_left(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_left(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_left(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_left(parent, &length, &unit);
- }
-
- return set_padding_left(result, type, length, unit);
+ return css__copy_padding_left(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_right.c b/src/select/properties/padding_right.c
index 82c1ed3..35417d6 100644
--- a/src/select/properties/padding_right.c
+++ b/src/select/properties/padding_right.c
@@ -33,6 +33,21 @@ css_error css__initial_padding_right(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_padding_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_right(to, type, length, unit);
+}
+
css_error css__compose_padding_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_padding_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_right(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_right(parent, &length, &unit);
- }
-
- return set_padding_right(result, type, length, unit);
+ return css__copy_padding_right(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/padding_top.c b/src/select/properties/padding_top.c
index f6d8b3e..a2cec95 100644
--- a/src/select/properties/padding_top.c
+++ b/src/select/properties/padding_top.c
@@ -32,6 +32,21 @@ css_error css__initial_padding_top(css_select_state *state)
return set_padding_top(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX);
}
+css_error css__copy_padding_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_padding_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_padding_top(to, type, length, unit);
+}
+
css_error css__compose_padding_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_padding_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_padding_top(child, &length, &unit);
- if (type == CSS_PADDING_INHERIT) {
- type = get_padding_top(parent, &length, &unit);
- }
-
- return set_padding_top(result, type, length, unit);
+ return css__copy_padding_top(
+ type == CSS_PADDING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_after.c b/src/select/properties/page_break_after.c
index fdb6774..4065a17 100644
--- a/src/select/properties/page_break_after.c
+++ b/src/select/properties/page_break_after.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_after(css_select_state *state)
CSS_PAGE_BREAK_AFTER_AUTO);
}
+css_error css__copy_page_break_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_after(to, get_page_break_after(from));
+}
+
css_error css__compose_page_break_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_after(child);
- if (type == CSS_PAGE_BREAK_AFTER_INHERIT) {
- type = get_page_break_after(parent);
- }
-
- return set_page_break_after(result, type);
+ return css__copy_page_break_after(
+ type == CSS_PAGE_BREAK_AFTER_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_before.c b/src/select/properties/page_break_before.c
index 1491997..d8fdd93 100644
--- a/src/select/properties/page_break_before.c
+++ b/src/select/properties/page_break_before.c
@@ -33,15 +33,24 @@ css_error css__initial_page_break_before(css_select_state *state)
CSS_PAGE_BREAK_BEFORE_AUTO);
}
+css_error css__copy_page_break_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_before(to, get_page_break_before(from));
+}
+
css_error css__compose_page_break_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_before(child);
- if (type == CSS_PAGE_BREAK_BEFORE_INHERIT) {
- type = get_page_break_before(parent);
- }
-
- return set_page_break_before(result, type);
+ return css__copy_page_break_before(
+ type == CSS_PAGE_BREAK_BEFORE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/page_break_inside.c b/src/select/properties/page_break_inside.c
index ddcb19f..8655c40 100644
--- a/src/select/properties/page_break_inside.c
+++ b/src/select/properties/page_break_inside.c
@@ -33,16 +33,25 @@ css_error css__initial_page_break_inside(css_select_state *state)
CSS_PAGE_BREAK_INSIDE_AUTO);
}
+css_error css__copy_page_break_inside(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_page_break_inside(to, get_page_break_inside(from));
+}
+
css_error css__compose_page_break_inside(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_page_break_inside(child);
- if (type == CSS_PAGE_BREAK_INSIDE_INHERIT) {
- type = get_page_break_inside(parent);
- }
-
- return set_page_break_inside(result, type);
+ return css__copy_page_break_inside(
+ type == CSS_PAGE_BREAK_INSIDE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/pause_after.c b/src/select/properties/pause_after.c
index 16bbefe..b8bf968 100644
--- a/src/select/properties/pause_after.c
+++ b/src/select/properties/pause_after.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_after(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_after(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_after(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pause_before.c b/src/select/properties/pause_before.c
index 7770615..74cb565 100644
--- a/src/select/properties/pause_before.c
+++ b/src/select/properties/pause_before.c
@@ -37,6 +37,16 @@ css_error css__initial_pause_before(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pause_before(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pause_before(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c
index c5484d9..c0c5c88 100644
--- a/src/select/properties/pitch.c
+++ b/src/select/properties/pitch.c
@@ -20,7 +20,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
css_fixed freq = 0;
uint32_t unit = UNIT_HZ;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PITCH_FREQUENCY:
freq = *((css_fixed *) style->bytecode);
@@ -41,7 +41,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo pitch */
}
@@ -64,6 +64,16 @@ css_error css__initial_pitch(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/pitch_range.c b/src/select/properties/pitch_range.c
index 52a5751..c8f7526 100644
--- a/src/select/properties/pitch_range.c
+++ b/src/select/properties/pitch_range.c
@@ -37,6 +37,16 @@ css_error css__initial_pitch_range(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_pitch_range(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_pitch_range(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c
index 413d75a..0f38f74 100644
--- a/src/select/properties/play_during.c
+++ b/src/select/properties/play_during.c
@@ -19,7 +19,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
{
lwc_string *uri = NULL;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case PLAY_DURING_URI:
css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri);
@@ -35,7 +35,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo play-during */
}
@@ -58,6 +58,16 @@ css_error css__initial_play_during(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_play_during(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_play_during(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/position.c b/src/select/properties/position.c
index 9f9658f..738dbff 100644
--- a/src/select/properties/position.c
+++ b/src/select/properties/position.c
@@ -21,7 +21,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case POSITION_STATIC:
value = CSS_POSITION_STATIC;
@@ -39,7 +39,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_position(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_position(css_select_state *state)
return set_position(state->computed, CSS_POSITION_STATIC);
}
+css_error css__copy_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_position(to, get_position(from));
+}
+
css_error css__compose_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_position(child);
- if (type == CSS_POSITION_INHERIT) {
- type = get_position(parent);
- }
-
- return set_position(result, type);
+ return css__copy_position(
+ type == CSS_POSITION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index 6eac397..be31d0b 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -18,6 +18,7 @@
css_error css__cascade_##pname (uint32_t opv, css_style *style, css_select_state *state); \
css_error css__set_##pname##_from_hint(const css_hint *hint, css_computed_style *style); \
css_error css__initial_##pname (css_select_state *state); \
+ css_error css__copy_##pname (const css_computed_style *from, css_computed_style *to); \
css_error css__compose_##pname (const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); \
uint32_t destroy_##pname (void *bytecode)
diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c
index 4144d8e..57fc48c 100644
--- a/src/select/properties/quotes.c
+++ b/src/select/properties/quotes.c
@@ -21,7 +21,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
lwc_string **quotes = NULL;
uint32_t n_quotes = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
value = CSS_QUOTES_STRING;
@@ -75,7 +75,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
css_error error;
error = set_quotes(state->computed, value, quotes);
@@ -123,43 +123,41 @@ css_error css__initial_quotes(css_select_state *state)
return css__set_quotes_from_hint(&hint, state->computed);
}
-css_error css__compose_quotes(const css_computed_style *parent,
- const css_computed_style *child,
- css_computed_style *result)
+css_error css__copy_quotes(
+ const css_computed_style *from,
+ css_computed_style *to)
{
css_error error;
+ lwc_string **copy = NULL;
lwc_string **quotes = NULL;
- uint8_t type = get_quotes(child, "es);
-
- if (type == CSS_QUOTES_INHERIT || result != child) {
- size_t n_quotes = 0;
- lwc_string **copy = NULL;
-
- if (type == CSS_QUOTES_INHERIT) {
- type = get_quotes(parent, "es);
- }
-
- if (quotes != NULL) {
- lwc_string **i;
+ uint8_t type = get_quotes(from, "es);
- for (i = quotes; (*i) != NULL; i++)
- n_quotes++;
+ if (from == to) {
+ return CSS_OK;
+ }
- copy = malloc((n_quotes + 1) * sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ error = css__copy_lwc_string_array(false, quotes, ©);
+ if (error != CSS_OK) {
+ return CSS_NOMEM;
+ }
- memcpy(copy, quotes, (n_quotes + 1) *
- sizeof(lwc_string *));
- }
+ error = set_quotes(to, type, copy);
+ if (error != CSS_OK) {
+ free(copy);
+ }
- error = set_quotes(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ return error;
+}
- return error;
- }
+css_error css__compose_quotes(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ lwc_string **quotes = NULL;
+ uint8_t type = get_quotes(child, "es);
- return CSS_OK;
+ return css__copy_quotes(
+ type == CSS_QUOTES_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/richness.c b/src/select/properties/richness.c
index 9656486..cd62d5c 100644
--- a/src/select/properties/richness.c
+++ b/src/select/properties/richness.c
@@ -37,6 +37,16 @@ css_error css__initial_richness(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_richness(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_richness(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/right.c b/src/select/properties/right.c
index 142e7e8..ee4f4a0 100644
--- a/src/select/properties/right.c
+++ b/src/select/properties/right.c
@@ -32,6 +32,21 @@ css_error css__initial_right(css_select_state *state)
return set_right(state->computed, CSS_RIGHT_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_right(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_right(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_right(to, type, length, unit);
+}
+
css_error css__compose_right(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_right(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_right(child, &length, &unit);
- if (type == CSS_RIGHT_INHERIT) {
- type = get_right(parent, &length, &unit);
- }
-
- return set_right(result, type, length, unit);
+ return css__copy_right(
+ type == CSS_RIGHT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c
index eb5528b..7b0d014 100644
--- a/src/select/properties/speak.c
+++ b/src/select/properties/speak.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NORMAL:
case SPEAK_NONE:
@@ -30,7 +30,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak */
}
@@ -53,6 +53,16 @@ css_error css__initial_speak(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c
index 0935528..88ad0d7 100644
--- a/src/select/properties/speak_header.c
+++ b/src/select/properties/speak_header.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_HEADER_ONCE:
case SPEAK_HEADER_ALWAYS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-header */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_header(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_header(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_header(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c
index fc54caf..1cd6e98 100644
--- a/src/select/properties/speak_numeral.c
+++ b/src/select/properties/speak_numeral.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_NUMERAL_DIGITS:
case SPEAK_NUMERAL_CONTINUOUS:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-numeral */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_numeral(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_numeral(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_numeral(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c
index 67cbdaf..916d530 100644
--- a/src/select/properties/speak_punctuation.c
+++ b/src/select/properties/speak_punctuation.c
@@ -19,7 +19,7 @@ css_error css__cascade_speak_punctuation(
{
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEAK_PUNCTUATION_CODE:
case SPEAK_PUNCTUATION_NONE:
@@ -29,7 +29,7 @@ css_error css__cascade_speak_punctuation(
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speak-punctuation */
}
@@ -52,6 +52,16 @@ css_error css__initial_speak_punctuation(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speak_punctuation(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speak_punctuation(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/speech_rate.c b/src/select/properties/speech_rate.c
index 5cec19b..296c248 100644
--- a/src/select/properties/speech_rate.c
+++ b/src/select/properties/speech_rate.c
@@ -19,7 +19,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
{
css_fixed rate = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case SPEECH_RATE_SET:
rate = *((css_fixed *) style->bytecode);
@@ -38,7 +38,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo speech-rate */
}
@@ -61,6 +61,16 @@ css_error css__initial_speech_rate(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_speech_rate(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_speech_rate(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/stress.c b/src/select/properties/stress.c
index c9d61dd..0320fd0 100644
--- a/src/select/properties/stress.c
+++ b/src/select/properties/stress.c
@@ -37,6 +37,16 @@ css_error css__initial_stress(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_stress(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_stress(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c
index c911e10..255ce37 100644
--- a/src/select/properties/table_layout.c
+++ b/src/select/properties/table_layout.c
@@ -21,7 +21,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TABLE_LAYOUT_AUTO:
value = CSS_TABLE_LAYOUT_AUTO;
@@ -33,7 +33,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_table_layout(state->computed, value);
}
@@ -51,16 +51,25 @@ css_error css__initial_table_layout(css_select_state *state)
return set_table_layout(state->computed, CSS_TABLE_LAYOUT_AUTO);
}
+css_error css__copy_table_layout(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_table_layout(to, get_table_layout(from));
+}
+
css_error css__compose_table_layout(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_table_layout(child);
- if (type == CSS_TABLE_LAYOUT_INHERIT) {
- type = get_table_layout(parent);
- }
-
- return set_table_layout(result, type);
+ return css__copy_table_layout(
+ type == CSS_TABLE_LAYOUT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c
index 808107f..303f8f5 100644
--- a/src/select/properties/text_align.c
+++ b/src/select/properties/text_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_ALIGN_LEFT:
value = CSS_TEXT_ALIGN_LEFT;
@@ -48,7 +48,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_align(state->computed, value);
}
@@ -66,15 +66,24 @@ css_error css__initial_text_align(css_select_state *state)
return set_text_align(state->computed, CSS_TEXT_ALIGN_DEFAULT);
}
+css_error css__copy_text_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_align(to, get_text_align(from));
+}
+
css_error css__compose_text_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_align(child);
- if (type == CSS_TEXT_ALIGN_INHERIT) {
- type = get_text_align(parent);
- } else if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
+ if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
/* This is purely for the benefit of HTML tables */
type = get_text_align(parent);
@@ -83,10 +92,15 @@ css_error css__compose_text_align(const css_computed_style *parent,
* inherit as normal. */
if (type == CSS_TEXT_ALIGN_LIBCSS_LEFT ||
type == CSS_TEXT_ALIGN_LIBCSS_CENTER ||
- type == CSS_TEXT_ALIGN_LIBCSS_RIGHT)
+ type == CSS_TEXT_ALIGN_LIBCSS_RIGHT) {
type = CSS_TEXT_ALIGN_DEFAULT;
+ }
+
+ return set_text_align(result, type);
}
- return set_text_align(result, type);
+ return css__copy_text_align(
+ type == CSS_TEXT_ALIGN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c
index 0e7544d..bfea8a8 100644
--- a/src/select/properties/text_decoration.c
+++ b/src/select/properties/text_decoration.c
@@ -23,7 +23,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
if (getValue(opv) == TEXT_DECORATION_NONE) {
value = CSS_TEXT_DECORATION_NONE;
} else {
@@ -41,7 +41,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_decoration(state->computed, value);
}
@@ -59,16 +59,25 @@ css_error css__initial_text_decoration(css_select_state *state)
return set_text_decoration(state->computed, CSS_TEXT_DECORATION_NONE);
}
+css_error css__copy_text_decoration(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_decoration(to, get_text_decoration(from));
+}
+
css_error css__compose_text_decoration(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_decoration(child);
- if (type == CSS_TEXT_DECORATION_INHERIT) {
- type = get_text_decoration(parent);
- }
-
- return set_text_decoration(result, type);
+ return css__copy_text_decoration(
+ type == CSS_TEXT_DECORATION_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_indent.c b/src/select/properties/text_indent.c
index 787c0be..3708130 100644
--- a/src/select/properties/text_indent.c
+++ b/src/select/properties/text_indent.c
@@ -33,6 +33,21 @@ css_error css__initial_text_indent(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_text_indent(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_text_indent(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_indent(to, type, length, unit);
+}
+
css_error css__compose_text_indent(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,10 +56,8 @@ css_error css__compose_text_indent(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_text_indent(child, &length, &unit);
- if (type == CSS_TEXT_INDENT_INHERIT) {
- type = get_text_indent(parent, &length, &unit);
- }
-
- return set_text_indent(result, type, length, unit);
+ return css__copy_text_indent(
+ type == CSS_TEXT_INDENT_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c
index 38cb427..3bc5757 100644
--- a/src/select/properties/text_transform.c
+++ b/src/select/properties/text_transform.c
@@ -21,7 +21,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case TEXT_TRANSFORM_CAPITALIZE:
value = CSS_TEXT_TRANSFORM_CAPITALIZE;
@@ -39,7 +39,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_text_transform(state->computed, value);
}
@@ -57,16 +57,25 @@ css_error css__initial_text_transform(css_select_state *state)
return set_text_transform(state->computed, CSS_TEXT_TRANSFORM_NONE);
}
+css_error css__copy_text_transform(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_text_transform(to, get_text_transform(from));
+}
+
css_error css__compose_text_transform(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_text_transform(child);
- if (type == CSS_TEXT_TRANSFORM_INHERIT) {
- type = get_text_transform(parent);
- }
-
- return set_text_transform(result, type);
+ return css__copy_text_transform(
+ type == CSS_TEXT_TRANSFORM_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/top.c b/src/select/properties/top.c
index 72129aa..473a105 100644
--- a/src/select/properties/top.c
+++ b/src/select/properties/top.c
@@ -32,6 +32,21 @@ css_error css__initial_top(css_select_state *state)
return set_top(state->computed, CSS_TOP_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_top(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_top(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_top(to, type, length, unit);
+}
+
css_error css__compose_top(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_top(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_top(child, &length, &unit);
- if (type == CSS_TOP_INHERIT) {
- type = get_top(parent, &length, &unit);
- }
-
- return set_top(result, type, length, unit);
+ return css__copy_top(
+ type == CSS_TOP_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c
index 5b91df1..ae0f4ad 100644
--- a/src/select/properties/unicode_bidi.c
+++ b/src/select/properties/unicode_bidi.c
@@ -21,7 +21,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case UNICODE_BIDI_NORMAL:
value = CSS_UNICODE_BIDI_NORMAL;
@@ -36,7 +36,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_unicode_bidi(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_unicode_bidi(css_select_state *state)
return set_unicode_bidi(state->computed, CSS_UNICODE_BIDI_NORMAL);
}
+css_error css__copy_unicode_bidi(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_unicode_bidi(to, get_unicode_bidi(from));
+}
+
css_error css__compose_unicode_bidi(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_unicode_bidi(child);
- if (type == CSS_UNICODE_BIDI_INHERIT) {
- type = get_unicode_bidi(parent);
- }
-
- return set_unicode_bidi(result, type);
+ return css__copy_unicode_bidi(
+ type == CSS_UNICODE_BIDI_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c
index 9fb7143..9fbffe6 100644
--- a/src/select/properties/vertical_align.c
+++ b/src/select/properties/vertical_align.c
@@ -21,7 +21,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
css_fixed length = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VERTICAL_ALIGN_SET:
value = CSS_VERTICAL_ALIGN_SET;
@@ -61,7 +61,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_vertical_align(state->computed, value, length, unit);
}
@@ -81,6 +81,21 @@ css_error css__initial_vertical_align(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_vertical_align(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_vertical_align(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_vertical_align(to, type, length, unit);
+}
+
css_error css__compose_vertical_align(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -89,10 +104,8 @@ css_error css__compose_vertical_align(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_vertical_align(child, &length, &unit);
- if (type == CSS_VERTICAL_ALIGN_INHERIT) {
- type = get_vertical_align(parent, &length, &unit);
- }
-
- return set_vertical_align(result, type, length, unit);
+ return css__copy_vertical_align(
+ type == CSS_VERTICAL_ALIGN_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c
index ef95252..674e433 100644
--- a/src/select/properties/visibility.c
+++ b/src/select/properties/visibility.c
@@ -21,7 +21,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VISIBILITY_VISIBLE:
value = CSS_VISIBILITY_VISIBLE;
@@ -36,7 +36,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_visibility(state->computed, value);
}
@@ -54,16 +54,25 @@ css_error css__initial_visibility(css_select_state *state)
return set_visibility(state->computed, CSS_VISIBILITY_VISIBLE);
}
+css_error css__copy_visibility(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_visibility(to, get_visibility(from));
+}
+
css_error css__compose_visibility(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_visibility(child);
- if (type == CSS_VISIBILITY_INHERIT) {
- type = get_visibility(parent);
- }
-
- return set_visibility(result, type);
+ return css__copy_visibility(
+ type == CSS_VISIBILITY_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c
index b370a2b..66e3123 100644
--- a/src/select/properties/voice_family.c
+++ b/src/select/properties/voice_family.c
@@ -21,7 +21,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
lwc_string **voices = NULL;
uint32_t n_voices = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
uint32_t v = getValue(opv);
while (v != VOICE_FAMILY_END) {
@@ -92,7 +92,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo voice-family */
if (n_voices > 0)
free(voices);
@@ -120,6 +120,16 @@ css_error css__initial_voice_family(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_voice_family(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_voice_family(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c
index 96787fa..65bdd03 100644
--- a/src/select/properties/volume.c
+++ b/src/select/properties/volume.c
@@ -20,7 +20,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PCT;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case VOLUME_NUMBER:
val = *((css_fixed *) style->bytecode);
@@ -46,7 +46,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
/** \todo volume */
}
@@ -69,6 +69,16 @@ css_error css__initial_volume(css_select_state *state)
return CSS_OK;
}
+css_error css__copy_volume(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ UNUSED(from);
+ UNUSED(to);
+
+ return CSS_OK;
+}
+
css_error css__compose_volume(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c
index b8d2e02..edc35cd 100644
--- a/src/select/properties/white_space.c
+++ b/src/select/properties/white_space.c
@@ -21,7 +21,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case WHITE_SPACE_NORMAL:
value = CSS_WHITE_SPACE_NORMAL;
@@ -42,7 +42,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_white_space(state->computed, value);
}
@@ -60,16 +60,25 @@ css_error css__initial_white_space(css_select_state *state)
return set_white_space(state->computed, CSS_WHITE_SPACE_NORMAL);
}
+css_error css__copy_white_space(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_white_space(to, get_white_space(from));
+}
+
css_error css__compose_white_space(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_white_space(child);
- if (type == CSS_WHITE_SPACE_INHERIT) {
- type = get_white_space(parent);
- }
-
- return set_white_space(result, type);
+ return css__copy_white_space(
+ type == CSS_WHITE_SPACE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/widows.c b/src/select/properties/widows.c
index 61126c2..853c08d 100644
--- a/src/select/properties/widows.c
+++ b/src/select/properties/widows.c
@@ -31,6 +31,20 @@ css_error css__initial_widows(css_select_state *state)
return set_widows(state->computed, CSS_WIDOWS_SET, 2);
}
+css_error css__copy_widows(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_widows(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_widows(to, type, count);
+}
+
css_error css__compose_widows(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_widows(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_widows(child, &count);
- if (type == CSS_WIDOWS_INHERIT) {
- type = get_widows(parent, &count);
- }
-
- return set_widows(result, type, count);
+ return css__copy_widows(
+ type == CSS_WIDOWS_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/width.c b/src/select/properties/width.c
index 829df91..c6d33ff 100644
--- a/src/select/properties/width.c
+++ b/src/select/properties/width.c
@@ -32,6 +32,21 @@ css_error css__initial_width(css_select_state *state)
return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX);
}
+css_error css__copy_width(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_width(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_width(to, type, length, unit);
+}
+
css_error css__compose_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -40,10 +55,8 @@ css_error css__compose_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_width(child, &length, &unit);
- if (type == CSS_WIDTH_INHERIT) {
- type = get_width(parent, &length, &unit);
- }
-
- return set_width(result, type, length, unit);
+ return css__copy_width(
+ type == CSS_WIDTH_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/word_spacing.c b/src/select/properties/word_spacing.c
index eb39b50..c1c6782 100644
--- a/src/select/properties/word_spacing.c
+++ b/src/select/properties/word_spacing.c
@@ -33,6 +33,21 @@ css_error css__initial_word_spacing(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_word_spacing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_word_spacing(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_word_spacing(to, type, length, unit);
+}
+
css_error css__compose_word_spacing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -41,9 +56,7 @@ css_error css__compose_word_spacing(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_word_spacing(child, &length, &unit);
- if (type == CSS_WORD_SPACING_INHERIT) {
- type = get_word_spacing(parent, &length, &unit);
- }
-
- return set_word_spacing(result, type, length, unit);
+ return css__copy_word_spacing(
+ type == CSS_WORD_SPACING_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/writing_mode.c b/src/select/properties/writing_mode.c
index bbd3753..05c0b26 100644
--- a/src/select/properties/writing_mode.c
+++ b/src/select/properties/writing_mode.c
@@ -17,11 +17,11 @@
css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
css_select_state *state)
{
- bool inherit = isInherit(opv);
+ enum flag_value flag_value = getFlagValue(opv);
uint16_t writing_mode = CSS_WRITING_MODE_INHERIT;
UNUSED(style);
- if (inherit == false) {
+ if (flag_value == FLAG_VALUE__NONE) {
switch (getValue(opv)) {
case WRITING_MODE_HORIZONTAL_TB:
writing_mode = CSS_WRITING_MODE_HORIZONTAL_TB;
@@ -36,7 +36,7 @@ css_error css__cascade_writing_mode(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- inherit)) {
+ flag_value)) {
return set_writing_mode(state->computed, writing_mode);
}
@@ -55,16 +55,25 @@ css_error css__initial_writing_mode(css_select_state *state)
CSS_WRITING_MODE_HORIZONTAL_TB);
}
+css_error css__copy_writing_mode(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_writing_mode(to, get_writing_mode(from));
+}
+
css_error css__compose_writing_mode(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- uint8_t writing_mode = get_writing_mode(child);
-
- if (writing_mode == CSS_WRITING_MODE_INHERIT) {
- writing_mode = get_writing_mode(parent);
- }
+ uint8_t type = get_writing_mode(child);
- return set_writing_mode(result, writing_mode);
+ return css__copy_writing_mode(
+ type == CSS_WRITING_MODE_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c
index 59cf242..e5159e5 100644
--- a/src/select/properties/z_index.c
+++ b/src/select/properties/z_index.c
@@ -20,7 +20,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
uint16_t value = CSS_Z_INDEX_INHERIT;
css_fixed index = 0;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case Z_INDEX_SET:
value = CSS_Z_INDEX_SET;
@@ -35,7 +35,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_z_index(state->computed, value, index);
}
@@ -53,6 +53,20 @@ css_error css__initial_z_index(css_select_state *state)
return set_z_index(state->computed, CSS_Z_INDEX_AUTO, 0);
}
+css_error css__copy_z_index(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t index = 0;
+ uint8_t type = get_z_index(from, &index);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_z_index(to, type, index);
+}
+
css_error css__compose_z_index(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -60,10 +74,8 @@ css_error css__compose_z_index(const css_computed_style *parent,
int32_t index = 0;
uint8_t type = get_z_index(child, &index);
- if (type == CSS_Z_INDEX_INHERIT) {
- type = get_z_index(parent, &index);
- }
-
- return set_z_index(result, type, index);
+ return css__copy_z_index(
+ type == CSS_Z_INDEX_INHERIT ? parent : child,
+ result);
}
diff --git a/src/select/select.c b/src/select/select.c
index 7d8195f..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;
@@ -1019,6 +1023,19 @@ static void css_select__finalise_selection_state(
if (state->element.name != NULL){
lwc_string_unref(state->element.name);
}
+
+ 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]);
+ }
+ }
+ free(state->revert);
+ }
}
@@ -1135,6 +1152,64 @@ failed:
return error;
}
+static css_error css__select_revert_property_to_origin(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ css_origin origin,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ error = prop_dispatch[property].copy(
+ select_state->revert[origin].style[pseudo],
+ select_state->results->styles[pseudo]);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ *prop_state = select_state->revert[origin].props[property][pseudo];
+ return CSS_OK;
+}
+
+static css_error css__select_revert_property(
+ css_select_state *select_state,
+ prop_state *prop_state,
+ enum css_pseudo_element pseudo,
+ enum css_properties_e property)
+{
+ css_error error;
+
+ switch (prop_state->origin) {
+ case CSS_ORIGIN_AUTHOR:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_USER,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_USER:
+ error = css__select_revert_property_to_origin(
+ select_state, prop_state, CSS_ORIGIN_UA,
+ pseudo, property);
+ if (error != CSS_OK) {
+ return error;
+ }
+ if (prop_state->explicit_default != FLAG_VALUE_REVERT) {
+ break;
+ }
+ /* Fall-through */
+ case CSS_ORIGIN_UA:
+ prop_state->explicit_default = FLAG_VALUE_UNSET;
+ break;
+ }
+
+ return CSS_OK;
+}
/**
* Select a style for the given node
@@ -1164,6 +1239,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;
@@ -1216,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]);
@@ -1242,9 +1328,29 @@ 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 (state.revert != NULL && 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].style[j]);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ memcpy(state.revert[origin].props,
+ state.props, sizeof(state.props));
+ }
+ origin = s.origin;
+ }
+
if (mq__list_match(s.media, unit_ctx, media, &ctx->str) &&
s.sheet->disabled == false) {
error = select_from_sheet(ctx, s.sheet,
@@ -1286,15 +1392,31 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE;
state.computed = state.results->styles[CSS_PSEUDO_ELEMENT_NONE];
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop =
- &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+ prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE];
+
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ error = css__select_revert_property(&state, prop,
+ CSS_PSEUDO_ELEMENT_NONE, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset or it's set to inherit
* and we're the root element, then set it to its initial
* value. */
- if (prop->set == false ||
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false ||
(parent == NULL &&
- prop->inherit == true)) {
+ prop->explicit_default == FLAG_VALUE_INHERIT)) {
error = set_initial(&state, i,
CSS_PSEUDO_ELEMENT_NONE, parent);
if (error != CSS_OK)
@@ -1312,11 +1434,28 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
continue;
for (i = 0; i < CSS_N_PROPERTIES; i++) {
- const prop_state *prop = &state.props[i][j];
+ prop_state *prop = &state.props[i][j];
+
+ if (prop->explicit_default == FLAG_VALUE_REVERT) {
+ error = css__select_revert_property(&state,
+ prop, j, i);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+ }
+
+ if (prop->explicit_default == FLAG_VALUE_UNSET) {
+ if (prop_dispatch[i].inherited == true) {
+ prop->explicit_default = FLAG_VALUE_INHERIT;
+ } else {
+ prop->explicit_default = FLAG_VALUE_INITIAL;
+ }
+ }
/* If the property is still unset then set it
* to its initial value. */
- if (prop->set == false) {
+ if (prop->explicit_default == FLAG_VALUE_INITIAL ||
+ prop->set == false) {
error = set_initial(&state, i, j, parent);
if (error != CSS_OK)
goto cleanup;
@@ -1548,7 +1687,8 @@ css_error set_hint(css_select_state *state, css_hint *hint)
existing->specificity = 0;
existing->origin = CSS_ORIGIN_AUTHOR;
existing->important = 0;
- existing->inherit = (hint->status == 0);
+ existing->explicit_default = (hint->status == 0) ?
+ FLAG_VALUE_INHERIT : FLAG_VALUE__NONE;
return CSS_OK;
}
@@ -1565,7 +1705,8 @@ css_error set_initial(css_select_state *state,
* If the node is tree root and we're dealing with the base element,
* everything should be defaulted.
*/
- if (prop_dispatch[prop].inherited == false ||
+ if (state->props[prop][pseudo].explicit_default == FLAG_VALUE_INITIAL ||
+ prop_dispatch[prop].inherited == false ||
(pseudo == CSS_PSEUDO_ELEMENT_NONE && parent == NULL)) {
error = prop_dispatch[prop].initial(state);
if (error != CSS_OK)
@@ -2600,7 +2741,7 @@ css_error cascade_style(const css_style *style, css_select_state *state)
}
bool css__outranks_existing(uint16_t op, bool important, css_select_state *state,
- bool inherit)
+ enum flag_value explicit_default)
{
prop_state *existing = &state->props[op][state->current_pseudo];
bool outranks = false;
@@ -2695,7 +2836,7 @@ bool css__outranks_existing(uint16_t op, bool important, css_select_state *state
existing->specificity = state->current_specificity;
existing->origin = state->current_origin;
existing->important = important;
- existing->inherit = inherit;
+ existing->explicit_default = explicit_default;
}
return outranks;
diff --git a/src/select/select.h b/src/select/select.h
index 0a16b12..5170e58 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -24,11 +24,11 @@ typedef struct reject_item {
} reject_item;
typedef struct prop_state {
- uint32_t specificity; /* Specificity of property in result */
- unsigned int set : 1, /* Whether property is set in result */
- origin : 2, /* Origin of property in result */
- important : 1, /* Importance of property in result */
- inherit : 1; /* Property is set to inherit */
+ uint32_t specificity; /* Specificity of property in result */
+ unsigned int set : 1, /* Whether property is set in result */
+ origin : 2, /* Origin of property in result */
+ important : 1; /* Importance of property in result */
+ enum flag_value explicit_default : 3; /* Property is set to inherit */
} prop_state;
@@ -58,6 +58,11 @@ struct css_node_data {
css_node_flags flags;
};
+struct revert_data {
+ prop_state props[CSS_N_PROPERTIES][CSS_PSEUDO_ELEMENT_COUNT];
+ css_computed_style *style[CSS_PSEUDO_ELEMENT_COUNT];
+};
+
/**
* 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; /* Length: CSS_ORIGIN_AUTHOR */
+
css_pseudo_element current_pseudo; /* Current pseudo element */
css_computed_style *computed; /* Computed style to populate */
@@ -98,7 +106,7 @@ static inline void advance_bytecode(css_style *style, uint32_t n_bytes)
}
bool css__outranks_existing(uint16_t op, bool important,
- css_select_state *state, bool inherit);
+ css_select_state *state, enum flag_value explicit_default);
#endif
diff --git a/src/stylesheet.h b/src/stylesheet.h
index a71fca6..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,11 +228,14 @@ 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));
}
-/** Helper function to set inherit flag */
+/** Helper function to set inherit generic value */
static inline css_error css_stylesheet_style_inherit(css_style *style,
opcode_t opcode)
{
@@ -238,6 +243,39 @@ static inline css_error css_stylesheet_style_inherit(css_style *style,
buildOPV(opcode, FLAG_INHERIT, 0));
}
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_initial(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_INITIAL, 0));
+}
+
+/** Helper function to set inherit generic value */
+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));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_unset(css_style *style,
+ opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, FLAG_UNSET, 0));
+}
+
+/** Helper function to set initial generic value */
+static inline css_error css_stylesheet_style_flag_value(css_style *style,
+ enum flag_value flag_value, opcode_t opcode)
+{
+ return css__stylesheet_style_append(style,
+ buildOPV(opcode, flag_value << 1, 0));
+}
+
css_error css__stylesheet_selector_create(css_stylesheet *sheet,
css_qname *qname, css_selector **selector);
css_error css__stylesheet_selector_destroy(css_stylesheet *sheet,
diff --git a/test/data/select/INDEX b/test/data/select/INDEX
index fb15ad4..c05567a 100644
--- a/test/data/select/INDEX
+++ b/test/data/select/INDEX
@@ -3,3 +3,4 @@
# Test Description
tests1.dat Basic tests
+defaulting.dat Explicit defaulting tests
diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat
new file mode 100644
index 0000000..4242e30
--- /dev/null
+++ b/test/data/select/defaulting.dat
@@ -0,0 +1,1452 @@
+#tree screen
+| div*
+#ua
+div { display: block; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: initial; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: inherit; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+#user
+p { display: table-cell; }
+p { display: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { font-style: italic; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+#user
+p { font-style: oblique; }
+p { font-style: unset; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: table-cell; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: table-cell
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { font-style: italic; }
+p { font-style: oblique; }
+p { font-style: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: italic
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div
+| p*
+#ua
+div { display: block; }
+p { display: table-cell; }
+p { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: inline-block; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline-block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree screen
+| div*
+#ua
+div { display: block; }
+#user
+div { display: revert; }
+#author
+div { display: table-cell; }
+div { display: revert; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: block
+empty-cells: show
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: auto
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
diff --git a/test/dump.h b/test/dump.h
index acfd8b0..f585788 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -788,8 +788,14 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*((*ptr)++) = ' ';
*ptr += sprintf(*ptr, "%s: ", opcode_names[op]);
- if (isInherit(opv)) {
+ if (getFlagValue(opv) == FLAG_VALUE_INHERIT) {
*ptr += sprintf(*ptr, "inherit");
+ } else if (getFlagValue(opv) == FLAG_VALUE_INITIAL) {
+ *ptr += sprintf(*ptr, "initial");
+ } else if (getFlagValue(opv) == FLAG_VALUE_REVERT) {
+ *ptr += sprintf(*ptr, "revert");
+ } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
+ *ptr += sprintf(*ptr, "unset");
} else {
value = getValue(opv);
--
Cascading Style Sheets library