summaryrefslogtreecommitdiff
path: root/src/select/properties
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties')
-rw-r--r--src/select/properties/border_spacing.c17
-rw-r--r--src/select/properties/clip.c14
-rw-r--r--src/select/properties/column_count.c14
-rw-r--r--src/select/properties/column_gap.c14
-rw-r--r--src/select/properties/column_width.c14
-rw-r--r--src/select/properties/content.c51
-rw-r--r--src/select/properties/counter_increment.c49
-rw-r--r--src/select/properties/counter_reset.c48
-rw-r--r--src/select/properties/cursor.c49
-rw-r--r--src/select/properties/letter_spacing.c14
-rw-r--r--src/select/properties/outline_color.c14
-rw-r--r--src/select/properties/outline_width.c13
-rw-r--r--src/select/properties/word_spacing.c14
13 files changed, 109 insertions, 216 deletions
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c
index 147f56f..0077aac 100644
--- a/src/select/properties/border_spacing.c
+++ b/src/select/properties/border_spacing.c
@@ -71,19 +71,10 @@ css_error css__compose_border_spacing(const css_computed_style *parent,
uint8_t type = get_border_spacing(child, &hlength, &hunit,
&vlength, &vunit);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_BORDER_SPACING_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_BORDER_SPACING_INHERIT) {
- type = get_border_spacing(parent,
- &hlength, &hunit, &vlength, &vunit);
- }
-
- return set_border_spacing(result, type, hlength, hunit,
- vlength, vunit);
+ if (type == CSS_BORDER_SPACING_INHERIT) {
+ type = get_border_spacing(parent,
+ &hlength, &hunit, &vlength, &vunit);
}
- return CSS_OK;
+ return set_border_spacing(result, type, hlength, hunit, vlength, vunit);
}
-
diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c
index fe1dd87..2785afb 100644
--- a/src/select/properties/clip.c
+++ b/src/select/properties/clip.c
@@ -102,17 +102,9 @@ css_error css__compose_clip(const css_computed_style *parent,
false, false, false, false };
uint8_t type = get_clip(child, &rect);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CLIP_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CLIP_INHERIT) {
- type = get_clip(parent, &rect);
- }
-
- return set_clip(result, type, &rect);
+ if (type == CSS_CLIP_INHERIT) {
+ type = get_clip(parent, &rect);
}
- return CSS_OK;
+ return set_clip(result, type, &rect);
}
-
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index 7e929b0..efd1243 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -59,17 +59,9 @@ css_error css__compose_column_count(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_column_count(child, &count);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_COUNT_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_COUNT_INHERIT) {
- type = get_column_count(parent, &count);
- }
-
- return set_column_count(result, type, count);
+ if (type == CSS_COLUMN_COUNT_INHERIT) {
+ type = get_column_count(parent, &count);
}
- return CSS_OK;
+ return set_column_count(result, type, count);
}
-
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 824b3a4..087eb0f 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -41,17 +41,9 @@ 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 ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_GAP_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_GAP_INHERIT) {
- type = get_column_gap(parent, &length, &unit);
- }
-
- return set_column_gap(result, type, length, unit);
+ if (type == CSS_COLUMN_GAP_INHERIT) {
+ type = get_column_gap(parent, &length, &unit);
}
- return CSS_OK;
+ return set_column_gap(result, type, length, unit);
}
-
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index b6550ab..e739ade 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -41,17 +41,9 @@ css_error css__compose_column_width(const css_computed_style *parent,
css_unit unit = CSS_UNIT_EM;
uint8_t type = get_column_width(child, &length, &unit);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_WIDTH_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COLUMN_WIDTH_INHERIT) {
- type = get_column_width(parent, &length, &unit);
- }
-
- return set_column_width(result, type, length, unit);
+ if (type == CSS_COLUMN_WIDTH_INHERIT) {
+ type = get_column_width(parent, &length, &unit);
}
- return CSS_OK;
+ return set_column_width(result, type, length, unit);
}
-
diff --git a/src/select/properties/content.c b/src/select/properties/content.c
index 0506ef3..f75743d 100644
--- a/src/select/properties/content.c
+++ b/src/select/properties/content.c
@@ -204,43 +204,34 @@ css_error css__compose_content(const css_computed_style *parent,
css_computed_style *result)
{
css_error error;
+ css_computed_content_item *copy = NULL;
const css_computed_content_item *items = NULL;
uint8_t type = get_content(child, &items);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CONTENT_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- size_t n_items = 0;
- css_computed_content_item *copy = NULL;
-
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CONTENT_INHERIT) {
- type = get_content(parent, &items);
- }
-
- if (type == CSS_CONTENT_SET) {
- const css_computed_content_item *i;
-
- for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
- i++)
- n_items++;
+ if (type == CSS_CONTENT_INHERIT) {
+ type = get_content(parent, &items);
+ }
- copy = malloc((n_items + 1) *
- sizeof(css_computed_content_item));
- if (copy == NULL)
- return CSS_NOMEM;
+ if (type == CSS_CONTENT_SET) {
+ size_t n_items = 0;
+ const css_computed_content_item *i;
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_content_item));
- }
+ for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
+ i++)
+ n_items++;
- error = set_content(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ copy = malloc((n_items + 1) *
+ sizeof(css_computed_content_item));
+ if (copy == NULL)
+ return CSS_NOMEM;
- return error;
+ memcpy(copy, items, (n_items + 1) *
+ sizeof(css_computed_content_item));
}
- return CSS_OK;
-}
+ error = set_content(result, type, copy);
+ if (error != CSS_OK && copy != NULL)
+ free(copy);
+ return error;
+}
diff --git a/src/select/properties/counter_increment.c b/src/select/properties/counter_increment.c
index 9888e0a..1b75c25 100644
--- a/src/select/properties/counter_increment.c
+++ b/src/select/properties/counter_increment.c
@@ -53,42 +53,33 @@ css_error css__compose_counter_increment(const css_computed_style *parent,
css_computed_style *result)
{
css_error error;
+ css_computed_counter *copy = NULL;
const css_computed_counter *items = NULL;
uint8_t type = get_counter_increment(child, &items);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COUNTER_INCREMENT_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- size_t n_items = 0;
- css_computed_counter *copy = NULL;
-
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COUNTER_INCREMENT_INHERIT) {
- type = get_counter_increment(parent, &items);
- }
-
- if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) {
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
+ if (type == CSS_COUNTER_INCREMENT_INHERIT) {
+ type = get_counter_increment(parent, &items);
+ }
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
+ if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) {
+ size_t n_items = 0;
+ const css_computed_counter *i;
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
- }
+ for (i = items; i->name != NULL; i++)
+ n_items++;
- error = set_counter_increment(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ copy = malloc((n_items + 1) *
+ sizeof(css_computed_counter));
+ if (copy == NULL)
+ return CSS_NOMEM;
- return error;
+ memcpy(copy, items, (n_items + 1) *
+ sizeof(css_computed_counter));
}
- return CSS_OK;
-}
+ error = set_counter_increment(result, type, copy);
+ if (error != CSS_OK && copy != NULL)
+ free(copy);
+ return error;
+}
diff --git a/src/select/properties/counter_reset.c b/src/select/properties/counter_reset.c
index 9d20609..e4ec8bf 100644
--- a/src/select/properties/counter_reset.c
+++ b/src/select/properties/counter_reset.c
@@ -52,41 +52,33 @@ css_error css__compose_counter_reset(const css_computed_style *parent,
css_computed_style *result)
{
css_error error;
+ css_computed_counter *copy = NULL;
const css_computed_counter *items = NULL;
uint8_t type = get_counter_reset(child, &items);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COUNTER_RESET_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- size_t n_items = 0;
- css_computed_counter *copy = NULL;
-
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_COUNTER_RESET_INHERIT) {
- type = get_counter_reset(parent, &items);
- }
-
- if (type == CSS_COUNTER_RESET_NAMED && items != NULL) {
- const css_computed_counter *i;
-
- for (i = items; i->name != NULL; i++)
- n_items++;
+ if (type == CSS_COUNTER_RESET_INHERIT) {
+ type = get_counter_reset(parent, &items);
+ }
- copy = malloc((n_items + 1) *
- sizeof(css_computed_counter));
- if (copy == NULL)
- return CSS_NOMEM;
+ if (type == CSS_COUNTER_RESET_NAMED && items != NULL) {
+ size_t n_items = 0;
+ const css_computed_counter *i;
- memcpy(copy, items, (n_items + 1) *
- sizeof(css_computed_counter));
- }
+ for (i = items; i->name != NULL; i++)
+ n_items++;
- error = set_counter_reset(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ copy = malloc((n_items + 1) *
+ sizeof(css_computed_counter));
+ if (copy == NULL)
+ return CSS_NOMEM;
- return error;
+ memcpy(copy, items, (n_items + 1) *
+ sizeof(css_computed_counter));
}
- return CSS_OK;
+ error = set_counter_reset(result, type, copy);
+ if (error != CSS_OK && copy != NULL)
+ free(copy);
+
+ return error;
}
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c
index 6effdb5..c5e50c6 100644
--- a/src/select/properties/cursor.c
+++ b/src/select/properties/cursor.c
@@ -169,42 +169,33 @@ css_error css__compose_cursor(const css_computed_style *parent,
css_computed_style *result)
{
css_error error;
+ lwc_string **copy = NULL;
lwc_string **urls = NULL;
uint8_t type = get_cursor(child, &urls);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CURSOR_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- size_t n_urls = 0;
- lwc_string **copy = NULL;
-
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_CURSOR_INHERIT) {
- type = get_cursor(parent, &urls);
- }
-
- if (urls != NULL) {
- lwc_string **i;
+ if (type == CSS_CURSOR_INHERIT) {
+ type = get_cursor(parent, &urls);
+ }
- for (i = urls; (*i) != NULL; i++)
- n_urls++;
+ if (urls != NULL) {
+ lwc_string **i;
+ size_t n_urls = 0;
- copy = malloc((n_urls + 1) *
- sizeof(lwc_string *));
- if (copy == NULL)
- return CSS_NOMEM;
+ for (i = urls; (*i) != NULL; i++)
+ n_urls++;
- memcpy(copy, urls, (n_urls + 1) *
- sizeof(lwc_string *));
- }
-
- error = set_cursor(result, type, copy);
- if (error != CSS_OK && copy != NULL)
- free(copy);
+ copy = malloc((n_urls + 1) *
+ sizeof(lwc_string *));
+ if (copy == NULL)
+ return CSS_NOMEM;
- return error;
+ memcpy(copy, urls, (n_urls + 1) *
+ sizeof(lwc_string *));
}
- return CSS_OK;
-}
+ error = set_cursor(result, type, copy);
+ if (error != CSS_OK && copy != NULL)
+ free(copy);
+ return error;
+}
diff --git a/src/select/properties/letter_spacing.c b/src/select/properties/letter_spacing.c
index d799467..27ea04b 100644
--- a/src/select/properties/letter_spacing.c
+++ b/src/select/properties/letter_spacing.c
@@ -41,17 +41,9 @@ 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 ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_LETTER_SPACING_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_LETTER_SPACING_INHERIT) {
- type = get_letter_spacing(parent, &length, &unit);
- }
-
- return set_letter_spacing(result, type, length, unit);
+ if (type == CSS_LETTER_SPACING_INHERIT) {
+ type = get_letter_spacing(parent, &length, &unit);
}
- return CSS_OK;
+ return set_letter_spacing(result, type, length, unit);
}
-
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c
index c6c576b..97846ac 100644
--- a/src/select/properties/outline_color.c
+++ b/src/select/properties/outline_color.c
@@ -65,17 +65,9 @@ css_error css__compose_outline_color(const css_computed_style *parent,
css_color color = 0;
uint8_t type = get_outline_color(child, &color);
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_OUTLINE_COLOR_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_OUTLINE_COLOR_INHERIT) {
- type = get_outline_color(parent, &color);
- }
-
- return set_outline_color(result, type, color);
+ if (type == CSS_OUTLINE_COLOR_INHERIT) {
+ type = get_outline_color(parent, &color);
}
- return CSS_OK;
+ return set_outline_color(result, type, color);
}
-
diff --git a/src/select/properties/outline_width.c b/src/select/properties/outline_width.c
index 4d9101c..0289c57 100644
--- a/src/select/properties/outline_width.c
+++ b/src/select/properties/outline_width.c
@@ -41,17 +41,10 @@ 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 ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_OUTLINE_WIDTH_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_OUTLINE_WIDTH_INHERIT) {
- type = get_outline_width(parent, &length, &unit);
- }
-
- return set_outline_width(result, type, length, unit);
+ if (type == CSS_OUTLINE_WIDTH_INHERIT) {
+ type = get_outline_width(parent, &length, &unit);
}
- return CSS_OK;
+ return set_outline_width(result, type, length, unit);
}
diff --git a/src/select/properties/word_spacing.c b/src/select/properties/word_spacing.c
index 4cb9422..eb39b50 100644
--- a/src/select/properties/word_spacing.c
+++ b/src/select/properties/word_spacing.c
@@ -41,17 +41,9 @@ 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 ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_WORD_SPACING_INHERIT ||
- (child->i.uncommon != NULL && result != child)) {
- if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) ||
- type == CSS_WORD_SPACING_INHERIT) {
- type = get_word_spacing(parent, &length, &unit);
- }
-
- return set_word_spacing(result, type, length, unit);
+ if (type == CSS_WORD_SPACING_INHERIT) {
+ type = get_word_spacing(parent, &length, &unit);
}
- return CSS_OK;
+ return set_word_spacing(result, type, length, unit);
}
-