summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-12-29 18:15:23 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2014-12-29 19:06:20 (GMT)
commit8bce7365823f887113c73af46ecdfee6322653f9 (patch)
treec97c5d5a1fb4246127590e0d759db89f52886dc6
parent5965aa66899dcd1b97d35656c56d512815a6579d (diff)
downloadlibcss-8bce7365823f887113c73af46ecdfee6322653f9.tar.gz
libcss-8bce7365823f887113c73af46ecdfee6322653f9.tar.bz2
Add helpers for selecting break-* properties.
-rw-r--r--src/select/properties/helpers.c49
-rw-r--r--src/select/properties/helpers.h3
2 files changed, 52 insertions, 0 deletions
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c
index df076db..1091a10 100644
--- a/src/select/properties/helpers.c
+++ b/src/select/properties/helpers.c
@@ -395,6 +395,55 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv,
return CSS_OK;
}
+css_error css__cascade_break_after_before_inside(uint32_t opv,
+ css_style *style, css_select_state *state,
+ css_error (*fun)(css_computed_style *, uint8_t))
+{
+ uint16_t value = CSS_BREAK_AFTER_AUTO;
+
+ UNUSED(style);
+
+ if (isInherit(opv) == false) {
+ switch (getValue(opv)) {
+ case BREAK_AFTER_AUTO:
+ value = CSS_BREAK_AFTER_AUTO;
+ break;
+ case BREAK_AFTER_ALWAYS:
+ value = CSS_BREAK_AFTER_ALWAYS;
+ break;
+ case BREAK_AFTER_AVOID:
+ value = CSS_BREAK_AFTER_AVOID;
+ break;
+ case BREAK_AFTER_LEFT:
+ value = CSS_BREAK_AFTER_LEFT;
+ break;
+ case BREAK_AFTER_RIGHT:
+ value = CSS_BREAK_AFTER_RIGHT;
+ break;
+ case BREAK_AFTER_PAGE:
+ value = CSS_BREAK_AFTER_PAGE;
+ break;
+ case BREAK_AFTER_COLUMN:
+ value = CSS_BREAK_AFTER_COLUMN;
+ break;
+ case BREAK_AFTER_AVOID_PAGE:
+ value = CSS_BREAK_AFTER_AVOID_PAGE;
+ break;
+ case BREAK_AFTER_AVOID_COLUMN:
+ value = CSS_BREAK_AFTER_AVOID_COLUMN;
+ break;
+ }
+ }
+
+ /** \todo lose fun != NULL */
+ if (fun != NULL && css__outranks_existing(getOpcode(opv),
+ isImportant(opv), state, isInherit(opv))) {
+ return fun(state->computed, value);
+ }
+
+ return CSS_OK;
+}
+
css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t,
diff --git a/src/select/properties/helpers.h b/src/select/properties/helpers.h
index 098fe1e..feed146 100644
--- a/src/select/properties/helpers.h
+++ b/src/select/properties/helpers.h
@@ -51,6 +51,9 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
css_error css__cascade_page_break_after_before_inside(uint32_t opv,
css_style *style, css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t));
+css_error css__cascade_break_after_before_inside(uint32_t opv,
+ css_style *style, css_select_state *state,
+ css_error (*fun)(css_computed_style *, uint8_t));
css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style,
css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t,