summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select/computed.h27
-rw-r--r--src/select/properties/column_rule_width.c50
-rw-r--r--src/select/propget.h27
-rw-r--r--src/select/propset.h29
4 files changed, 84 insertions, 49 deletions
diff --git a/src/select/computed.h b/src/select/computed.h
index 71a3916..39904f9 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -22,12 +22,13 @@ typedef struct css_computed_uncommon {
* column_gap 2 + 4 4
* column_rule_color 2 4
* column_rule_style 4 0
+ * column_rule_width 3 + 4 4
* letter_spacing 2 + 4 4
* outline_color 2 4
* outline_width 3 + 4 4
* word_spacing 2 + 4 4
* --- ---
- * 68 bits 52 bytes
+ * 75 bits 56 bytes
*
* Encode counter_increment and _reset as an array of name, value pairs,
* terminated with a blank entry.
@@ -51,27 +52,28 @@ typedef struct css_computed_uncommon {
* 2 bits sizeof(ptr)
*
* ___ ___
- * 81 bits 52 + 4sizeof(ptr) bytes
+ * 88 bits 58 + 4sizeof(ptr) bytes
*
- * 10 bytes 52 + 4sizeof(ptr) bytes
+ * 11 bytes 58 + 4sizeof(ptr) bytes
* ===================
- * 62 + 4sizeof(ptr) bytes
+ * 67 + 4sizeof(ptr) bytes
*
* Bit allocations:
*
* 76543210
- * 1 llllllcc letter-spacing | outline-color
- * 2 ooooooob outline-width | border-spacing
+ * 1 llllllcc letter-spacing | outline-color
+ * 2 ooooooob outline-width | border-spacing
* 3 bbbbbbbb border-spacing
- * 4 wwwwwwir word-spacing | counter-increment | counter-reset
- * 5 uuuuumm. cursor | writing-mode | <unused>
+ * 4 wwwwwwir word-spacing | counter-increment | counter-reset
+ * 5 uuuuumm. cursor | writing-mode | <unused>
* 6 cccccccc clip
* 7 cccccccc clip
- * 8 ccccccoo clip | content
- * 9 ccffssss column_count | column-fill | column-rule-style
- * 10 ggggggcc column-gap | column-rule-color
+ * 8 ccccccoo clip | content
+ * 9 ccffssss column_count | column-fill | column-rule-style
+ * 10 ggggggcc column-gap | column-rule-color
+ * 11 wwwwwww. column-rule-width
*/
- uint8_t bits[10];
+ uint8_t bits[11];
css_fixed border_spacing[2];
@@ -87,6 +89,7 @@ typedef struct css_computed_uncommon {
int32_t column_count;
css_fixed column_gap;
css_color column_rule_color;
+ css_fixed column_rule_width;
css_computed_counter *counter_increment;
css_computed_counter *counter_reset;
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 2c0ca0d..8694a09 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -17,57 +17,35 @@
css_error css__cascade_column_rule_width(uint32_t opv, css_style *style,
css_select_state *state)
{
- css_fixed length = 0;
- uint32_t unit = UNIT_PX;
-
- if (isInherit(opv) == false) {
- switch (getValue(opv)) {
- case COLUMN_RULE_WIDTH_SET:
- length = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(length));
- unit = *((uint32_t *) style->bytecode);
- advance_bytecode(style, sizeof(unit));
- break;
- case COLUMN_RULE_WIDTH_THIN:
- case COLUMN_RULE_WIDTH_MEDIUM:
- case COLUMN_RULE_WIDTH_THICK:
- /** \todo convert to public values */
- break;
- }
- }
-
- if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
- /** \todo set computed elevation */
- }
-
- return CSS_OK;
+ return css__cascade_border_width(opv, style, state,
+ set_column_rule_width);
}
css_error css__set_column_rule_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_width(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_rule_width(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_width(state->computed,
+ CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
css_error css__compose_column_rule_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ css_fixed length = 0;
+ 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 CSS_OK;
+ return set_column_rule_width(result, type, length, unit);
}
diff --git a/src/select/propget.h b/src/select/propget.h
index 4ced8bb..423e299 100644
--- a/src/select/propget.h
+++ b/src/select/propget.h
@@ -459,6 +459,33 @@ static inline uint8_t get_column_rule_style(
#undef COLUMN_RULE_STYLE_SHIFT
#undef COLUMN_RULE_STYLE_INDEX
+#define COLUMN_RULE_WIDTH_INDEX 10
+#define COLUMN_RULE_WIDTH_SHIFT 1
+#define COLUMN_RULE_WIDTH_MASK 0xfe
+static inline uint8_t get_column_rule_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_RULE_WIDTH_INDEX];
+ bits &= COLUMN_RULE_WIDTH_MASK;
+ bits >>= COLUMN_RULE_WIDTH_SHIFT;
+
+ /* 7bits: uuuuttt : units | type */
+ if ((bits & 0x7) == CSS_COLUMN_RULE_WIDTH_WIDTH) {
+ *length = style->uncommon->column_rule_width;
+ *unit = bits >> 3;
+ }
+
+ return (bits & 0x7);
+ }
+
+ return CSS_COLUMN_RULE_WIDTH_MEDIUM;
+}
+#undef COLUMN_RULE_WIDTH_MASK
+#undef COLUMN_RULE_WIDTH_SHIFT
+#undef COLUMN_RULE_WIDTH_INDEX
+
#define CONTENT_INDEX 7
#define CONTENT_SHIFT 0
#define CONTENT_MASK 0x3
diff --git a/src/select/propset.h b/src/select/propset.h
index 5aa253e..6dcfbc6 100644
--- a/src/select/propset.h
+++ b/src/select/propset.h
@@ -28,7 +28,8 @@ static const css_computed_uncommon default_uncommon = {
(CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL,
(CSS_COLUMN_COUNT_AUTO << 6) | (CSS_COLUMN_FILL_BALANCE << 4) |
(CSS_COLUMN_RULE_STYLE_NONE << 0),
- (CSS_COLUMN_GAP_NORMAL << 2) | (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR)
+ (CSS_COLUMN_GAP_NORMAL << 2) | (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR),
+ (CSS_COLUMN_RULE_WIDTH_MEDIUM << 1)
},
{ 0, 0 },
{ 0, 0, 0, 0 },
@@ -39,6 +40,7 @@ static const css_computed_uncommon default_uncommon = {
0,
0,
0,
+ 0,
NULL,
NULL,
NULL,
@@ -528,6 +530,31 @@ static inline css_error set_column_rule_style(
#undef COLUMN_RULE_STYLE_SHIFT
#undef COLUMN_RULE_STYLE_INDEX
+#define COLUMN_RULE_WIDTH_INDEX 10
+#define COLUMN_RULE_WIDTH_SHIFT 1
+#define COLUMN_RULE_WIDTH_MASK 0xfe
+static inline css_error set_column_rule_width(
+ css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_RULE_WIDTH_INDEX];
+
+ /* 7bits: uuuuttt : units | type */
+ *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) |
+ (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT);
+
+ style->uncommon->column_rule_width = length;
+
+ return CSS_OK;
+}
+#undef COLUMN_RULE_WIDTH_MASK
+#undef COLUMN_RULE_WIDTH_SHIFT
+#undef COLUMN_RULE_WIDTH_INDEX
+
#define CONTENT_INDEX 7
#define CONTENT_SHIFT 0
#define CONTENT_MASK 0x3