Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/0fc93505cfdb45546c8f98...
...commit
http://git.netsurf-browser.org/libcss.git/commit/0fc93505cfdb45546c8f9831...
...tree
http://git.netsurf-browser.org/libcss.git/tree/0fc93505cfdb45546c8f9831d1...
The branch, lcneves/units has been updated
via 0fc93505cfdb45546c8f9831d183d050f039e79e (commit)
via dec1109d988c5a05107be9a38426766b8177d63b (commit)
from bc3af2d21d26e0377fac15945f66abd9f620546b (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=0fc93505cfdb45546c8f...
commit 0fc93505cfdb45546c8f9831d183d050f039e79e
Author: Lucas Neves <lcneves(a)gmail.com>
Commit: Lucas Neves <lcneves(a)gmail.com>
Select: Cleanup.
diff --git a/src/select/.gitignore b/src/select/.gitignore
index 8e6c76d..a8bedc3 100644
--- a/src/select/.gitignore
+++ b/src/select/.gitignore
@@ -1,3 +1,5 @@
autogenerated_*.c
autogenerated_*.h
+__pycache__
+*.pyc
diff --git a/src/select/__pycache__/assets.cpython-36.pyc
b/src/select/__pycache__/assets.cpython-36.pyc
deleted file mode 100644
index 797012f..0000000
Binary files a/src/select/__pycache__/assets.cpython-36.pyc and /dev/null differ
diff --git a/src/select/__pycache__/overrides.cpython-36.pyc
b/src/select/__pycache__/overrides.cpython-36.pyc
deleted file mode 100644
index 91cff8b..0000000
Binary files a/src/select/__pycache__/overrides.cpython-36.pyc and /dev/null differ
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc
b/src/select/__pycache__/select_config.cpython-36.pyc
deleted file mode 100644
index 2a86225..0000000
Binary files a/src/select/__pycache__/select_config.cpython-36.pyc and /dev/null differ
diff --git a/src/select/computed.h.old b/src/select/computed.h.old
deleted file mode 100644
index a8934b1..0000000
--- a/src/select/computed.h.old
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_computed_h_
-#define css_select_computed_h_
-
-#include <libcss/computed.h>
-#include <libcss/hint.h>
-
-
-
-struct css_computed_uncommon_i {
-/*
- * border_spacing 1 + 2(4) 2(4)
- * break_before 4 0
- * break_after 4 0
- * break_inside 4 0
- * clip 2 + 4(4) + 4 4(4)
- * column_count 2 4
- * column_fill 2 0
- * column_gap 2 + 4 4
- * column_rule_color 2 4
- * column_rule_style 4 0
- * column_rule_width 3 + 4 4
- * column_span 2 0
- * column_width 2 + 4 4
- * letter_spacing 2 + 4 4
- * outline_color 2 4
- * outline_width 3 + 4 4
- * word_spacing 2 + 4 4
- * --- ---
- * 95 bits 60 bytes
- *
- * Encode counter_increment and _reset as an array of name, value pairs,
- * terminated with a blank entry.
- *
- * counter_increment 1 sizeof(ptr)
- * counter_reset 1 sizeof(ptr)
- * --- ---
- * 2 bits 2sizeof(ptr) bytes
- *
- * Encode cursor uri(s) as an array of string objects, terminated with a
- * blank entry.
- *
- * cursor 5 sizeof(ptr)
- * --- ---
- * 5 bits sizeof(ptr) bytes
- *
- * Encode content as an array of content items, terminated with a blank entry.
- *
- * content 2 sizeof(ptr)
- * --- ---
- * 2 bits sizeof(ptr)
- *
- * ___ ___
- * 108 bits 62 + 4sizeof(ptr) bytes
- *
- * 14 bytes 62 + 4sizeof(ptr) bytes
- * ===================
- * 74 + 4sizeof(ptr) bytes
- *
- * Bit allocations:
- *
- * 76543210
- * 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>
- * 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
- * 11 wwwwwww. column-rule-width | <unused>
- * 12 sswwwwww column-span | column_width
- * 13 bbbbaaaa break-before | break-after
- * 14 iiii.... break-inside | <unused>
- */
- uint8_t bits[14];
-
- css_fixed border_spacing[2];
-
- css_fixed clip[4];
-
- css_fixed letter_spacing;
-
- css_color outline_color;
- css_fixed outline_width;
-
- css_fixed word_spacing;
-
- int32_t column_count;
- css_fixed column_gap;
- css_color column_rule_color;
- css_fixed column_rule_width;
- css_fixed column_width;
-};
-
-typedef struct css_computed_uncommon {
- struct css_computed_uncommon_i i;
-
- css_computed_counter *counter_increment;
- css_computed_counter *counter_reset;
-
- css_computed_content_item *content;
-
- lwc_string **cursor;
- struct css_computed_uncommon *next;
- uint32_t count;
- uint32_t bin;
-} css_computed_uncommon;
-
-typedef struct css_computed_page {
-/*
- * Bit allocations:
- *
- * 76543210
- * 1 aaabbbii page_break_after | page_break_before | page_break_inside
- * 2 ......wo widows | orphans
- */
- uint8_t bits[2];
-
- int32_t widows;
- int32_t orphans;
-} css_computed_page;
-
-struct css_computed_style_i {
-/*
- * background_attachment 2
- * background_repeat 3
- * border_collapse 2
- * border_top_style 4
- * border_right_style 4
- * border_bottom_style 4
- * border_left_style 4
- * caption_side 2
- * clear 3
- * direction 2
- * display 5
- * empty_cells 2
- * float 2
- * font_style 2
- * font_variant 2
- * font_weight 4
- * list_style_position 2
- * list_style_type 4
- * overflow 3
- * outline_style 4
- * position 3
- * table_layout 2
- * text_align 4
- * text_decoration 5
- * text_transform 3
- * unicode_bidi 2
- * visibility 2
- * white_space 3
- * box_sizing 2
- * align_content 3
- * align_items 3
- * align_self 3
- * flex_direction 3
- * flex_wrap 2
- * justify_content 3
- * ---
- * 103 bits
- *
- * Colours are 32bits of AARRGGBB
- * Dimensions are encoded as a fixed point value + 4 bits of unit data
- *
- * background_color 2 4
- * background_image 1 sizeof(ptr)
- * background_position 1 + 2(4) 2(4)
- * border_top_color 2 4
- * border_right_color 2 4
- * border_bottom_color 2 4
- * border_left_color 2 4
- * border_top_width 3 + 4 4
- * border_right_width 3 + 4 4
- * border_bottom_width 3 + 4 4
- * border_left_width 3 + 4 4
- * top 2 + 4 4
- * right 2 + 4 4
- * bottom 2 + 4 4
- * left 2 + 4 4
- * color 1 4
- * font_size 4 + 4 4
- * height 2 + 4 4
- * line_height 2 + 4 4
- * list_style_image 1 sizeof(ptr)
- * margin_top 2 + 4 4
- * margin_right 2 + 4 4
- * margin_bottom 2 + 4 4
- * margin_left 2 + 4 4
- * max_height 2 + 4 4
- * max_width 2 + 4 4
- * min_height 2 + 4 4
- * min_width 2 + 4 4
- * padding_top 1 + 4 4
- * padding_right 1 + 4 4
- * padding_bottom 1 + 4 4
- * padding_left 1 + 4 4
- * text_indent 1 + 4 4
- * vertical_align 4 + 4 4
- * width 2 + 4 4
- * z_index 2 4
- * flex_basis 2 + 4 4
- * flex_grow 1 4
- * flex_shrink 1 4
- * order 1 4
- * --- ---
- * 196 bits 156 + 2sizeof(ptr) bytes
- *
- * Encode font family as an array of string objects, terminated with a
- * blank entry.
- *
- * font_family 3 sizeof(ptr)
- * --- ---
- * 3 bits sizeof(ptr)
- *
- * Encode quotes as an array of string objects, terminated with a blank entry.
- *
- * quotes 1 sizeof(ptr)
- * --- ---
- * 1 bit sizeof(ptr) bytes
- *
- * ___ ___
- * 303 bits 156 + 4sizeof(ptr) bytes
- *
- * 38 bytes 156 + 4sizeof(ptr) bytes
- * ===================
- * 194 + 4sizeof(ptr) bytes
- *
- * Bit allocations:
- *
- * 76543210
- * 1 vvvvvvvv vertical-align
- * 2 ffffffff font-size
- * 3 ttttttti border-top-width | background-image
- * 4 rrrrrrrc border-right-width | color
- * 5 bbbbbbbl border-bottom-width | list-style-image
- * 6 lllllllq border-left-width | quotes
- * 7 ttttttcc top | border-top-color
- * 8 rrrrrrcc right | border-right-color
- * 9 bbbbbbcc bottom | border-bottom-color
- * 10 llllllcc left | border-left-color
- * 11 hhhhhhbb height | background-color
- * 12 llllllzz line-height | z-index
- * 13 ttttttbb margin-top | background-attachment
- * 14 rrrrrrbb margin-right | border-collapse
- * 15 bbbbbbcc margin-bottom | caption-side
- * 16 lllllldd margin-left | direction
- * 17 mmmmmmee max-height | empty-cells
- * 18 mmmmmmff max-width | float
- * 19 wwwwwwff width | font-style
- * 20 mmmmmmff min-height | flex-wrap
- * 21 mmmmmmsg min-width | flex-shrink | flex_grow
- * 22 tttttxxx padding-top | overflow-x
- * 23 rrrrrppp padding-right | position
- * 24 bbbbboss padding-bottom | opacity | box-sizing
- * 25 lllllttt padding-left | text-transform
- * 26 tttttwww text-indent | white-space
- * 27 bbbbbbbb background-position
- * 28 bdddddff background-position | display | font-variant
- * 29 tttttfff text-decoration | font-family
- * 30 ttttrrrr border-top-style | border-right-style
- * 31 bbbbllll border-bottom-style | border-left-style
- * 32 ffffllll font-weight | list-style-type
- * 33 oooottuu outline-style | table-layout | unicode-bidi
- * 34 vvlltttt visibility | list-style-position | text-align
- * 35 yyybbbaa overflow-y | background-repeat | align-content1
- * 36 bbbbbbaj flex-basis | align-content2 | justify_content1
- * 37 fffcccjj flex-direction | clear | justify_content2
- * 38 iiissso. align-items | align-self | order
- */
- uint8_t bits[38];
-
- uint8_t unused[1];
-
- css_color background_color;
- lwc_string *background_image;
- css_fixed background_position[2];
-
- css_color border_color[4];
- css_fixed border_width[4];
-
- css_fixed top;
- css_fixed right;
- css_fixed bottom;
- css_fixed left;
-
- css_color color;
-
- css_fixed font_size;
-
- css_fixed height;
-
- css_fixed line_height;
-
- lwc_string *list_style_image;
-
- css_fixed margin[4];
-
- css_fixed max_height;
- css_fixed max_width;
-
- css_fixed min_height;
- css_fixed min_width;
-
- css_fixed opacity;
-
- css_fixed padding[4];
-
- css_fixed text_indent;
-
- css_fixed vertical_align;
-
- css_fixed width;
-
- int32_t z_index;
-
- css_fixed flex_basis;
-
- css_fixed flex_grow;
-
- css_fixed flex_shrink;
-
- int32_t order;
-
- css_computed_uncommon *uncommon;/**< Uncommon properties */
- void *aural; /**< Aural properties */
-};
-
-struct css_computed_style {
- struct css_computed_style_i i;
-
- lwc_string **font_family;
-
- lwc_string **quotes;
- css_computed_page *page; /**< Page properties */
- struct css_computed_style *next;
- uint32_t count;
- uint32_t bin;
-};
-
-
-/**
- * Take a new reference to a computed style
- *
- * \param style The style to take a new reference to.
- * \return The new computed style reference
- */
-static inline css_computed_style * css__computed_style_ref(
- css_computed_style *style)
-{
- if (style == NULL)
- return NULL;
-
- if (style->i.uncommon != NULL) {
- style->i.uncommon->count++;
- }
-
- style->count++;
- return style;
-}
-
-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_uncommon_destroy(css_computed_uncommon *uncommon);
-
-css_error css__compute_absolute_values(const css_computed_style *parent,
- css_computed_style *style,
- css_error (*compute_font_size)(void *pw,
- const css_hint *parent, css_hint *size),
- void *pw);
-
-#endif
diff --git a/src/select/propget.h.old b/src/select/propget.h.old
deleted file mode 100644
index 737dcd4..0000000
--- a/src/select/propget.h.old
+++ /dev/null
@@ -1,2408 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_propget_h_
-#define css_select_propget_h_
-
-#include <libcss/computed.h>
-#include "computed.h"
-
-/* Important: keep this file in sync with computed.h */
-/** \todo Is there a better way to ensure this happens? */
-
-#define LETTER_SPACING_INDEX 0
-#define LETTER_SPACING_SHIFT 2
-#define LETTER_SPACING_MASK 0xfc
-static inline uint8_t get_letter_spacing(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[LETTER_SPACING_INDEX];
- bits &= LETTER_SPACING_MASK;
- bits >>= LETTER_SPACING_SHIFT;
-
- /* 6bits: uuuutt : unit | type */
-
- if ((bits & 3) == CSS_LETTER_SPACING_SET) {
- *length = style->i.uncommon->i.letter_spacing;
- *unit = bits >> 2;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_LETTER_SPACING_NORMAL;
-}
-#undef LETTER_SPACING_MASK
-#undef LETTER_SPACING_SHIFT
-#undef LETTER_SPACING_INDEX
-
-#define OUTLINE_COLOR_INDEX 0
-#define OUTLINE_COLOR_SHIFT 0
-#define OUTLINE_COLOR_MASK 0x3
-static inline uint8_t get_outline_color(
- const css_computed_style *style, css_color *color)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX];
- bits &= OUTLINE_COLOR_MASK;
- bits >>= OUTLINE_COLOR_SHIFT;
-
- /* 2bits: tt : type */
-
- if ((bits & 3) == CSS_OUTLINE_COLOR_COLOR) {
- *color = style->i.uncommon->i.outline_color;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_OUTLINE_COLOR_INVERT;
-}
-#undef OUTLINE_COLOR_MASK
-#undef OUTLINE_COLOR_SHIFT
-#undef OUTLINE_COLOR_INDEX
-
-#define OUTLINE_WIDTH_INDEX 1
-#define OUTLINE_WIDTH_SHIFT 1
-#define OUTLINE_WIDTH_MASK 0xfe
-static inline uint8_t get_outline_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX];
- bits &= OUTLINE_WIDTH_MASK;
- bits >>= OUTLINE_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : unit | type */
-
- if ((bits & 7) == CSS_OUTLINE_WIDTH_WIDTH) {
- *length = style->i.uncommon->i.outline_width;
- *unit = bits >> 3;
- }
-
- return (bits & 7);
- }
-
- /* Initial value */
- return CSS_OUTLINE_WIDTH_MEDIUM;
-}
-#undef OUTLINE_WIDTH_MASK
-#undef OUTLINE_WIDTH_SHIFT
-#undef OUTLINE_WIDTH_INDEX
-
-#define BORDER_SPACING_INDEX 1
-#define BORDER_SPACING_SHIFT 0
-#define BORDER_SPACING_MASK 0x1
-#define BORDER_SPACING_INDEX1 2
-#define BORDER_SPACING_SHIFT1 0
-#define BORDER_SPACING_MASK1 0xff
-static inline uint8_t get_border_spacing(
- const css_computed_style *style,
- css_fixed *hlength, css_unit *hunit,
- css_fixed *vlength, css_unit *vunit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BORDER_SPACING_INDEX];
- bits &= BORDER_SPACING_MASK;
- bits >>= BORDER_SPACING_SHIFT;
-
- /* 1 bit: type */
- if (bits == CSS_BORDER_SPACING_SET) {
- uint8_t bits1 =
- style->i.uncommon->i.bits[BORDER_SPACING_INDEX1];
- bits1 &= BORDER_SPACING_MASK1;
- bits1 >>= BORDER_SPACING_SHIFT1;
-
- /* 8bits: hhhhvvvv : hunit | vunit */
-
- *hlength = style->i.uncommon->i.border_spacing[0];
- *hunit = bits1 >> 4;
-
- *vlength = style->i.uncommon->i.border_spacing[1];
- *vunit = bits1 & 0xf;
- }
-
- return bits;
- }
-
- /* Initial value */
- *hlength = *vlength = 0;
- *hunit = *vunit = CSS_UNIT_PX;
- return CSS_BORDER_SPACING_SET;
-}
-#undef BORDER_SPACING_MASK1
-#undef BORDER_SPACING_SHIFT1
-#undef BORDER_SPACING_INDEX1
-#undef BORDER_SPACING_MASK
-#undef BORDER_SPACING_SHIFT
-#undef BORDER_SPACING_INDEX
-
-#define BREAK_AFTER_INDEX 12
-#define BREAK_AFTER_SHIFT 0
-#define BREAK_AFTER_MASK 0xf
-static inline uint8_t get_break_after(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_AFTER_INDEX];
- bits &= BREAK_AFTER_MASK;
- bits >>= BREAK_AFTER_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_AFTER_AUTO;
-}
-#undef BREAK_AFTER_MASK
-#undef BREAK_AFTER_SHIFT
-#undef BREAK_AFTER_INDEX
-
-#define BREAK_BEFORE_INDEX 12
-#define BREAK_BEFORE_SHIFT 4
-#define BREAK_BEFORE_MASK (0xf << 4)
-static inline uint8_t get_break_before(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_BEFORE_INDEX];
- bits &= BREAK_BEFORE_MASK;
- bits >>= BREAK_BEFORE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_BEFORE_AUTO;
-}
-#undef BREAK_BEFORE_MASK
-#undef BREAK_BEFORE_SHIFT
-#undef BREAK_BEFORE_INDEX
-
-#define BREAK_INSIDE_INDEX 13
-#define BREAK_INSIDE_SHIFT 4
-#define BREAK_INSIDE_MASK (0xf << 4)
-static inline uint8_t get_break_inside(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_INSIDE_INDEX];
- bits &= BREAK_INSIDE_MASK;
- bits >>= BREAK_INSIDE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_INSIDE_AUTO;
-}
-#undef BREAK_INSIDE_MASK
-#undef BREAK_INSIDE_SHIFT
-#undef BREAK_INSIDE_INDEX
-
-#define WORD_SPACING_INDEX 3
-#define WORD_SPACING_SHIFT 2
-#define WORD_SPACING_MASK 0xfc
-static inline uint8_t get_word_spacing(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[WORD_SPACING_INDEX];
- bits &= WORD_SPACING_MASK;
- bits >>= WORD_SPACING_SHIFT;
-
- /* 6bits: uuuutt : unit | type */
-
- if ((bits & 3) == CSS_WORD_SPACING_SET) {
- *length = style->i.uncommon->i.word_spacing;
- *unit = bits >> 2;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_WORD_SPACING_NORMAL;
-}
-#undef WORD_SPACING_MASK
-#undef WORD_SPACING_SHIFT
-#undef WORD_SPACING_INDEX
-
-#define WRITING_MODE_INDEX 4
-#define WRITING_MODE_MASK 0x6
-#define WRITING_MODE_SHIFT 1
-static inline uint8_t get_writing_mode(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[WRITING_MODE_INDEX];
- bits &= WRITING_MODE_MASK;
- bits >>= WRITING_MODE_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_WRITING_MODE_HORIZONTAL_TB;
-}
-#undef WRITING_MODE_INDEX
-#undef WRITING_MODE_MASK
-#undef WRITING_MODE_SHIFT
-
-#define COUNTER_INCREMENT_INDEX 3
-#define COUNTER_INCREMENT_SHIFT 1
-#define COUNTER_INCREMENT_MASK 0x2
-static inline uint8_t get_counter_increment(
- const css_computed_style *style,
- const css_computed_counter **counters)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX];
- bits &= COUNTER_INCREMENT_MASK;
- bits >>= COUNTER_INCREMENT_SHIFT;
-
- /* 1bit: type */
- *counters = style->i.uncommon->counter_increment;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COUNTER_INCREMENT_NONE;
-}
-#undef COUNTER_INCREMENT_MASK
-#undef COUNTER_INCREMENT_SHIFT
-#undef COUNTER_INCREMENT_INDEX
-
-#define COUNTER_RESET_INDEX 3
-#define COUNTER_RESET_SHIFT 0
-#define COUNTER_RESET_MASK 0x1
-static inline uint8_t get_counter_reset(
- const css_computed_style *style,
- const css_computed_counter **counters)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COUNTER_RESET_INDEX];
- bits &= COUNTER_RESET_MASK;
- bits >>= COUNTER_RESET_SHIFT;
-
- /* 1bit: type */
- *counters = style->i.uncommon->counter_reset;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COUNTER_RESET_NONE;
-}
-#undef COUNTER_RESET_MASK
-#undef COUNTER_RESET_SHIFT
-#undef COUNTER_RESET_INDEX
-
-#define CURSOR_INDEX 4
-#define CURSOR_SHIFT 3
-#define CURSOR_MASK 0xf8
-static inline uint8_t get_cursor(
- const css_computed_style *style,
- lwc_string ***urls)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CURSOR_INDEX];
- bits &= CURSOR_MASK;
- bits >>= CURSOR_SHIFT;
-
- /* 5bits: type */
- *urls = style->i.uncommon->cursor;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_CURSOR_AUTO;
-}
-#undef CURSOR_MASK
-#undef CURSOR_SHIFT
-#undef CURSOR_INDEX
-
-#define CLIP_INDEX 7
-#define CLIP_SHIFT 2
-#define CLIP_MASK 0xfc
-#define CLIP_INDEX1 5
-#define CLIP_SHIFT1 0
-#define CLIP_MASK1 0xff
-#define CLIP_INDEX2 6
-#define CLIP_SHIFT2 0
-#define CLIP_MASK2 0xff
-static inline uint8_t get_clip(
- const css_computed_style *style,
- css_computed_clip_rect *rect)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CLIP_INDEX];
- bits &= CLIP_MASK;
- bits >>= CLIP_SHIFT;
-
- /* 6bits: trblyy : top | right | bottom | left | type */
- if ((bits & 0x3) == CSS_CLIP_RECT) {
- uint8_t bits1;
-
- rect->left_auto = (bits & 0x4);
- rect->bottom_auto = (bits & 0x8);
- rect->right_auto = (bits & 0x10);
- rect->top_auto = (bits & 0x20);
-
- if (rect->top_auto == false ||
- rect->right_auto == false) {
- /* 8bits: ttttrrrr : top | right */
- bits1 = style->i.uncommon->i.bits[CLIP_INDEX1];
- bits1 &= CLIP_MASK1;
- bits1 >>= CLIP_SHIFT1;
- } else {
- bits1 = 0;
- }
-
- rect->top = style->i.uncommon->i.clip[0];
- rect->tunit = bits1 >> 4;
-
- rect->right = style->i.uncommon->i.clip[1];
- rect->runit = bits1 & 0xf;
-
- if (rect->bottom_auto == false ||
- rect->left_auto == false) {
- /* 8bits: bbbbllll : bottom | left */
- bits1 = style->i.uncommon->i.bits[CLIP_INDEX2];
- bits1 &= CLIP_MASK2;
- bits1 >>= CLIP_SHIFT2;
- } else {
- bits1 = 0;
- }
-
- rect->bottom = style->i.uncommon->i.clip[2];
- rect->bunit = bits1 >> 4;
-
- rect->left = style->i.uncommon->i.clip[3];
- rect->lunit = bits1 & 0xf;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_CLIP_AUTO;
-}
-#undef CLIP_MASK2
-#undef CLIP_SHIFT2
-#undef CLIP_INDEX2
-#undef CLIP_MASK1
-#undef CLIP_SHIFT1
-#undef CLIP_INDEX1
-#undef CLIP_MASK
-#undef CLIP_SHIFT
-#undef CLIP_INDEX
-
-#define COLUMN_COUNT_INDEX 8
-#define COLUMN_COUNT_SHIFT 6
-#define COLUMN_COUNT_MASK 0xc0
-static inline uint8_t get_column_count(
- const css_computed_style *style, int32_t *count)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_COUNT_INDEX];
- bits &= COLUMN_COUNT_MASK;
- bits >>= COLUMN_COUNT_SHIFT;
-
- /* 2bits: tt : type */
- *count = style->i.uncommon->i.column_count;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_COUNT_AUTO;
-}
-#undef COLUMN_COUNT_MASK
-#undef COLUMN_COUNT_SHIFT
-#undef COLUMN_COUNT_INDEX
-
-#define COLUMN_FILL_INDEX 8
-#define COLUMN_FILL_SHIFT 4
-#define COLUMN_FILL_MASK 0x30
-static inline uint8_t get_column_fill(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_FILL_INDEX];
- bits &= COLUMN_FILL_MASK;
- bits >>= COLUMN_FILL_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_FILL_BALANCE;
-}
-#undef COLUMN_FILL_MASK
-#undef COLUMN_FILL_SHIFT
-#undef COLUMN_FILL_INDEX
-
-#define COLUMN_GAP_INDEX 9
-#define COLUMN_GAP_SHIFT 2
-#define COLUMN_GAP_MASK 0xfc
-static inline uint8_t get_column_gap(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_GAP_INDEX];
- bits &= COLUMN_GAP_MASK;
- bits >>= COLUMN_GAP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_COLUMN_GAP_SET) {
- *length = style->i.uncommon->i.column_gap;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_COLUMN_GAP_NORMAL;
-}
-#undef COLUMN_GAP_MASK
-#undef COLUMN_GAP_SHIFT
-#undef COLUMN_GAP_INDEX
-
-#define COLUMN_RULE_COLOR_INDEX 9
-#define COLUMN_RULE_COLOR_SHIFT 0
-#define COLUMN_RULE_COLOR_MASK 0x3
-static inline uint8_t get_column_rule_color(
- const css_computed_style *style,
- css_color *color)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX];
- bits &= COLUMN_RULE_COLOR_MASK;
- bits >>= COLUMN_RULE_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.uncommon->i.column_rule_color;
-
- return bits;
- }
-
- /* Initial value */
- *color = 0;
- return CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
-}
-#undef COLUMN_RULE_COLOR_MASK
-#undef COLUMN_RULE_COLOR_SHIFT
-#undef COLUMN_RULE_COLOR_INDEX
-
-#define COLUMN_RULE_STYLE_INDEX 8
-#define COLUMN_RULE_STYLE_SHIFT 0
-#define COLUMN_RULE_STYLE_MASK 0xf
-static inline uint8_t get_column_rule_style(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX];
- bits &= COLUMN_RULE_STYLE_MASK;
- bits >>= COLUMN_RULE_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_RULE_STYLE_NONE;
-}
-#undef COLUMN_RULE_STYLE_MASK
-#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->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.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->i.uncommon->i.column_rule_width;
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
- }
-
- /* Initial value */
- return CSS_COLUMN_RULE_WIDTH_MEDIUM;
-}
-#undef COLUMN_RULE_WIDTH_MASK
-#undef COLUMN_RULE_WIDTH_SHIFT
-#undef COLUMN_RULE_WIDTH_INDEX
-
-#define COLUMN_SPAN_INDEX 11
-#define COLUMN_SPAN_SHIFT 6
-#define COLUMN_SPAN_MASK 0xc0
-static inline uint8_t get_column_span(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_SPAN_INDEX];
- bits &= COLUMN_SPAN_MASK;
- bits >>= COLUMN_SPAN_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_SPAN_NONE;
-}
-#undef COLUMN_SPAN_MASK
-#undef COLUMN_SPAN_SHIFT
-#undef COLUMN_SPAN_INDEX
-
-#define COLUMN_WIDTH_INDEX 11
-#define COLUMN_WIDTH_SHIFT 0
-#define COLUMN_WIDTH_MASK 0x3f
-static inline uint8_t get_column_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX];
- bits &= COLUMN_WIDTH_MASK;
- bits >>= COLUMN_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_COLUMN_WIDTH_SET) {
- *length = style->i.uncommon->i.column_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_COLUMN_WIDTH_AUTO;
-}
-#undef COLUMN_WIDTH_MASK
-#undef COLUMN_WIDTH_SHIFT
-#undef COLUMN_WIDTH_INDEX
-
-#define CONTENT_INDEX 7
-#define CONTENT_SHIFT 0
-#define CONTENT_MASK 0x3
-static inline uint8_t get_content(
- const css_computed_style *style,
- const css_computed_content_item **content)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CONTENT_INDEX];
- bits &= CONTENT_MASK;
- bits >>= CONTENT_SHIFT;
-
- /* 2bits: type */
- *content = style->i.uncommon->content;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_CONTENT_NORMAL;
-}
-#undef CONTENT_MASK
-#undef CONTENT_SHIFT
-#undef CONTENT_INDEX
-
-#define VERTICAL_ALIGN_INDEX 0
-#define VERTICAL_ALIGN_SHIFT 0
-#define VERTICAL_ALIGN_MASK 0xff
-static inline uint8_t get_vertical_align(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[VERTICAL_ALIGN_INDEX];
- bits &= VERTICAL_ALIGN_MASK;
- bits >>= VERTICAL_ALIGN_SHIFT;
-
- /* 8bits: uuuutttt : units | type */
- if ((bits & 0xf) == CSS_VERTICAL_ALIGN_SET) {
- *length = style->i.vertical_align;
- *unit = bits >> 4;
- }
-
- return (bits & 0xf);
-}
-#undef VERTICAL_ALIGN_MASK
-#undef VERTICAL_ALIGN_SHIFT
-#undef VERTICAL_ALIGN_INDEX
-
-#define FONT_SIZE_INDEX 1
-#define FONT_SIZE_SHIFT 0
-#define FONT_SIZE_MASK 0xff
-static inline uint8_t get_font_size(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[FONT_SIZE_INDEX];
- bits &= FONT_SIZE_MASK;
- bits >>= FONT_SIZE_SHIFT;
-
- /* 8bits: uuuutttt : units | type */
- if ((bits & 0xf) == CSS_FONT_SIZE_DIMENSION) {
- *length = style->i.font_size;
- *unit = bits >> 4;
- }
-
- return (bits & 0xf);
-}
-#undef FONT_SIZE_MASK
-#undef FONT_SIZE_SHIFT
-#undef FONT_SIZE_INDEX
-
-#define BORDER_TOP_WIDTH_INDEX 2
-#define BORDER_TOP_WIDTH_SHIFT 1
-#define BORDER_TOP_WIDTH_MASK 0xfe
-static inline uint8_t get_border_top_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_WIDTH_INDEX];
- bits &= BORDER_TOP_WIDTH_MASK;
- bits >>= BORDER_TOP_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[0];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_TOP_WIDTH_MASK
-#undef BORDER_TOP_WIDTH_SHIFT
-#undef BORDER_TOP_WIDTH_INDEX
-
-#define BORDER_RIGHT_WIDTH_INDEX 3
-#define BORDER_RIGHT_WIDTH_SHIFT 1
-#define BORDER_RIGHT_WIDTH_MASK 0xfe
-static inline uint8_t get_border_right_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
- bits &= BORDER_RIGHT_WIDTH_MASK;
- bits >>= BORDER_RIGHT_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[1];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_RIGHT_WIDTH_MASK
-#undef BORDER_RIGHT_WIDTH_SHIFT
-#undef BORDER_RIGHT_WIDTH_INDEX
-
-#define BORDER_BOTTOM_WIDTH_INDEX 4
-#define BORDER_BOTTOM_WIDTH_SHIFT 1
-#define BORDER_BOTTOM_WIDTH_MASK 0xfe
-static inline uint8_t get_border_bottom_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
- bits &= BORDER_BOTTOM_WIDTH_MASK;
- bits >>= BORDER_BOTTOM_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[2];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_BOTTOM_WIDTH_MASK
-#undef BORDER_BOTTOM_WIDTH_SHIFT
-#undef BORDER_BOTTOM_WIDTH_INDEX
-
-#define BORDER_LEFT_WIDTH_INDEX 5
-#define BORDER_LEFT_WIDTH_SHIFT 1
-#define BORDER_LEFT_WIDTH_MASK 0xfe
-static inline uint8_t get_border_left_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_WIDTH_INDEX];
- bits &= BORDER_LEFT_WIDTH_MASK;
- bits >>= BORDER_LEFT_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[3];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_LEFT_WIDTH_MASK
-#undef BORDER_LEFT_WIDTH_SHIFT
-#undef BORDER_LEFT_WIDTH_INDEX
-
-#define BACKGROUND_IMAGE_INDEX 2
-#define BACKGROUND_IMAGE_SHIFT 0
-#define BACKGROUND_IMAGE_MASK 0x1
-static inline uint8_t get_background_image(
- const css_computed_style *style,
- lwc_string **url)
-{
- uint8_t bits = style->i.bits[BACKGROUND_IMAGE_INDEX];
- bits &= BACKGROUND_IMAGE_MASK;
- bits >>= BACKGROUND_IMAGE_SHIFT;
-
- /* 1bit: type */
- *url = style->i.background_image;
-
- return bits;
-}
-#undef BACKGROUND_IMAGE_MASK
-#undef BACKGROUND_IMAGE_SHIFT
-#undef BACKGROUND_IMAGE_INDEX
-
-#define COLOR_INDEX 3
-#define COLOR_SHIFT 0
-#define COLOR_MASK 0x1
-static inline uint8_t get_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[COLOR_INDEX];
- bits &= COLOR_MASK;
- bits >>= COLOR_SHIFT;
-
- /* 1bit: type */
- *color = style->i.color;
-
- return bits;
-}
-#undef COLOR_MASK
-#undef COLOR_SHIFT
-#undef COLOR_INDEX
-
-#define LIST_STYLE_IMAGE_INDEX 4
-#define LIST_STYLE_IMAGE_SHIFT 0
-#define LIST_STYLE_IMAGE_MASK 0x1
-static inline uint8_t get_list_style_image(
- const css_computed_style *style,
- lwc_string **url)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_IMAGE_INDEX];
- bits &= LIST_STYLE_IMAGE_MASK;
- bits >>= LIST_STYLE_IMAGE_SHIFT;
-
- /* 1bit: type */
- *url = style->i.list_style_image;
-
- return bits;
-}
-#undef LIST_STYLE_IMAGE_MASK
-#undef LIST_STYLE_IMAGE_SHIFT
-#undef LIST_STYLE_IMAGE_INDEX
-
-#define QUOTES_INDEX 5
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
-static inline uint8_t get_quotes(
- const css_computed_style *style,
- lwc_string ***quotes)
-{
- uint8_t bits = style->i.bits[QUOTES_INDEX];
- bits &= QUOTES_MASK;
- bits >>= QUOTES_SHIFT;
-
- /* 1bit: type */
- *quotes = style->quotes;
-
- return bits;
-}
-#undef QUOTES_MASK
-#undef QUOTES_SHIFT
-#undef QUOTES_INDEX
-
-#define TOP_INDEX 6
-#define TOP_SHIFT 2
-#define TOP_MASK 0xfc
-static inline uint8_t get_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[TOP_INDEX];
- bits &= TOP_MASK;
- bits >>= TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_TOP_SET) {
- *length = style->i.top;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_top_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TOP_INDEX];
- bits &= TOP_MASK;
- bits >>= TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef TOP_MASK
-#undef TOP_SHIFT
-#undef TOP_INDEX
-
-#define RIGHT_INDEX 7
-#define RIGHT_SHIFT 2
-#define RIGHT_MASK 0xfc
-static inline uint8_t get_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[RIGHT_INDEX];
- bits &= RIGHT_MASK;
- bits >>= RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_RIGHT_SET) {
- *length = style->i.right;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_right_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[RIGHT_INDEX];
- bits &= RIGHT_MASK;
- bits >>= RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef RIGHT_MASK
-#undef RIGHT_SHIFT
-#undef RIGHT_INDEX
-
-#define BOTTOM_INDEX 8
-#define BOTTOM_SHIFT 2
-#define BOTTOM_MASK 0xfc
-static inline uint8_t get_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BOTTOM_INDEX];
- bits &= BOTTOM_MASK;
- bits >>= BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_BOTTOM_SET) {
- *length = style->i.bottom;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_bottom_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BOTTOM_INDEX];
- bits &= BOTTOM_MASK;
- bits >>= BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef BOTTOM_MASK
-#undef BOTTOM_SHIFT
-#undef BOTTOM_INDEX
-
-#define LEFT_INDEX 9
-#define LEFT_SHIFT 2
-#define LEFT_MASK 0xfc
-static inline uint8_t get_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[LEFT_INDEX];
- bits &= LEFT_MASK;
- bits >>= LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_LEFT_SET) {
- *length = style->i.left;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_left_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LEFT_INDEX];
- bits &= LEFT_MASK;
- bits >>= LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef LEFT_MASK
-#undef LEFT_SHIFT
-#undef LEFT_INDEX
-
-#define BORDER_TOP_COLOR_INDEX 6
-#define BORDER_TOP_COLOR_SHIFT 0
-#define BORDER_TOP_COLOR_MASK 0x3
-static inline uint8_t get_border_top_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_COLOR_INDEX];
- bits &= BORDER_TOP_COLOR_MASK;
- bits >>= BORDER_TOP_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[0];
-
- return bits;
-}
-#undef BORDER_TOP_COLOR_MASK
-#undef BORDER_TOP_COLOR_SHIFT
-#undef BORDER_TOP_COLOR_INDEX
-
-#define BORDER_RIGHT_COLOR_INDEX 7
-#define BORDER_RIGHT_COLOR_SHIFT 0
-#define BORDER_RIGHT_COLOR_MASK 0x3
-static inline uint8_t get_border_right_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_COLOR_INDEX];
- bits &= BORDER_RIGHT_COLOR_MASK;
- bits >>= BORDER_RIGHT_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[1];
-
- return bits;
-}
-#undef BORDER_RIGHT_COLOR_MASK
-#undef BORDER_RIGHT_COLOR_SHIFT
-#undef BORDER_RIGHT_COLOR_INDEX
-
-#define BORDER_BOTTOM_COLOR_INDEX 8
-#define BORDER_BOTTOM_COLOR_SHIFT 0
-#define BORDER_BOTTOM_COLOR_MASK 0x3
-static inline uint8_t get_border_bottom_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
- bits &= BORDER_BOTTOM_COLOR_MASK;
- bits >>= BORDER_BOTTOM_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[2];
-
- return bits;
-}
-#undef BORDER_BOTTOM_COLOR_MASK
-#undef BORDER_BOTTOM_COLOR_SHIFT
-#undef BORDER_BOTTOM_COLOR_INDEX
-
-#define BORDER_LEFT_COLOR_INDEX 9
-#define BORDER_LEFT_COLOR_SHIFT 0
-#define BORDER_LEFT_COLOR_MASK 0x3
-static inline uint8_t get_border_left_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_COLOR_INDEX];
- bits &= BORDER_LEFT_COLOR_MASK;
- bits >>= BORDER_LEFT_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[3];
-
- return bits;
-}
-#undef BORDER_LEFT_COLOR_MASK
-#undef BORDER_LEFT_COLOR_SHIFT
-#undef BORDER_LEFT_COLOR_INDEX
-
-#define HEIGHT_INDEX 10
-#define HEIGHT_SHIFT 2
-#define HEIGHT_MASK 0xfc
-static inline uint8_t get_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[HEIGHT_INDEX];
- bits &= HEIGHT_MASK;
- bits >>= HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_HEIGHT_SET) {
- *length = style->i.height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef HEIGHT_MASK
-#undef HEIGHT_SHIFT
-#undef HEIGHT_INDEX
-
-#define LINE_HEIGHT_INDEX 11
-#define LINE_HEIGHT_SHIFT 2
-#define LINE_HEIGHT_MASK 0xfc
-static inline uint8_t get_line_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[LINE_HEIGHT_INDEX];
- bits &= LINE_HEIGHT_MASK;
- bits >>= LINE_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
- (bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
- *length = style->i.line_height;
- }
-
- if ((bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef LINE_HEIGHT_MASK
-#undef LINE_HEIGHT_SHIFT
-#undef LINE_HEIGHT_INDEX
-
-#define BACKGROUND_COLOR_INDEX 10
-#define BACKGROUND_COLOR_SHIFT 0
-#define BACKGROUND_COLOR_MASK 0x3
-static inline uint8_t get_background_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BACKGROUND_COLOR_INDEX];
- bits &= BACKGROUND_COLOR_MASK;
- bits >>= BACKGROUND_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.background_color;
-
- return bits;
-}
-#undef BACKGROUND_COLOR_MASK
-#undef BACKGROUND_COLOR_SHIFT
-#undef BACKGROUND_COLOR_INDEX
-
-#define Z_INDEX_INDEX 11
-#define Z_INDEX_SHIFT 0
-#define Z_INDEX_MASK 0x3
-static inline uint8_t get_z_index(
- const css_computed_style *style,
- int32_t *z_index)
-{
- uint8_t bits = style->i.bits[Z_INDEX_INDEX];
- bits &= Z_INDEX_MASK;
- bits >>= Z_INDEX_SHIFT;
-
- /* 2bits: type */
- *z_index = style->i.z_index;
-
- return bits;
-}
-#undef Z_INDEX_MASK
-#undef Z_INDEX_SHIFT
-#undef Z_INDEX_INDEX
-
-#define MARGIN_TOP_INDEX 12
-#define MARGIN_TOP_SHIFT 2
-#define MARGIN_TOP_MASK 0xfc
-static inline uint8_t get_margin_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_TOP_INDEX];
- bits &= MARGIN_TOP_MASK;
- bits >>= MARGIN_TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[0];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_TOP_MASK
-#undef MARGIN_TOP_SHIFT
-#undef MARGIN_TOP_INDEX
-
-#define MARGIN_RIGHT_INDEX 13
-#define MARGIN_RIGHT_SHIFT 2
-#define MARGIN_RIGHT_MASK 0xfc
-static inline uint8_t get_margin_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_RIGHT_INDEX];
- bits &= MARGIN_RIGHT_MASK;
- bits >>= MARGIN_RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[1];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_RIGHT_MASK
-#undef MARGIN_RIGHT_SHIFT
-#undef MARGIN_RIGHT_INDEX
-
-#define MARGIN_BOTTOM_INDEX 14
-#define MARGIN_BOTTOM_SHIFT 2
-#define MARGIN_BOTTOM_MASK 0xfc
-static inline uint8_t get_margin_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_BOTTOM_INDEX];
- bits &= MARGIN_BOTTOM_MASK;
- bits >>= MARGIN_BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[2];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_BOTTOM_MASK
-#undef MARGIN_BOTTOM_SHIFT
-#undef MARGIN_BOTTOM_INDEX
-
-#define MARGIN_LEFT_INDEX 15
-#define MARGIN_LEFT_SHIFT 2
-#define MARGIN_LEFT_MASK 0xfc
-static inline uint8_t get_margin_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_LEFT_INDEX];
- bits &= MARGIN_LEFT_MASK;
- bits >>= MARGIN_LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[3];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_LEFT_MASK
-#undef MARGIN_LEFT_SHIFT
-#undef MARGIN_LEFT_INDEX
-
-#define BACKGROUND_ATTACHMENT_INDEX 12
-#define BACKGROUND_ATTACHMENT_SHIFT 0
-#define BACKGROUND_ATTACHMENT_MASK 0x3
-static inline uint8_t get_background_attachment(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
- bits &= BACKGROUND_ATTACHMENT_MASK;
- bits >>= BACKGROUND_ATTACHMENT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BACKGROUND_ATTACHMENT_MASK
-#undef BACKGROUND_ATTACHMENT_SHIFT
-#undef BACKGROUND_ATTACHMENT_INDEX
-
-#define BOX_SIZING_INDEX 23
-#define BOX_SIZING_SHIFT 0
-#define BOX_SIZING_MASK 0x3
-static inline uint8_t get_box_sizing(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BOX_SIZING_INDEX];
- bits &= BOX_SIZING_MASK;
- bits >>= BOX_SIZING_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BOX_SIZING_MASK
-#undef BOX_SIZING_SHIFT
-#undef BOX_SIZING_INDEX
-
-#define BORDER_COLLAPSE_INDEX 13
-#define BORDER_COLLAPSE_SHIFT 0
-#define BORDER_COLLAPSE_MASK 0x3
-static inline uint8_t get_border_collapse(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
- bits &= BORDER_COLLAPSE_MASK;
- bits >>= BORDER_COLLAPSE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BORDER_COLLAPSE_MASK
-#undef BORDER_COLLAPSE_SHIFT
-#undef BORDER_COLLAPSE_INDEX
-
-#define CAPTION_SIDE_INDEX 14
-#define CAPTION_SIDE_SHIFT 0
-#define CAPTION_SIDE_MASK 0x3
-static inline uint8_t get_caption_side(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[CAPTION_SIDE_INDEX];
- bits &= CAPTION_SIDE_MASK;
- bits >>= CAPTION_SIDE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef CAPTION_SIDE_MASK
-#undef CAPTION_SIDE_SHIFT
-#undef CAPTION_SIDE_INDEX
-
-#define DIRECTION_INDEX 15
-#define DIRECTION_SHIFT 0
-#define DIRECTION_MASK 0x3
-static inline uint8_t get_direction(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[DIRECTION_INDEX];
- bits &= DIRECTION_MASK;
- bits >>= DIRECTION_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef DIRECTION_MASK
-#undef DIRECTION_SHIFT
-#undef DIRECTION_INDEX
-
-#define MAX_HEIGHT_INDEX 16
-#define MAX_HEIGHT_SHIFT 2
-#define MAX_HEIGHT_MASK 0xfc
-static inline uint8_t get_max_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MAX_HEIGHT_INDEX];
- bits &= MAX_HEIGHT_MASK;
- bits >>= MAX_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MAX_HEIGHT_SET) {
- *length = style->i.max_height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MAX_HEIGHT_MASK
-#undef MAX_HEIGHT_SHIFT
-#undef MAX_HEIGHT_INDEX
-
-#define MAX_WIDTH_INDEX 17
-#define MAX_WIDTH_SHIFT 2
-#define MAX_WIDTH_MASK 0xfc
-static inline uint8_t get_max_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MAX_WIDTH_INDEX];
- bits &= MAX_WIDTH_MASK;
- bits >>= MAX_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MAX_WIDTH_SET) {
- *length = style->i.max_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MAX_WIDTH_MASK
-#undef MAX_WIDTH_SHIFT
-#undef MAX_WIDTH_INDEX
-
-#define WIDTH_INDEX 18
-#define WIDTH_SHIFT 2
-#define WIDTH_MASK 0xfc
-static inline uint8_t get_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[WIDTH_INDEX];
- bits &= WIDTH_MASK;
- bits >>= WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_WIDTH_SET) {
- *length = style->i.width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef WIDTH_MASK
-#undef WIDTH_SHIFT
-#undef WIDTH_INDEX
-
-#define EMPTY_CELLS_INDEX 16
-#define EMPTY_CELLS_SHIFT 0
-#define EMPTY_CELLS_MASK 0x3
-static inline uint8_t get_empty_cells(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[EMPTY_CELLS_INDEX];
- bits &= EMPTY_CELLS_MASK;
- bits >>= EMPTY_CELLS_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef EMPTY_CELLS_MASK
-#undef EMPTY_CELLS_SHIFT
-#undef EMPTY_CELLS_INDEX
-
-#define FLOAT_INDEX 17
-#define FLOAT_SHIFT 0
-#define FLOAT_MASK 0x3
-static inline uint8_t get_float(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLOAT_INDEX];
- bits &= FLOAT_MASK;
- bits >>= FLOAT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FLOAT_MASK
-#undef FLOAT_SHIFT
-#undef FLOAT_INDEX
-
-#define FONT_STYLE_INDEX 18
-#define FONT_STYLE_SHIFT 0
-#define FONT_STYLE_MASK 0x3
-static inline uint8_t get_font_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_STYLE_INDEX];
- bits &= FONT_STYLE_MASK;
- bits >>= FONT_STYLE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FONT_STYLE_MASK
-#undef FONT_STYLE_SHIFT
-#undef FONT_STYLE_INDEX
-
-#define MIN_HEIGHT_INDEX 19
-#define MIN_HEIGHT_SHIFT 2
-#define MIN_HEIGHT_MASK 0xfc
-static inline uint8_t get_min_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MIN_HEIGHT_INDEX];
- bits &= MIN_HEIGHT_MASK;
- bits >>= MIN_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MIN_HEIGHT_SET) {
- *length = style->i.min_height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MIN_HEIGHT_MASK
-#undef MIN_HEIGHT_SHIFT
-#undef MIN_HEIGHT_INDEX
-
-#define MIN_WIDTH_INDEX 20
-#define MIN_WIDTH_SHIFT 2
-#define MIN_WIDTH_MASK 0xfc
-static inline uint8_t get_min_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MIN_WIDTH_INDEX];
- bits &= MIN_WIDTH_MASK;
- bits >>= MIN_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MIN_WIDTH_SET) {
- *length = style->i.min_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MIN_WIDTH_MASK
-#undef MIN_WIDTH_SHIFT
-#undef MIN_WIDTH_INDEX
-
-#define BACKGROUND_REPEAT_INDEX 34
-#define BACKGROUND_REPEAT_SHIFT 2
-#define BACKGROUND_REPEAT_MASK 0x1c
-static inline uint8_t get_background_repeat(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
- bits &= BACKGROUND_REPEAT_MASK;
- bits >>= BACKGROUND_REPEAT_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef BACKGROUND_REPEAT_MASK
-#undef BACKGROUND_REPEAT_SHIFT
-#undef BACKGROUND_REPEAT_INDEX
-
-#define CLEAR_INDEX 36
-#define CLEAR_SHIFT 2
-#define CLEAR_MASK 0x1c
-static inline uint8_t get_clear(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[CLEAR_INDEX];
- bits &= CLEAR_MASK;
- bits >>= CLEAR_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef CLEAR_MASK
-#undef CLEAR_SHIFT
-#undef CLEAR_INDEX
-
-#define PADDING_TOP_INDEX 21
-#define PADDING_TOP_SHIFT 3
-#define PADDING_TOP_MASK 0xf8
-static inline uint8_t get_padding_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_TOP_INDEX];
- bits &= PADDING_TOP_MASK;
- bits >>= PADDING_TOP_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[0];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_TOP_MASK
-#undef PADDING_TOP_SHIFT
-#undef PADDING_TOP_INDEX
-
-#define PADDING_RIGHT_INDEX 22
-#define PADDING_RIGHT_SHIFT 3
-#define PADDING_RIGHT_MASK 0xf8
-static inline uint8_t get_padding_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_RIGHT_INDEX];
- bits &= PADDING_RIGHT_MASK;
- bits >>= PADDING_RIGHT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[1];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_RIGHT_MASK
-#undef PADDING_RIGHT_SHIFT
-#undef PADDING_RIGHT_INDEX
-
-#define PADDING_BOTTOM_INDEX 23
-#define PADDING_BOTTOM_SHIFT 3
-#define PADDING_BOTTOM_MASK 0xf8
-static inline uint8_t get_padding_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_BOTTOM_INDEX];
- bits &= PADDING_BOTTOM_MASK;
- bits >>= PADDING_BOTTOM_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[2];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_BOTTOM_MASK
-#undef PADDING_BOTTOM_SHIFT
-#undef PADDING_BOTTOM_INDEX
-
-#define PADDING_LEFT_INDEX 24
-#define PADDING_LEFT_SHIFT 3
-#define PADDING_LEFT_MASK 0xf8
-static inline uint8_t get_padding_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_LEFT_INDEX];
- bits &= PADDING_LEFT_MASK;
- bits >>= PADDING_LEFT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[3];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_LEFT_MASK
-#undef PADDING_LEFT_SHIFT
-#undef PADDING_LEFT_INDEX
-
-#define OVERFLOW_X_INDEX 21
-#define OVERFLOW_X_SHIFT 0
-#define OVERFLOW_X_MASK 0x7
-static inline uint8_t get_overflow_x(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OVERFLOW_X_INDEX];
- bits &= OVERFLOW_X_MASK;
- bits >>= OVERFLOW_X_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef OVERFLOW_X_MASK
-#undef OVERFLOW_X_SHIFT
-#undef OVERFLOW_X_INDEX
-
-#define OVERFLOW_Y_INDEX 34
-#define OVERFLOW_Y_SHIFT 5
-#define OVERFLOW_Y_MASK 0xe0
-static inline uint8_t get_overflow_y(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OVERFLOW_Y_INDEX];
- bits &= OVERFLOW_Y_MASK;
- bits >>= OVERFLOW_Y_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef OVERFLOW_Y_MASK
-#undef OVERFLOW_Y_SHIFT
-#undef OVERFLOW_Y_INDEX
-
-#define POSITION_INDEX 22
-#define POSITION_SHIFT 0
-#define POSITION_MASK 0x7
-static inline uint8_t get_position(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[POSITION_INDEX];
- bits &= POSITION_MASK;
- bits >>= POSITION_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef POSITION_MASK
-#undef POSITION_SHIFT
-#undef POSITION_INDEX
-
-#define OPACITY_INDEX 23
-#define OPACITY_SHIFT 2
-#define OPACITY_MASK 0x04
-static inline uint8_t get_opacity(
- const css_computed_style *style,
- css_fixed *opacity)
-{
- uint8_t bits = style->i.bits[OPACITY_INDEX];
- bits &= OPACITY_MASK;
- bits >>= OPACITY_SHIFT;
-
- /* 1bit: t : type */
- if ((bits & 0x1) == CSS_OPACITY_SET) {
- *opacity = style->i.opacity;
- }
-
- return (bits & 0x1);
-}
-#undef OPACITY_MASK
-#undef OPACITY_SHIFT
-#undef OPACITY_INDEX
-
-#define TEXT_TRANSFORM_INDEX 24
-#define TEXT_TRANSFORM_SHIFT 0
-#define TEXT_TRANSFORM_MASK 0x7
-static inline uint8_t get_text_transform(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
- bits &= TEXT_TRANSFORM_MASK;
- bits >>= TEXT_TRANSFORM_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef TEXT_TRANSFORM_MASK
-#undef TEXT_TRANSFORM_SHIFT
-#undef TEXT_TRANSFORM_INDEX
-
-#define TEXT_INDENT_INDEX 25
-#define TEXT_INDENT_SHIFT 3
-#define TEXT_INDENT_MASK 0xf8
-static inline uint8_t get_text_indent(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[TEXT_INDENT_INDEX];
- bits &= TEXT_INDENT_MASK;
- bits >>= TEXT_INDENT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_TEXT_INDENT_SET) {
- *length = style->i.text_indent;
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef TEXT_INDENT_MASK
-#undef TEXT_INDENT_SHIFT
-#undef TEXT_INDENT_INDEX
-
-#define WHITE_SPACE_INDEX 25
-#define WHITE_SPACE_SHIFT 0
-#define WHITE_SPACE_MASK 0x7
-static inline uint8_t get_white_space(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[WHITE_SPACE_INDEX];
- bits &= WHITE_SPACE_MASK;
- bits >>= WHITE_SPACE_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef WHITE_SPACE_MASK
-#undef WHITE_SPACE_SHIFT
-#undef WHITE_SPACE_INDEX
-
-#define BACKGROUND_POSITION_INDEX 27
-#define BACKGROUND_POSITION_SHIFT 7
-#define BACKGROUND_POSITION_MASK 0x80
-#define BACKGROUND_POSITION_INDEX1 26
-#define BACKGROUND_POSITION_SHIFT1 0
-#define BACKGROUND_POSITION_MASK1 0xff
-static inline uint8_t get_background_position(
- const css_computed_style *style,
- css_fixed *hlength, css_unit *hunit,
- css_fixed *vlength, css_unit *vunit)
-{
- uint8_t bits = style->i.bits[BACKGROUND_POSITION_INDEX];
- bits &= BACKGROUND_POSITION_MASK;
- bits >>= BACKGROUND_POSITION_SHIFT;
-
- /* 1bit: type */
- if (bits == CSS_BACKGROUND_POSITION_SET) {
- uint8_t bits1 = style->i.bits[BACKGROUND_POSITION_INDEX1];
- bits1 &= BACKGROUND_POSITION_MASK1;
- bits1 >>= BACKGROUND_POSITION_SHIFT1;
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *hlength = style->i.background_position[0];
- *hunit = bits1 >> 4;
-
- *vlength = style->i.background_position[1];
- *vunit = bits1 & 0xf;
- }
-
- return bits;
-}
-#undef BACKGROUND_POSITION_MASK1
-#undef BACKGROUND_POSITION_SHIFT1
-#undef BACKGROUND_POSITION_INDEX1
-#undef BACKGROUND_POSITION_MASK
-#undef BACKGROUND_POSITION_SHIFT
-#undef BACKGROUND_POSITION_INDEX
-
-#define DISPLAY_INDEX 27
-#define DISPLAY_SHIFT 2
-#define DISPLAY_MASK 0x7c
-static inline uint8_t get_display(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[DISPLAY_INDEX];
- bits &= DISPLAY_MASK;
- bits >>= DISPLAY_SHIFT;
-
- /* 5bits: type */
- return bits;
-}
-#undef DISPLAY_MASK
-#undef DISPLAY_SHIFT
-#undef DISPLAY_INDEX
-
-#define FONT_VARIANT_INDEX 27
-#define FONT_VARIANT_SHIFT 0
-#define FONT_VARIANT_MASK 0x3
-static inline uint8_t get_font_variant(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_VARIANT_INDEX];
- bits &= FONT_VARIANT_MASK;
- bits >>= FONT_VARIANT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FONT_VARIANT_MASK
-#undef FONT_VARIANT_SHIFT
-#undef FONT_VARIANT_INDEX
-
-#define TEXT_DECORATION_INDEX 28
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
-static inline uint8_t get_text_decoration(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_DECORATION_INDEX];
- bits &= TEXT_DECORATION_MASK;
- bits >>= TEXT_DECORATION_SHIFT;
-
- /* 5bits: type */
- return bits;
-}
-#undef TEXT_DECORATION_MASK
-#undef TEXT_DECORATION_SHIFT
-#undef TEXT_DECORATION_INDEX
-
-#define FONT_FAMILY_INDEX 28
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
-static inline uint8_t get_font_family(
- const css_computed_style *style,
- lwc_string ***names)
-{
- uint8_t bits = style->i.bits[FONT_FAMILY_INDEX];
- bits &= FONT_FAMILY_MASK;
- bits >>= FONT_FAMILY_SHIFT;
-
- /* 3bits: type */
- *names = style->font_family;
-
- return bits;
-}
-#undef FONT_FAMILY_MASK
-#undef FONT_FAMILY_SHIFT
-#undef FONT_FAMILY_INDEX
-
-#define BORDER_TOP_STYLE_INDEX 29
-#define BORDER_TOP_STYLE_SHIFT 4
-#define BORDER_TOP_STYLE_MASK 0xf0
-static inline uint8_t get_border_top_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
- bits &= BORDER_TOP_STYLE_MASK;
- bits >>= BORDER_TOP_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_TOP_STYLE_MASK
-#undef BORDER_TOP_STYLE_SHIFT
-#undef BORDER_TOP_STYLE_INDEX
-
-#define BORDER_RIGHT_STYLE_INDEX 29
-#define BORDER_RIGHT_STYLE_SHIFT 0
-#define BORDER_RIGHT_STYLE_MASK 0xf
-static inline uint8_t get_border_right_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
- bits &= BORDER_RIGHT_STYLE_MASK;
- bits >>= BORDER_RIGHT_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_RIGHT_STYLE_MASK
-#undef BORDER_RIGHT_STYLE_SHIFT
-#undef BORDER_RIGHT_STYLE_INDEX
-
-#define BORDER_BOTTOM_STYLE_INDEX 30
-#define BORDER_BOTTOM_STYLE_SHIFT 4
-#define BORDER_BOTTOM_STYLE_MASK 0xf0
-static inline uint8_t get_border_bottom_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
- bits &= BORDER_BOTTOM_STYLE_MASK;
- bits >>= BORDER_BOTTOM_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_BOTTOM_STYLE_MASK
-#undef BORDER_BOTTOM_STYLE_SHIFT
-#undef BORDER_BOTTOM_STYLE_INDEX
-
-#define BORDER_LEFT_STYLE_INDEX 30
-#define BORDER_LEFT_STYLE_SHIFT 0
-#define BORDER_LEFT_STYLE_MASK 0xf
-static inline uint8_t get_border_left_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
- bits &= BORDER_LEFT_STYLE_MASK;
- bits >>= BORDER_LEFT_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_LEFT_STYLE_MASK
-#undef BORDER_LEFT_STYLE_SHIFT
-#undef BORDER_LEFT_STYLE_INDEX
-
-#define FONT_WEIGHT_INDEX 31
-#define FONT_WEIGHT_SHIFT 4
-#define FONT_WEIGHT_MASK 0xf0
-static inline uint8_t get_font_weight(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_WEIGHT_INDEX];
- bits &= FONT_WEIGHT_MASK;
- bits >>= FONT_WEIGHT_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef FONT_WEIGHT_MASK
-#undef FONT_WEIGHT_SHIFT
-#undef FONT_WEIGHT_INDEX
-
-#define LIST_STYLE_TYPE_INDEX 31
-#define LIST_STYLE_TYPE_SHIFT 0
-#define LIST_STYLE_TYPE_MASK 0xf
-static inline uint8_t get_list_style_type(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
- bits &= LIST_STYLE_TYPE_MASK;
- bits >>= LIST_STYLE_TYPE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef LIST_STYLE_TYPE_MASK
-#undef LIST_STYLE_TYPE_SHIFT
-#undef LIST_STYLE_TYPE_INDEX
-
-#define OUTLINE_STYLE_INDEX 32
-#define OUTLINE_STYLE_SHIFT 4
-#define OUTLINE_STYLE_MASK 0xf0
-static inline uint8_t get_outline_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
- bits &= OUTLINE_STYLE_MASK;
- bits >>= OUTLINE_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef OUTLINE_STYLE_MASK
-#undef OUTLINE_STYLE_SHIFT
-#undef OUTLINE_STYLE_INDEX
-
-#define TABLE_LAYOUT_INDEX 32
-#define TABLE_LAYOUT_SHIFT 2
-#define TABLE_LAYOUT_MASK 0xc
-static inline uint8_t get_table_layout(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
- bits &= TABLE_LAYOUT_MASK;
- bits >>= TABLE_LAYOUT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef TABLE_LAYOUT_MASK
-#undef TABLE_LAYOUT_SHIFT
-#undef TABLE_LAYOUT_INDEX
-
-#define UNICODE_BIDI_INDEX 32
-#define UNICODE_BIDI_SHIFT 0
-#define UNICODE_BIDI_MASK 0x3
-static inline uint8_t get_unicode_bidi(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[UNICODE_BIDI_INDEX];
- bits &= UNICODE_BIDI_MASK;
- bits >>= UNICODE_BIDI_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef UNICODE_BIDI_MASK
-#undef UNICODE_BIDI_SHIFT
-#undef UNICODE_BIDI_INDEX
-
-#define VISIBILITY_INDEX 33
-#define VISIBILITY_SHIFT 6
-#define VISIBILITY_MASK 0xc0
-static inline uint8_t get_visibility(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[VISIBILITY_INDEX];
- bits &= VISIBILITY_MASK;
- bits >>= VISIBILITY_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef VISIBILITY_MASK
-#undef VISIBILITY_SHIFT
-#undef VISIBILITY_INDEX
-
-#define LIST_STYLE_POSITION_INDEX 33
-#define LIST_STYLE_POSITION_SHIFT 4
-#define LIST_STYLE_POSITION_MASK 0x30
-static inline uint8_t get_list_style_position(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
- bits &= LIST_STYLE_POSITION_MASK;
- bits >>= LIST_STYLE_POSITION_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef LIST_STYLE_POSITION_MASK
-#undef LIST_STYLE_POSITION_SHIFT
-#undef LIST_STYLE_POSITION_INDEX
-
-#define TEXT_ALIGN_INDEX 33
-#define TEXT_ALIGN_SHIFT 0
-#define TEXT_ALIGN_MASK 0xf
-static inline uint8_t get_text_align(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_ALIGN_INDEX];
- bits &= TEXT_ALIGN_MASK;
- bits >>= TEXT_ALIGN_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef TEXT_ALIGN_MASK
-#undef TEXT_ALIGN_SHIFT
-#undef TEXT_ALIGN_INDEX
-
-#define PAGE_BREAK_AFTER_INDEX 0
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
-static inline uint8_t get_page_break_after(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_AFTER_INDEX];
- bits &= PAGE_BREAK_AFTER_MASK;
- bits >>= PAGE_BREAK_AFTER_SHIFT;
-
- /* 3bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_AFTER_AUTO;
-}
-#undef PAGE_BREAK_AFTER_MASK
-#undef PAGE_BREAK_AFTER_SHIFT
-#undef PAGE_BREAK_AFTER_INDEX
-
-#define PAGE_BREAK_BEFORE_INDEX 0
-#define PAGE_BREAK_BEFORE_SHIFT 3
-#define PAGE_BREAK_BEFORE_MASK 0x38
-static inline uint8_t get_page_break_before(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_BEFORE_INDEX];
- bits &= PAGE_BREAK_BEFORE_MASK;
- bits >>= PAGE_BREAK_BEFORE_SHIFT;
-
- /* 3bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_BEFORE_AUTO;
-}
-#undef PAGE_BREAK_BEFORE_MASK
-#undef PAGE_BREAK_BEFORE_SHIFT
-#undef PAGE_BREAK_BEFORE_INDEX
-
-#define PAGE_BREAK_INSIDE_INDEX 0
-#define PAGE_BREAK_INSIDE_SHIFT 6
-#define PAGE_BREAK_INSIDE_MASK 0xc0
-static inline uint8_t get_page_break_inside(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_INSIDE_INDEX];
- bits &= PAGE_BREAK_INSIDE_MASK;
- bits >>= PAGE_BREAK_INSIDE_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_INSIDE_AUTO;
-}
-#undef PAGE_BREAK_INSIDE_MASK
-#undef PAGE_BREAK_INSIDE_SHIFT
-#undef PAGE_BREAK_INSIDE_INDEX
-
-#define ORPHANS_INDEX 1
-#define ORPHANS_SHIFT 0
-#define ORPHANS_MASK 0x1
-static inline uint8_t get_orphans(
- const css_computed_style *style,
- int32_t *orphans)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[ORPHANS_INDEX];
- bits &= ORPHANS_MASK;
- bits >>= ORPHANS_SHIFT;
-
- *orphans = style->page->orphans;
-
- /* 1bit: type */
- return bits;
- }
-
- /* Initial value */
- *orphans = 2;
- return CSS_ORPHANS_SET;
-}
-#undef ORPHANS_MASK
-#undef ORPHANS_SHIFT
-#undef ORPHANS_INDEX
-
-#define WIDOWS_INDEX 1
-#define WIDOWS_SHIFT 1
-#define WIDOWS_MASK 0x2
-static inline uint8_t get_widows(
- const css_computed_style *style,
- int32_t *widows)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[WIDOWS_INDEX];
- bits &= WIDOWS_MASK;
- bits >>= WIDOWS_SHIFT;
-
- *widows = style->page->widows;
-
- /* 1bit: type */
- return bits;
- }
-
- /* Initial value */
- *widows = 2;
- return CSS_WIDOWS_SET;
-}
-#undef WIDOWS_MASK
-#undef WIDOWS_SHIFT
-#undef WIDOWS_INDEX
-
-#define ALIGN_CONTENT_INDEX_A 34
-#define ALIGN_CONTENT_SHIFT_A 0
-#define ALIGN_CONTENT_MASK_A 0x3
-#define ALIGN_CONTENT_INDEX_B 35
-#define ALIGN_CONTENT_SHIFT_B 1
-#define ALIGN_CONTENT_MASK_B 0x2
-static inline uint8_t get_align_content(
- const css_computed_style *style)
-{
- uint8_t bits_a = style->i.bits[ALIGN_CONTENT_INDEX_A];
- bits_a &= ALIGN_CONTENT_MASK_A;
- bits_a >>= ALIGN_CONTENT_SHIFT_A;
-
- uint8_t bits_b = style->i.bits[ALIGN_CONTENT_INDEX_B];
- bits_b &= ALIGN_CONTENT_MASK_B;
- bits_b >>= ALIGN_CONTENT_SHIFT_B;
- /* Most significant bit out of three */
- bits_b <<= 2;
-
- uint8_t bits = bits_a | bits_b;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_CONTENT_MASK_A
-#undef ALIGN_CONTENT_SHIFT_A
-#undef ALIGN_CONTENT_INDEX_A
-#undef ALIGN_CONTENT_MASK_B
-#undef ALIGN_CONTENT_SHIFT_B
-#undef ALIGN_CONTENT_INDEX_B
-
-#define FLEX_WRAP_INDEX 19
-#define FLEX_WRAP_SHIFT 0
-#define FLEX_WRAP_MASK 0x3
-static inline uint8_t get_flex_wrap(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLEX_WRAP_INDEX];
- bits &= FLEX_WRAP_MASK;
- bits >>= FLEX_WRAP_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FLEX_WRAP_MASK
-#undef FLEX_WRAP_SHIFT
-#undef FLEX_WRAP_INDEX
-
-#define FLEX_BASIS_INDEX 35
-#define FLEX_BASIS_SHIFT 2
-#define FLEX_BASIS_MASK 0xfc
-static inline uint8_t get_flex_basis(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[FLEX_BASIS_INDEX];
- bits &= FLEX_BASIS_MASK;
- bits >>= FLEX_BASIS_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_FLEX_BASIS_SET) {
- *length = style->i.flex_basis;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef FLEX_BASIS_MASK
-#undef FLEX_BASIS_SHIFT
-#undef FLEX_BASIS_INDEX
-
-#define FLEX_SHRINK_INDEX 20
-#define FLEX_SHRINK_SHIFT 1
-#define FLEX_SHRINK_MASK 0x2
-static inline uint8_t get_flex_shrink(
- const css_computed_style *style, css_fixed *number)
-{
- uint8_t bits = style->i.bits[FLEX_SHRINK_INDEX];
- bits &= FLEX_SHRINK_MASK;
- bits >>= FLEX_SHRINK_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_FLEX_SHRINK_SET) {
- *number = style->i.flex_shrink;
- }
-
- return (bits & 0x1);
-}
-#undef FLEX_SHRINK_MASK
-#undef FLEX_SHRINK_SHIFT
-#undef FLEX_SHRINK_INDEX
-
-#define FLEX_GROW_INDEX 20
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
-static inline uint8_t get_flex_grow(
- const css_computed_style *style, css_fixed *number)
-{
- uint8_t bits = style->i.bits[FLEX_GROW_INDEX];
- bits &= FLEX_GROW_MASK;
- bits >>= FLEX_GROW_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_FLEX_GROW_SET) {
- *number = style->i.flex_grow;
- }
-
- return (bits & 0x1);
-}
-#undef FLEX_GROW_MASK
-#undef FLEX_GROW_SHIFT
-#undef FLEX_GROW_INDEX
-
-#define FLEX_DIRECTION_INDEX 36
-#define FLEX_DIRECTION_SHIFT 5
-#define FLEX_DIRECTION_MASK 0xe0
-static inline uint8_t get_flex_direction(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
- bits &= FLEX_DIRECTION_MASK;
- bits >>= FLEX_DIRECTION_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef FLEX_DIRECTION_MASK
-#undef FLEX_DIRECTION_SHIFT
-#undef FLEX_DIRECTION_INDEX
-
-#define JUSTIFY_CONTENT_INDEX_A 35
-#define JUSTIFY_CONTENT_SHIFT_A 0
-#define JUSTIFY_CONTENT_MASK_A 0x1
-#define JUSTIFY_CONTENT_INDEX_B 36
-#define JUSTIFY_CONTENT_SHIFT_B 0
-#define JUSTIFY_CONTENT_MASK_B 0x3
-static inline uint8_t get_justify_content(
- const css_computed_style *style)
-{
- uint8_t bits_a = style->i.bits[JUSTIFY_CONTENT_INDEX_A];
- bits_a &= JUSTIFY_CONTENT_MASK_A;
- bits_a >>= JUSTIFY_CONTENT_SHIFT_A;
-
- uint8_t bits_b = style->i.bits[JUSTIFY_CONTENT_INDEX_B];
- bits_b &= JUSTIFY_CONTENT_MASK_B;
- bits_b >>= JUSTIFY_CONTENT_SHIFT_B;
- /* Most significant two bits out of three */
- bits_b <<= 1;
-
- uint8_t bits = bits_a | bits_b;
-
- /* 3bits: type */
- return bits;
-}
-#undef JUSTIFY_CONTENT_MASK_A
-#undef JUSTIFY_CONTENT_SHIFT_A
-#undef JUSTIFY_CONTENT_INDEX_A
-#undef JUSTIFY_CONTENT_MASK_B
-#undef JUSTIFY_CONTENT_SHIFT_B
-#undef JUSTIFY_CONTENT_INDEX_B
-
-#define ORDER_INDEX 37
-#define ORDER_SHIFT 1
-#define ORDER_MASK 0x2
-static inline uint8_t get_order(
- const css_computed_style *style, int32_t *number)
-{
- uint8_t bits = style->i.bits[ORDER_INDEX];
- bits &= ORDER_MASK;
- bits >>= ORDER_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_ORDER_SET) {
- *number = style->i.order;
- }
-
- return (bits & 0x1);
-}
-#undef ORDER_MASK
-#undef ORDER_SHIFT
-#undef ORDER_INDEX
-
-#define ALIGN_ITEMS_INDEX 37
-#define ALIGN_ITEMS_SHIFT 5
-#define ALIGN_ITEMS_MASK 0xe0
-static inline uint8_t get_align_items(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
- bits &= ALIGN_ITEMS_MASK;
- bits >>= ALIGN_ITEMS_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_ITEMS_MASK
-#undef ALIGN_ITEMS_SHIFT
-#undef ALIGN_ITEMS_INDEX
-
-#define ALIGN_SELF_INDEX 37
-#define ALIGN_SELF_SHIFT 2
-#define ALIGN_SELF_MASK 0x1c
-static inline uint8_t get_align_self(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[ALIGN_SELF_INDEX];
- bits &= ALIGN_SELF_MASK;
- bits >>= ALIGN_SELF_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_SELF_MASK
-#undef ALIGN_SELF_SHIFT
-#undef ALIGN_SELF_INDEX
-
-#endif
diff --git a/src/select/propset.h.old b/src/select/propset.h.old
deleted file mode 100644
index ea7ca48..0000000
--- a/src/select/propset.h.old
+++ /dev/null
@@ -1,2546 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_propset_h_
-#define css_select_propset_h_
-
-#include <string.h>
-
-#include <libcss/computed.h>
-#include "computed.h"
-
-/* Important: keep this file in sync with computed.h */
-/** \todo Is there a better way to ensure this happens? */
-
-/** Default values are 'initial value', unless the property is inherited,
- * in which case it is 'inherit'. */
-static const css_computed_uncommon default_uncommon = {
- .i = {
- .bits = {
- (CSS_LETTER_SPACING_INHERIT << 2) |
- CSS_OUTLINE_COLOR_INVERT,
- (CSS_OUTLINE_WIDTH_MEDIUM << 1) |
- CSS_BORDER_SPACING_INHERIT,
- 0,
- (CSS_WORD_SPACING_INHERIT << 2) |
- (CSS_COUNTER_INCREMENT_NONE << 1) |
- CSS_COUNTER_RESET_NONE,
- (CSS_CURSOR_INHERIT << 3) |
- (CSS_WRITING_MODE_INHERIT << 1),
- 0,
- 0,
- (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_RULE_WIDTH_MEDIUM << 1),
- (CSS_COLUMN_SPAN_NONE << 6) | CSS_COLUMN_WIDTH_AUTO,
- (CSS_BREAK_BEFORE_AUTO << 4) | CSS_BREAK_AFTER_AUTO,
- (CSS_BREAK_INSIDE_AUTO)
- },
- .border_spacing = { 0, 0 },
- .clip = { 0, 0, 0, 0 },
- .letter_spacing = 0,
- .outline_color = 0x0,
- .outline_width = 0,
- .word_spacing = 0,
- .column_count = 0,
- .column_gap = 0,
- .column_rule_color = 0,
- .column_rule_width = 0,
- .column_width = 0
- },
- .counter_increment = NULL,
- .counter_reset = NULL,
- .content = NULL,
- .cursor = NULL,
- .next = NULL,
- .count = 0,
- .bin = UINT32_MAX
-};
-
-#define ENSURE_UNCOMMON do { \
- if (style->i.uncommon == NULL) { \
- style->i.uncommon = malloc( \
- sizeof(css_computed_uncommon)); \
- if (style->i.uncommon == NULL) \
- return CSS_NOMEM; \
- \
- memcpy(style->i.uncommon, &default_uncommon, \
- sizeof(css_computed_uncommon)); \
- } \
-} while(0)
-
-static const css_computed_page default_page = {
- {
- (CSS_PAGE_BREAK_INSIDE_AUTO << 6) |
- (CSS_PAGE_BREAK_BEFORE_AUTO << 3) |
- CSS_PAGE_BREAK_AFTER_AUTO,
- (CSS_WIDOWS_SET << 1) |
- CSS_ORPHANS_SET
- },
- 2 << CSS_RADIX_POINT,
- 2 << CSS_RADIX_POINT
-};
-
-#define ENSURE_PAGE do { \
- if (style->page == NULL) { \
- style->page = malloc(sizeof(css_computed_page)); \
- if (style->page == NULL) \
- return CSS_NOMEM; \
- \
- memcpy(style->page, &default_page, \
- sizeof(css_computed_page)); \
- } \
-} while(0)
-
-#define LETTER_SPACING_INDEX 0
-#define LETTER_SPACING_SHIFT 2
-#define LETTER_SPACING_MASK 0xfc
-static inline css_error set_letter_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[LETTER_SPACING_INDEX];
-
- /* 6bits: uuuutt : unit | type */
- *bits = (*bits & ~LETTER_SPACING_MASK) |
- (((type & 0x3) | unit << 2) << LETTER_SPACING_SHIFT);
-
- style->i.uncommon->i.letter_spacing = length;
-
- return CSS_OK;
-}
-#undef LETTER_SPACING_MASK
-#undef LETTER_SPACING_SHIFT
-#undef LETTER_SPACING_INDEX
-
-#define OUTLINE_COLOR_INDEX 0
-#define OUTLINE_COLOR_SHIFT 0
-#define OUTLINE_COLOR_MASK 0x3
-static inline css_error set_outline_color(
- css_computed_style *style, uint8_t type, css_color color)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~OUTLINE_COLOR_MASK) |
- ((type & 0x3) << OUTLINE_COLOR_SHIFT);
-
- style->i.uncommon->i.outline_color = color;
-
- return CSS_OK;
-}
-#undef OUTLINE_COLOR_MASK
-#undef OUTLINE_COLOR_SHIFT
-#undef OUTLINE_COLOR_INDEX
-
-#define OUTLINE_WIDTH_INDEX 1
-#define OUTLINE_WIDTH_SHIFT 1
-#define OUTLINE_WIDTH_MASK 0xfe
-static inline css_error set_outline_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : unit | type */
- *bits = (*bits & ~OUTLINE_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << OUTLINE_WIDTH_SHIFT);
-
- style->i.uncommon->i.outline_width = length;
-
- return CSS_OK;
-}
-#undef OUTLINE_WIDTH_MASK
-#undef OUTLINE_WIDTH_SHIFT
-#undef OUTLINE_WIDTH_INDEX
-
-#define BORDER_SPACING_INDEX 1
-#define BORDER_SPACING_SHIFT 0
-#define BORDER_SPACING_MASK 0x1
-#define BORDER_SPACING_INDEX1 2
-#define BORDER_SPACING_SHIFT1 0
-static inline css_error set_border_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed hlength, css_unit hunit,
- css_fixed vlength, css_unit vunit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX];
-
- /* 1 bit: type */
- *bits = (*bits & ~BORDER_SPACING_MASK) |
- ((type & 0x1) << BORDER_SPACING_SHIFT);
-
- bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX1];
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *bits = (((hunit << 4) | vunit) << BORDER_SPACING_SHIFT1);
-
-
- style->i.uncommon->i.border_spacing[0] = hlength;
- style->i.uncommon->i.border_spacing[1] = vlength;
-
- return CSS_OK;
-}
-#undef BORDER_SPACING_SHIFT1
-#undef BORDER_SPACING_INDEX1
-#undef BORDER_SPACING_MASK
-#undef BORDER_SPACING_SHIFT
-#undef BORDER_SPACING_INDEX
-
-#define BREAK_AFTER_INDEX 12
-#define BREAK_AFTER_SHIFT 0
-#define BREAK_AFTER_MASK 0xf
-static inline css_error set_break_after(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_AFTER_MASK) |
- ((type & 0xf) << BREAK_AFTER_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_AFTER_MASK
-#undef BREAK_AFTER_SHIFT
-#undef BREAK_AFTER_INDEX
-
-#define BREAK_BEFORE_INDEX 12
-#define BREAK_BEFORE_SHIFT 4
-#define BREAK_BEFORE_MASK (0xf << 4)
-static inline css_error set_break_before(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_BEFORE_MASK) |
- ((type & 0xf) << BREAK_BEFORE_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_BEFORE_MASK
-#undef BREAK_BEFORE_SHIFT
-#undef BREAK_BEFORE_INDEX
-
-#define BREAK_INSIDE_INDEX 13
-#define BREAK_INSIDE_SHIFT 4
-#define BREAK_INSIDE_MASK (0xf << 4)
-static inline css_error set_break_inside(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_INSIDE_MASK) |
- ((type & 0xf) << BREAK_INSIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_INSIDE_MASK
-#undef BREAK_INSIDE_SHIFT
-#undef BREAK_INSIDE_INDEX
-
-#define WORD_SPACING_INDEX 3
-#define WORD_SPACING_SHIFT 2
-#define WORD_SPACING_MASK 0xfc
-static inline css_error set_word_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[WORD_SPACING_INDEX];
-
- /* 6bits: uuuutt : unit | type */
- *bits = (*bits & ~WORD_SPACING_MASK) |
- (((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT);
-
- style->i.uncommon->i.word_spacing = length;
-
- return CSS_OK;
-}
-#undef WORD_SPACING_MASK
-#undef WORD_SPACING_SHIFT
-#undef WORD_SPACING_INDEX
-
-#define WRITING_MODE_INDEX 4
-#define WRITING_MODE_SHIFT 1
-#define WRITING_MODE_MASK 0x6
-static inline css_error set_writing_mode(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[WRITING_MODE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~WRITING_MODE_MASK) |
- ((type & 0x3) << WRITING_MODE_SHIFT);
-
- return CSS_OK;
-}
-#undef WRITING_MODE_MASK
-#undef WRITING_MODE_SHIFT
-#undef WRITING_MODE_INDEX
-
-#define COUNTER_INCREMENT_INDEX 3
-#define COUNTER_INCREMENT_SHIFT 1
-#define COUNTER_INCREMENT_MASK 0x2
-static inline css_error set_counter_increment(
- css_computed_style *style, uint8_t type,
- css_computed_counter *counters)
-{
- uint8_t *bits;
- css_computed_counter *oldcounters;
- css_computed_counter *c;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX];
- oldcounters = style->i.uncommon->counter_increment;
-
- /* 1bit: type */
- *bits = (*bits & ~COUNTER_INCREMENT_MASK) |
- ((type & 0x1) << COUNTER_INCREMENT_SHIFT);
-
- for (c = counters; c != NULL && c->name != NULL; c++)
- c->name = lwc_string_ref(c->name);
-
- style->i.uncommon->counter_increment = counters;
-
- /* Free existing array */
- if (oldcounters != NULL) {
- for (c = oldcounters; c->name != NULL; c++)
- lwc_string_unref(c->name);
-
- if (oldcounters != counters)
- free(oldcounters);
- }
-
- return CSS_OK;
-}
-#undef COUNTER_INCREMENT_MASK
-#undef COUNTER_INCREMENT_SHIFT
-#undef COUNTER_INCREMENT_INDEX
-
-#define COUNTER_RESET_INDEX 3
-#define COUNTER_RESET_SHIFT 0
-#define COUNTER_RESET_MASK 0x1
-static inline css_error set_counter_reset(
- css_computed_style *style, uint8_t type,
- css_computed_counter *counters)
-{
- uint8_t *bits;
- css_computed_counter *oldcounters;
- css_computed_counter *c;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX];
- oldcounters = style->i.uncommon->counter_reset;
-
- /* 1bit: type */
- *bits = (*bits & ~COUNTER_RESET_MASK) |
- ((type & 0x1) << COUNTER_RESET_SHIFT);
-
- for (c = counters; c != NULL && c->name != NULL; c++)
- c->name = lwc_string_ref(c->name);
-
- style->i.uncommon->counter_reset = counters;
-
- /* Free existing array */
- if (oldcounters != NULL) {
- for (c = oldcounters; c->name != NULL; c++)
- lwc_string_unref(c->name);
-
- if (oldcounters != counters)
- free(oldcounters);
- }
-
- return CSS_OK;
-}
-#undef COUNTER_RESET_MASK
-#undef COUNTER_RESET_SHIFT
-#undef COUNTER_RESET_INDEX
-
-#define CURSOR_INDEX 4
-#define CURSOR_SHIFT 3
-#define CURSOR_MASK 0xf8
-static inline css_error set_cursor(
- css_computed_style *style, uint8_t type,
- lwc_string **urls)
-{
- uint8_t *bits;
- lwc_string **oldurls;
- lwc_string **s;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[CURSOR_INDEX];
- oldurls = style->i.uncommon->cursor;
-
- /* 5bits: type */
- *bits = (*bits & ~CURSOR_MASK) |
- ((type & 0x1f) << CURSOR_SHIFT);
-
- for (s = urls; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->i.uncommon->cursor = urls;
-
- /* Free existing array */
- if (oldurls != NULL) {
- for (s = oldurls; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldurls != urls)
- free(oldurls);
- }
-
- return CSS_OK;
-}
-#undef CURSOR_MASK
-#undef CURSOR_SHIFT
-#undef CURSOR_INDEX
-
-#define CLIP_INDEX 7
-#define CLIP_SHIFT 2
-#define CLIP_MASK 0xfc
-#define CLIP_INDEX1 5
-#define CLIP_SHIFT1 0
-#define CLIP_INDEX2 6
-#define CLIP_SHIFT2 0
-static inline css_error set_clip(
- css_computed_style *style, uint8_t type,
- css_computed_clip_rect *rect)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX];
-
- /* 6bits: trblyy : top | right | bottom | left | type */
- *bits = (*bits & ~CLIP_MASK) |
- ((type & 0x3) << CLIP_SHIFT);
-
- if (type == CSS_CLIP_RECT) {
- *bits |= (((rect->top_auto ? 0x20 : 0) |
- (rect->right_auto ? 0x10 : 0) |
- (rect->bottom_auto ? 0x8 : 0) |
- (rect->left_auto ? 0x4 : 0)) << CLIP_SHIFT);
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX1];
-
- /* 8bits: ttttrrrr : top | right */
- *bits = (((rect->tunit << 4) | rect->runit) << CLIP_SHIFT1);
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX2];
-
- /* 8bits: bbbbllll : bottom | left */
- *bits = (((rect->bunit << 4) | rect->lunit) << CLIP_SHIFT2);
-
- style->i.uncommon->i.clip[0] = rect->top;
- style->i.uncommon->i.clip[1] = rect->right;
- style->i.uncommon->i.clip[2] = rect->bottom;
- style->i.uncommon->i.clip[3] = rect->left;
- }
-
- return CSS_OK;
-}
-#undef CLIP_SHIFT2
-#undef CLIP_INDEX2
-#undef CLIP_SHIFT1
-#undef CLIP_INDEX1
-#undef CLIP_MASK
-#undef CLIP_SHIFT
-#undef CLIP_INDEX
-
-#define COLUMN_COUNT_INDEX 8
-#define COLUMN_COUNT_SHIFT 6
-#define COLUMN_COUNT_MASK 0xc0
-static inline css_error set_column_count(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_COUNT_MASK) |
- ((type & 0x3) << COLUMN_COUNT_SHIFT);
-
- style->i.uncommon->i.column_count = count;
-
- return CSS_OK;
-}
-#undef COLUMN_COUNT_MASK
-#undef COLUMN_COUNT_SHIFT
-#undef COLUMN_COUNT_INDEX
-
-#define COLUMN_FILL_INDEX 8
-#define COLUMN_FILL_SHIFT 4
-#define COLUMN_FILL_MASK 0x30
-static inline css_error set_column_fill(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_FILL_MASK) |
- ((type & 0x3) << COLUMN_FILL_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_FILL_MASK
-#undef COLUMN_FILL_SHIFT
-#undef COLUMN_FILL_INDEX
-
-#define COLUMN_GAP_INDEX 9
-#define COLUMN_GAP_SHIFT 2
-#define COLUMN_GAP_MASK 0xfc
-static inline css_error set_column_gap(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_GAP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~COLUMN_GAP_MASK) |
- (((type & 0x3) | (unit << 2)) << COLUMN_GAP_SHIFT);
-
- style->i.uncommon->i.column_gap = length;
-
- return CSS_OK;
-}
-#undef COLUMN_GAP_MASK
-#undef COLUMN_GAP_SHIFT
-#undef COLUMN_GAP_INDEX
-
-#define COLUMN_RULE_COLOR_INDEX 9
-#define COLUMN_RULE_COLOR_SHIFT 0
-#define COLUMN_RULE_COLOR_MASK 0x3
-static inline css_error set_column_rule_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) |
- ((type & 0x3) << COLUMN_RULE_COLOR_SHIFT);
-
- style->i.uncommon->i.column_rule_color = color;
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_COLOR_MASK
-#undef COLUMN_RULE_COLOR_SHIFT
-#undef COLUMN_RULE_COLOR_INDEX
-
-#define COLUMN_RULE_STYLE_INDEX 8
-#define COLUMN_RULE_STYLE_SHIFT 0
-#define COLUMN_RULE_STYLE_MASK 0xf
-static inline css_error set_column_rule_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) |
- ((type & 0xf) << COLUMN_RULE_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_STYLE_MASK
-#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->i.uncommon->i.bits[COLUMN_RULE_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT);
-
- style->i.uncommon->i.column_rule_width = length;
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_WIDTH_MASK
-#undef COLUMN_RULE_WIDTH_SHIFT
-#undef COLUMN_RULE_WIDTH_INDEX
-
-#define COLUMN_SPAN_INDEX 11
-#define COLUMN_SPAN_SHIFT 6
-#define COLUMN_SPAN_MASK 0xc0
-static inline css_error set_column_span(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_SPAN_MASK) |
- ((type & 0x3) << COLUMN_SPAN_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_SPAN_MASK
-#undef COLUMN_SPAN_SHIFT
-#undef COLUMN_SPAN_INDEX
-
-#define COLUMN_WIDTH_INDEX 11
-#define COLUMN_WIDTH_SHIFT 0
-#define COLUMN_WIDTH_MASK 0x3f
-static inline css_error set_column_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~COLUMN_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << COLUMN_WIDTH_SHIFT);
-
- style->i.uncommon->i.column_width = length;
-
- return CSS_OK;
-}
-#undef COLUMN_WIDTH_MASK
-#undef COLUMN_WIDTH_SHIFT
-#undef COLUMN_WIDTH_INDEX
-
-#define CONTENT_INDEX 7
-#define CONTENT_SHIFT 0
-#define CONTENT_MASK 0x3
-static inline css_error set_content(
- css_computed_style *style, uint8_t type,
- css_computed_content_item *content)
-{
- uint8_t *bits;
- css_computed_content_item *oldcontent;
- css_computed_content_item *c;
-
- ENSURE_UNCOMMON;
-
- /* 2bits: type */
- bits = &style->i.uncommon->i.bits[CONTENT_INDEX];
- oldcontent = style->i.uncommon->content;
-
- *bits = (*bits & ~CONTENT_MASK) |
- ((type & 0x3) << CONTENT_SHIFT);
-
- for (c = content; c != NULL &&
- c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
- switch (c->type) {
- case CSS_COMPUTED_CONTENT_STRING:
- c->data.string = lwc_string_ref(c->data.string);
- break;
- case CSS_COMPUTED_CONTENT_URI:
- c->data.uri = lwc_string_ref(c->data.uri);
- break;
- case CSS_COMPUTED_CONTENT_ATTR:
- c->data.attr = lwc_string_ref(c->data.attr);
- break;
- case CSS_COMPUTED_CONTENT_COUNTER:
- c->data.counter.name =
- lwc_string_ref(c->data.counter.name);
- break;
- case CSS_COMPUTED_CONTENT_COUNTERS:
- c->data.counters.name =
- lwc_string_ref(c->data.counters.name);
- c->data.counters.sep =
- lwc_string_ref(c->data.counters.sep);
- break;
- default:
- break;
- }
- }
-
- style->i.uncommon->content = content;
-
- /* Free existing array */
- if (oldcontent != NULL) {
- for (c = oldcontent;
- c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
- switch (c->type) {
- case CSS_COMPUTED_CONTENT_STRING:
- lwc_string_unref(c->data.string);
- break;
- case CSS_COMPUTED_CONTENT_URI:
- lwc_string_unref(c->data.uri);
- break;
- case CSS_COMPUTED_CONTENT_ATTR:
- lwc_string_unref(c->data.attr);
- break;
- case CSS_COMPUTED_CONTENT_COUNTER:
- lwc_string_unref(c->data.counter.name);
- break;
- case CSS_COMPUTED_CONTENT_COUNTERS:
- lwc_string_unref(c->data.counters.name);
- lwc_string_unref(c->data.counters.sep);
- break;
- default:
- break;
- }
- }
-
- if (oldcontent != content)
- free(oldcontent);
- }
-
- return CSS_OK;
-}
-#undef CONTENT_MASK
-#undef CONTENT_SHIFT
-#undef CONTENT_INDEX
-
-
-#define VERTICAL_ALIGN_INDEX 0
-#define VERTICAL_ALIGN_SHIFT 0
-static inline css_error set_vertical_align(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
-
- /* 8bits: uuuutttt : units | type */
- *bits = (((type & 0xf) | (unit << 4)) << VERTICAL_ALIGN_SHIFT);
-
- style->i.vertical_align = length;
-
- return CSS_OK;
-}
-#undef VERTICAL_ALIGN_SHIFT
-#undef VERTICAL_ALIGN_INDEX
-
-#define FONT_SIZE_INDEX 1
-#define FONT_SIZE_SHIFT 0
-static inline css_error set_font_size(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[FONT_SIZE_INDEX];
-
- /* 8bits: uuuutttt : units | type */
- *bits = (((type & 0xf) | (unit << 4)) << FONT_SIZE_SHIFT);
-
- style->i.font_size = length;
-
- return CSS_OK;
-}
-#undef FONT_SIZE_SHIFT
-#undef FONT_SIZE_INDEX
-
-#define BORDER_TOP_WIDTH_INDEX 2
-#define BORDER_TOP_WIDTH_SHIFT 1
-#define BORDER_TOP_WIDTH_MASK 0xfe
-static inline css_error set_border_top_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_TOP_WIDTH_SHIFT);
-
- style->i.border_width[0] = length;
-
- return CSS_OK;
-}
-#undef BORDER_TOP_WIDTH_MASK
-#undef BORDER_TOP_WIDTH_SHIFT
-#undef BORDER_TOP_WIDTH_INDEX
-
-#define BORDER_RIGHT_WIDTH_INDEX 3
-#define BORDER_RIGHT_WIDTH_SHIFT 1
-#define BORDER_RIGHT_WIDTH_MASK 0xfe
-static inline css_error set_border_right_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_RIGHT_WIDTH_SHIFT);
-
- style->i.border_width[1] = length;
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_WIDTH_MASK
-#undef BORDER_RIGHT_WIDTH_SHIFT
-#undef BORDER_RIGHT_WIDTH_INDEX
-
-#define BORDER_BOTTOM_WIDTH_INDEX 4
-#define BORDER_BOTTOM_WIDTH_SHIFT 1
-#define BORDER_BOTTOM_WIDTH_MASK 0xfe
-static inline css_error set_border_bottom_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_BOTTOM_WIDTH_SHIFT);
-
- style->i.border_width[2] = length;
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_WIDTH_MASK
-#undef BORDER_BOTTOM_WIDTH_SHIFT
-#undef BORDER_BOTTOM_WIDTH_INDEX
-
-#define BORDER_LEFT_WIDTH_INDEX 5
-#define BORDER_LEFT_WIDTH_SHIFT 1
-#define BORDER_LEFT_WIDTH_MASK 0xfe
-static inline css_error set_border_left_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_LEFT_WIDTH_SHIFT);
-
- style->i.border_width[3] = length;
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_WIDTH_MASK
-#undef BORDER_LEFT_WIDTH_SHIFT
-#undef BORDER_LEFT_WIDTH_INDEX
-
-#define BACKGROUND_IMAGE_INDEX 2
-#define BACKGROUND_IMAGE_SHIFT 0
-#define BACKGROUND_IMAGE_MASK 0x1
-static inline css_error set_background_image(
- css_computed_style *style, uint8_t type,
- lwc_string *url)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
- lwc_string *oldurl = style->i.background_image;
-
- /* 1bit: type */
- *bits = (*bits & ~BACKGROUND_IMAGE_MASK) |
- ((type & 0x1) << BACKGROUND_IMAGE_SHIFT);
-
- if (url != NULL) {
- style->i.background_image = lwc_string_ref(url);
- } else {
- style->i.background_image = NULL;
- }
-
- if (oldurl != NULL)
- lwc_string_unref(oldurl);
-
- return CSS_OK;
-}
-#undef BACKGROUND_IMAGE_MASK
-#undef BACKGROUND_IMAGE_SHIFT
-#undef BACKGROUND_IMAGE_INDEX
-
-#define COLOR_INDEX 3
-#define COLOR_SHIFT 0
-#define COLOR_MASK 0x1
-static inline css_error set_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[COLOR_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~COLOR_MASK) |
- ((type & 0x1) << COLOR_SHIFT);
-
- style->i.color = color;
-
- return CSS_OK;
-}
-#undef COLOR_MASK
-#undef COLOR_SHIFT
-#undef COLOR_INDEX
-
-#define LIST_STYLE_IMAGE_INDEX 4
-#define LIST_STYLE_IMAGE_SHIFT 0
-#define LIST_STYLE_IMAGE_MASK 0x1
-static inline css_error set_list_style_image(
- css_computed_style *style, uint8_t type,
- lwc_string *url)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
- lwc_string *oldurl = style->i.list_style_image;
-
- /* 1bit: type */
- *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) |
- ((type & 0x1) << LIST_STYLE_IMAGE_SHIFT);
-
- if (url != NULL) {
- style->i.list_style_image = lwc_string_ref(url);
- } else {
- style->i.list_style_image = NULL;
- }
-
- if (oldurl != NULL)
- lwc_string_unref(oldurl);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_IMAGE_MASK
-#undef LIST_STYLE_IMAGE_SHIFT
-#undef LIST_STYLE_IMAGE_INDEX
-
-#define QUOTES_INDEX 5
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
-static inline css_error set_quotes(
- css_computed_style *style, uint8_t type,
- lwc_string **quotes)
-{
- uint8_t *bits = &style->i.bits[QUOTES_INDEX];
- lwc_string **oldquotes = style->quotes;
- lwc_string **s;
-
- /* 1bit: type */
- *bits = (*bits & ~QUOTES_MASK) |
- ((type & 0x1) << QUOTES_SHIFT);
-
- for (s = quotes; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->quotes = quotes;
-
- /* Free current quotes */
- if (oldquotes != NULL) {
- for (s = oldquotes; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldquotes != quotes)
- free(oldquotes);
- }
-
- return CSS_OK;
-}
-#undef QUOTES_MASK
-#undef QUOTES_SHIFT
-#undef QUOTES_INDEX
-
-#define TOP_INDEX 6
-#define TOP_SHIFT 2
-#define TOP_MASK 0xfc
-static inline css_error set_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[TOP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~TOP_MASK) |
- (((type & 0x3) | (unit << 2)) << TOP_SHIFT);
-
- style->i.top = length;
-
- return CSS_OK;
-}
-#undef TOP_MASK
-#undef TOP_SHIFT
-#undef TOP_INDEX
-
-#define RIGHT_INDEX 7
-#define RIGHT_SHIFT 2
-#define RIGHT_MASK 0xfc
-static inline css_error set_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[RIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~RIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << RIGHT_SHIFT);
-
- style->i.right = length;
-
- return CSS_OK;
-}
-#undef RIGHT_MASK
-#undef RIGHT_SHIFT
-#undef RIGHT_INDEX
-
-#define BOTTOM_INDEX 8
-#define BOTTOM_SHIFT 2
-#define BOTTOM_MASK 0xfc
-static inline css_error set_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BOTTOM_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~BOTTOM_MASK) |
- (((type & 0x3) | (unit << 2)) << BOTTOM_SHIFT);
-
- style->i.bottom = length;
-
- return CSS_OK;
-}
-#undef BOTTOM_MASK
-#undef BOTTOM_SHIFT
-#undef BOTTOM_INDEX
-
-#define LEFT_INDEX 9
-#define LEFT_SHIFT 2
-#define LEFT_MASK 0xfc
-static inline css_error set_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[LEFT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~LEFT_MASK) |
- (((type & 0x3) | (unit << 2)) << LEFT_SHIFT);
-
- style->i.left = length;
-
- return CSS_OK;
-}
-#undef LEFT_MASK
-#undef LEFT_SHIFT
-#undef LEFT_INDEX
-
-#define BORDER_TOP_COLOR_INDEX 6
-#define BORDER_TOP_COLOR_SHIFT 0
-#define BORDER_TOP_COLOR_MASK 0x3
-static inline css_error set_border_top_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_TOP_COLOR_MASK) |
- ((type & 0x3) << BORDER_TOP_COLOR_SHIFT);
-
- style->i.border_color[0] = color;
-
- return CSS_OK;
-}
-#undef BORDER_TOP_COLOR_MASK
-#undef BORDER_TOP_COLOR_SHIFT
-#undef BORDER_TOP_COLOR_INDEX
-
-#define BORDER_RIGHT_COLOR_INDEX 7
-#define BORDER_RIGHT_COLOR_SHIFT 0
-#define BORDER_RIGHT_COLOR_MASK 0x3
-static inline css_error set_border_right_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) |
- ((type & 0x3) << BORDER_RIGHT_COLOR_SHIFT);
-
- style->i.border_color[1] = color;
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_COLOR_MASK
-#undef BORDER_RIGHT_COLOR_SHIFT
-#undef BORDER_RIGHT_COLOR_INDEX
-
-#define BORDER_BOTTOM_COLOR_INDEX 8
-#define BORDER_BOTTOM_COLOR_SHIFT 0
-#define BORDER_BOTTOM_COLOR_MASK 0x3
-static inline css_error set_border_bottom_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) |
- ((type & 0x3) << BORDER_BOTTOM_COLOR_SHIFT);
-
- style->i.border_color[2] = color;
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_COLOR_MASK
-#undef BORDER_BOTTOM_COLOR_SHIFT
-#undef BORDER_BOTTOM_COLOR_INDEX
-
-#define BORDER_LEFT_COLOR_INDEX 9
-#define BORDER_LEFT_COLOR_SHIFT 0
-#define BORDER_LEFT_COLOR_MASK 0x3
-static inline css_error set_border_left_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) |
- ((type & 0x3) << BORDER_LEFT_COLOR_SHIFT);
-
- style->i.border_color[3] = color;
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_COLOR_MASK
-#undef BORDER_LEFT_COLOR_SHIFT
-#undef BORDER_LEFT_COLOR_INDEX
-
-#define HEIGHT_INDEX 10
-#define HEIGHT_SHIFT 2
-#define HEIGHT_MASK 0xfc
-static inline css_error set_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << HEIGHT_SHIFT);
-
- style->i.height = length;
-
- return CSS_OK;
-}
-#undef HEIGHT_MASK
-#undef HEIGHT_SHIFT
-#undef HEIGHT_INDEX
-
-#define LINE_HEIGHT_INDEX 11
-#define LINE_HEIGHT_SHIFT 2
-#define LINE_HEIGHT_MASK 0xfc
-static inline css_error set_line_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[LINE_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~LINE_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << LINE_HEIGHT_SHIFT);
-
- style->i.line_height = length;
-
- return CSS_OK;
-}
-#undef LINE_HEIGHT_MASK
-#undef LINE_HEIGHT_SHIFT
-#undef LINE_HEIGHT_INDEX
-
-#define BACKGROUND_COLOR_INDEX 10
-#define BACKGROUND_COLOR_SHIFT 0
-#define BACKGROUND_COLOR_MASK 0x3
-static inline css_error set_background_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BACKGROUND_COLOR_MASK) |
- ((type & 0x3) << BACKGROUND_COLOR_SHIFT);
-
- style->i.background_color = color;
-
- return CSS_OK;
-}
-#undef BACKGROUND_COLOR_MASK
-#undef BACKGROUND_COLOR_SHIFT
-#undef BACKGROUND_COLOR_INDEX
-
-#define Z_INDEX_INDEX 11
-#define Z_INDEX_SHIFT 0
-#define Z_INDEX_MASK 0x3
-static inline css_error set_z_index(
- css_computed_style *style, uint8_t type,
- int32_t z_index)
-{
- uint8_t *bits = &style->i.bits[Z_INDEX_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~Z_INDEX_MASK) |
- ((type & 0x3) << Z_INDEX_SHIFT);
-
- style->i.z_index = z_index;
-
- return CSS_OK;
-}
-#undef Z_INDEX_MASK
-#undef Z_INDEX_SHIFT
-#undef Z_INDEX_INDEX
-
-#define MARGIN_TOP_INDEX 12
-#define MARGIN_TOP_SHIFT 2
-#define MARGIN_TOP_MASK 0xfc
-static inline css_error set_margin_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_TOP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_TOP_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_TOP_SHIFT);
-
- style->i.margin[0] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_TOP_MASK
-#undef MARGIN_TOP_SHIFT
-#undef MARGIN_TOP_INDEX
-
-#define MARGIN_RIGHT_INDEX 13
-#define MARGIN_RIGHT_SHIFT 2
-#define MARGIN_RIGHT_MASK 0xfc
-static inline css_error set_margin_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_RIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_RIGHT_SHIFT);
-
- style->i.margin[1] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_RIGHT_MASK
-#undef MARGIN_RIGHT_SHIFT
-#undef MARGIN_RIGHT_INDEX
-
-#define MARGIN_BOTTOM_INDEX 14
-#define MARGIN_BOTTOM_SHIFT 2
-#define MARGIN_BOTTOM_MASK 0xfc
-static inline css_error set_margin_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_BOTTOM_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_BOTTOM_SHIFT);
-
- style->i.margin[2] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_BOTTOM_MASK
-#undef MARGIN_BOTTOM_SHIFT
-#undef MARGIN_BOTTOM_INDEX
-
-#define MARGIN_LEFT_INDEX 15
-#define MARGIN_LEFT_SHIFT 2
-#define MARGIN_LEFT_MASK 0xfc
-static inline css_error set_margin_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_LEFT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_LEFT_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_LEFT_SHIFT);
-
- style->i.margin[3] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_LEFT_MASK
-#undef MARGIN_LEFT_SHIFT
-#undef MARGIN_LEFT_INDEX
-
-#define BACKGROUND_ATTACHMENT_INDEX 12
-#define BACKGROUND_ATTACHMENT_SHIFT 0
-#define BACKGROUND_ATTACHMENT_MASK 0x3
-static inline css_error set_background_attachment(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) |
- ((type & 0x3) << BACKGROUND_ATTACHMENT_SHIFT);
-
- return CSS_OK;
-}
-#undef BACKGROUND_ATTACHMENT_MASK
-#undef BACKGROUND_ATTACHMENT_SHIFT
-#undef BACKGROUND_ATTACHMENT_INDEX
-
-#define BOX_SIZING_INDEX 23
-#define BOX_SIZING_SHIFT 0
-#define BOX_SIZING_MASK 0x3
-static inline css_error set_box_sizing(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BOX_SIZING_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BOX_SIZING_MASK) |
- ((type & 0x3) << BOX_SIZING_SHIFT);
-
- return CSS_OK;
-}
-#undef BOX_SIZING_MASK
-#undef BOX_SIZING_SHIFT
-#undef BOX_SIZING_INDEX
-
-#define BORDER_COLLAPSE_INDEX 13
-#define BORDER_COLLAPSE_SHIFT 0
-#define BORDER_COLLAPSE_MASK 0x3
-static inline css_error set_border_collapse(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_COLLAPSE_MASK) |
- ((type & 0x3) << BORDER_COLLAPSE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_COLLAPSE_MASK
-#undef BORDER_COLLAPSE_SHIFT
-#undef BORDER_COLLAPSE_INDEX
-
-#define CAPTION_SIDE_INDEX 14
-#define CAPTION_SIDE_SHIFT 0
-#define CAPTION_SIDE_MASK 0x3
-static inline css_error set_caption_side(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[CAPTION_SIDE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~CAPTION_SIDE_MASK) |
- ((type & 0x3) << CAPTION_SIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef CAPTION_SIDE_MASK
-#undef CAPTION_SIDE_SHIFT
-#undef CAPTION_SIDE_INDEX
-
-#define DIRECTION_INDEX 15
-#define DIRECTION_SHIFT 0
-#define DIRECTION_MASK 0x3
-static inline css_error set_direction(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[DIRECTION_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~DIRECTION_MASK) |
- ((type & 0x3) << DIRECTION_SHIFT);
-
- return CSS_OK;
-}
-#undef DIRECTION_MASK
-#undef DIRECTION_SHIFT
-#undef DIRECTION_INDEX
-
-#define MAX_HEIGHT_INDEX 16
-#define MAX_HEIGHT_SHIFT 2
-#define MAX_HEIGHT_MASK 0xfc
-static inline css_error set_max_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MAX_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MAX_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MAX_HEIGHT_SHIFT);
-
- style->i.max_height = length;
-
- return CSS_OK;
-}
-#undef MAX_HEIGHT_MASK
-#undef MAX_HEIGHT_SHIFT
-#undef MAX_HEIGHT_INDEX
-
-#define MAX_WIDTH_INDEX 17
-#define MAX_WIDTH_SHIFT 2
-#define MAX_WIDTH_MASK 0xfc
-static inline css_error set_max_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MAX_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MAX_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << MAX_WIDTH_SHIFT);
-
- style->i.max_width = length;
-
- return CSS_OK;
-}
-#undef MAX_WIDTH_MASK
-#undef MAX_WIDTH_SHIFT
-#undef MAX_WIDTH_INDEX
-
-#define WIDTH_INDEX 18
-#define WIDTH_SHIFT 2
-#define WIDTH_MASK 0xfc
-static inline css_error set_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << WIDTH_SHIFT);
-
- style->i.width = length;
-
- return CSS_OK;
-}
-#undef WIDTH_MASK
-#undef WIDTH_SHIFT
-#undef WIDTH_INDEX
-
-#define EMPTY_CELLS_INDEX 16
-#define EMPTY_CELLS_SHIFT 0
-#define EMPTY_CELLS_MASK 0x3
-static inline css_error set_empty_cells(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[EMPTY_CELLS_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~EMPTY_CELLS_MASK) |
- ((type & 0x3) << EMPTY_CELLS_SHIFT);
-
- return CSS_OK;
-}
-#undef EMPTY_CELLS_MASK
-#undef EMPTY_CELLS_SHIFT
-#undef EMPTY_CELLS_INDEX
-
-#define FLOAT_INDEX 17
-#define FLOAT_SHIFT 0
-#define FLOAT_MASK 0x3
-static inline css_error set_float(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLOAT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FLOAT_MASK) |
- ((type & 0x3) << FLOAT_SHIFT);
-
- return CSS_OK;
-}
-#undef FLOAT_MASK
-#undef FLOAT_SHIFT
-#undef FLOAT_INDEX
-
-#define FONT_STYLE_INDEX 18
-#define FONT_STYLE_SHIFT 0
-#define FONT_STYLE_MASK 0x3
-static inline css_error set_font_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_STYLE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FONT_STYLE_MASK) |
- ((type & 0x3) << FONT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_STYLE_MASK
-#undef FONT_STYLE_SHIFT
-#undef FONT_STYLE_INDEX
-
-#define MIN_HEIGHT_INDEX 19
-#define MIN_HEIGHT_SHIFT 2
-#define MIN_HEIGHT_MASK 0xfc
-static inline css_error set_min_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MIN_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MIN_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MIN_HEIGHT_SHIFT);
-
- style->i.min_height = length;
-
- return CSS_OK;
-}
-#undef MIN_HEIGHT_MASK
-#undef MIN_HEIGHT_SHIFT
-#undef MIN_HEIGHT_INDEX
-
-#define MIN_WIDTH_INDEX 20
-#define MIN_WIDTH_SHIFT 2
-#define MIN_WIDTH_MASK 0xfc
-static inline css_error set_min_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MIN_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MIN_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << MIN_WIDTH_SHIFT);
-
- style->i.min_width = length;
-
- return CSS_OK;
-}
-#undef MIN_WIDTH_MASK
-#undef MIN_WIDTH_SHIFT
-#undef MIN_WIDTH_INDEX
-
-#define BACKGROUND_REPEAT_INDEX 34
-#define BACKGROUND_REPEAT_SHIFT 2
-#define BACKGROUND_REPEAT_MASK 0x1c
-static inline css_error set_background_repeat(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~BACKGROUND_REPEAT_MASK) |
- ((type & 0x7) << BACKGROUND_REPEAT_SHIFT);
-
- return CSS_OK;
-}
-#undef BACKGROUND_REPEAT_MASK
-#undef BACKGROUND_REPEAT_SHIFT
-#undef BACKGROUND_REPEAT_INDEX
-
-#define CLEAR_INDEX 36
-#define CLEAR_SHIFT 2
-#define CLEAR_MASK 0x1c
-static inline css_error set_clear(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[CLEAR_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~CLEAR_MASK) |
- ((type & 0x7) << CLEAR_SHIFT);
-
- return CSS_OK;
-}
-#undef CLEAR_MASK
-#undef CLEAR_SHIFT
-#undef CLEAR_INDEX
-
-#define PADDING_TOP_INDEX 21
-#define PADDING_TOP_SHIFT 3
-#define PADDING_TOP_MASK 0xf8
-static inline css_error set_padding_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_TOP_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_TOP_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_TOP_SHIFT);
-
- style->i.padding[0] = length;
-
- return CSS_OK;
-}
-#undef PADDING_TOP_MASK
-#undef PADDING_TOP_SHIFT
-#undef PADDING_TOP_INDEX
-
-#define PADDING_RIGHT_INDEX 22
-#define PADDING_RIGHT_SHIFT 3
-#define PADDING_RIGHT_MASK 0xf8
-static inline css_error set_padding_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_RIGHT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_RIGHT_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_RIGHT_SHIFT);
-
- style->i.padding[1] = length;
-
- return CSS_OK;
-}
-#undef PADDING_RIGHT_MASK
-#undef PADDING_RIGHT_SHIFT
-#undef PADDING_RIGHT_INDEX
-
-#define PADDING_BOTTOM_INDEX 23
-#define PADDING_BOTTOM_SHIFT 3
-#define PADDING_BOTTOM_MASK 0xf8
-static inline css_error set_padding_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_BOTTOM_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_BOTTOM_SHIFT);
-
- style->i.padding[2] = length;
-
- return CSS_OK;
-}
-#undef PADDING_BOTTOM_MASK
-#undef PADDING_BOTTOM_SHIFT
-#undef PADDING_BOTTOM_INDEX
-
-#define PADDING_LEFT_INDEX 24
-#define PADDING_LEFT_SHIFT 3
-#define PADDING_LEFT_MASK 0xf8
-static inline css_error set_padding_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_LEFT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_LEFT_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_LEFT_SHIFT);
-
- style->i.padding[3] = length;
-
- return CSS_OK;
-}
-#undef PADDING_LEFT_MASK
-#undef PADDING_LEFT_SHIFT
-#undef PADDING_LEFT_INDEX
-
-#define OVERFLOW_X_INDEX 21
-#define OVERFLOW_X_SHIFT 0
-#define OVERFLOW_X_MASK 0x7
-static inline css_error set_overflow_x(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OVERFLOW_X_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~OVERFLOW_X_MASK) |
- ((type & 0x7) << OVERFLOW_X_SHIFT);
-
- return CSS_OK;
-}
-#undef OVERFLOW_X_MASK
-#undef OVERFLOW_X_SHIFT
-#undef OVERFLOW_X_INDEX
-
-#define OVERFLOW_Y_INDEX 34
-#define OVERFLOW_Y_SHIFT 5
-#define OVERFLOW_Y_MASK 0xe0
-static inline css_error set_overflow_y(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OVERFLOW_Y_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~OVERFLOW_Y_MASK) |
- ((type & 0x7) << OVERFLOW_Y_SHIFT);
-
- return CSS_OK;
-}
-#undef OVERFLOW_Y_MASK
-#undef OVERFLOW_Y_SHIFT
-#undef OVERFLOW_Y_INDEX
-
-#define POSITION_INDEX 22
-#define POSITION_SHIFT 0
-#define POSITION_MASK 0x7
-static inline css_error set_position(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[POSITION_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~POSITION_MASK) |
- ((type & 0x7) << POSITION_SHIFT);
-
- return CSS_OK;
-}
-#undef POSITION_MASK
-#undef POSITION_SHIFT
-#undef POSITION_INDEX
-
-#define OPACITY_INDEX 23
-#define OPACITY_SHIFT 2
-#define OPACITY_MASK 0x04
-static inline css_error set_opacity(
- css_computed_style *style,
- uint8_t type, css_fixed opacity)
-{
- uint8_t *bits = &style->i.bits[OPACITY_INDEX];
-
- /* 1bit: t : type */
- *bits = (*bits & ~OPACITY_MASK) |
- ((type & 0x1) << OPACITY_SHIFT);
-
- style->i.opacity = opacity;
-
- return CSS_OK;
-}
-#undef OPACITY_MASK
-#undef OPACITY_SHIFT
-#undef OPACITY_INDEX
-
-#define TEXT_TRANSFORM_INDEX 24
-#define TEXT_TRANSFORM_SHIFT 0
-#define TEXT_TRANSFORM_MASK 0x7
-static inline css_error set_text_transform(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~TEXT_TRANSFORM_MASK) |
- ((type & 0x7) << TEXT_TRANSFORM_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_TRANSFORM_MASK
-#undef TEXT_TRANSFORM_SHIFT
-#undef TEXT_TRANSFORM_INDEX
-
-#define TEXT_INDENT_INDEX 25
-#define TEXT_INDENT_SHIFT 3
-#define TEXT_INDENT_MASK 0xf8
-static inline css_error set_text_indent(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[TEXT_INDENT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~TEXT_INDENT_MASK) |
- (((type & 0x1) | (unit << 1)) << TEXT_INDENT_SHIFT);
-
- style->i.text_indent = length;
-
- return CSS_OK;
-}
-#undef TEXT_INDENT_MASK
-#undef TEXT_INDENT_SHIFT
-#undef TEXT_INDENT_INDEX
-
-#define WHITE_SPACE_INDEX 25
-#define WHITE_SPACE_SHIFT 0
-#define WHITE_SPACE_MASK 0x7
-static inline css_error set_white_space(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[WHITE_SPACE_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~WHITE_SPACE_MASK) |
- ((type & 0x7) << WHITE_SPACE_SHIFT);
-
- return CSS_OK;
-}
-#undef WHITE_SPACE_MASK
-#undef WHITE_SPACE_SHIFT
-#undef WHITE_SPACE_INDEX
-
-#define BACKGROUND_POSITION_INDEX 27
-#define BACKGROUND_POSITION_SHIFT 7
-#define BACKGROUND_POSITION_MASK 0x80
-#define BACKGROUND_POSITION_INDEX1 26
-#define BACKGROUND_POSITION_SHIFT1 0
-static inline css_error set_background_position(
- css_computed_style *style, uint8_t type,
- css_fixed hlength, css_unit hunit,
- css_fixed vlength, css_unit vunit)
-{
- uint8_t *bits;
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
-
- /* 1 bit: type */
- *bits = (*bits & ~BACKGROUND_POSITION_MASK) |
- ((type & 0x1) << BACKGROUND_POSITION_SHIFT);
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX1];
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *bits = (((hunit << 4) | vunit) << BACKGROUND_POSITION_SHIFT1);
-
- style->i.background_position[0] = hlength;
- style->i.background_position[1] = vlength;
-
- return CSS_OK;
-}
-#undef BACKGROUND_POSITION_SHIFT1
-#undef BACKGROUND_POSITION_INDEX1
-#undef BACKGROUND_POSITION_MASK
-#undef BACKGROUND_POSITION_SHIFT
-#undef BACKGROUND_POSITION_INDEX
-
-#define DISPLAY_INDEX 27
-#define DISPLAY_SHIFT 2
-#define DISPLAY_MASK 0x7c
-static inline css_error set_display(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[DISPLAY_INDEX];
-
- /* 5bits: type */
- *bits = (*bits & ~DISPLAY_MASK) |
- ((type & 0x1f) << DISPLAY_SHIFT);
-
- return CSS_OK;
-}
-#undef DISPLAY_MASK
-#undef DISPLAY_SHIFT
-#undef DISPLAY_INDEX
-
-#define FONT_VARIANT_INDEX 27
-#define FONT_VARIANT_SHIFT 0
-#define FONT_VARIANT_MASK 0x3
-static inline css_error set_font_variant(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_VARIANT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FONT_VARIANT_MASK) |
- ((type & 0x3) << FONT_VARIANT_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_VARIANT_MASK
-#undef FONT_VARIANT_SHIFT
-#undef FONT_VARIANT_INDEX
-
-#define TEXT_DECORATION_INDEX 28
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
-static inline css_error set_text_decoration(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_DECORATION_INDEX];
-
- /* 5bits: type */
- *bits = (*bits & ~TEXT_DECORATION_MASK) |
- ((type & 0x1f) << TEXT_DECORATION_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_DECORATION_MASK
-#undef TEXT_DECORATION_SHIFT
-#undef TEXT_DECORATION_INDEX
-
-#define FONT_FAMILY_INDEX 28
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
-static inline css_error set_font_family(
- css_computed_style *style, uint8_t type,
- lwc_string **names)
-{
- uint8_t *bits = &style->i.bits[FONT_FAMILY_INDEX];
- lwc_string **oldnames = style->font_family;
- lwc_string **s;
-
- /* 3bits: type */
- *bits = (*bits & ~FONT_FAMILY_MASK) |
- ((type & 0x7) << FONT_FAMILY_SHIFT);
-
- for (s = names; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->font_family = names;
-
- /* Free existing families */
- if (oldnames != NULL) {
- for (s = oldnames; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldnames != names)
- free(oldnames);
- }
-
- return CSS_OK;
-}
-#undef FONT_FAMILY_MASK
-#undef FONT_FAMILY_SHIFT
-#undef FONT_FAMILY_INDEX
-
-#define BORDER_TOP_STYLE_INDEX 29
-#define BORDER_TOP_STYLE_SHIFT 4
-#define BORDER_TOP_STYLE_MASK 0xf0
-static inline css_error set_border_top_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_TOP_STYLE_MASK) |
- ((type & 0xf) << BORDER_TOP_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_TOP_STYLE_MASK
-#undef BORDER_TOP_STYLE_SHIFT
-#undef BORDER_TOP_STYLE_INDEX
-
-#define BORDER_RIGHT_STYLE_INDEX 29
-#define BORDER_RIGHT_STYLE_SHIFT 0
-#define BORDER_RIGHT_STYLE_MASK 0xf
-static inline css_error set_border_right_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) |
- ((type & 0xf) << BORDER_RIGHT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_STYLE_MASK
-#undef BORDER_RIGHT_STYLE_SHIFT
-#undef BORDER_RIGHT_STYLE_INDEX
-
-#define BORDER_BOTTOM_STYLE_INDEX 30
-#define BORDER_BOTTOM_STYLE_SHIFT 4
-#define BORDER_BOTTOM_STYLE_MASK 0xf0
-static inline css_error set_border_bottom_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) |
- ((type & 0xf) << BORDER_BOTTOM_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_STYLE_MASK
-#undef BORDER_BOTTOM_STYLE_SHIFT
-#undef BORDER_BOTTOM_STYLE_INDEX
-
-#define BORDER_LEFT_STYLE_INDEX 30
-#define BORDER_LEFT_STYLE_SHIFT 0
-#define BORDER_LEFT_STYLE_MASK 0xf
-static inline css_error set_border_left_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) |
- ((type & 0xf) << BORDER_LEFT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_STYLE_MASK
-#undef BORDER_LEFT_STYLE_SHIFT
-#undef BORDER_LEFT_STYLE_INDEX
-
-#define FONT_WEIGHT_INDEX 31
-#define FONT_WEIGHT_SHIFT 4
-#define FONT_WEIGHT_MASK 0xf0
-static inline css_error set_font_weight(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_WEIGHT_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~FONT_WEIGHT_MASK) |
- ((type & 0xf) << FONT_WEIGHT_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_WEIGHT_MASK
-#undef FONT_WEIGHT_SHIFT
-#undef FONT_WEIGHT_INDEX
-
-#define LIST_STYLE_TYPE_INDEX 31
-#define LIST_STYLE_TYPE_SHIFT 0
-#define LIST_STYLE_TYPE_MASK 0xf
-static inline css_error set_list_style_type(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~LIST_STYLE_TYPE_MASK) |
- ((type & 0xf) << LIST_STYLE_TYPE_SHIFT);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_TYPE_MASK
-#undef LIST_STYLE_TYPE_SHIFT
-#undef LIST_STYLE_TYPE_INDEX
-
-#define OUTLINE_STYLE_INDEX 32
-#define OUTLINE_STYLE_SHIFT 4
-#define OUTLINE_STYLE_MASK 0xf0
-static inline css_error set_outline_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~OUTLINE_STYLE_MASK) |
- ((type & 0xf) << OUTLINE_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef OUTLINE_STYLE_MASK
-#undef OUTLINE_STYLE_SHIFT
-#undef OUTLINE_STYLE_INDEX
-
-#define TABLE_LAYOUT_INDEX 32
-#define TABLE_LAYOUT_SHIFT 2
-#define TABLE_LAYOUT_MASK 0xc
-static inline css_error set_table_layout(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~TABLE_LAYOUT_MASK) |
- ((type & 0x3) << TABLE_LAYOUT_SHIFT);
-
- return CSS_OK;
-}
-#undef TABLE_LAYOUT_MASK
-#undef TABLE_LAYOUT_SHIFT
-#undef TABLE_LAYOUT_INDEX
-
-#define UNICODE_BIDI_INDEX 32
-#define UNICODE_BIDI_SHIFT 0
-#define UNICODE_BIDI_MASK 0x3
-static inline css_error set_unicode_bidi(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[UNICODE_BIDI_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~UNICODE_BIDI_MASK) |
- ((type & 0x3) << UNICODE_BIDI_SHIFT);
-
- return CSS_OK;
-}
-#undef UNICODE_BIDI_MASK
-#undef UNICODE_BIDI_SHIFT
-#undef UNICODE_BIDI_INDEX
-
-#define VISIBILITY_INDEX 33
-#define VISIBILITY_SHIFT 6
-#define VISIBILITY_MASK 0xc0
-static inline css_error set_visibility(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[VISIBILITY_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~VISIBILITY_MASK) |
- ((type & 0x3) << VISIBILITY_SHIFT);
-
- return CSS_OK;
-}
-#undef VISIBILITY_MASK
-#undef VISIBILITY_SHIFT
-#undef VISIBILITY_INDEX
-
-#define LIST_STYLE_POSITION_INDEX 33
-#define LIST_STYLE_POSITION_SHIFT 4
-#define LIST_STYLE_POSITION_MASK 0x30
-static inline css_error set_list_style_position(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~LIST_STYLE_POSITION_MASK) |
- ((type & 0x3) << LIST_STYLE_POSITION_SHIFT);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_POSITION_MASK
-#undef LIST_STYLE_POSITION_SHIFT
-#undef LIST_STYLE_POSITION_INDEX
-
-#define TEXT_ALIGN_INDEX 33
-#define TEXT_ALIGN_SHIFT 0
-#define TEXT_ALIGN_MASK 0xf
-static inline uint8_t set_text_align(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_ALIGN_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~TEXT_ALIGN_MASK) |
- ((type & 0xf) << TEXT_ALIGN_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_ALIGN_MASK
-#undef TEXT_ALIGN_SHIFT
-#undef TEXT_ALIGN_INDEX
-
-#define PAGE_BREAK_AFTER_INDEX 0
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
-static inline css_error set_page_break_after(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_AFTER_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) |
- ((type & 0x7) << PAGE_BREAK_AFTER_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_AFTER_INDEX
-#undef PAGE_BREAK_AFTER_SHIFT
-#undef PAGE_BREAK_AFTER_MASK
-
-#define PAGE_BREAK_BEFORE_INDEX 0
-#define PAGE_BREAK_BEFORE_SHIFT 3
-#define PAGE_BREAK_BEFORE_MASK 0x38
-static inline css_error set_page_break_before(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_BEFORE_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) |
- ((type & 0x7) << PAGE_BREAK_BEFORE_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_BEFORE_INDEX
-#undef PAGE_BREAK_BEFORE_SHIFT
-#undef PAGE_BREAK_BEFORE_MASK
-
-#define PAGE_BREAK_INSIDE_INDEX 0
-#define PAGE_BREAK_INSIDE_SHIFT 6
-#define PAGE_BREAK_INSIDE_MASK 0xc0
-static inline css_error set_page_break_inside(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_INSIDE_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) |
- ((type & 0x3) << PAGE_BREAK_INSIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_INSIDE_INDEX
-#undef PAGE_BREAK_INSIDE_SHIFT
-#undef PAGE_BREAK_INSIDE_MASK
-
-#define ORPHANS_INDEX 1
-#define ORPHANS_SHIFT 0
-#define ORPHANS_MASK 0x1
-static inline css_error set_orphans(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_ORPHANS_SET && count == 2) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[ORPHANS_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT);
-
- style->page->orphans = count;
-
- return CSS_OK;
-}
-#undef ORPHANS_INDEX
-#undef ORPHANS_SHIFT
-#undef ORPHANS_MASK
-
-#define WIDOWS_INDEX 1
-#define WIDOWS_SHIFT 1
-#define WIDOWS_MASK 0x2
-static inline css_error set_widows(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_WIDOWS_SET && count == 2) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[WIDOWS_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT);
-
- style->page->widows = count;
-
- return CSS_OK;
-}
-#undef WIDOWS_INDEX
-#undef WIDOWS_SHIFT
-#undef WIDOWS_MASK
-
-#define ALIGN_CONTENT_INDEX_A 34
-#define ALIGN_CONTENT_SHIFT_A 0
-#define ALIGN_CONTENT_MASK_A 0x3
-#define ALIGN_CONTENT_INDEX_B 35
-#define ALIGN_CONTENT_SHIFT_B 1
-#define ALIGN_CONTENT_MASK_B 0x2
-static inline css_error set_align_content(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits_a = &style->i.bits[ALIGN_CONTENT_INDEX_A];
- uint8_t *bits_b = &style->i.bits[ALIGN_CONTENT_INDEX_B];
-
- /* type is 3bits: assigning the least significant two */
- *bits_a = (*bits_a & ~ALIGN_CONTENT_MASK_A) |
- ((type & 0x3) << ALIGN_CONTENT_SHIFT_A);
-
- /* type is 3bits: assigning the most significant one */
- *bits_b = (*bits_b & ~ALIGN_CONTENT_MASK_B) |
- (((type & 0x4) >> 2) << ALIGN_CONTENT_SHIFT_B);
-
- return CSS_OK;
-}
-#undef ALIGN_CONTENT_MASK_A
-#undef ALIGN_CONTENT_SHIFT_A
-#undef ALIGN_CONTENT_INDEX_A
-#undef ALIGN_CONTENT_MASK_B
-#undef ALIGN_CONTENT_SHIFT_B
-#undef ALIGN_CONTENT_INDEX_B
-
-#define FLEX_WRAP_INDEX 19
-#define FLEX_WRAP_SHIFT 0
-#define FLEX_WRAP_MASK 0x3
-static inline css_error set_flex_wrap(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLEX_WRAP_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FLEX_WRAP_MASK) |
- ((type & 0x3) << FLEX_WRAP_SHIFT);
-
- return CSS_OK;
-}
-#undef FLEX_WRAP_MASK
-#undef FLEX_WRAP_SHIFT
-#undef FLEX_WRAP_INDEX
-
-#define FLEX_BASIS_INDEX 35
-#define FLEX_BASIS_SHIFT 2
-#define FLEX_BASIS_MASK 0xfc
-static inline css_error set_flex_basis(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[FLEX_BASIS_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~FLEX_BASIS_MASK) |
- (((type & 0x3) | (unit << 2)) << FLEX_BASIS_SHIFT);
-
- style->i.flex_basis = length;
-
- return CSS_OK;
-}
-
-#undef FLEX_BASIS_MASK
-#undef FLEX_BASIS_SHIFT
-#undef FLEX_BASIS_INDEX
-
-#define FLEX_SHRINK_INDEX 20
-#define FLEX_SHRINK_SHIFT 1
-#define FLEX_SHRINK_MASK 0x2
-static inline css_error set_flex_shrink(
- css_computed_style *style, uint8_t type,
- css_fixed number)
-{
- uint8_t *bits = &style->i.bits[FLEX_SHRINK_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~FLEX_SHRINK_MASK) |
- ((type & 0x1) << FLEX_SHRINK_SHIFT);
-
- style->i.flex_shrink = number;
-
- return CSS_OK;
-}
-
-#undef FLEX_SHRINK_MASK
-#undef FLEX_SHRINK_SHIFT
-#undef FLEX_SHRINK_INDEX
-
-#define FLEX_GROW_INDEX 20
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
-static inline css_error set_flex_grow(
- css_computed_style *style, uint8_t type,
- css_fixed number)
-{
- uint8_t *bits = &style->i.bits[FLEX_GROW_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~FLEX_GROW_MASK) |
- ((type & 0x1) << FLEX_GROW_SHIFT);
-
- style->i.flex_grow = number;
-
- return CSS_OK;
-}
-
-#undef FLEX_GROW_MASK
-#undef FLEX_GROW_SHIFT
-#undef FLEX_GROW_INDEX
-
-#define FLEX_DIRECTION_INDEX 36
-#define FLEX_DIRECTION_SHIFT 5
-#define FLEX_DIRECTION_MASK 0xe0
-static inline css_error set_flex_direction(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~FLEX_DIRECTION_MASK) |
- ((type & 0x7) << FLEX_DIRECTION_SHIFT);
-
- return CSS_OK;
-}
-#undef FLEX_DIRECTION_MASK
-#undef FLEX_DIRECTION_SHIFT
-#undef FLEX_DIRECTION_INDEX
-
-#define JUSTIFY_CONTENT_INDEX_A 35
-#define JUSTIFY_CONTENT_SHIFT_A 0
-#define JUSTIFY_CONTENT_MASK_A 0x1
-#define JUSTIFY_CONTENT_INDEX_B 36
-#define JUSTIFY_CONTENT_SHIFT_B 0
-#define JUSTIFY_CONTENT_MASK_B 0x3
-static inline css_error set_justify_content(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits_a = &style->i.bits[JUSTIFY_CONTENT_INDEX_A];
- uint8_t *bits_b = &style->i.bits[JUSTIFY_CONTENT_INDEX_B];
-
- /* type is 3bits: assigning the least significant one */
- *bits_a = (*bits_a & ~JUSTIFY_CONTENT_MASK_A) |
- ((type & 0x1) << JUSTIFY_CONTENT_SHIFT_A);
-
- /* type is 3bits: assigning the most significant two */
- *bits_b = (*bits_b & ~JUSTIFY_CONTENT_MASK_B) |
- (((type & 0x6) >> 1) << JUSTIFY_CONTENT_SHIFT_B);
-
- return CSS_OK;
-}
-#undef JUSTIFY_CONTENT_MASK_A
-#undef JUSTIFY_CONTENT_SHIFT_A
-#undef JUSTIFY_CONTENT_INDEX_A
-#undef JUSTIFY_CONTENT_MASK_B
-#undef JUSTIFY_CONTENT_SHIFT_B
-#undef JUSTIFY_CONTENT_INDEX_B
-
-#define ORDER_INDEX 37
-#define ORDER_SHIFT 1
-#define ORDER_MASK 0x2
-static inline css_error set_order(
- css_computed_style *style, uint8_t type,
- int32_t number)
-{
- uint8_t *bits = &style->i.bits[ORDER_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~ORDER_MASK) |
- ((type & 0x1) << ORDER_SHIFT);
-
- style->i.order = number;
-
- return CSS_OK;
-}
-
-#undef ORDER_MASK
-#undef ORDER_SHIFT
-#undef ORDER_INDEX
-
-#define ALIGN_ITEMS_INDEX 37
-#define ALIGN_ITEMS_SHIFT 5
-#define ALIGN_ITEMS_MASK 0xe0
-static inline css_error set_align_items(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~ALIGN_ITEMS_MASK) |
- ((type & 0x7) << ALIGN_ITEMS_SHIFT);
-
- return CSS_OK;
-}
-#undef ALIGN_ITEMS_MASK
-#undef ALIGN_ITEMS_SHIFT
-#undef ALIGN_ITEMS_INDEX
-
-#define ALIGN_SELF_INDEX 37
-#define ALIGN_SELF_SHIFT 2
-#define ALIGN_SELF_MASK 0x1c
-static inline css_error set_align_self(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[ALIGN_SELF_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~ALIGN_SELF_MASK) |
- ((type & 0x7) << ALIGN_SELF_SHIFT);
-
- return CSS_OK;
-}
-#undef ALIGN_SELF_MASK
-#undef ALIGN_SELF_SHIFT
-#undef ALIGN_SELF_INDEX
-
-#endif
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=dec1109d988c5a05107b...
commit dec1109d988c5a05107be9a38426766b8177d63b
Author: Lucas Neves <lcneves(a)gmail.com>
Commit: Lucas Neves <lcneves(a)gmail.com>
Select: autogen for selection properties.
diff --git a/README b/README
index 1cec83f..b70bc6a 100644
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ Requirements
+ GNU make or compatible
+ Pkg-config
+ Perl (for the testcases)
- + Python3
+ + Python3 (minimum 3.6)
LibCSS also requires the following libraries to be installed:
diff --git a/src/select/Makefile b/src/select/Makefile
index e937191..13c3eec 100644
--- a/src/select/Makefile
+++ b/src/select/Makefile
@@ -1,4 +1,8 @@
# Sources
+select_generator:
+ python3 src/select/select_generator.py
+
DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c font_face.c
+PRE_TARGETS := select_generator
include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/__pycache__/overrides.cpython-36.pyc
b/src/select/__pycache__/overrides.cpython-36.pyc
index d14dace..91cff8b 100644
Binary files a/src/select/__pycache__/overrides.cpython-36.pyc and
b/src/select/__pycache__/overrides.cpython-36.pyc differ
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc
b/src/select/__pycache__/select_config.cpython-36.pyc
index d498b36..2a86225 100644
Binary files a/src/select/__pycache__/select_config.cpython-36.pyc and
b/src/select/__pycache__/select_config.cpython-36.pyc differ
diff --git a/src/select/assets.pyc b/src/select/assets.pyc
new file mode 100644
index 0000000..01660b0
Binary files /dev/null and b/src/select/assets.pyc differ
diff --git a/src/select/overrides.py b/src/select/overrides.py
index 6c8d6eb..fc2117b 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -49,8 +49,7 @@ static inline uint8_t get_clip(
/* Initial value */
return CSS_CLIP_AUTO;
-}
-'''
+}'''
overrides['set']['clip'] = '''\
static inline css_error set_clip(
@@ -90,8 +89,7 @@ static inline css_error set_clip(
}
return CSS_OK;
-}
-'''
+}'''
overrides['get']['line_height'] = '''\
static inline uint8_t get_line_height(
@@ -113,8 +111,7 @@ static inline uint8_t get_line_height(
}
return (bits & 0x3);
-}
-'''
+}'''
overrides['set']['content'] = '''\
static inline css_error set_content(
@@ -194,8 +191,7 @@ static inline css_error set_content(
}
return CSS_OK;
-}
-'''
+}'''
get_side = '''\
static inline uint8_t get_{0}(
@@ -223,8 +219,7 @@ static inline uint8_t get_{0}_bits(
/* 7bits: uuuuutt : units | type */
return bits;
-}}
-'''
+}}'''
overrides['get']['top'] = get_side.format('top', 'TOP')
overrides['get']['right'] = get_side.format('right',
'RIGHT')
overrides['get']['bottom'] = get_side.format('bottom',
'BOTTOM')
diff --git a/src/select/overrides.pyc b/src/select/overrides.pyc
new file mode 100644
index 0000000..7bb0ad5
Binary files /dev/null and b/src/select/overrides.pyc differ
diff --git a/src/select/select_config.py b/src/select/select_config.py
index 86d815d..468e8dc 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -3,7 +3,10 @@
#
http://www.opensource.org/licenses/mit-license.php
# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
-# Configuration of CSS values
+# Configuration of CSS values.
+# The tuples in this set will be unpacked as arguments to the CSSValue
+# class.
+# Args: see docstring for class CSSValue in select_generator.py.
values = {
('length', 'css_fixed', 4, '0',
'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
@@ -16,7 +19,10 @@ values = {
('content_item', 'css_computed_content_item*')
}
-# Configuration of properties
+# Configuration of property groups.
+# The tuples in these sets will be unpacked as arguments to the
+# CSSproperty class.
+# Args: see docstring for class CSSProperty in select_generator.py.
style = {
# Style group, only opcode
('align_content', 3),
@@ -68,17 +74,17 @@ style = {
('border_right_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
('border_bottom_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
('border_left_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
- ('top', 2, 'length', 'CSS_TOP_SET', None, None,
('get',)),
- ('right', 2, 'length', 'CSS_RIGHT_SET', None, None,
('get',)),
- ('bottom', 2, 'length', 'CSS_BOTTOM_SET', None, None,
('get',)),
- ('left', 2, 'length', 'CSS_LEFT_SET', None, None,
('get',)),
+ ('top', 2, 'length', 'CSS_TOP_SET', None, None,
'get'),
+ ('right', 2, 'length', 'CSS_RIGHT_SET', None, None,
'get'),
+ ('bottom', 2, 'length', 'CSS_BOTTOM_SET', None, None,
'get'),
+ ('left', 2, 'length', 'CSS_LEFT_SET', None, None,
'get'),
('color', 1, 'color'),
('flex_basis', 2, 'length', 'CSS_FLEX_BASIS_SET'),
('flex_grow', 1, 'fixed', 'CSS_FLEX_GROW_SET'),
('flex_shrink', 1, 'fixed', 'CSS_FLEX_SHRINK_SET'),
('font_size', 4, 'length', 'CSS_FONT_SIZE_DIMENSION'),
('height', 2, 'length', 'CSS_HEIGHT_SET'),
- ('line_height', 2, 'length', None, None, None, ('get',)),
+ ('line_height', 2, 'length', None, None, None, 'get'),
('list_style_image', 1, 'string'),
('margin_top', 2, 'length', 'CSS_MARGIN_SET'),
('margin_right', 2, 'length', 'CSS_MARGIN_SET'),
@@ -112,9 +118,9 @@ page = {
('page_break_after', 3, None, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
('page_break_before', 3, None, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
('page_break_inside', 2, None, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
- ('widows', 1, (('integer', '2 << CSS_RADIX_POINT'),),
None,
+ ('widows', 1, (('integer', '2'),), None,
'CSS_WIDOWS_SET'),
- ('orphans', 1, (('integer', '2 << CSS_RADIX_POINT'),),
None,
+ ('orphans', 1, (('integer', '2'),), None,
'CSS_ORPHANS_SET')
}
@@ -160,7 +166,7 @@ uncommon = {
'with a blank entry'),
('content', 2, 'content_item', 'CSS_CONTENT_NORMAL',
'CSS_CONTENT_NORMAL',
'Encode content as an array of content items, terminated with '
- 'a blank entry.')
+ 'a blank entry.', 'set')
}
groups = [
diff --git a/src/select/select_config.pyc b/src/select/select_config.pyc
new file mode 100644
index 0000000..fabcdce
Binary files /dev/null and b/src/select/select_config.pyc differ
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 75d2e3b..d215f2b 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -5,12 +5,13 @@
import math
import string
+import os
from select_config import values, groups
from assets import assets
from overrides import overrides
def get_tuple(from_var):
- 'Accepts tuples, strings and None; returns a tuple.'
+ """Convert tuples, strings and None into tuple."""
if type(from_var) is tuple:
return from_var
elif type(from_var) is str:
@@ -22,14 +23,18 @@ def get_tuple(from_var):
'received: ' + type(from_var).__name__)
def shift_star(value_type, prop_name):
- '''Shifts the asterisks from a pointer type to its name.
- i.e. `lwc_string** str_array` would become `lwc_string **str_array`'''
+ """Shift the asterisks from a pointer type to its name.
+
+ Example: `lwc_string** str_array` would become
+ `lwc_string **str_array`
+ """
star_i = value_type.find('*')
v_type = value_type if star_i is -1 else value_type[:star_i]
v_name = prop_name if star_i is -1 else value_type[star_i:] + prop_name
return (v_type, v_name)
class Text:
+ """Class for building strings for output files."""
def __init__(self):
self._lines = []
self._comment = False
@@ -39,22 +44,37 @@ class Text:
name_width = 31
bits_width = 16
- def indent(self, value, absolute=False):
- if absolute:
- self._indent = value
- else:
- self._indent += value
+ def indent(self, value):
+ """Increase or decrease indent by <value>.
+
+ Args:
+ value <int>: positive or negative value to be added to
+ indentation.
+ """
+ self._indent += value
def comment(self):
+ """Toggle C-style comment in the output text."""
comm = self._comment
self._comment = False
self.append(' */' if comm else '/*')
self._comment = not comm
def escape_newline(self):
+ """Toggle escape of newline character."""
self._esc_nl = not self._esc_nl
def append(self, text=None, pre_formatted=False):
+ """Append text to file builder.
+
+ Args:
+ text:
+ <str> add contents, breaking lines and adding comment
+ markers or newline escapes as needed.
+ <list> recursively call this method for list items.
+ <falsey value> add a new line.
+ pre_formatted: just add text without preprocessing.
+ """
if not text:
self._lines.append('{}{}{}'.format(
'\t' * self._indent,
@@ -105,23 +125,40 @@ class Text:
self.indent(-2)
def table_line(self):
+ """Add a sum line for the tables in computed.h"""
self.append('{0:{n}}{0:{b}}{0}'.format(
'---', n=self.name_width, b=self.bits_width))
def table_header(self):
+ """Add a header line for the tables in
computed.h"""
self.append('{:{n}}{:{b}}{}'.format(
'Property', 'Size (bits)', 'Size (bytes)',
n=self.name_width, b=self.bits_width))
self.table_line()
def result_line(self):
+ """Add a result line for the tables in
computed.h"""
self.append(' ' * self.name_width + '=' * (self.bits_width + 3))
def to_string(self):
+ """Output contents of file builder as a string."""
return '\n'.join(self._lines)
class CSSValue:
- 'Values to be associated with properties.'
+ """Values to be associated with properties.
+
+ Args:
+ name <str>: value name (required).
+ css_type <str>: C type of value (required).
+ size <int>: value size, in bytes (default: None, for pointers).
+ defaults <str>: default value (default: 'NULL', for pointers).
+ The fields below are only needed if the value stores data in the
+ array of bits (currently only css_unit uses it).
+ bits_name <str>: name of bits value (default: None).
+ bits_type <str>: C type of bits value (default: None).
+ bits_size <int>: value size, in bits (default: None).
+ bits_defaults <str>: default value (default: '0').
+ """
def __init__(self, name, css_type, size=None, defaults='NULL',
bits_name=None, bits_type=None,
bits_size=None, bits_defaults='0'):
@@ -139,9 +176,38 @@ class CSSValue:
@property
def is_ptr(self):
+ """Return True if value is a pointer; False
otherwise."""
return ((self.type, self.name) != shift_star(self.type, self.name))
class CSSProperty:
+ """Class for CSS properties.
+
+ Args:
+ name <str>: property name (required).
+ type_size <int>: opcode size, in bits (required).
+ values <tuple or str>: property values (default: None).
+ To set one value, using the value's defaults:
+ 'value_name'
+ To set multiple values, using the values' defaults:
+ (('value_name',), ('value_name',))
+ To override the default of one or multiple values:
+ (('value_name', 'default'),)
+ (('value_name', 'default'), ('value_name',
'default'))
+ condition <str>: condition (opcode value) to get property
+ values in propget.h (default: None).
+ defaults <str>: default opcode (default: None)
+ comments <str>: comments for properties that are stored in
+ "struct css_computed_{group}", instead of
+ "struct css_computed_{group}_i (default: None)
+ NOTE: passing this argument will result in the property being
+ stored in "struct css_computed_{group}"!
+ overrides <tuple | str>: files for which this property shouldn't
+ autogenerate content; instead, read entry from from overrides.py
+ Possible values:
+ 'get': overrides output to autogenerated_propget.h
+ 'set': overrides output to autogenerated_propset.h
+ ('get', 'set'): overrides output to both files.
+ """
def __init__(self, name, type_size, values=None, condition=None,
defaults=None, comments=None, override=None):
self.name = name
@@ -154,6 +220,7 @@ class CSSProperty:
self.__mask = None
def make_values(self, vals):
+ """Make list of values for this property."""
if vals is None:
return []
elif type(vals) is str:
@@ -179,19 +246,23 @@ class CSSProperty:
@property
def bits_size(self):
+ """Size of this property in the bits array."""
return self.type_size + sum([ v.bits['size'] for v in self.values
if v.bits is not None ])
@property
def bytes_size(self):
+ """Size of this property's values, in bytes (excluding
pointers)."""
return sum([ v.size for v in self.values if v.size is not None ])
@property
def ptr_size(self):
+ """Number of values of this property that are
pointers."""
return sum([ 1 for v in self.values if v.size is None ])
@property
def size_line(self):
+ """String for computed.h with the sizes of this
property."""
name = '{:{width}}'.format(self.name, width=Text.name_width)
type_size = '{:>3}'.format(str(self.type_size))
extra_size = sum([ v.bits['size'] for v in self.values
@@ -212,12 +283,14 @@ class CSSProperty:
@property
def mask(self):
+ """Getter for the bitwise mask of this property in the bits
array."""
if self.__mask is None:
raise NameError('Attribute `mask` not set yet!')
return '0x{:x}'.format(self.__mask).lower()
@mask.setter
def mask(self, val):
+ """Setter for the bitwise mask of this property in the bits
array."""
if type(val) is not int:
raise TypeError('Value of `mask` must be an integer!')
if val < 0:
@@ -226,6 +299,7 @@ class CSSProperty:
@property
def def_undefs(self):
+ """Return defines and undefs for propget.h and
propset.h."""
defines = [
'#define {}_INDEX {}'.format(self.name.upper(), self.index),
'#define {}_SHIFT {}'.format(self.name.upper(), self.shift),
@@ -239,6 +313,11 @@ class CSSProperty:
return (defines, undefs)
def get_param_values(self, pointer=False):
+ """Make parameters for functions in propget.h and propset.h.
+
+ Args:
+ pointer <bool>: add a star before value name.
+ """
vals = []
for v in self.values:
vt, vn = shift_star(v.type, v.name)
@@ -257,6 +336,7 @@ class CSSProperty:
return vals
def get_bits(self):
+ """Make vars for the bitwise operations in propget.h and
propset.h."""
bits = [
{ 'letter': v.suffix[1] if v.suffix else v.bits['name'][0],
'name': v.bits['name'] + v.suffix,
@@ -280,6 +360,7 @@ class CSSProperty:
return (type_mask, shift_list, comment)
class Bin:
+ """The storage unit for the bits array of
properties."""
def __init__(self, first_object):
self.contents = [ first_object ]
@@ -291,6 +372,11 @@ class Bin:
self.contents.append(obj)
class CSSGroup:
+ """Group of CSS properties (i.e. style, page, uncommon).
+
+ Args:
+ config <tuple>: imported from select_config.py.
+ """
def __init__(self, config):
self.name = config['name']
self.props = [ CSSProperty(*x) for x in config['props'] ]
@@ -298,25 +384,28 @@ class CSSGroup:
@property
def bits_size(self):
+ """Sum of all property bits in the bits array."""
return sum([ p.bits_size for p in self.props ])
@property
def bytes_size(self):
+ """Sum of all property value bytes (excluded
pointers)."""
return sum([ p.bytes_size for p in self.props ])
@property
def ptr_size(self):
+ """Sum of all property pointers."""
return sum([ p.ptr_size for p in self.props ])
@property
def bits_array(self):
- '''Implements a `best fit first` heuristics for the bin packing of
- property bits in the bits array'''
+ """Implement a `best fit first` heuristics for the bin packing
+ of property bits in the bits array."""
if self.__bits_array is not None:
return self.__bits_array
- bin_size = 32
+ bin_size = 32 # We're using uint32_t as concrete bins.
self.__bits_array = []
props = sorted(self.props, key=(lambda x: x.bits_size), reverse=True)
@@ -324,10 +413,11 @@ class CSSGroup:
for b in self.__bits_array:
if b.size + p.bits_size <= bin_size:
b.push(p)
- p.shift = 32 - sum([ x.bits_size for x in b.contents ])
+ p.shift = (bin_size -
+ sum([ x.bits_size for x in b.contents ]))
break
else:
- p.shift = 32 - p.bits_size
+ p.shift = bin_size - p.bits_size
self.__bits_array.append(Bin(p))
p.mask = (sum([ 2 ** x for x in range(p.bits_size) ]) *
@@ -341,12 +431,14 @@ class CSSGroup:
return self.__bits_array
def get_idot_grp(self):
+ """Make parameters for accessing bits and values in this
group."""
i_dot = '' if self.name is 'page' else 'i.'
grp = '' if self.name is 'style' else
'->{}{}'.format(
'' if self.name is 'page' else i_dot, self.name)
return (i_dot, grp)
def make_computed_h(self):
+ """Output this group's text for the computed.h
file."""
t = Text()
t.append()
@@ -357,11 +449,13 @@ class CSSGroup:
t.comment()
commented = []
t.table_header()
+
for prop in sorted(self.props, key=(lambda x: x.name)):
if prop.comments is None:
t.append(prop.size_line)
else:
commented.extend(( '', prop.comments, '', prop.size_line
))
+
t.append(commented)
t.append()
t.table_line()
@@ -396,10 +490,14 @@ class CSSGroup:
t.append('uint32_t bits[' + str(len(self.bits_array)) + '];')
t.append()
t.append(self.make_value_declaration(for_commented=False))
+
if self.name is 'style':
t.append()
- t.append('css_computed_uncommon *uncommon;')
+ for g in css_groups:
+ if g.name is not 'style' and g.name is not 'page':
+ t.append('css_computed_{0} *{0};'.format(g.name))
t.append('void *aural;')
+
t.indent(-1)
t.append('}}{};'.format(
' css_computed_' + self.name if typedef else ''))
@@ -414,8 +512,10 @@ class CSSGroup:
t.append()
t.append(self.make_value_declaration(for_commented=True))
t.append()
+
if self.name is 'style':
t.append('css_computed_page *page;')
+
t.append('struct css_computed_' + self.name + ' *next;')
t.append('uint32_t count;')
t.append('uint32_t bin;')
@@ -426,6 +526,11 @@ class CSSGroup:
return t.to_string()
def make_propset_h(self):
+ """Output this group's property functions for the propset.h
file.
+
+ If group is not `style`, will also output the defaults
+ and the ENSURE_{group} texts.
+ """
t = Text()
i_dot, grp = self.get_idot_grp()
@@ -433,11 +538,14 @@ class CSSGroup:
t.append('static const css_computed_{0} default_{0} = {{'.format(
self.name))
t.indent(1)
+
if self.name is not 'page':
t.append('.i = {')
t.indent(1)
+
t.append('.bits = {')
t.indent(1)
+
bits_ops = []
for b in self.bits_array:
or_ops = []
@@ -445,6 +553,7 @@ class CSSGroup:
or_ops.append('({} << {})'.format(p.defaults,
str(p.shift))
if p.shift else p.defaults)
bits_ops.append(' | '.join(or_ops))
+
t.append(',\n'.join(bits_ops).split('\n'))
t.indent(-1)
t.append('},')
@@ -487,6 +596,7 @@ class CSSGroup:
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
+ t.append()
t.append(defines)
if p.name in overrides['set']:
@@ -502,6 +612,7 @@ class CSSGroup:
p.name, params))
t.append('{')
t.indent(1)
+
t.append('uint32_t *bits;')
t.append()
@@ -598,17 +709,18 @@ class CSSGroup:
t.indent(-1)
t.append('}')
t.append(undefs)
- t.append()
return t.to_string()
def make_propget_h(self):
+ """Output this group's property functions for the propget.h
file."""
t = Text()
i_dot, grp = self.get_idot_grp()
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
+ t.append()
t.append(defines)
if p.name in overrides['get']:
@@ -675,11 +787,17 @@ class CSSGroup:
t.indent(-1)
t.append('}')
t.append(undefs)
- t.append()
return t.to_string()
def make_value_declaration(self, for_commented, defaults=False):
+ """Output declarations of values for this group's properties.
+
+ Args:
+ for_commented: only parse values that have a `comment` field
+ defaults: outputs default value assignments.
+ """
+
r = []
for p in sorted(self.props, key=(lambda x: x.name)):
if bool(p.comments) == for_commented:
@@ -693,6 +811,7 @@ class CSSGroup:
return r
def make_text(self, filename):
+ """Return this group's text for the given
file."""
if filename == 'computed.h':
return self.make_computed_h()
elif filename == 'propset.h':
@@ -703,10 +822,11 @@ class CSSGroup:
raise ValueError()
css_groups = [ CSSGroup(g) for g in groups ]
+dir_path = os.path.dirname(os.path.realpath(__file__))
for k, v in assets.items():
# Key is filename string (e.g. "computed.h") without autogenerated_ prefix
body = '\n'.join([ g.make_text(k) for g in css_groups ])
text = '\n'.join([ v['header'], body, v['footer'] ])
- with open('autogenerated_' + k, 'w') as file_k:
+ with open(os.path.join(dir_path, 'autogenerated_') + k, 'w') as
file_k:
file_k.write(text)
-----------------------------------------------------------------------
Summary of changes:
README | 2 +-
src/select/.gitignore | 2 +
src/select/Makefile | 4 +
src/select/__pycache__/assets.cpython-36.pyc | Bin 629 -> 0 bytes
.../__pycache__/select_config.cpython-36.pyc | Bin 6738 -> 0 bytes
src/select/assets.pyc | Bin 0 -> 692 bytes
src/select/computed.h.old | 385 ---
src/select/overrides.py | 15 +-
.../overrides.cpython-36.pyc => overrides.pyc} | Bin 5301 -> 5402 bytes
src/select/propget.h.old | 2408 ------------------
src/select/propset.h.old | 2546 --------------------
src/select/select_config.py | 26 +-
src/select/select_config.pyc | Bin 0 -> 11183 bytes
src/select/select_generator.py | 156 +-
14 files changed, 166 insertions(+), 5378 deletions(-)
delete mode 100644 src/select/__pycache__/assets.cpython-36.pyc
delete mode 100644 src/select/__pycache__/select_config.cpython-36.pyc
create mode 100644 src/select/assets.pyc
delete mode 100644 src/select/computed.h.old
rename src/select/{__pycache__/overrides.cpython-36.pyc => overrides.pyc} (86%)
delete mode 100644 src/select/propget.h.old
delete mode 100644 src/select/propset.h.old
create mode 100644 src/select/select_config.pyc
diff --git a/README b/README
index 1cec83f..b70bc6a 100644
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ Requirements
+ GNU make or compatible
+ Pkg-config
+ Perl (for the testcases)
- + Python3
+ + Python3 (minimum 3.6)
LibCSS also requires the following libraries to be installed:
diff --git a/src/select/.gitignore b/src/select/.gitignore
index 8e6c76d..a8bedc3 100644
--- a/src/select/.gitignore
+++ b/src/select/.gitignore
@@ -1,3 +1,5 @@
autogenerated_*.c
autogenerated_*.h
+__pycache__
+*.pyc
diff --git a/src/select/Makefile b/src/select/Makefile
index e937191..13c3eec 100644
--- a/src/select/Makefile
+++ b/src/select/Makefile
@@ -1,4 +1,8 @@
# Sources
+select_generator:
+ python3 src/select/select_generator.py
+
DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c font_face.c
+PRE_TARGETS := select_generator
include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/__pycache__/assets.cpython-36.pyc
b/src/select/__pycache__/assets.cpython-36.pyc
deleted file mode 100644
index 797012f..0000000
Binary files a/src/select/__pycache__/assets.cpython-36.pyc and /dev/null differ
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc
b/src/select/__pycache__/select_config.cpython-36.pyc
deleted file mode 100644
index d498b36..0000000
Binary files a/src/select/__pycache__/select_config.cpython-36.pyc and /dev/null differ
diff --git a/src/select/assets.pyc b/src/select/assets.pyc
new file mode 100644
index 0000000..01660b0
Binary files /dev/null and b/src/select/assets.pyc differ
diff --git a/src/select/computed.h.old b/src/select/computed.h.old
deleted file mode 100644
index a8934b1..0000000
--- a/src/select/computed.h.old
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_computed_h_
-#define css_select_computed_h_
-
-#include <libcss/computed.h>
-#include <libcss/hint.h>
-
-
-
-struct css_computed_uncommon_i {
-/*
- * border_spacing 1 + 2(4) 2(4)
- * break_before 4 0
- * break_after 4 0
- * break_inside 4 0
- * clip 2 + 4(4) + 4 4(4)
- * column_count 2 4
- * column_fill 2 0
- * column_gap 2 + 4 4
- * column_rule_color 2 4
- * column_rule_style 4 0
- * column_rule_width 3 + 4 4
- * column_span 2 0
- * column_width 2 + 4 4
- * letter_spacing 2 + 4 4
- * outline_color 2 4
- * outline_width 3 + 4 4
- * word_spacing 2 + 4 4
- * --- ---
- * 95 bits 60 bytes
- *
- * Encode counter_increment and _reset as an array of name, value pairs,
- * terminated with a blank entry.
- *
- * counter_increment 1 sizeof(ptr)
- * counter_reset 1 sizeof(ptr)
- * --- ---
- * 2 bits 2sizeof(ptr) bytes
- *
- * Encode cursor uri(s) as an array of string objects, terminated with a
- * blank entry.
- *
- * cursor 5 sizeof(ptr)
- * --- ---
- * 5 bits sizeof(ptr) bytes
- *
- * Encode content as an array of content items, terminated with a blank entry.
- *
- * content 2 sizeof(ptr)
- * --- ---
- * 2 bits sizeof(ptr)
- *
- * ___ ___
- * 108 bits 62 + 4sizeof(ptr) bytes
- *
- * 14 bytes 62 + 4sizeof(ptr) bytes
- * ===================
- * 74 + 4sizeof(ptr) bytes
- *
- * Bit allocations:
- *
- * 76543210
- * 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>
- * 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
- * 11 wwwwwww. column-rule-width | <unused>
- * 12 sswwwwww column-span | column_width
- * 13 bbbbaaaa break-before | break-after
- * 14 iiii.... break-inside | <unused>
- */
- uint8_t bits[14];
-
- css_fixed border_spacing[2];
-
- css_fixed clip[4];
-
- css_fixed letter_spacing;
-
- css_color outline_color;
- css_fixed outline_width;
-
- css_fixed word_spacing;
-
- int32_t column_count;
- css_fixed column_gap;
- css_color column_rule_color;
- css_fixed column_rule_width;
- css_fixed column_width;
-};
-
-typedef struct css_computed_uncommon {
- struct css_computed_uncommon_i i;
-
- css_computed_counter *counter_increment;
- css_computed_counter *counter_reset;
-
- css_computed_content_item *content;
-
- lwc_string **cursor;
- struct css_computed_uncommon *next;
- uint32_t count;
- uint32_t bin;
-} css_computed_uncommon;
-
-typedef struct css_computed_page {
-/*
- * Bit allocations:
- *
- * 76543210
- * 1 aaabbbii page_break_after | page_break_before | page_break_inside
- * 2 ......wo widows | orphans
- */
- uint8_t bits[2];
-
- int32_t widows;
- int32_t orphans;
-} css_computed_page;
-
-struct css_computed_style_i {
-/*
- * background_attachment 2
- * background_repeat 3
- * border_collapse 2
- * border_top_style 4
- * border_right_style 4
- * border_bottom_style 4
- * border_left_style 4
- * caption_side 2
- * clear 3
- * direction 2
- * display 5
- * empty_cells 2
- * float 2
- * font_style 2
- * font_variant 2
- * font_weight 4
- * list_style_position 2
- * list_style_type 4
- * overflow 3
- * outline_style 4
- * position 3
- * table_layout 2
- * text_align 4
- * text_decoration 5
- * text_transform 3
- * unicode_bidi 2
- * visibility 2
- * white_space 3
- * box_sizing 2
- * align_content 3
- * align_items 3
- * align_self 3
- * flex_direction 3
- * flex_wrap 2
- * justify_content 3
- * ---
- * 103 bits
- *
- * Colours are 32bits of AARRGGBB
- * Dimensions are encoded as a fixed point value + 4 bits of unit data
- *
- * background_color 2 4
- * background_image 1 sizeof(ptr)
- * background_position 1 + 2(4) 2(4)
- * border_top_color 2 4
- * border_right_color 2 4
- * border_bottom_color 2 4
- * border_left_color 2 4
- * border_top_width 3 + 4 4
- * border_right_width 3 + 4 4
- * border_bottom_width 3 + 4 4
- * border_left_width 3 + 4 4
- * top 2 + 4 4
- * right 2 + 4 4
- * bottom 2 + 4 4
- * left 2 + 4 4
- * color 1 4
- * font_size 4 + 4 4
- * height 2 + 4 4
- * line_height 2 + 4 4
- * list_style_image 1 sizeof(ptr)
- * margin_top 2 + 4 4
- * margin_right 2 + 4 4
- * margin_bottom 2 + 4 4
- * margin_left 2 + 4 4
- * max_height 2 + 4 4
- * max_width 2 + 4 4
- * min_height 2 + 4 4
- * min_width 2 + 4 4
- * padding_top 1 + 4 4
- * padding_right 1 + 4 4
- * padding_bottom 1 + 4 4
- * padding_left 1 + 4 4
- * text_indent 1 + 4 4
- * vertical_align 4 + 4 4
- * width 2 + 4 4
- * z_index 2 4
- * flex_basis 2 + 4 4
- * flex_grow 1 4
- * flex_shrink 1 4
- * order 1 4
- * --- ---
- * 196 bits 156 + 2sizeof(ptr) bytes
- *
- * Encode font family as an array of string objects, terminated with a
- * blank entry.
- *
- * font_family 3 sizeof(ptr)
- * --- ---
- * 3 bits sizeof(ptr)
- *
- * Encode quotes as an array of string objects, terminated with a blank entry.
- *
- * quotes 1 sizeof(ptr)
- * --- ---
- * 1 bit sizeof(ptr) bytes
- *
- * ___ ___
- * 303 bits 156 + 4sizeof(ptr) bytes
- *
- * 38 bytes 156 + 4sizeof(ptr) bytes
- * ===================
- * 194 + 4sizeof(ptr) bytes
- *
- * Bit allocations:
- *
- * 76543210
- * 1 vvvvvvvv vertical-align
- * 2 ffffffff font-size
- * 3 ttttttti border-top-width | background-image
- * 4 rrrrrrrc border-right-width | color
- * 5 bbbbbbbl border-bottom-width | list-style-image
- * 6 lllllllq border-left-width | quotes
- * 7 ttttttcc top | border-top-color
- * 8 rrrrrrcc right | border-right-color
- * 9 bbbbbbcc bottom | border-bottom-color
- * 10 llllllcc left | border-left-color
- * 11 hhhhhhbb height | background-color
- * 12 llllllzz line-height | z-index
- * 13 ttttttbb margin-top | background-attachment
- * 14 rrrrrrbb margin-right | border-collapse
- * 15 bbbbbbcc margin-bottom | caption-side
- * 16 lllllldd margin-left | direction
- * 17 mmmmmmee max-height | empty-cells
- * 18 mmmmmmff max-width | float
- * 19 wwwwwwff width | font-style
- * 20 mmmmmmff min-height | flex-wrap
- * 21 mmmmmmsg min-width | flex-shrink | flex_grow
- * 22 tttttxxx padding-top | overflow-x
- * 23 rrrrrppp padding-right | position
- * 24 bbbbboss padding-bottom | opacity | box-sizing
- * 25 lllllttt padding-left | text-transform
- * 26 tttttwww text-indent | white-space
- * 27 bbbbbbbb background-position
- * 28 bdddddff background-position | display | font-variant
- * 29 tttttfff text-decoration | font-family
- * 30 ttttrrrr border-top-style | border-right-style
- * 31 bbbbllll border-bottom-style | border-left-style
- * 32 ffffllll font-weight | list-style-type
- * 33 oooottuu outline-style | table-layout | unicode-bidi
- * 34 vvlltttt visibility | list-style-position | text-align
- * 35 yyybbbaa overflow-y | background-repeat | align-content1
- * 36 bbbbbbaj flex-basis | align-content2 | justify_content1
- * 37 fffcccjj flex-direction | clear | justify_content2
- * 38 iiissso. align-items | align-self | order
- */
- uint8_t bits[38];
-
- uint8_t unused[1];
-
- css_color background_color;
- lwc_string *background_image;
- css_fixed background_position[2];
-
- css_color border_color[4];
- css_fixed border_width[4];
-
- css_fixed top;
- css_fixed right;
- css_fixed bottom;
- css_fixed left;
-
- css_color color;
-
- css_fixed font_size;
-
- css_fixed height;
-
- css_fixed line_height;
-
- lwc_string *list_style_image;
-
- css_fixed margin[4];
-
- css_fixed max_height;
- css_fixed max_width;
-
- css_fixed min_height;
- css_fixed min_width;
-
- css_fixed opacity;
-
- css_fixed padding[4];
-
- css_fixed text_indent;
-
- css_fixed vertical_align;
-
- css_fixed width;
-
- int32_t z_index;
-
- css_fixed flex_basis;
-
- css_fixed flex_grow;
-
- css_fixed flex_shrink;
-
- int32_t order;
-
- css_computed_uncommon *uncommon;/**< Uncommon properties */
- void *aural; /**< Aural properties */
-};
-
-struct css_computed_style {
- struct css_computed_style_i i;
-
- lwc_string **font_family;
-
- lwc_string **quotes;
- css_computed_page *page; /**< Page properties */
- struct css_computed_style *next;
- uint32_t count;
- uint32_t bin;
-};
-
-
-/**
- * Take a new reference to a computed style
- *
- * \param style The style to take a new reference to.
- * \return The new computed style reference
- */
-static inline css_computed_style * css__computed_style_ref(
- css_computed_style *style)
-{
- if (style == NULL)
- return NULL;
-
- if (style->i.uncommon != NULL) {
- style->i.uncommon->count++;
- }
-
- style->count++;
- return style;
-}
-
-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_uncommon_destroy(css_computed_uncommon *uncommon);
-
-css_error css__compute_absolute_values(const css_computed_style *parent,
- css_computed_style *style,
- css_error (*compute_font_size)(void *pw,
- const css_hint *parent, css_hint *size),
- void *pw);
-
-#endif
diff --git a/src/select/overrides.py b/src/select/overrides.py
index 6c8d6eb..fc2117b 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -49,8 +49,7 @@ static inline uint8_t get_clip(
/* Initial value */
return CSS_CLIP_AUTO;
-}
-'''
+}'''
overrides['set']['clip'] = '''\
static inline css_error set_clip(
@@ -90,8 +89,7 @@ static inline css_error set_clip(
}
return CSS_OK;
-}
-'''
+}'''
overrides['get']['line_height'] = '''\
static inline uint8_t get_line_height(
@@ -113,8 +111,7 @@ static inline uint8_t get_line_height(
}
return (bits & 0x3);
-}
-'''
+}'''
overrides['set']['content'] = '''\
static inline css_error set_content(
@@ -194,8 +191,7 @@ static inline css_error set_content(
}
return CSS_OK;
-}
-'''
+}'''
get_side = '''\
static inline uint8_t get_{0}(
@@ -223,8 +219,7 @@ static inline uint8_t get_{0}_bits(
/* 7bits: uuuuutt : units | type */
return bits;
-}}
-'''
+}}'''
overrides['get']['top'] = get_side.format('top', 'TOP')
overrides['get']['right'] = get_side.format('right',
'RIGHT')
overrides['get']['bottom'] = get_side.format('bottom',
'BOTTOM')
diff --git a/src/select/__pycache__/overrides.cpython-36.pyc b/src/select/overrides.pyc
similarity index 86%
rename from src/select/__pycache__/overrides.cpython-36.pyc
rename to src/select/overrides.pyc
index d14dace..7bb0ad5 100644
Binary files a/src/select/__pycache__/overrides.cpython-36.pyc and
b/src/select/overrides.pyc differ
diff --git a/src/select/propget.h.old b/src/select/propget.h.old
deleted file mode 100644
index 737dcd4..0000000
--- a/src/select/propget.h.old
+++ /dev/null
@@ -1,2408 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_propget_h_
-#define css_select_propget_h_
-
-#include <libcss/computed.h>
-#include "computed.h"
-
-/* Important: keep this file in sync with computed.h */
-/** \todo Is there a better way to ensure this happens? */
-
-#define LETTER_SPACING_INDEX 0
-#define LETTER_SPACING_SHIFT 2
-#define LETTER_SPACING_MASK 0xfc
-static inline uint8_t get_letter_spacing(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[LETTER_SPACING_INDEX];
- bits &= LETTER_SPACING_MASK;
- bits >>= LETTER_SPACING_SHIFT;
-
- /* 6bits: uuuutt : unit | type */
-
- if ((bits & 3) == CSS_LETTER_SPACING_SET) {
- *length = style->i.uncommon->i.letter_spacing;
- *unit = bits >> 2;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_LETTER_SPACING_NORMAL;
-}
-#undef LETTER_SPACING_MASK
-#undef LETTER_SPACING_SHIFT
-#undef LETTER_SPACING_INDEX
-
-#define OUTLINE_COLOR_INDEX 0
-#define OUTLINE_COLOR_SHIFT 0
-#define OUTLINE_COLOR_MASK 0x3
-static inline uint8_t get_outline_color(
- const css_computed_style *style, css_color *color)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX];
- bits &= OUTLINE_COLOR_MASK;
- bits >>= OUTLINE_COLOR_SHIFT;
-
- /* 2bits: tt : type */
-
- if ((bits & 3) == CSS_OUTLINE_COLOR_COLOR) {
- *color = style->i.uncommon->i.outline_color;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_OUTLINE_COLOR_INVERT;
-}
-#undef OUTLINE_COLOR_MASK
-#undef OUTLINE_COLOR_SHIFT
-#undef OUTLINE_COLOR_INDEX
-
-#define OUTLINE_WIDTH_INDEX 1
-#define OUTLINE_WIDTH_SHIFT 1
-#define OUTLINE_WIDTH_MASK 0xfe
-static inline uint8_t get_outline_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX];
- bits &= OUTLINE_WIDTH_MASK;
- bits >>= OUTLINE_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : unit | type */
-
- if ((bits & 7) == CSS_OUTLINE_WIDTH_WIDTH) {
- *length = style->i.uncommon->i.outline_width;
- *unit = bits >> 3;
- }
-
- return (bits & 7);
- }
-
- /* Initial value */
- return CSS_OUTLINE_WIDTH_MEDIUM;
-}
-#undef OUTLINE_WIDTH_MASK
-#undef OUTLINE_WIDTH_SHIFT
-#undef OUTLINE_WIDTH_INDEX
-
-#define BORDER_SPACING_INDEX 1
-#define BORDER_SPACING_SHIFT 0
-#define BORDER_SPACING_MASK 0x1
-#define BORDER_SPACING_INDEX1 2
-#define BORDER_SPACING_SHIFT1 0
-#define BORDER_SPACING_MASK1 0xff
-static inline uint8_t get_border_spacing(
- const css_computed_style *style,
- css_fixed *hlength, css_unit *hunit,
- css_fixed *vlength, css_unit *vunit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BORDER_SPACING_INDEX];
- bits &= BORDER_SPACING_MASK;
- bits >>= BORDER_SPACING_SHIFT;
-
- /* 1 bit: type */
- if (bits == CSS_BORDER_SPACING_SET) {
- uint8_t bits1 =
- style->i.uncommon->i.bits[BORDER_SPACING_INDEX1];
- bits1 &= BORDER_SPACING_MASK1;
- bits1 >>= BORDER_SPACING_SHIFT1;
-
- /* 8bits: hhhhvvvv : hunit | vunit */
-
- *hlength = style->i.uncommon->i.border_spacing[0];
- *hunit = bits1 >> 4;
-
- *vlength = style->i.uncommon->i.border_spacing[1];
- *vunit = bits1 & 0xf;
- }
-
- return bits;
- }
-
- /* Initial value */
- *hlength = *vlength = 0;
- *hunit = *vunit = CSS_UNIT_PX;
- return CSS_BORDER_SPACING_SET;
-}
-#undef BORDER_SPACING_MASK1
-#undef BORDER_SPACING_SHIFT1
-#undef BORDER_SPACING_INDEX1
-#undef BORDER_SPACING_MASK
-#undef BORDER_SPACING_SHIFT
-#undef BORDER_SPACING_INDEX
-
-#define BREAK_AFTER_INDEX 12
-#define BREAK_AFTER_SHIFT 0
-#define BREAK_AFTER_MASK 0xf
-static inline uint8_t get_break_after(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_AFTER_INDEX];
- bits &= BREAK_AFTER_MASK;
- bits >>= BREAK_AFTER_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_AFTER_AUTO;
-}
-#undef BREAK_AFTER_MASK
-#undef BREAK_AFTER_SHIFT
-#undef BREAK_AFTER_INDEX
-
-#define BREAK_BEFORE_INDEX 12
-#define BREAK_BEFORE_SHIFT 4
-#define BREAK_BEFORE_MASK (0xf << 4)
-static inline uint8_t get_break_before(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_BEFORE_INDEX];
- bits &= BREAK_BEFORE_MASK;
- bits >>= BREAK_BEFORE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_BEFORE_AUTO;
-}
-#undef BREAK_BEFORE_MASK
-#undef BREAK_BEFORE_SHIFT
-#undef BREAK_BEFORE_INDEX
-
-#define BREAK_INSIDE_INDEX 13
-#define BREAK_INSIDE_SHIFT 4
-#define BREAK_INSIDE_MASK (0xf << 4)
-static inline uint8_t get_break_inside(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[BREAK_INSIDE_INDEX];
- bits &= BREAK_INSIDE_MASK;
- bits >>= BREAK_INSIDE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_BREAK_INSIDE_AUTO;
-}
-#undef BREAK_INSIDE_MASK
-#undef BREAK_INSIDE_SHIFT
-#undef BREAK_INSIDE_INDEX
-
-#define WORD_SPACING_INDEX 3
-#define WORD_SPACING_SHIFT 2
-#define WORD_SPACING_MASK 0xfc
-static inline uint8_t get_word_spacing(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[WORD_SPACING_INDEX];
- bits &= WORD_SPACING_MASK;
- bits >>= WORD_SPACING_SHIFT;
-
- /* 6bits: uuuutt : unit | type */
-
- if ((bits & 3) == CSS_WORD_SPACING_SET) {
- *length = style->i.uncommon->i.word_spacing;
- *unit = bits >> 2;
- }
-
- return (bits & 3);
- }
-
- /* Initial value */
- return CSS_WORD_SPACING_NORMAL;
-}
-#undef WORD_SPACING_MASK
-#undef WORD_SPACING_SHIFT
-#undef WORD_SPACING_INDEX
-
-#define WRITING_MODE_INDEX 4
-#define WRITING_MODE_MASK 0x6
-#define WRITING_MODE_SHIFT 1
-static inline uint8_t get_writing_mode(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[WRITING_MODE_INDEX];
- bits &= WRITING_MODE_MASK;
- bits >>= WRITING_MODE_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_WRITING_MODE_HORIZONTAL_TB;
-}
-#undef WRITING_MODE_INDEX
-#undef WRITING_MODE_MASK
-#undef WRITING_MODE_SHIFT
-
-#define COUNTER_INCREMENT_INDEX 3
-#define COUNTER_INCREMENT_SHIFT 1
-#define COUNTER_INCREMENT_MASK 0x2
-static inline uint8_t get_counter_increment(
- const css_computed_style *style,
- const css_computed_counter **counters)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX];
- bits &= COUNTER_INCREMENT_MASK;
- bits >>= COUNTER_INCREMENT_SHIFT;
-
- /* 1bit: type */
- *counters = style->i.uncommon->counter_increment;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COUNTER_INCREMENT_NONE;
-}
-#undef COUNTER_INCREMENT_MASK
-#undef COUNTER_INCREMENT_SHIFT
-#undef COUNTER_INCREMENT_INDEX
-
-#define COUNTER_RESET_INDEX 3
-#define COUNTER_RESET_SHIFT 0
-#define COUNTER_RESET_MASK 0x1
-static inline uint8_t get_counter_reset(
- const css_computed_style *style,
- const css_computed_counter **counters)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COUNTER_RESET_INDEX];
- bits &= COUNTER_RESET_MASK;
- bits >>= COUNTER_RESET_SHIFT;
-
- /* 1bit: type */
- *counters = style->i.uncommon->counter_reset;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COUNTER_RESET_NONE;
-}
-#undef COUNTER_RESET_MASK
-#undef COUNTER_RESET_SHIFT
-#undef COUNTER_RESET_INDEX
-
-#define CURSOR_INDEX 4
-#define CURSOR_SHIFT 3
-#define CURSOR_MASK 0xf8
-static inline uint8_t get_cursor(
- const css_computed_style *style,
- lwc_string ***urls)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CURSOR_INDEX];
- bits &= CURSOR_MASK;
- bits >>= CURSOR_SHIFT;
-
- /* 5bits: type */
- *urls = style->i.uncommon->cursor;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_CURSOR_AUTO;
-}
-#undef CURSOR_MASK
-#undef CURSOR_SHIFT
-#undef CURSOR_INDEX
-
-#define CLIP_INDEX 7
-#define CLIP_SHIFT 2
-#define CLIP_MASK 0xfc
-#define CLIP_INDEX1 5
-#define CLIP_SHIFT1 0
-#define CLIP_MASK1 0xff
-#define CLIP_INDEX2 6
-#define CLIP_SHIFT2 0
-#define CLIP_MASK2 0xff
-static inline uint8_t get_clip(
- const css_computed_style *style,
- css_computed_clip_rect *rect)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CLIP_INDEX];
- bits &= CLIP_MASK;
- bits >>= CLIP_SHIFT;
-
- /* 6bits: trblyy : top | right | bottom | left | type */
- if ((bits & 0x3) == CSS_CLIP_RECT) {
- uint8_t bits1;
-
- rect->left_auto = (bits & 0x4);
- rect->bottom_auto = (bits & 0x8);
- rect->right_auto = (bits & 0x10);
- rect->top_auto = (bits & 0x20);
-
- if (rect->top_auto == false ||
- rect->right_auto == false) {
- /* 8bits: ttttrrrr : top | right */
- bits1 = style->i.uncommon->i.bits[CLIP_INDEX1];
- bits1 &= CLIP_MASK1;
- bits1 >>= CLIP_SHIFT1;
- } else {
- bits1 = 0;
- }
-
- rect->top = style->i.uncommon->i.clip[0];
- rect->tunit = bits1 >> 4;
-
- rect->right = style->i.uncommon->i.clip[1];
- rect->runit = bits1 & 0xf;
-
- if (rect->bottom_auto == false ||
- rect->left_auto == false) {
- /* 8bits: bbbbllll : bottom | left */
- bits1 = style->i.uncommon->i.bits[CLIP_INDEX2];
- bits1 &= CLIP_MASK2;
- bits1 >>= CLIP_SHIFT2;
- } else {
- bits1 = 0;
- }
-
- rect->bottom = style->i.uncommon->i.clip[2];
- rect->bunit = bits1 >> 4;
-
- rect->left = style->i.uncommon->i.clip[3];
- rect->lunit = bits1 & 0xf;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_CLIP_AUTO;
-}
-#undef CLIP_MASK2
-#undef CLIP_SHIFT2
-#undef CLIP_INDEX2
-#undef CLIP_MASK1
-#undef CLIP_SHIFT1
-#undef CLIP_INDEX1
-#undef CLIP_MASK
-#undef CLIP_SHIFT
-#undef CLIP_INDEX
-
-#define COLUMN_COUNT_INDEX 8
-#define COLUMN_COUNT_SHIFT 6
-#define COLUMN_COUNT_MASK 0xc0
-static inline uint8_t get_column_count(
- const css_computed_style *style, int32_t *count)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_COUNT_INDEX];
- bits &= COLUMN_COUNT_MASK;
- bits >>= COLUMN_COUNT_SHIFT;
-
- /* 2bits: tt : type */
- *count = style->i.uncommon->i.column_count;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_COUNT_AUTO;
-}
-#undef COLUMN_COUNT_MASK
-#undef COLUMN_COUNT_SHIFT
-#undef COLUMN_COUNT_INDEX
-
-#define COLUMN_FILL_INDEX 8
-#define COLUMN_FILL_SHIFT 4
-#define COLUMN_FILL_MASK 0x30
-static inline uint8_t get_column_fill(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_FILL_INDEX];
- bits &= COLUMN_FILL_MASK;
- bits >>= COLUMN_FILL_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_FILL_BALANCE;
-}
-#undef COLUMN_FILL_MASK
-#undef COLUMN_FILL_SHIFT
-#undef COLUMN_FILL_INDEX
-
-#define COLUMN_GAP_INDEX 9
-#define COLUMN_GAP_SHIFT 2
-#define COLUMN_GAP_MASK 0xfc
-static inline uint8_t get_column_gap(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_GAP_INDEX];
- bits &= COLUMN_GAP_MASK;
- bits >>= COLUMN_GAP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_COLUMN_GAP_SET) {
- *length = style->i.uncommon->i.column_gap;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_COLUMN_GAP_NORMAL;
-}
-#undef COLUMN_GAP_MASK
-#undef COLUMN_GAP_SHIFT
-#undef COLUMN_GAP_INDEX
-
-#define COLUMN_RULE_COLOR_INDEX 9
-#define COLUMN_RULE_COLOR_SHIFT 0
-#define COLUMN_RULE_COLOR_MASK 0x3
-static inline uint8_t get_column_rule_color(
- const css_computed_style *style,
- css_color *color)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX];
- bits &= COLUMN_RULE_COLOR_MASK;
- bits >>= COLUMN_RULE_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.uncommon->i.column_rule_color;
-
- return bits;
- }
-
- /* Initial value */
- *color = 0;
- return CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
-}
-#undef COLUMN_RULE_COLOR_MASK
-#undef COLUMN_RULE_COLOR_SHIFT
-#undef COLUMN_RULE_COLOR_INDEX
-
-#define COLUMN_RULE_STYLE_INDEX 8
-#define COLUMN_RULE_STYLE_SHIFT 0
-#define COLUMN_RULE_STYLE_MASK 0xf
-static inline uint8_t get_column_rule_style(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX];
- bits &= COLUMN_RULE_STYLE_MASK;
- bits >>= COLUMN_RULE_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_RULE_STYLE_NONE;
-}
-#undef COLUMN_RULE_STYLE_MASK
-#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->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.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->i.uncommon->i.column_rule_width;
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
- }
-
- /* Initial value */
- return CSS_COLUMN_RULE_WIDTH_MEDIUM;
-}
-#undef COLUMN_RULE_WIDTH_MASK
-#undef COLUMN_RULE_WIDTH_SHIFT
-#undef COLUMN_RULE_WIDTH_INDEX
-
-#define COLUMN_SPAN_INDEX 11
-#define COLUMN_SPAN_SHIFT 6
-#define COLUMN_SPAN_MASK 0xc0
-static inline uint8_t get_column_span(
- const css_computed_style *style)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_SPAN_INDEX];
- bits &= COLUMN_SPAN_MASK;
- bits >>= COLUMN_SPAN_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_COLUMN_SPAN_NONE;
-}
-#undef COLUMN_SPAN_MASK
-#undef COLUMN_SPAN_SHIFT
-#undef COLUMN_SPAN_INDEX
-
-#define COLUMN_WIDTH_INDEX 11
-#define COLUMN_WIDTH_SHIFT 0
-#define COLUMN_WIDTH_MASK 0x3f
-static inline uint8_t get_column_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX];
- bits &= COLUMN_WIDTH_MASK;
- bits >>= COLUMN_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_COLUMN_WIDTH_SET) {
- *length = style->i.uncommon->i.column_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
- }
-
- /* Initial value */
- return CSS_COLUMN_WIDTH_AUTO;
-}
-#undef COLUMN_WIDTH_MASK
-#undef COLUMN_WIDTH_SHIFT
-#undef COLUMN_WIDTH_INDEX
-
-#define CONTENT_INDEX 7
-#define CONTENT_SHIFT 0
-#define CONTENT_MASK 0x3
-static inline uint8_t get_content(
- const css_computed_style *style,
- const css_computed_content_item **content)
-{
- if (style->i.uncommon != NULL) {
- uint8_t bits = style->i.uncommon->i.bits[CONTENT_INDEX];
- bits &= CONTENT_MASK;
- bits >>= CONTENT_SHIFT;
-
- /* 2bits: type */
- *content = style->i.uncommon->content;
-
- return bits;
- }
-
- /* Initial value */
- return CSS_CONTENT_NORMAL;
-}
-#undef CONTENT_MASK
-#undef CONTENT_SHIFT
-#undef CONTENT_INDEX
-
-#define VERTICAL_ALIGN_INDEX 0
-#define VERTICAL_ALIGN_SHIFT 0
-#define VERTICAL_ALIGN_MASK 0xff
-static inline uint8_t get_vertical_align(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[VERTICAL_ALIGN_INDEX];
- bits &= VERTICAL_ALIGN_MASK;
- bits >>= VERTICAL_ALIGN_SHIFT;
-
- /* 8bits: uuuutttt : units | type */
- if ((bits & 0xf) == CSS_VERTICAL_ALIGN_SET) {
- *length = style->i.vertical_align;
- *unit = bits >> 4;
- }
-
- return (bits & 0xf);
-}
-#undef VERTICAL_ALIGN_MASK
-#undef VERTICAL_ALIGN_SHIFT
-#undef VERTICAL_ALIGN_INDEX
-
-#define FONT_SIZE_INDEX 1
-#define FONT_SIZE_SHIFT 0
-#define FONT_SIZE_MASK 0xff
-static inline uint8_t get_font_size(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[FONT_SIZE_INDEX];
- bits &= FONT_SIZE_MASK;
- bits >>= FONT_SIZE_SHIFT;
-
- /* 8bits: uuuutttt : units | type */
- if ((bits & 0xf) == CSS_FONT_SIZE_DIMENSION) {
- *length = style->i.font_size;
- *unit = bits >> 4;
- }
-
- return (bits & 0xf);
-}
-#undef FONT_SIZE_MASK
-#undef FONT_SIZE_SHIFT
-#undef FONT_SIZE_INDEX
-
-#define BORDER_TOP_WIDTH_INDEX 2
-#define BORDER_TOP_WIDTH_SHIFT 1
-#define BORDER_TOP_WIDTH_MASK 0xfe
-static inline uint8_t get_border_top_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_WIDTH_INDEX];
- bits &= BORDER_TOP_WIDTH_MASK;
- bits >>= BORDER_TOP_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[0];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_TOP_WIDTH_MASK
-#undef BORDER_TOP_WIDTH_SHIFT
-#undef BORDER_TOP_WIDTH_INDEX
-
-#define BORDER_RIGHT_WIDTH_INDEX 3
-#define BORDER_RIGHT_WIDTH_SHIFT 1
-#define BORDER_RIGHT_WIDTH_MASK 0xfe
-static inline uint8_t get_border_right_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
- bits &= BORDER_RIGHT_WIDTH_MASK;
- bits >>= BORDER_RIGHT_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[1];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_RIGHT_WIDTH_MASK
-#undef BORDER_RIGHT_WIDTH_SHIFT
-#undef BORDER_RIGHT_WIDTH_INDEX
-
-#define BORDER_BOTTOM_WIDTH_INDEX 4
-#define BORDER_BOTTOM_WIDTH_SHIFT 1
-#define BORDER_BOTTOM_WIDTH_MASK 0xfe
-static inline uint8_t get_border_bottom_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
- bits &= BORDER_BOTTOM_WIDTH_MASK;
- bits >>= BORDER_BOTTOM_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[2];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_BOTTOM_WIDTH_MASK
-#undef BORDER_BOTTOM_WIDTH_SHIFT
-#undef BORDER_BOTTOM_WIDTH_INDEX
-
-#define BORDER_LEFT_WIDTH_INDEX 5
-#define BORDER_LEFT_WIDTH_SHIFT 1
-#define BORDER_LEFT_WIDTH_MASK 0xfe
-static inline uint8_t get_border_left_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_WIDTH_INDEX];
- bits &= BORDER_LEFT_WIDTH_MASK;
- bits >>= BORDER_LEFT_WIDTH_SHIFT;
-
- /* 7bits: uuuuttt : units | type */
- if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) {
- *length = style->i.border_width[3];
- *unit = bits >> 3;
- }
-
- return (bits & 0x7);
-}
-#undef BORDER_LEFT_WIDTH_MASK
-#undef BORDER_LEFT_WIDTH_SHIFT
-#undef BORDER_LEFT_WIDTH_INDEX
-
-#define BACKGROUND_IMAGE_INDEX 2
-#define BACKGROUND_IMAGE_SHIFT 0
-#define BACKGROUND_IMAGE_MASK 0x1
-static inline uint8_t get_background_image(
- const css_computed_style *style,
- lwc_string **url)
-{
- uint8_t bits = style->i.bits[BACKGROUND_IMAGE_INDEX];
- bits &= BACKGROUND_IMAGE_MASK;
- bits >>= BACKGROUND_IMAGE_SHIFT;
-
- /* 1bit: type */
- *url = style->i.background_image;
-
- return bits;
-}
-#undef BACKGROUND_IMAGE_MASK
-#undef BACKGROUND_IMAGE_SHIFT
-#undef BACKGROUND_IMAGE_INDEX
-
-#define COLOR_INDEX 3
-#define COLOR_SHIFT 0
-#define COLOR_MASK 0x1
-static inline uint8_t get_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[COLOR_INDEX];
- bits &= COLOR_MASK;
- bits >>= COLOR_SHIFT;
-
- /* 1bit: type */
- *color = style->i.color;
-
- return bits;
-}
-#undef COLOR_MASK
-#undef COLOR_SHIFT
-#undef COLOR_INDEX
-
-#define LIST_STYLE_IMAGE_INDEX 4
-#define LIST_STYLE_IMAGE_SHIFT 0
-#define LIST_STYLE_IMAGE_MASK 0x1
-static inline uint8_t get_list_style_image(
- const css_computed_style *style,
- lwc_string **url)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_IMAGE_INDEX];
- bits &= LIST_STYLE_IMAGE_MASK;
- bits >>= LIST_STYLE_IMAGE_SHIFT;
-
- /* 1bit: type */
- *url = style->i.list_style_image;
-
- return bits;
-}
-#undef LIST_STYLE_IMAGE_MASK
-#undef LIST_STYLE_IMAGE_SHIFT
-#undef LIST_STYLE_IMAGE_INDEX
-
-#define QUOTES_INDEX 5
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
-static inline uint8_t get_quotes(
- const css_computed_style *style,
- lwc_string ***quotes)
-{
- uint8_t bits = style->i.bits[QUOTES_INDEX];
- bits &= QUOTES_MASK;
- bits >>= QUOTES_SHIFT;
-
- /* 1bit: type */
- *quotes = style->quotes;
-
- return bits;
-}
-#undef QUOTES_MASK
-#undef QUOTES_SHIFT
-#undef QUOTES_INDEX
-
-#define TOP_INDEX 6
-#define TOP_SHIFT 2
-#define TOP_MASK 0xfc
-static inline uint8_t get_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[TOP_INDEX];
- bits &= TOP_MASK;
- bits >>= TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_TOP_SET) {
- *length = style->i.top;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_top_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TOP_INDEX];
- bits &= TOP_MASK;
- bits >>= TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef TOP_MASK
-#undef TOP_SHIFT
-#undef TOP_INDEX
-
-#define RIGHT_INDEX 7
-#define RIGHT_SHIFT 2
-#define RIGHT_MASK 0xfc
-static inline uint8_t get_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[RIGHT_INDEX];
- bits &= RIGHT_MASK;
- bits >>= RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_RIGHT_SET) {
- *length = style->i.right;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_right_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[RIGHT_INDEX];
- bits &= RIGHT_MASK;
- bits >>= RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef RIGHT_MASK
-#undef RIGHT_SHIFT
-#undef RIGHT_INDEX
-
-#define BOTTOM_INDEX 8
-#define BOTTOM_SHIFT 2
-#define BOTTOM_MASK 0xfc
-static inline uint8_t get_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[BOTTOM_INDEX];
- bits &= BOTTOM_MASK;
- bits >>= BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_BOTTOM_SET) {
- *length = style->i.bottom;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_bottom_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BOTTOM_INDEX];
- bits &= BOTTOM_MASK;
- bits >>= BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef BOTTOM_MASK
-#undef BOTTOM_SHIFT
-#undef BOTTOM_INDEX
-
-#define LEFT_INDEX 9
-#define LEFT_SHIFT 2
-#define LEFT_MASK 0xfc
-static inline uint8_t get_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[LEFT_INDEX];
- bits &= LEFT_MASK;
- bits >>= LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_LEFT_SET) {
- *length = style->i.left;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-static inline uint8_t get_left_bits(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LEFT_INDEX];
- bits &= LEFT_MASK;
- bits >>= LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- return bits;
-}
-#undef LEFT_MASK
-#undef LEFT_SHIFT
-#undef LEFT_INDEX
-
-#define BORDER_TOP_COLOR_INDEX 6
-#define BORDER_TOP_COLOR_SHIFT 0
-#define BORDER_TOP_COLOR_MASK 0x3
-static inline uint8_t get_border_top_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_COLOR_INDEX];
- bits &= BORDER_TOP_COLOR_MASK;
- bits >>= BORDER_TOP_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[0];
-
- return bits;
-}
-#undef BORDER_TOP_COLOR_MASK
-#undef BORDER_TOP_COLOR_SHIFT
-#undef BORDER_TOP_COLOR_INDEX
-
-#define BORDER_RIGHT_COLOR_INDEX 7
-#define BORDER_RIGHT_COLOR_SHIFT 0
-#define BORDER_RIGHT_COLOR_MASK 0x3
-static inline uint8_t get_border_right_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_COLOR_INDEX];
- bits &= BORDER_RIGHT_COLOR_MASK;
- bits >>= BORDER_RIGHT_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[1];
-
- return bits;
-}
-#undef BORDER_RIGHT_COLOR_MASK
-#undef BORDER_RIGHT_COLOR_SHIFT
-#undef BORDER_RIGHT_COLOR_INDEX
-
-#define BORDER_BOTTOM_COLOR_INDEX 8
-#define BORDER_BOTTOM_COLOR_SHIFT 0
-#define BORDER_BOTTOM_COLOR_MASK 0x3
-static inline uint8_t get_border_bottom_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
- bits &= BORDER_BOTTOM_COLOR_MASK;
- bits >>= BORDER_BOTTOM_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[2];
-
- return bits;
-}
-#undef BORDER_BOTTOM_COLOR_MASK
-#undef BORDER_BOTTOM_COLOR_SHIFT
-#undef BORDER_BOTTOM_COLOR_INDEX
-
-#define BORDER_LEFT_COLOR_INDEX 9
-#define BORDER_LEFT_COLOR_SHIFT 0
-#define BORDER_LEFT_COLOR_MASK 0x3
-static inline uint8_t get_border_left_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_COLOR_INDEX];
- bits &= BORDER_LEFT_COLOR_MASK;
- bits >>= BORDER_LEFT_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.border_color[3];
-
- return bits;
-}
-#undef BORDER_LEFT_COLOR_MASK
-#undef BORDER_LEFT_COLOR_SHIFT
-#undef BORDER_LEFT_COLOR_INDEX
-
-#define HEIGHT_INDEX 10
-#define HEIGHT_SHIFT 2
-#define HEIGHT_MASK 0xfc
-static inline uint8_t get_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[HEIGHT_INDEX];
- bits &= HEIGHT_MASK;
- bits >>= HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_HEIGHT_SET) {
- *length = style->i.height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef HEIGHT_MASK
-#undef HEIGHT_SHIFT
-#undef HEIGHT_INDEX
-
-#define LINE_HEIGHT_INDEX 11
-#define LINE_HEIGHT_SHIFT 2
-#define LINE_HEIGHT_MASK 0xfc
-static inline uint8_t get_line_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[LINE_HEIGHT_INDEX];
- bits &= LINE_HEIGHT_MASK;
- bits >>= LINE_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
- (bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
- *length = style->i.line_height;
- }
-
- if ((bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef LINE_HEIGHT_MASK
-#undef LINE_HEIGHT_SHIFT
-#undef LINE_HEIGHT_INDEX
-
-#define BACKGROUND_COLOR_INDEX 10
-#define BACKGROUND_COLOR_SHIFT 0
-#define BACKGROUND_COLOR_MASK 0x3
-static inline uint8_t get_background_color(
- const css_computed_style *style,
- css_color *color)
-{
- uint8_t bits = style->i.bits[BACKGROUND_COLOR_INDEX];
- bits &= BACKGROUND_COLOR_MASK;
- bits >>= BACKGROUND_COLOR_SHIFT;
-
- /* 2bits: type */
- *color = style->i.background_color;
-
- return bits;
-}
-#undef BACKGROUND_COLOR_MASK
-#undef BACKGROUND_COLOR_SHIFT
-#undef BACKGROUND_COLOR_INDEX
-
-#define Z_INDEX_INDEX 11
-#define Z_INDEX_SHIFT 0
-#define Z_INDEX_MASK 0x3
-static inline uint8_t get_z_index(
- const css_computed_style *style,
- int32_t *z_index)
-{
- uint8_t bits = style->i.bits[Z_INDEX_INDEX];
- bits &= Z_INDEX_MASK;
- bits >>= Z_INDEX_SHIFT;
-
- /* 2bits: type */
- *z_index = style->i.z_index;
-
- return bits;
-}
-#undef Z_INDEX_MASK
-#undef Z_INDEX_SHIFT
-#undef Z_INDEX_INDEX
-
-#define MARGIN_TOP_INDEX 12
-#define MARGIN_TOP_SHIFT 2
-#define MARGIN_TOP_MASK 0xfc
-static inline uint8_t get_margin_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_TOP_INDEX];
- bits &= MARGIN_TOP_MASK;
- bits >>= MARGIN_TOP_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[0];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_TOP_MASK
-#undef MARGIN_TOP_SHIFT
-#undef MARGIN_TOP_INDEX
-
-#define MARGIN_RIGHT_INDEX 13
-#define MARGIN_RIGHT_SHIFT 2
-#define MARGIN_RIGHT_MASK 0xfc
-static inline uint8_t get_margin_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_RIGHT_INDEX];
- bits &= MARGIN_RIGHT_MASK;
- bits >>= MARGIN_RIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[1];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_RIGHT_MASK
-#undef MARGIN_RIGHT_SHIFT
-#undef MARGIN_RIGHT_INDEX
-
-#define MARGIN_BOTTOM_INDEX 14
-#define MARGIN_BOTTOM_SHIFT 2
-#define MARGIN_BOTTOM_MASK 0xfc
-static inline uint8_t get_margin_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_BOTTOM_INDEX];
- bits &= MARGIN_BOTTOM_MASK;
- bits >>= MARGIN_BOTTOM_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[2];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_BOTTOM_MASK
-#undef MARGIN_BOTTOM_SHIFT
-#undef MARGIN_BOTTOM_INDEX
-
-#define MARGIN_LEFT_INDEX 15
-#define MARGIN_LEFT_SHIFT 2
-#define MARGIN_LEFT_MASK 0xfc
-static inline uint8_t get_margin_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MARGIN_LEFT_INDEX];
- bits &= MARGIN_LEFT_MASK;
- bits >>= MARGIN_LEFT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MARGIN_SET) {
- *length = style->i.margin[3];
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MARGIN_LEFT_MASK
-#undef MARGIN_LEFT_SHIFT
-#undef MARGIN_LEFT_INDEX
-
-#define BACKGROUND_ATTACHMENT_INDEX 12
-#define BACKGROUND_ATTACHMENT_SHIFT 0
-#define BACKGROUND_ATTACHMENT_MASK 0x3
-static inline uint8_t get_background_attachment(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
- bits &= BACKGROUND_ATTACHMENT_MASK;
- bits >>= BACKGROUND_ATTACHMENT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BACKGROUND_ATTACHMENT_MASK
-#undef BACKGROUND_ATTACHMENT_SHIFT
-#undef BACKGROUND_ATTACHMENT_INDEX
-
-#define BOX_SIZING_INDEX 23
-#define BOX_SIZING_SHIFT 0
-#define BOX_SIZING_MASK 0x3
-static inline uint8_t get_box_sizing(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BOX_SIZING_INDEX];
- bits &= BOX_SIZING_MASK;
- bits >>= BOX_SIZING_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BOX_SIZING_MASK
-#undef BOX_SIZING_SHIFT
-#undef BOX_SIZING_INDEX
-
-#define BORDER_COLLAPSE_INDEX 13
-#define BORDER_COLLAPSE_SHIFT 0
-#define BORDER_COLLAPSE_MASK 0x3
-static inline uint8_t get_border_collapse(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
- bits &= BORDER_COLLAPSE_MASK;
- bits >>= BORDER_COLLAPSE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef BORDER_COLLAPSE_MASK
-#undef BORDER_COLLAPSE_SHIFT
-#undef BORDER_COLLAPSE_INDEX
-
-#define CAPTION_SIDE_INDEX 14
-#define CAPTION_SIDE_SHIFT 0
-#define CAPTION_SIDE_MASK 0x3
-static inline uint8_t get_caption_side(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[CAPTION_SIDE_INDEX];
- bits &= CAPTION_SIDE_MASK;
- bits >>= CAPTION_SIDE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef CAPTION_SIDE_MASK
-#undef CAPTION_SIDE_SHIFT
-#undef CAPTION_SIDE_INDEX
-
-#define DIRECTION_INDEX 15
-#define DIRECTION_SHIFT 0
-#define DIRECTION_MASK 0x3
-static inline uint8_t get_direction(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[DIRECTION_INDEX];
- bits &= DIRECTION_MASK;
- bits >>= DIRECTION_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef DIRECTION_MASK
-#undef DIRECTION_SHIFT
-#undef DIRECTION_INDEX
-
-#define MAX_HEIGHT_INDEX 16
-#define MAX_HEIGHT_SHIFT 2
-#define MAX_HEIGHT_MASK 0xfc
-static inline uint8_t get_max_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MAX_HEIGHT_INDEX];
- bits &= MAX_HEIGHT_MASK;
- bits >>= MAX_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MAX_HEIGHT_SET) {
- *length = style->i.max_height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MAX_HEIGHT_MASK
-#undef MAX_HEIGHT_SHIFT
-#undef MAX_HEIGHT_INDEX
-
-#define MAX_WIDTH_INDEX 17
-#define MAX_WIDTH_SHIFT 2
-#define MAX_WIDTH_MASK 0xfc
-static inline uint8_t get_max_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MAX_WIDTH_INDEX];
- bits &= MAX_WIDTH_MASK;
- bits >>= MAX_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MAX_WIDTH_SET) {
- *length = style->i.max_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MAX_WIDTH_MASK
-#undef MAX_WIDTH_SHIFT
-#undef MAX_WIDTH_INDEX
-
-#define WIDTH_INDEX 18
-#define WIDTH_SHIFT 2
-#define WIDTH_MASK 0xfc
-static inline uint8_t get_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[WIDTH_INDEX];
- bits &= WIDTH_MASK;
- bits >>= WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_WIDTH_SET) {
- *length = style->i.width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef WIDTH_MASK
-#undef WIDTH_SHIFT
-#undef WIDTH_INDEX
-
-#define EMPTY_CELLS_INDEX 16
-#define EMPTY_CELLS_SHIFT 0
-#define EMPTY_CELLS_MASK 0x3
-static inline uint8_t get_empty_cells(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[EMPTY_CELLS_INDEX];
- bits &= EMPTY_CELLS_MASK;
- bits >>= EMPTY_CELLS_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef EMPTY_CELLS_MASK
-#undef EMPTY_CELLS_SHIFT
-#undef EMPTY_CELLS_INDEX
-
-#define FLOAT_INDEX 17
-#define FLOAT_SHIFT 0
-#define FLOAT_MASK 0x3
-static inline uint8_t get_float(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLOAT_INDEX];
- bits &= FLOAT_MASK;
- bits >>= FLOAT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FLOAT_MASK
-#undef FLOAT_SHIFT
-#undef FLOAT_INDEX
-
-#define FONT_STYLE_INDEX 18
-#define FONT_STYLE_SHIFT 0
-#define FONT_STYLE_MASK 0x3
-static inline uint8_t get_font_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_STYLE_INDEX];
- bits &= FONT_STYLE_MASK;
- bits >>= FONT_STYLE_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FONT_STYLE_MASK
-#undef FONT_STYLE_SHIFT
-#undef FONT_STYLE_INDEX
-
-#define MIN_HEIGHT_INDEX 19
-#define MIN_HEIGHT_SHIFT 2
-#define MIN_HEIGHT_MASK 0xfc
-static inline uint8_t get_min_height(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MIN_HEIGHT_INDEX];
- bits &= MIN_HEIGHT_MASK;
- bits >>= MIN_HEIGHT_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MIN_HEIGHT_SET) {
- *length = style->i.min_height;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MIN_HEIGHT_MASK
-#undef MIN_HEIGHT_SHIFT
-#undef MIN_HEIGHT_INDEX
-
-#define MIN_WIDTH_INDEX 20
-#define MIN_WIDTH_SHIFT 2
-#define MIN_WIDTH_MASK 0xfc
-static inline uint8_t get_min_width(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[MIN_WIDTH_INDEX];
- bits &= MIN_WIDTH_MASK;
- bits >>= MIN_WIDTH_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_MIN_WIDTH_SET) {
- *length = style->i.min_width;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef MIN_WIDTH_MASK
-#undef MIN_WIDTH_SHIFT
-#undef MIN_WIDTH_INDEX
-
-#define BACKGROUND_REPEAT_INDEX 34
-#define BACKGROUND_REPEAT_SHIFT 2
-#define BACKGROUND_REPEAT_MASK 0x1c
-static inline uint8_t get_background_repeat(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
- bits &= BACKGROUND_REPEAT_MASK;
- bits >>= BACKGROUND_REPEAT_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef BACKGROUND_REPEAT_MASK
-#undef BACKGROUND_REPEAT_SHIFT
-#undef BACKGROUND_REPEAT_INDEX
-
-#define CLEAR_INDEX 36
-#define CLEAR_SHIFT 2
-#define CLEAR_MASK 0x1c
-static inline uint8_t get_clear(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[CLEAR_INDEX];
- bits &= CLEAR_MASK;
- bits >>= CLEAR_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef CLEAR_MASK
-#undef CLEAR_SHIFT
-#undef CLEAR_INDEX
-
-#define PADDING_TOP_INDEX 21
-#define PADDING_TOP_SHIFT 3
-#define PADDING_TOP_MASK 0xf8
-static inline uint8_t get_padding_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_TOP_INDEX];
- bits &= PADDING_TOP_MASK;
- bits >>= PADDING_TOP_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[0];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_TOP_MASK
-#undef PADDING_TOP_SHIFT
-#undef PADDING_TOP_INDEX
-
-#define PADDING_RIGHT_INDEX 22
-#define PADDING_RIGHT_SHIFT 3
-#define PADDING_RIGHT_MASK 0xf8
-static inline uint8_t get_padding_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_RIGHT_INDEX];
- bits &= PADDING_RIGHT_MASK;
- bits >>= PADDING_RIGHT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[1];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_RIGHT_MASK
-#undef PADDING_RIGHT_SHIFT
-#undef PADDING_RIGHT_INDEX
-
-#define PADDING_BOTTOM_INDEX 23
-#define PADDING_BOTTOM_SHIFT 3
-#define PADDING_BOTTOM_MASK 0xf8
-static inline uint8_t get_padding_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_BOTTOM_INDEX];
- bits &= PADDING_BOTTOM_MASK;
- bits >>= PADDING_BOTTOM_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[2];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_BOTTOM_MASK
-#undef PADDING_BOTTOM_SHIFT
-#undef PADDING_BOTTOM_INDEX
-
-#define PADDING_LEFT_INDEX 24
-#define PADDING_LEFT_SHIFT 3
-#define PADDING_LEFT_MASK 0xf8
-static inline uint8_t get_padding_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[PADDING_LEFT_INDEX];
- bits &= PADDING_LEFT_MASK;
- bits >>= PADDING_LEFT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_PADDING_SET) {
- *length = style->i.padding[3];
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef PADDING_LEFT_MASK
-#undef PADDING_LEFT_SHIFT
-#undef PADDING_LEFT_INDEX
-
-#define OVERFLOW_X_INDEX 21
-#define OVERFLOW_X_SHIFT 0
-#define OVERFLOW_X_MASK 0x7
-static inline uint8_t get_overflow_x(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OVERFLOW_X_INDEX];
- bits &= OVERFLOW_X_MASK;
- bits >>= OVERFLOW_X_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef OVERFLOW_X_MASK
-#undef OVERFLOW_X_SHIFT
-#undef OVERFLOW_X_INDEX
-
-#define OVERFLOW_Y_INDEX 34
-#define OVERFLOW_Y_SHIFT 5
-#define OVERFLOW_Y_MASK 0xe0
-static inline uint8_t get_overflow_y(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OVERFLOW_Y_INDEX];
- bits &= OVERFLOW_Y_MASK;
- bits >>= OVERFLOW_Y_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef OVERFLOW_Y_MASK
-#undef OVERFLOW_Y_SHIFT
-#undef OVERFLOW_Y_INDEX
-
-#define POSITION_INDEX 22
-#define POSITION_SHIFT 0
-#define POSITION_MASK 0x7
-static inline uint8_t get_position(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[POSITION_INDEX];
- bits &= POSITION_MASK;
- bits >>= POSITION_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef POSITION_MASK
-#undef POSITION_SHIFT
-#undef POSITION_INDEX
-
-#define OPACITY_INDEX 23
-#define OPACITY_SHIFT 2
-#define OPACITY_MASK 0x04
-static inline uint8_t get_opacity(
- const css_computed_style *style,
- css_fixed *opacity)
-{
- uint8_t bits = style->i.bits[OPACITY_INDEX];
- bits &= OPACITY_MASK;
- bits >>= OPACITY_SHIFT;
-
- /* 1bit: t : type */
- if ((bits & 0x1) == CSS_OPACITY_SET) {
- *opacity = style->i.opacity;
- }
-
- return (bits & 0x1);
-}
-#undef OPACITY_MASK
-#undef OPACITY_SHIFT
-#undef OPACITY_INDEX
-
-#define TEXT_TRANSFORM_INDEX 24
-#define TEXT_TRANSFORM_SHIFT 0
-#define TEXT_TRANSFORM_MASK 0x7
-static inline uint8_t get_text_transform(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
- bits &= TEXT_TRANSFORM_MASK;
- bits >>= TEXT_TRANSFORM_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef TEXT_TRANSFORM_MASK
-#undef TEXT_TRANSFORM_SHIFT
-#undef TEXT_TRANSFORM_INDEX
-
-#define TEXT_INDENT_INDEX 25
-#define TEXT_INDENT_SHIFT 3
-#define TEXT_INDENT_MASK 0xf8
-static inline uint8_t get_text_indent(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[TEXT_INDENT_INDEX];
- bits &= TEXT_INDENT_MASK;
- bits >>= TEXT_INDENT_SHIFT;
-
- /* 5bits: uuuut : units | type */
- if ((bits & 0x1) == CSS_TEXT_INDENT_SET) {
- *length = style->i.text_indent;
- *unit = bits >> 1;
- }
-
- return (bits & 0x1);
-}
-#undef TEXT_INDENT_MASK
-#undef TEXT_INDENT_SHIFT
-#undef TEXT_INDENT_INDEX
-
-#define WHITE_SPACE_INDEX 25
-#define WHITE_SPACE_SHIFT 0
-#define WHITE_SPACE_MASK 0x7
-static inline uint8_t get_white_space(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[WHITE_SPACE_INDEX];
- bits &= WHITE_SPACE_MASK;
- bits >>= WHITE_SPACE_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef WHITE_SPACE_MASK
-#undef WHITE_SPACE_SHIFT
-#undef WHITE_SPACE_INDEX
-
-#define BACKGROUND_POSITION_INDEX 27
-#define BACKGROUND_POSITION_SHIFT 7
-#define BACKGROUND_POSITION_MASK 0x80
-#define BACKGROUND_POSITION_INDEX1 26
-#define BACKGROUND_POSITION_SHIFT1 0
-#define BACKGROUND_POSITION_MASK1 0xff
-static inline uint8_t get_background_position(
- const css_computed_style *style,
- css_fixed *hlength, css_unit *hunit,
- css_fixed *vlength, css_unit *vunit)
-{
- uint8_t bits = style->i.bits[BACKGROUND_POSITION_INDEX];
- bits &= BACKGROUND_POSITION_MASK;
- bits >>= BACKGROUND_POSITION_SHIFT;
-
- /* 1bit: type */
- if (bits == CSS_BACKGROUND_POSITION_SET) {
- uint8_t bits1 = style->i.bits[BACKGROUND_POSITION_INDEX1];
- bits1 &= BACKGROUND_POSITION_MASK1;
- bits1 >>= BACKGROUND_POSITION_SHIFT1;
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *hlength = style->i.background_position[0];
- *hunit = bits1 >> 4;
-
- *vlength = style->i.background_position[1];
- *vunit = bits1 & 0xf;
- }
-
- return bits;
-}
-#undef BACKGROUND_POSITION_MASK1
-#undef BACKGROUND_POSITION_SHIFT1
-#undef BACKGROUND_POSITION_INDEX1
-#undef BACKGROUND_POSITION_MASK
-#undef BACKGROUND_POSITION_SHIFT
-#undef BACKGROUND_POSITION_INDEX
-
-#define DISPLAY_INDEX 27
-#define DISPLAY_SHIFT 2
-#define DISPLAY_MASK 0x7c
-static inline uint8_t get_display(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[DISPLAY_INDEX];
- bits &= DISPLAY_MASK;
- bits >>= DISPLAY_SHIFT;
-
- /* 5bits: type */
- return bits;
-}
-#undef DISPLAY_MASK
-#undef DISPLAY_SHIFT
-#undef DISPLAY_INDEX
-
-#define FONT_VARIANT_INDEX 27
-#define FONT_VARIANT_SHIFT 0
-#define FONT_VARIANT_MASK 0x3
-static inline uint8_t get_font_variant(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_VARIANT_INDEX];
- bits &= FONT_VARIANT_MASK;
- bits >>= FONT_VARIANT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FONT_VARIANT_MASK
-#undef FONT_VARIANT_SHIFT
-#undef FONT_VARIANT_INDEX
-
-#define TEXT_DECORATION_INDEX 28
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
-static inline uint8_t get_text_decoration(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_DECORATION_INDEX];
- bits &= TEXT_DECORATION_MASK;
- bits >>= TEXT_DECORATION_SHIFT;
-
- /* 5bits: type */
- return bits;
-}
-#undef TEXT_DECORATION_MASK
-#undef TEXT_DECORATION_SHIFT
-#undef TEXT_DECORATION_INDEX
-
-#define FONT_FAMILY_INDEX 28
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
-static inline uint8_t get_font_family(
- const css_computed_style *style,
- lwc_string ***names)
-{
- uint8_t bits = style->i.bits[FONT_FAMILY_INDEX];
- bits &= FONT_FAMILY_MASK;
- bits >>= FONT_FAMILY_SHIFT;
-
- /* 3bits: type */
- *names = style->font_family;
-
- return bits;
-}
-#undef FONT_FAMILY_MASK
-#undef FONT_FAMILY_SHIFT
-#undef FONT_FAMILY_INDEX
-
-#define BORDER_TOP_STYLE_INDEX 29
-#define BORDER_TOP_STYLE_SHIFT 4
-#define BORDER_TOP_STYLE_MASK 0xf0
-static inline uint8_t get_border_top_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
- bits &= BORDER_TOP_STYLE_MASK;
- bits >>= BORDER_TOP_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_TOP_STYLE_MASK
-#undef BORDER_TOP_STYLE_SHIFT
-#undef BORDER_TOP_STYLE_INDEX
-
-#define BORDER_RIGHT_STYLE_INDEX 29
-#define BORDER_RIGHT_STYLE_SHIFT 0
-#define BORDER_RIGHT_STYLE_MASK 0xf
-static inline uint8_t get_border_right_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
- bits &= BORDER_RIGHT_STYLE_MASK;
- bits >>= BORDER_RIGHT_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_RIGHT_STYLE_MASK
-#undef BORDER_RIGHT_STYLE_SHIFT
-#undef BORDER_RIGHT_STYLE_INDEX
-
-#define BORDER_BOTTOM_STYLE_INDEX 30
-#define BORDER_BOTTOM_STYLE_SHIFT 4
-#define BORDER_BOTTOM_STYLE_MASK 0xf0
-static inline uint8_t get_border_bottom_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
- bits &= BORDER_BOTTOM_STYLE_MASK;
- bits >>= BORDER_BOTTOM_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_BOTTOM_STYLE_MASK
-#undef BORDER_BOTTOM_STYLE_SHIFT
-#undef BORDER_BOTTOM_STYLE_INDEX
-
-#define BORDER_LEFT_STYLE_INDEX 30
-#define BORDER_LEFT_STYLE_SHIFT 0
-#define BORDER_LEFT_STYLE_MASK 0xf
-static inline uint8_t get_border_left_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
- bits &= BORDER_LEFT_STYLE_MASK;
- bits >>= BORDER_LEFT_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef BORDER_LEFT_STYLE_MASK
-#undef BORDER_LEFT_STYLE_SHIFT
-#undef BORDER_LEFT_STYLE_INDEX
-
-#define FONT_WEIGHT_INDEX 31
-#define FONT_WEIGHT_SHIFT 4
-#define FONT_WEIGHT_MASK 0xf0
-static inline uint8_t get_font_weight(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FONT_WEIGHT_INDEX];
- bits &= FONT_WEIGHT_MASK;
- bits >>= FONT_WEIGHT_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef FONT_WEIGHT_MASK
-#undef FONT_WEIGHT_SHIFT
-#undef FONT_WEIGHT_INDEX
-
-#define LIST_STYLE_TYPE_INDEX 31
-#define LIST_STYLE_TYPE_SHIFT 0
-#define LIST_STYLE_TYPE_MASK 0xf
-static inline uint8_t get_list_style_type(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
- bits &= LIST_STYLE_TYPE_MASK;
- bits >>= LIST_STYLE_TYPE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef LIST_STYLE_TYPE_MASK
-#undef LIST_STYLE_TYPE_SHIFT
-#undef LIST_STYLE_TYPE_INDEX
-
-#define OUTLINE_STYLE_INDEX 32
-#define OUTLINE_STYLE_SHIFT 4
-#define OUTLINE_STYLE_MASK 0xf0
-static inline uint8_t get_outline_style(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
- bits &= OUTLINE_STYLE_MASK;
- bits >>= OUTLINE_STYLE_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef OUTLINE_STYLE_MASK
-#undef OUTLINE_STYLE_SHIFT
-#undef OUTLINE_STYLE_INDEX
-
-#define TABLE_LAYOUT_INDEX 32
-#define TABLE_LAYOUT_SHIFT 2
-#define TABLE_LAYOUT_MASK 0xc
-static inline uint8_t get_table_layout(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
- bits &= TABLE_LAYOUT_MASK;
- bits >>= TABLE_LAYOUT_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef TABLE_LAYOUT_MASK
-#undef TABLE_LAYOUT_SHIFT
-#undef TABLE_LAYOUT_INDEX
-
-#define UNICODE_BIDI_INDEX 32
-#define UNICODE_BIDI_SHIFT 0
-#define UNICODE_BIDI_MASK 0x3
-static inline uint8_t get_unicode_bidi(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[UNICODE_BIDI_INDEX];
- bits &= UNICODE_BIDI_MASK;
- bits >>= UNICODE_BIDI_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef UNICODE_BIDI_MASK
-#undef UNICODE_BIDI_SHIFT
-#undef UNICODE_BIDI_INDEX
-
-#define VISIBILITY_INDEX 33
-#define VISIBILITY_SHIFT 6
-#define VISIBILITY_MASK 0xc0
-static inline uint8_t get_visibility(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[VISIBILITY_INDEX];
- bits &= VISIBILITY_MASK;
- bits >>= VISIBILITY_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef VISIBILITY_MASK
-#undef VISIBILITY_SHIFT
-#undef VISIBILITY_INDEX
-
-#define LIST_STYLE_POSITION_INDEX 33
-#define LIST_STYLE_POSITION_SHIFT 4
-#define LIST_STYLE_POSITION_MASK 0x30
-static inline uint8_t get_list_style_position(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
- bits &= LIST_STYLE_POSITION_MASK;
- bits >>= LIST_STYLE_POSITION_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef LIST_STYLE_POSITION_MASK
-#undef LIST_STYLE_POSITION_SHIFT
-#undef LIST_STYLE_POSITION_INDEX
-
-#define TEXT_ALIGN_INDEX 33
-#define TEXT_ALIGN_SHIFT 0
-#define TEXT_ALIGN_MASK 0xf
-static inline uint8_t get_text_align(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[TEXT_ALIGN_INDEX];
- bits &= TEXT_ALIGN_MASK;
- bits >>= TEXT_ALIGN_SHIFT;
-
- /* 4bits: type */
- return bits;
-}
-#undef TEXT_ALIGN_MASK
-#undef TEXT_ALIGN_SHIFT
-#undef TEXT_ALIGN_INDEX
-
-#define PAGE_BREAK_AFTER_INDEX 0
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
-static inline uint8_t get_page_break_after(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_AFTER_INDEX];
- bits &= PAGE_BREAK_AFTER_MASK;
- bits >>= PAGE_BREAK_AFTER_SHIFT;
-
- /* 3bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_AFTER_AUTO;
-}
-#undef PAGE_BREAK_AFTER_MASK
-#undef PAGE_BREAK_AFTER_SHIFT
-#undef PAGE_BREAK_AFTER_INDEX
-
-#define PAGE_BREAK_BEFORE_INDEX 0
-#define PAGE_BREAK_BEFORE_SHIFT 3
-#define PAGE_BREAK_BEFORE_MASK 0x38
-static inline uint8_t get_page_break_before(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_BEFORE_INDEX];
- bits &= PAGE_BREAK_BEFORE_MASK;
- bits >>= PAGE_BREAK_BEFORE_SHIFT;
-
- /* 3bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_BEFORE_AUTO;
-}
-#undef PAGE_BREAK_BEFORE_MASK
-#undef PAGE_BREAK_BEFORE_SHIFT
-#undef PAGE_BREAK_BEFORE_INDEX
-
-#define PAGE_BREAK_INSIDE_INDEX 0
-#define PAGE_BREAK_INSIDE_SHIFT 6
-#define PAGE_BREAK_INSIDE_MASK 0xc0
-static inline uint8_t get_page_break_inside(
- const css_computed_style *style)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[PAGE_BREAK_INSIDE_INDEX];
- bits &= PAGE_BREAK_INSIDE_MASK;
- bits >>= PAGE_BREAK_INSIDE_SHIFT;
-
- /* 2bits: type */
- return bits;
- }
-
- /* Initial value */
- return CSS_PAGE_BREAK_INSIDE_AUTO;
-}
-#undef PAGE_BREAK_INSIDE_MASK
-#undef PAGE_BREAK_INSIDE_SHIFT
-#undef PAGE_BREAK_INSIDE_INDEX
-
-#define ORPHANS_INDEX 1
-#define ORPHANS_SHIFT 0
-#define ORPHANS_MASK 0x1
-static inline uint8_t get_orphans(
- const css_computed_style *style,
- int32_t *orphans)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[ORPHANS_INDEX];
- bits &= ORPHANS_MASK;
- bits >>= ORPHANS_SHIFT;
-
- *orphans = style->page->orphans;
-
- /* 1bit: type */
- return bits;
- }
-
- /* Initial value */
- *orphans = 2;
- return CSS_ORPHANS_SET;
-}
-#undef ORPHANS_MASK
-#undef ORPHANS_SHIFT
-#undef ORPHANS_INDEX
-
-#define WIDOWS_INDEX 1
-#define WIDOWS_SHIFT 1
-#define WIDOWS_MASK 0x2
-static inline uint8_t get_widows(
- const css_computed_style *style,
- int32_t *widows)
-{
- if (style->page != NULL) {
- uint8_t bits = style->page->bits[WIDOWS_INDEX];
- bits &= WIDOWS_MASK;
- bits >>= WIDOWS_SHIFT;
-
- *widows = style->page->widows;
-
- /* 1bit: type */
- return bits;
- }
-
- /* Initial value */
- *widows = 2;
- return CSS_WIDOWS_SET;
-}
-#undef WIDOWS_MASK
-#undef WIDOWS_SHIFT
-#undef WIDOWS_INDEX
-
-#define ALIGN_CONTENT_INDEX_A 34
-#define ALIGN_CONTENT_SHIFT_A 0
-#define ALIGN_CONTENT_MASK_A 0x3
-#define ALIGN_CONTENT_INDEX_B 35
-#define ALIGN_CONTENT_SHIFT_B 1
-#define ALIGN_CONTENT_MASK_B 0x2
-static inline uint8_t get_align_content(
- const css_computed_style *style)
-{
- uint8_t bits_a = style->i.bits[ALIGN_CONTENT_INDEX_A];
- bits_a &= ALIGN_CONTENT_MASK_A;
- bits_a >>= ALIGN_CONTENT_SHIFT_A;
-
- uint8_t bits_b = style->i.bits[ALIGN_CONTENT_INDEX_B];
- bits_b &= ALIGN_CONTENT_MASK_B;
- bits_b >>= ALIGN_CONTENT_SHIFT_B;
- /* Most significant bit out of three */
- bits_b <<= 2;
-
- uint8_t bits = bits_a | bits_b;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_CONTENT_MASK_A
-#undef ALIGN_CONTENT_SHIFT_A
-#undef ALIGN_CONTENT_INDEX_A
-#undef ALIGN_CONTENT_MASK_B
-#undef ALIGN_CONTENT_SHIFT_B
-#undef ALIGN_CONTENT_INDEX_B
-
-#define FLEX_WRAP_INDEX 19
-#define FLEX_WRAP_SHIFT 0
-#define FLEX_WRAP_MASK 0x3
-static inline uint8_t get_flex_wrap(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLEX_WRAP_INDEX];
- bits &= FLEX_WRAP_MASK;
- bits >>= FLEX_WRAP_SHIFT;
-
- /* 2bits: type */
- return bits;
-}
-#undef FLEX_WRAP_MASK
-#undef FLEX_WRAP_SHIFT
-#undef FLEX_WRAP_INDEX
-
-#define FLEX_BASIS_INDEX 35
-#define FLEX_BASIS_SHIFT 2
-#define FLEX_BASIS_MASK 0xfc
-static inline uint8_t get_flex_basis(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{
- uint8_t bits = style->i.bits[FLEX_BASIS_INDEX];
- bits &= FLEX_BASIS_MASK;
- bits >>= FLEX_BASIS_SHIFT;
-
- /* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_FLEX_BASIS_SET) {
- *length = style->i.flex_basis;
- *unit = bits >> 2;
- }
-
- return (bits & 0x3);
-}
-#undef FLEX_BASIS_MASK
-#undef FLEX_BASIS_SHIFT
-#undef FLEX_BASIS_INDEX
-
-#define FLEX_SHRINK_INDEX 20
-#define FLEX_SHRINK_SHIFT 1
-#define FLEX_SHRINK_MASK 0x2
-static inline uint8_t get_flex_shrink(
- const css_computed_style *style, css_fixed *number)
-{
- uint8_t bits = style->i.bits[FLEX_SHRINK_INDEX];
- bits &= FLEX_SHRINK_MASK;
- bits >>= FLEX_SHRINK_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_FLEX_SHRINK_SET) {
- *number = style->i.flex_shrink;
- }
-
- return (bits & 0x1);
-}
-#undef FLEX_SHRINK_MASK
-#undef FLEX_SHRINK_SHIFT
-#undef FLEX_SHRINK_INDEX
-
-#define FLEX_GROW_INDEX 20
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
-static inline uint8_t get_flex_grow(
- const css_computed_style *style, css_fixed *number)
-{
- uint8_t bits = style->i.bits[FLEX_GROW_INDEX];
- bits &= FLEX_GROW_MASK;
- bits >>= FLEX_GROW_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_FLEX_GROW_SET) {
- *number = style->i.flex_grow;
- }
-
- return (bits & 0x1);
-}
-#undef FLEX_GROW_MASK
-#undef FLEX_GROW_SHIFT
-#undef FLEX_GROW_INDEX
-
-#define FLEX_DIRECTION_INDEX 36
-#define FLEX_DIRECTION_SHIFT 5
-#define FLEX_DIRECTION_MASK 0xe0
-static inline uint8_t get_flex_direction(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
- bits &= FLEX_DIRECTION_MASK;
- bits >>= FLEX_DIRECTION_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef FLEX_DIRECTION_MASK
-#undef FLEX_DIRECTION_SHIFT
-#undef FLEX_DIRECTION_INDEX
-
-#define JUSTIFY_CONTENT_INDEX_A 35
-#define JUSTIFY_CONTENT_SHIFT_A 0
-#define JUSTIFY_CONTENT_MASK_A 0x1
-#define JUSTIFY_CONTENT_INDEX_B 36
-#define JUSTIFY_CONTENT_SHIFT_B 0
-#define JUSTIFY_CONTENT_MASK_B 0x3
-static inline uint8_t get_justify_content(
- const css_computed_style *style)
-{
- uint8_t bits_a = style->i.bits[JUSTIFY_CONTENT_INDEX_A];
- bits_a &= JUSTIFY_CONTENT_MASK_A;
- bits_a >>= JUSTIFY_CONTENT_SHIFT_A;
-
- uint8_t bits_b = style->i.bits[JUSTIFY_CONTENT_INDEX_B];
- bits_b &= JUSTIFY_CONTENT_MASK_B;
- bits_b >>= JUSTIFY_CONTENT_SHIFT_B;
- /* Most significant two bits out of three */
- bits_b <<= 1;
-
- uint8_t bits = bits_a | bits_b;
-
- /* 3bits: type */
- return bits;
-}
-#undef JUSTIFY_CONTENT_MASK_A
-#undef JUSTIFY_CONTENT_SHIFT_A
-#undef JUSTIFY_CONTENT_INDEX_A
-#undef JUSTIFY_CONTENT_MASK_B
-#undef JUSTIFY_CONTENT_SHIFT_B
-#undef JUSTIFY_CONTENT_INDEX_B
-
-#define ORDER_INDEX 37
-#define ORDER_SHIFT 1
-#define ORDER_MASK 0x2
-static inline uint8_t get_order(
- const css_computed_style *style, int32_t *number)
-{
- uint8_t bits = style->i.bits[ORDER_INDEX];
- bits &= ORDER_MASK;
- bits >>= ORDER_SHIFT;
-
- /* 1bit: type */
- if ((bits & 0x1) == CSS_ORDER_SET) {
- *number = style->i.order;
- }
-
- return (bits & 0x1);
-}
-#undef ORDER_MASK
-#undef ORDER_SHIFT
-#undef ORDER_INDEX
-
-#define ALIGN_ITEMS_INDEX 37
-#define ALIGN_ITEMS_SHIFT 5
-#define ALIGN_ITEMS_MASK 0xe0
-static inline uint8_t get_align_items(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
- bits &= ALIGN_ITEMS_MASK;
- bits >>= ALIGN_ITEMS_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_ITEMS_MASK
-#undef ALIGN_ITEMS_SHIFT
-#undef ALIGN_ITEMS_INDEX
-
-#define ALIGN_SELF_INDEX 37
-#define ALIGN_SELF_SHIFT 2
-#define ALIGN_SELF_MASK 0x1c
-static inline uint8_t get_align_self(
- const css_computed_style *style)
-{
- uint8_t bits = style->i.bits[ALIGN_SELF_INDEX];
- bits &= ALIGN_SELF_MASK;
- bits >>= ALIGN_SELF_SHIFT;
-
- /* 3bits: type */
- return bits;
-}
-#undef ALIGN_SELF_MASK
-#undef ALIGN_SELF_SHIFT
-#undef ALIGN_SELF_INDEX
-
-#endif
diff --git a/src/select/propset.h.old b/src/select/propset.h.old
deleted file mode 100644
index ea7ca48..0000000
--- a/src/select/propset.h.old
+++ /dev/null
@@ -1,2546 +0,0 @@
-/*
- * This file is part of LibCSS
- * Licensed under the MIT License,
- *
http://www.opensource.org/licenses/mit-license.php
- * Copyright 2009 John-Mark Bell <jmb(a)netsurf-browser.org>
- */
-
-#ifndef css_select_propset_h_
-#define css_select_propset_h_
-
-#include <string.h>
-
-#include <libcss/computed.h>
-#include "computed.h"
-
-/* Important: keep this file in sync with computed.h */
-/** \todo Is there a better way to ensure this happens? */
-
-/** Default values are 'initial value', unless the property is inherited,
- * in which case it is 'inherit'. */
-static const css_computed_uncommon default_uncommon = {
- .i = {
- .bits = {
- (CSS_LETTER_SPACING_INHERIT << 2) |
- CSS_OUTLINE_COLOR_INVERT,
- (CSS_OUTLINE_WIDTH_MEDIUM << 1) |
- CSS_BORDER_SPACING_INHERIT,
- 0,
- (CSS_WORD_SPACING_INHERIT << 2) |
- (CSS_COUNTER_INCREMENT_NONE << 1) |
- CSS_COUNTER_RESET_NONE,
- (CSS_CURSOR_INHERIT << 3) |
- (CSS_WRITING_MODE_INHERIT << 1),
- 0,
- 0,
- (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_RULE_WIDTH_MEDIUM << 1),
- (CSS_COLUMN_SPAN_NONE << 6) | CSS_COLUMN_WIDTH_AUTO,
- (CSS_BREAK_BEFORE_AUTO << 4) | CSS_BREAK_AFTER_AUTO,
- (CSS_BREAK_INSIDE_AUTO)
- },
- .border_spacing = { 0, 0 },
- .clip = { 0, 0, 0, 0 },
- .letter_spacing = 0,
- .outline_color = 0x0,
- .outline_width = 0,
- .word_spacing = 0,
- .column_count = 0,
- .column_gap = 0,
- .column_rule_color = 0,
- .column_rule_width = 0,
- .column_width = 0
- },
- .counter_increment = NULL,
- .counter_reset = NULL,
- .content = NULL,
- .cursor = NULL,
- .next = NULL,
- .count = 0,
- .bin = UINT32_MAX
-};
-
-#define ENSURE_UNCOMMON do { \
- if (style->i.uncommon == NULL) { \
- style->i.uncommon = malloc( \
- sizeof(css_computed_uncommon)); \
- if (style->i.uncommon == NULL) \
- return CSS_NOMEM; \
- \
- memcpy(style->i.uncommon, &default_uncommon, \
- sizeof(css_computed_uncommon)); \
- } \
-} while(0)
-
-static const css_computed_page default_page = {
- {
- (CSS_PAGE_BREAK_INSIDE_AUTO << 6) |
- (CSS_PAGE_BREAK_BEFORE_AUTO << 3) |
- CSS_PAGE_BREAK_AFTER_AUTO,
- (CSS_WIDOWS_SET << 1) |
- CSS_ORPHANS_SET
- },
- 2 << CSS_RADIX_POINT,
- 2 << CSS_RADIX_POINT
-};
-
-#define ENSURE_PAGE do { \
- if (style->page == NULL) { \
- style->page = malloc(sizeof(css_computed_page)); \
- if (style->page == NULL) \
- return CSS_NOMEM; \
- \
- memcpy(style->page, &default_page, \
- sizeof(css_computed_page)); \
- } \
-} while(0)
-
-#define LETTER_SPACING_INDEX 0
-#define LETTER_SPACING_SHIFT 2
-#define LETTER_SPACING_MASK 0xfc
-static inline css_error set_letter_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[LETTER_SPACING_INDEX];
-
- /* 6bits: uuuutt : unit | type */
- *bits = (*bits & ~LETTER_SPACING_MASK) |
- (((type & 0x3) | unit << 2) << LETTER_SPACING_SHIFT);
-
- style->i.uncommon->i.letter_spacing = length;
-
- return CSS_OK;
-}
-#undef LETTER_SPACING_MASK
-#undef LETTER_SPACING_SHIFT
-#undef LETTER_SPACING_INDEX
-
-#define OUTLINE_COLOR_INDEX 0
-#define OUTLINE_COLOR_SHIFT 0
-#define OUTLINE_COLOR_MASK 0x3
-static inline css_error set_outline_color(
- css_computed_style *style, uint8_t type, css_color color)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~OUTLINE_COLOR_MASK) |
- ((type & 0x3) << OUTLINE_COLOR_SHIFT);
-
- style->i.uncommon->i.outline_color = color;
-
- return CSS_OK;
-}
-#undef OUTLINE_COLOR_MASK
-#undef OUTLINE_COLOR_SHIFT
-#undef OUTLINE_COLOR_INDEX
-
-#define OUTLINE_WIDTH_INDEX 1
-#define OUTLINE_WIDTH_SHIFT 1
-#define OUTLINE_WIDTH_MASK 0xfe
-static inline css_error set_outline_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : unit | type */
- *bits = (*bits & ~OUTLINE_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << OUTLINE_WIDTH_SHIFT);
-
- style->i.uncommon->i.outline_width = length;
-
- return CSS_OK;
-}
-#undef OUTLINE_WIDTH_MASK
-#undef OUTLINE_WIDTH_SHIFT
-#undef OUTLINE_WIDTH_INDEX
-
-#define BORDER_SPACING_INDEX 1
-#define BORDER_SPACING_SHIFT 0
-#define BORDER_SPACING_MASK 0x1
-#define BORDER_SPACING_INDEX1 2
-#define BORDER_SPACING_SHIFT1 0
-static inline css_error set_border_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed hlength, css_unit hunit,
- css_fixed vlength, css_unit vunit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX];
-
- /* 1 bit: type */
- *bits = (*bits & ~BORDER_SPACING_MASK) |
- ((type & 0x1) << BORDER_SPACING_SHIFT);
-
- bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX1];
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *bits = (((hunit << 4) | vunit) << BORDER_SPACING_SHIFT1);
-
-
- style->i.uncommon->i.border_spacing[0] = hlength;
- style->i.uncommon->i.border_spacing[1] = vlength;
-
- return CSS_OK;
-}
-#undef BORDER_SPACING_SHIFT1
-#undef BORDER_SPACING_INDEX1
-#undef BORDER_SPACING_MASK
-#undef BORDER_SPACING_SHIFT
-#undef BORDER_SPACING_INDEX
-
-#define BREAK_AFTER_INDEX 12
-#define BREAK_AFTER_SHIFT 0
-#define BREAK_AFTER_MASK 0xf
-static inline css_error set_break_after(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_AFTER_MASK) |
- ((type & 0xf) << BREAK_AFTER_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_AFTER_MASK
-#undef BREAK_AFTER_SHIFT
-#undef BREAK_AFTER_INDEX
-
-#define BREAK_BEFORE_INDEX 12
-#define BREAK_BEFORE_SHIFT 4
-#define BREAK_BEFORE_MASK (0xf << 4)
-static inline css_error set_break_before(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_BEFORE_MASK) |
- ((type & 0xf) << BREAK_BEFORE_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_BEFORE_MASK
-#undef BREAK_BEFORE_SHIFT
-#undef BREAK_BEFORE_INDEX
-
-#define BREAK_INSIDE_INDEX 13
-#define BREAK_INSIDE_SHIFT 4
-#define BREAK_INSIDE_MASK (0xf << 4)
-static inline css_error set_break_inside(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BREAK_INSIDE_MASK) |
- ((type & 0xf) << BREAK_INSIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef BREAK_INSIDE_MASK
-#undef BREAK_INSIDE_SHIFT
-#undef BREAK_INSIDE_INDEX
-
-#define WORD_SPACING_INDEX 3
-#define WORD_SPACING_SHIFT 2
-#define WORD_SPACING_MASK 0xfc
-static inline css_error set_word_spacing(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[WORD_SPACING_INDEX];
-
- /* 6bits: uuuutt : unit | type */
- *bits = (*bits & ~WORD_SPACING_MASK) |
- (((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT);
-
- style->i.uncommon->i.word_spacing = length;
-
- return CSS_OK;
-}
-#undef WORD_SPACING_MASK
-#undef WORD_SPACING_SHIFT
-#undef WORD_SPACING_INDEX
-
-#define WRITING_MODE_INDEX 4
-#define WRITING_MODE_SHIFT 1
-#define WRITING_MODE_MASK 0x6
-static inline css_error set_writing_mode(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[WRITING_MODE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~WRITING_MODE_MASK) |
- ((type & 0x3) << WRITING_MODE_SHIFT);
-
- return CSS_OK;
-}
-#undef WRITING_MODE_MASK
-#undef WRITING_MODE_SHIFT
-#undef WRITING_MODE_INDEX
-
-#define COUNTER_INCREMENT_INDEX 3
-#define COUNTER_INCREMENT_SHIFT 1
-#define COUNTER_INCREMENT_MASK 0x2
-static inline css_error set_counter_increment(
- css_computed_style *style, uint8_t type,
- css_computed_counter *counters)
-{
- uint8_t *bits;
- css_computed_counter *oldcounters;
- css_computed_counter *c;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX];
- oldcounters = style->i.uncommon->counter_increment;
-
- /* 1bit: type */
- *bits = (*bits & ~COUNTER_INCREMENT_MASK) |
- ((type & 0x1) << COUNTER_INCREMENT_SHIFT);
-
- for (c = counters; c != NULL && c->name != NULL; c++)
- c->name = lwc_string_ref(c->name);
-
- style->i.uncommon->counter_increment = counters;
-
- /* Free existing array */
- if (oldcounters != NULL) {
- for (c = oldcounters; c->name != NULL; c++)
- lwc_string_unref(c->name);
-
- if (oldcounters != counters)
- free(oldcounters);
- }
-
- return CSS_OK;
-}
-#undef COUNTER_INCREMENT_MASK
-#undef COUNTER_INCREMENT_SHIFT
-#undef COUNTER_INCREMENT_INDEX
-
-#define COUNTER_RESET_INDEX 3
-#define COUNTER_RESET_SHIFT 0
-#define COUNTER_RESET_MASK 0x1
-static inline css_error set_counter_reset(
- css_computed_style *style, uint8_t type,
- css_computed_counter *counters)
-{
- uint8_t *bits;
- css_computed_counter *oldcounters;
- css_computed_counter *c;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX];
- oldcounters = style->i.uncommon->counter_reset;
-
- /* 1bit: type */
- *bits = (*bits & ~COUNTER_RESET_MASK) |
- ((type & 0x1) << COUNTER_RESET_SHIFT);
-
- for (c = counters; c != NULL && c->name != NULL; c++)
- c->name = lwc_string_ref(c->name);
-
- style->i.uncommon->counter_reset = counters;
-
- /* Free existing array */
- if (oldcounters != NULL) {
- for (c = oldcounters; c->name != NULL; c++)
- lwc_string_unref(c->name);
-
- if (oldcounters != counters)
- free(oldcounters);
- }
-
- return CSS_OK;
-}
-#undef COUNTER_RESET_MASK
-#undef COUNTER_RESET_SHIFT
-#undef COUNTER_RESET_INDEX
-
-#define CURSOR_INDEX 4
-#define CURSOR_SHIFT 3
-#define CURSOR_MASK 0xf8
-static inline css_error set_cursor(
- css_computed_style *style, uint8_t type,
- lwc_string **urls)
-{
- uint8_t *bits;
- lwc_string **oldurls;
- lwc_string **s;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[CURSOR_INDEX];
- oldurls = style->i.uncommon->cursor;
-
- /* 5bits: type */
- *bits = (*bits & ~CURSOR_MASK) |
- ((type & 0x1f) << CURSOR_SHIFT);
-
- for (s = urls; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->i.uncommon->cursor = urls;
-
- /* Free existing array */
- if (oldurls != NULL) {
- for (s = oldurls; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldurls != urls)
- free(oldurls);
- }
-
- return CSS_OK;
-}
-#undef CURSOR_MASK
-#undef CURSOR_SHIFT
-#undef CURSOR_INDEX
-
-#define CLIP_INDEX 7
-#define CLIP_SHIFT 2
-#define CLIP_MASK 0xfc
-#define CLIP_INDEX1 5
-#define CLIP_SHIFT1 0
-#define CLIP_INDEX2 6
-#define CLIP_SHIFT2 0
-static inline css_error set_clip(
- css_computed_style *style, uint8_t type,
- css_computed_clip_rect *rect)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX];
-
- /* 6bits: trblyy : top | right | bottom | left | type */
- *bits = (*bits & ~CLIP_MASK) |
- ((type & 0x3) << CLIP_SHIFT);
-
- if (type == CSS_CLIP_RECT) {
- *bits |= (((rect->top_auto ? 0x20 : 0) |
- (rect->right_auto ? 0x10 : 0) |
- (rect->bottom_auto ? 0x8 : 0) |
- (rect->left_auto ? 0x4 : 0)) << CLIP_SHIFT);
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX1];
-
- /* 8bits: ttttrrrr : top | right */
- *bits = (((rect->tunit << 4) | rect->runit) << CLIP_SHIFT1);
-
- bits = &style->i.uncommon->i.bits[CLIP_INDEX2];
-
- /* 8bits: bbbbllll : bottom | left */
- *bits = (((rect->bunit << 4) | rect->lunit) << CLIP_SHIFT2);
-
- style->i.uncommon->i.clip[0] = rect->top;
- style->i.uncommon->i.clip[1] = rect->right;
- style->i.uncommon->i.clip[2] = rect->bottom;
- style->i.uncommon->i.clip[3] = rect->left;
- }
-
- return CSS_OK;
-}
-#undef CLIP_SHIFT2
-#undef CLIP_INDEX2
-#undef CLIP_SHIFT1
-#undef CLIP_INDEX1
-#undef CLIP_MASK
-#undef CLIP_SHIFT
-#undef CLIP_INDEX
-
-#define COLUMN_COUNT_INDEX 8
-#define COLUMN_COUNT_SHIFT 6
-#define COLUMN_COUNT_MASK 0xc0
-static inline css_error set_column_count(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_COUNT_MASK) |
- ((type & 0x3) << COLUMN_COUNT_SHIFT);
-
- style->i.uncommon->i.column_count = count;
-
- return CSS_OK;
-}
-#undef COLUMN_COUNT_MASK
-#undef COLUMN_COUNT_SHIFT
-#undef COLUMN_COUNT_INDEX
-
-#define COLUMN_FILL_INDEX 8
-#define COLUMN_FILL_SHIFT 4
-#define COLUMN_FILL_MASK 0x30
-static inline css_error set_column_fill(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_FILL_MASK) |
- ((type & 0x3) << COLUMN_FILL_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_FILL_MASK
-#undef COLUMN_FILL_SHIFT
-#undef COLUMN_FILL_INDEX
-
-#define COLUMN_GAP_INDEX 9
-#define COLUMN_GAP_SHIFT 2
-#define COLUMN_GAP_MASK 0xfc
-static inline css_error set_column_gap(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_GAP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~COLUMN_GAP_MASK) |
- (((type & 0x3) | (unit << 2)) << COLUMN_GAP_SHIFT);
-
- style->i.uncommon->i.column_gap = length;
-
- return CSS_OK;
-}
-#undef COLUMN_GAP_MASK
-#undef COLUMN_GAP_SHIFT
-#undef COLUMN_GAP_INDEX
-
-#define COLUMN_RULE_COLOR_INDEX 9
-#define COLUMN_RULE_COLOR_SHIFT 0
-#define COLUMN_RULE_COLOR_MASK 0x3
-static inline css_error set_column_rule_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) |
- ((type & 0x3) << COLUMN_RULE_COLOR_SHIFT);
-
- style->i.uncommon->i.column_rule_color = color;
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_COLOR_MASK
-#undef COLUMN_RULE_COLOR_SHIFT
-#undef COLUMN_RULE_COLOR_INDEX
-
-#define COLUMN_RULE_STYLE_INDEX 8
-#define COLUMN_RULE_STYLE_SHIFT 0
-#define COLUMN_RULE_STYLE_MASK 0xf
-static inline css_error set_column_rule_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) |
- ((type & 0xf) << COLUMN_RULE_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_STYLE_MASK
-#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->i.uncommon->i.bits[COLUMN_RULE_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT);
-
- style->i.uncommon->i.column_rule_width = length;
-
- return CSS_OK;
-}
-#undef COLUMN_RULE_WIDTH_MASK
-#undef COLUMN_RULE_WIDTH_SHIFT
-#undef COLUMN_RULE_WIDTH_INDEX
-
-#define COLUMN_SPAN_INDEX 11
-#define COLUMN_SPAN_SHIFT 6
-#define COLUMN_SPAN_MASK 0xc0
-static inline css_error set_column_span(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX];
-
- /* 2bits: tt : type */
- *bits = (*bits & ~COLUMN_SPAN_MASK) |
- ((type & 0x3) << COLUMN_SPAN_SHIFT);
-
- return CSS_OK;
-}
-#undef COLUMN_SPAN_MASK
-#undef COLUMN_SPAN_SHIFT
-#undef COLUMN_SPAN_INDEX
-
-#define COLUMN_WIDTH_INDEX 11
-#define COLUMN_WIDTH_SHIFT 0
-#define COLUMN_WIDTH_MASK 0x3f
-static inline css_error set_column_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits;
-
- ENSURE_UNCOMMON;
-
- bits = &style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~COLUMN_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << COLUMN_WIDTH_SHIFT);
-
- style->i.uncommon->i.column_width = length;
-
- return CSS_OK;
-}
-#undef COLUMN_WIDTH_MASK
-#undef COLUMN_WIDTH_SHIFT
-#undef COLUMN_WIDTH_INDEX
-
-#define CONTENT_INDEX 7
-#define CONTENT_SHIFT 0
-#define CONTENT_MASK 0x3
-static inline css_error set_content(
- css_computed_style *style, uint8_t type,
- css_computed_content_item *content)
-{
- uint8_t *bits;
- css_computed_content_item *oldcontent;
- css_computed_content_item *c;
-
- ENSURE_UNCOMMON;
-
- /* 2bits: type */
- bits = &style->i.uncommon->i.bits[CONTENT_INDEX];
- oldcontent = style->i.uncommon->content;
-
- *bits = (*bits & ~CONTENT_MASK) |
- ((type & 0x3) << CONTENT_SHIFT);
-
- for (c = content; c != NULL &&
- c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
- switch (c->type) {
- case CSS_COMPUTED_CONTENT_STRING:
- c->data.string = lwc_string_ref(c->data.string);
- break;
- case CSS_COMPUTED_CONTENT_URI:
- c->data.uri = lwc_string_ref(c->data.uri);
- break;
- case CSS_COMPUTED_CONTENT_ATTR:
- c->data.attr = lwc_string_ref(c->data.attr);
- break;
- case CSS_COMPUTED_CONTENT_COUNTER:
- c->data.counter.name =
- lwc_string_ref(c->data.counter.name);
- break;
- case CSS_COMPUTED_CONTENT_COUNTERS:
- c->data.counters.name =
- lwc_string_ref(c->data.counters.name);
- c->data.counters.sep =
- lwc_string_ref(c->data.counters.sep);
- break;
- default:
- break;
- }
- }
-
- style->i.uncommon->content = content;
-
- /* Free existing array */
- if (oldcontent != NULL) {
- for (c = oldcontent;
- c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
- switch (c->type) {
- case CSS_COMPUTED_CONTENT_STRING:
- lwc_string_unref(c->data.string);
- break;
- case CSS_COMPUTED_CONTENT_URI:
- lwc_string_unref(c->data.uri);
- break;
- case CSS_COMPUTED_CONTENT_ATTR:
- lwc_string_unref(c->data.attr);
- break;
- case CSS_COMPUTED_CONTENT_COUNTER:
- lwc_string_unref(c->data.counter.name);
- break;
- case CSS_COMPUTED_CONTENT_COUNTERS:
- lwc_string_unref(c->data.counters.name);
- lwc_string_unref(c->data.counters.sep);
- break;
- default:
- break;
- }
- }
-
- if (oldcontent != content)
- free(oldcontent);
- }
-
- return CSS_OK;
-}
-#undef CONTENT_MASK
-#undef CONTENT_SHIFT
-#undef CONTENT_INDEX
-
-
-#define VERTICAL_ALIGN_INDEX 0
-#define VERTICAL_ALIGN_SHIFT 0
-static inline css_error set_vertical_align(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
-
- /* 8bits: uuuutttt : units | type */
- *bits = (((type & 0xf) | (unit << 4)) << VERTICAL_ALIGN_SHIFT);
-
- style->i.vertical_align = length;
-
- return CSS_OK;
-}
-#undef VERTICAL_ALIGN_SHIFT
-#undef VERTICAL_ALIGN_INDEX
-
-#define FONT_SIZE_INDEX 1
-#define FONT_SIZE_SHIFT 0
-static inline css_error set_font_size(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[FONT_SIZE_INDEX];
-
- /* 8bits: uuuutttt : units | type */
- *bits = (((type & 0xf) | (unit << 4)) << FONT_SIZE_SHIFT);
-
- style->i.font_size = length;
-
- return CSS_OK;
-}
-#undef FONT_SIZE_SHIFT
-#undef FONT_SIZE_INDEX
-
-#define BORDER_TOP_WIDTH_INDEX 2
-#define BORDER_TOP_WIDTH_SHIFT 1
-#define BORDER_TOP_WIDTH_MASK 0xfe
-static inline css_error set_border_top_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_TOP_WIDTH_SHIFT);
-
- style->i.border_width[0] = length;
-
- return CSS_OK;
-}
-#undef BORDER_TOP_WIDTH_MASK
-#undef BORDER_TOP_WIDTH_SHIFT
-#undef BORDER_TOP_WIDTH_INDEX
-
-#define BORDER_RIGHT_WIDTH_INDEX 3
-#define BORDER_RIGHT_WIDTH_SHIFT 1
-#define BORDER_RIGHT_WIDTH_MASK 0xfe
-static inline css_error set_border_right_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_RIGHT_WIDTH_SHIFT);
-
- style->i.border_width[1] = length;
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_WIDTH_MASK
-#undef BORDER_RIGHT_WIDTH_SHIFT
-#undef BORDER_RIGHT_WIDTH_INDEX
-
-#define BORDER_BOTTOM_WIDTH_INDEX 4
-#define BORDER_BOTTOM_WIDTH_SHIFT 1
-#define BORDER_BOTTOM_WIDTH_MASK 0xfe
-static inline css_error set_border_bottom_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_BOTTOM_WIDTH_SHIFT);
-
- style->i.border_width[2] = length;
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_WIDTH_MASK
-#undef BORDER_BOTTOM_WIDTH_SHIFT
-#undef BORDER_BOTTOM_WIDTH_INDEX
-
-#define BORDER_LEFT_WIDTH_INDEX 5
-#define BORDER_LEFT_WIDTH_SHIFT 1
-#define BORDER_LEFT_WIDTH_MASK 0xfe
-static inline css_error set_border_left_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
-
- /* 7bits: uuuuttt : units | type */
- *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) |
- (((type & 0x7) | (unit << 3)) << BORDER_LEFT_WIDTH_SHIFT);
-
- style->i.border_width[3] = length;
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_WIDTH_MASK
-#undef BORDER_LEFT_WIDTH_SHIFT
-#undef BORDER_LEFT_WIDTH_INDEX
-
-#define BACKGROUND_IMAGE_INDEX 2
-#define BACKGROUND_IMAGE_SHIFT 0
-#define BACKGROUND_IMAGE_MASK 0x1
-static inline css_error set_background_image(
- css_computed_style *style, uint8_t type,
- lwc_string *url)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
- lwc_string *oldurl = style->i.background_image;
-
- /* 1bit: type */
- *bits = (*bits & ~BACKGROUND_IMAGE_MASK) |
- ((type & 0x1) << BACKGROUND_IMAGE_SHIFT);
-
- if (url != NULL) {
- style->i.background_image = lwc_string_ref(url);
- } else {
- style->i.background_image = NULL;
- }
-
- if (oldurl != NULL)
- lwc_string_unref(oldurl);
-
- return CSS_OK;
-}
-#undef BACKGROUND_IMAGE_MASK
-#undef BACKGROUND_IMAGE_SHIFT
-#undef BACKGROUND_IMAGE_INDEX
-
-#define COLOR_INDEX 3
-#define COLOR_SHIFT 0
-#define COLOR_MASK 0x1
-static inline css_error set_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[COLOR_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~COLOR_MASK) |
- ((type & 0x1) << COLOR_SHIFT);
-
- style->i.color = color;
-
- return CSS_OK;
-}
-#undef COLOR_MASK
-#undef COLOR_SHIFT
-#undef COLOR_INDEX
-
-#define LIST_STYLE_IMAGE_INDEX 4
-#define LIST_STYLE_IMAGE_SHIFT 0
-#define LIST_STYLE_IMAGE_MASK 0x1
-static inline css_error set_list_style_image(
- css_computed_style *style, uint8_t type,
- lwc_string *url)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
- lwc_string *oldurl = style->i.list_style_image;
-
- /* 1bit: type */
- *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) |
- ((type & 0x1) << LIST_STYLE_IMAGE_SHIFT);
-
- if (url != NULL) {
- style->i.list_style_image = lwc_string_ref(url);
- } else {
- style->i.list_style_image = NULL;
- }
-
- if (oldurl != NULL)
- lwc_string_unref(oldurl);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_IMAGE_MASK
-#undef LIST_STYLE_IMAGE_SHIFT
-#undef LIST_STYLE_IMAGE_INDEX
-
-#define QUOTES_INDEX 5
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
-static inline css_error set_quotes(
- css_computed_style *style, uint8_t type,
- lwc_string **quotes)
-{
- uint8_t *bits = &style->i.bits[QUOTES_INDEX];
- lwc_string **oldquotes = style->quotes;
- lwc_string **s;
-
- /* 1bit: type */
- *bits = (*bits & ~QUOTES_MASK) |
- ((type & 0x1) << QUOTES_SHIFT);
-
- for (s = quotes; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->quotes = quotes;
-
- /* Free current quotes */
- if (oldquotes != NULL) {
- for (s = oldquotes; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldquotes != quotes)
- free(oldquotes);
- }
-
- return CSS_OK;
-}
-#undef QUOTES_MASK
-#undef QUOTES_SHIFT
-#undef QUOTES_INDEX
-
-#define TOP_INDEX 6
-#define TOP_SHIFT 2
-#define TOP_MASK 0xfc
-static inline css_error set_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[TOP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~TOP_MASK) |
- (((type & 0x3) | (unit << 2)) << TOP_SHIFT);
-
- style->i.top = length;
-
- return CSS_OK;
-}
-#undef TOP_MASK
-#undef TOP_SHIFT
-#undef TOP_INDEX
-
-#define RIGHT_INDEX 7
-#define RIGHT_SHIFT 2
-#define RIGHT_MASK 0xfc
-static inline css_error set_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[RIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~RIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << RIGHT_SHIFT);
-
- style->i.right = length;
-
- return CSS_OK;
-}
-#undef RIGHT_MASK
-#undef RIGHT_SHIFT
-#undef RIGHT_INDEX
-
-#define BOTTOM_INDEX 8
-#define BOTTOM_SHIFT 2
-#define BOTTOM_MASK 0xfc
-static inline css_error set_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[BOTTOM_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~BOTTOM_MASK) |
- (((type & 0x3) | (unit << 2)) << BOTTOM_SHIFT);
-
- style->i.bottom = length;
-
- return CSS_OK;
-}
-#undef BOTTOM_MASK
-#undef BOTTOM_SHIFT
-#undef BOTTOM_INDEX
-
-#define LEFT_INDEX 9
-#define LEFT_SHIFT 2
-#define LEFT_MASK 0xfc
-static inline css_error set_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[LEFT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~LEFT_MASK) |
- (((type & 0x3) | (unit << 2)) << LEFT_SHIFT);
-
- style->i.left = length;
-
- return CSS_OK;
-}
-#undef LEFT_MASK
-#undef LEFT_SHIFT
-#undef LEFT_INDEX
-
-#define BORDER_TOP_COLOR_INDEX 6
-#define BORDER_TOP_COLOR_SHIFT 0
-#define BORDER_TOP_COLOR_MASK 0x3
-static inline css_error set_border_top_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_TOP_COLOR_MASK) |
- ((type & 0x3) << BORDER_TOP_COLOR_SHIFT);
-
- style->i.border_color[0] = color;
-
- return CSS_OK;
-}
-#undef BORDER_TOP_COLOR_MASK
-#undef BORDER_TOP_COLOR_SHIFT
-#undef BORDER_TOP_COLOR_INDEX
-
-#define BORDER_RIGHT_COLOR_INDEX 7
-#define BORDER_RIGHT_COLOR_SHIFT 0
-#define BORDER_RIGHT_COLOR_MASK 0x3
-static inline css_error set_border_right_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) |
- ((type & 0x3) << BORDER_RIGHT_COLOR_SHIFT);
-
- style->i.border_color[1] = color;
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_COLOR_MASK
-#undef BORDER_RIGHT_COLOR_SHIFT
-#undef BORDER_RIGHT_COLOR_INDEX
-
-#define BORDER_BOTTOM_COLOR_INDEX 8
-#define BORDER_BOTTOM_COLOR_SHIFT 0
-#define BORDER_BOTTOM_COLOR_MASK 0x3
-static inline css_error set_border_bottom_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) |
- ((type & 0x3) << BORDER_BOTTOM_COLOR_SHIFT);
-
- style->i.border_color[2] = color;
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_COLOR_MASK
-#undef BORDER_BOTTOM_COLOR_SHIFT
-#undef BORDER_BOTTOM_COLOR_INDEX
-
-#define BORDER_LEFT_COLOR_INDEX 9
-#define BORDER_LEFT_COLOR_SHIFT 0
-#define BORDER_LEFT_COLOR_MASK 0x3
-static inline css_error set_border_left_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) |
- ((type & 0x3) << BORDER_LEFT_COLOR_SHIFT);
-
- style->i.border_color[3] = color;
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_COLOR_MASK
-#undef BORDER_LEFT_COLOR_SHIFT
-#undef BORDER_LEFT_COLOR_INDEX
-
-#define HEIGHT_INDEX 10
-#define HEIGHT_SHIFT 2
-#define HEIGHT_MASK 0xfc
-static inline css_error set_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << HEIGHT_SHIFT);
-
- style->i.height = length;
-
- return CSS_OK;
-}
-#undef HEIGHT_MASK
-#undef HEIGHT_SHIFT
-#undef HEIGHT_INDEX
-
-#define LINE_HEIGHT_INDEX 11
-#define LINE_HEIGHT_SHIFT 2
-#define LINE_HEIGHT_MASK 0xfc
-static inline css_error set_line_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[LINE_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~LINE_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << LINE_HEIGHT_SHIFT);
-
- style->i.line_height = length;
-
- return CSS_OK;
-}
-#undef LINE_HEIGHT_MASK
-#undef LINE_HEIGHT_SHIFT
-#undef LINE_HEIGHT_INDEX
-
-#define BACKGROUND_COLOR_INDEX 10
-#define BACKGROUND_COLOR_SHIFT 0
-#define BACKGROUND_COLOR_MASK 0x3
-static inline css_error set_background_color(
- css_computed_style *style, uint8_t type,
- css_color color)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BACKGROUND_COLOR_MASK) |
- ((type & 0x3) << BACKGROUND_COLOR_SHIFT);
-
- style->i.background_color = color;
-
- return CSS_OK;
-}
-#undef BACKGROUND_COLOR_MASK
-#undef BACKGROUND_COLOR_SHIFT
-#undef BACKGROUND_COLOR_INDEX
-
-#define Z_INDEX_INDEX 11
-#define Z_INDEX_SHIFT 0
-#define Z_INDEX_MASK 0x3
-static inline css_error set_z_index(
- css_computed_style *style, uint8_t type,
- int32_t z_index)
-{
- uint8_t *bits = &style->i.bits[Z_INDEX_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~Z_INDEX_MASK) |
- ((type & 0x3) << Z_INDEX_SHIFT);
-
- style->i.z_index = z_index;
-
- return CSS_OK;
-}
-#undef Z_INDEX_MASK
-#undef Z_INDEX_SHIFT
-#undef Z_INDEX_INDEX
-
-#define MARGIN_TOP_INDEX 12
-#define MARGIN_TOP_SHIFT 2
-#define MARGIN_TOP_MASK 0xfc
-static inline css_error set_margin_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_TOP_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_TOP_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_TOP_SHIFT);
-
- style->i.margin[0] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_TOP_MASK
-#undef MARGIN_TOP_SHIFT
-#undef MARGIN_TOP_INDEX
-
-#define MARGIN_RIGHT_INDEX 13
-#define MARGIN_RIGHT_SHIFT 2
-#define MARGIN_RIGHT_MASK 0xfc
-static inline css_error set_margin_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_RIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_RIGHT_SHIFT);
-
- style->i.margin[1] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_RIGHT_MASK
-#undef MARGIN_RIGHT_SHIFT
-#undef MARGIN_RIGHT_INDEX
-
-#define MARGIN_BOTTOM_INDEX 14
-#define MARGIN_BOTTOM_SHIFT 2
-#define MARGIN_BOTTOM_MASK 0xfc
-static inline css_error set_margin_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_BOTTOM_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_BOTTOM_SHIFT);
-
- style->i.margin[2] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_BOTTOM_MASK
-#undef MARGIN_BOTTOM_SHIFT
-#undef MARGIN_BOTTOM_INDEX
-
-#define MARGIN_LEFT_INDEX 15
-#define MARGIN_LEFT_SHIFT 2
-#define MARGIN_LEFT_MASK 0xfc
-static inline css_error set_margin_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MARGIN_LEFT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MARGIN_LEFT_MASK) |
- (((type & 0x3) | (unit << 2)) << MARGIN_LEFT_SHIFT);
-
- style->i.margin[3] = length;
-
- return CSS_OK;
-}
-#undef MARGIN_LEFT_MASK
-#undef MARGIN_LEFT_SHIFT
-#undef MARGIN_LEFT_INDEX
-
-#define BACKGROUND_ATTACHMENT_INDEX 12
-#define BACKGROUND_ATTACHMENT_SHIFT 0
-#define BACKGROUND_ATTACHMENT_MASK 0x3
-static inline css_error set_background_attachment(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) |
- ((type & 0x3) << BACKGROUND_ATTACHMENT_SHIFT);
-
- return CSS_OK;
-}
-#undef BACKGROUND_ATTACHMENT_MASK
-#undef BACKGROUND_ATTACHMENT_SHIFT
-#undef BACKGROUND_ATTACHMENT_INDEX
-
-#define BOX_SIZING_INDEX 23
-#define BOX_SIZING_SHIFT 0
-#define BOX_SIZING_MASK 0x3
-static inline css_error set_box_sizing(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BOX_SIZING_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BOX_SIZING_MASK) |
- ((type & 0x3) << BOX_SIZING_SHIFT);
-
- return CSS_OK;
-}
-#undef BOX_SIZING_MASK
-#undef BOX_SIZING_SHIFT
-#undef BOX_SIZING_INDEX
-
-#define BORDER_COLLAPSE_INDEX 13
-#define BORDER_COLLAPSE_SHIFT 0
-#define BORDER_COLLAPSE_MASK 0x3
-static inline css_error set_border_collapse(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~BORDER_COLLAPSE_MASK) |
- ((type & 0x3) << BORDER_COLLAPSE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_COLLAPSE_MASK
-#undef BORDER_COLLAPSE_SHIFT
-#undef BORDER_COLLAPSE_INDEX
-
-#define CAPTION_SIDE_INDEX 14
-#define CAPTION_SIDE_SHIFT 0
-#define CAPTION_SIDE_MASK 0x3
-static inline css_error set_caption_side(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[CAPTION_SIDE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~CAPTION_SIDE_MASK) |
- ((type & 0x3) << CAPTION_SIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef CAPTION_SIDE_MASK
-#undef CAPTION_SIDE_SHIFT
-#undef CAPTION_SIDE_INDEX
-
-#define DIRECTION_INDEX 15
-#define DIRECTION_SHIFT 0
-#define DIRECTION_MASK 0x3
-static inline css_error set_direction(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[DIRECTION_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~DIRECTION_MASK) |
- ((type & 0x3) << DIRECTION_SHIFT);
-
- return CSS_OK;
-}
-#undef DIRECTION_MASK
-#undef DIRECTION_SHIFT
-#undef DIRECTION_INDEX
-
-#define MAX_HEIGHT_INDEX 16
-#define MAX_HEIGHT_SHIFT 2
-#define MAX_HEIGHT_MASK 0xfc
-static inline css_error set_max_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MAX_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MAX_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MAX_HEIGHT_SHIFT);
-
- style->i.max_height = length;
-
- return CSS_OK;
-}
-#undef MAX_HEIGHT_MASK
-#undef MAX_HEIGHT_SHIFT
-#undef MAX_HEIGHT_INDEX
-
-#define MAX_WIDTH_INDEX 17
-#define MAX_WIDTH_SHIFT 2
-#define MAX_WIDTH_MASK 0xfc
-static inline css_error set_max_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MAX_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MAX_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << MAX_WIDTH_SHIFT);
-
- style->i.max_width = length;
-
- return CSS_OK;
-}
-#undef MAX_WIDTH_MASK
-#undef MAX_WIDTH_SHIFT
-#undef MAX_WIDTH_INDEX
-
-#define WIDTH_INDEX 18
-#define WIDTH_SHIFT 2
-#define WIDTH_MASK 0xfc
-static inline css_error set_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << WIDTH_SHIFT);
-
- style->i.width = length;
-
- return CSS_OK;
-}
-#undef WIDTH_MASK
-#undef WIDTH_SHIFT
-#undef WIDTH_INDEX
-
-#define EMPTY_CELLS_INDEX 16
-#define EMPTY_CELLS_SHIFT 0
-#define EMPTY_CELLS_MASK 0x3
-static inline css_error set_empty_cells(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[EMPTY_CELLS_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~EMPTY_CELLS_MASK) |
- ((type & 0x3) << EMPTY_CELLS_SHIFT);
-
- return CSS_OK;
-}
-#undef EMPTY_CELLS_MASK
-#undef EMPTY_CELLS_SHIFT
-#undef EMPTY_CELLS_INDEX
-
-#define FLOAT_INDEX 17
-#define FLOAT_SHIFT 0
-#define FLOAT_MASK 0x3
-static inline css_error set_float(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLOAT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FLOAT_MASK) |
- ((type & 0x3) << FLOAT_SHIFT);
-
- return CSS_OK;
-}
-#undef FLOAT_MASK
-#undef FLOAT_SHIFT
-#undef FLOAT_INDEX
-
-#define FONT_STYLE_INDEX 18
-#define FONT_STYLE_SHIFT 0
-#define FONT_STYLE_MASK 0x3
-static inline css_error set_font_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_STYLE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FONT_STYLE_MASK) |
- ((type & 0x3) << FONT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_STYLE_MASK
-#undef FONT_STYLE_SHIFT
-#undef FONT_STYLE_INDEX
-
-#define MIN_HEIGHT_INDEX 19
-#define MIN_HEIGHT_SHIFT 2
-#define MIN_HEIGHT_MASK 0xfc
-static inline css_error set_min_height(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MIN_HEIGHT_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MIN_HEIGHT_MASK) |
- (((type & 0x3) | (unit << 2)) << MIN_HEIGHT_SHIFT);
-
- style->i.min_height = length;
-
- return CSS_OK;
-}
-#undef MIN_HEIGHT_MASK
-#undef MIN_HEIGHT_SHIFT
-#undef MIN_HEIGHT_INDEX
-
-#define MIN_WIDTH_INDEX 20
-#define MIN_WIDTH_SHIFT 2
-#define MIN_WIDTH_MASK 0xfc
-static inline css_error set_min_width(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[MIN_WIDTH_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~MIN_WIDTH_MASK) |
- (((type & 0x3) | (unit << 2)) << MIN_WIDTH_SHIFT);
-
- style->i.min_width = length;
-
- return CSS_OK;
-}
-#undef MIN_WIDTH_MASK
-#undef MIN_WIDTH_SHIFT
-#undef MIN_WIDTH_INDEX
-
-#define BACKGROUND_REPEAT_INDEX 34
-#define BACKGROUND_REPEAT_SHIFT 2
-#define BACKGROUND_REPEAT_MASK 0x1c
-static inline css_error set_background_repeat(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~BACKGROUND_REPEAT_MASK) |
- ((type & 0x7) << BACKGROUND_REPEAT_SHIFT);
-
- return CSS_OK;
-}
-#undef BACKGROUND_REPEAT_MASK
-#undef BACKGROUND_REPEAT_SHIFT
-#undef BACKGROUND_REPEAT_INDEX
-
-#define CLEAR_INDEX 36
-#define CLEAR_SHIFT 2
-#define CLEAR_MASK 0x1c
-static inline css_error set_clear(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[CLEAR_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~CLEAR_MASK) |
- ((type & 0x7) << CLEAR_SHIFT);
-
- return CSS_OK;
-}
-#undef CLEAR_MASK
-#undef CLEAR_SHIFT
-#undef CLEAR_INDEX
-
-#define PADDING_TOP_INDEX 21
-#define PADDING_TOP_SHIFT 3
-#define PADDING_TOP_MASK 0xf8
-static inline css_error set_padding_top(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_TOP_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_TOP_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_TOP_SHIFT);
-
- style->i.padding[0] = length;
-
- return CSS_OK;
-}
-#undef PADDING_TOP_MASK
-#undef PADDING_TOP_SHIFT
-#undef PADDING_TOP_INDEX
-
-#define PADDING_RIGHT_INDEX 22
-#define PADDING_RIGHT_SHIFT 3
-#define PADDING_RIGHT_MASK 0xf8
-static inline css_error set_padding_right(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_RIGHT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_RIGHT_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_RIGHT_SHIFT);
-
- style->i.padding[1] = length;
-
- return CSS_OK;
-}
-#undef PADDING_RIGHT_MASK
-#undef PADDING_RIGHT_SHIFT
-#undef PADDING_RIGHT_INDEX
-
-#define PADDING_BOTTOM_INDEX 23
-#define PADDING_BOTTOM_SHIFT 3
-#define PADDING_BOTTOM_MASK 0xf8
-static inline css_error set_padding_bottom(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_BOTTOM_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_BOTTOM_SHIFT);
-
- style->i.padding[2] = length;
-
- return CSS_OK;
-}
-#undef PADDING_BOTTOM_MASK
-#undef PADDING_BOTTOM_SHIFT
-#undef PADDING_BOTTOM_INDEX
-
-#define PADDING_LEFT_INDEX 24
-#define PADDING_LEFT_SHIFT 3
-#define PADDING_LEFT_MASK 0xf8
-static inline css_error set_padding_left(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[PADDING_LEFT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~PADDING_LEFT_MASK) |
- (((type & 0x1) | (unit << 1)) << PADDING_LEFT_SHIFT);
-
- style->i.padding[3] = length;
-
- return CSS_OK;
-}
-#undef PADDING_LEFT_MASK
-#undef PADDING_LEFT_SHIFT
-#undef PADDING_LEFT_INDEX
-
-#define OVERFLOW_X_INDEX 21
-#define OVERFLOW_X_SHIFT 0
-#define OVERFLOW_X_MASK 0x7
-static inline css_error set_overflow_x(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OVERFLOW_X_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~OVERFLOW_X_MASK) |
- ((type & 0x7) << OVERFLOW_X_SHIFT);
-
- return CSS_OK;
-}
-#undef OVERFLOW_X_MASK
-#undef OVERFLOW_X_SHIFT
-#undef OVERFLOW_X_INDEX
-
-#define OVERFLOW_Y_INDEX 34
-#define OVERFLOW_Y_SHIFT 5
-#define OVERFLOW_Y_MASK 0xe0
-static inline css_error set_overflow_y(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OVERFLOW_Y_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~OVERFLOW_Y_MASK) |
- ((type & 0x7) << OVERFLOW_Y_SHIFT);
-
- return CSS_OK;
-}
-#undef OVERFLOW_Y_MASK
-#undef OVERFLOW_Y_SHIFT
-#undef OVERFLOW_Y_INDEX
-
-#define POSITION_INDEX 22
-#define POSITION_SHIFT 0
-#define POSITION_MASK 0x7
-static inline css_error set_position(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[POSITION_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~POSITION_MASK) |
- ((type & 0x7) << POSITION_SHIFT);
-
- return CSS_OK;
-}
-#undef POSITION_MASK
-#undef POSITION_SHIFT
-#undef POSITION_INDEX
-
-#define OPACITY_INDEX 23
-#define OPACITY_SHIFT 2
-#define OPACITY_MASK 0x04
-static inline css_error set_opacity(
- css_computed_style *style,
- uint8_t type, css_fixed opacity)
-{
- uint8_t *bits = &style->i.bits[OPACITY_INDEX];
-
- /* 1bit: t : type */
- *bits = (*bits & ~OPACITY_MASK) |
- ((type & 0x1) << OPACITY_SHIFT);
-
- style->i.opacity = opacity;
-
- return CSS_OK;
-}
-#undef OPACITY_MASK
-#undef OPACITY_SHIFT
-#undef OPACITY_INDEX
-
-#define TEXT_TRANSFORM_INDEX 24
-#define TEXT_TRANSFORM_SHIFT 0
-#define TEXT_TRANSFORM_MASK 0x7
-static inline css_error set_text_transform(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~TEXT_TRANSFORM_MASK) |
- ((type & 0x7) << TEXT_TRANSFORM_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_TRANSFORM_MASK
-#undef TEXT_TRANSFORM_SHIFT
-#undef TEXT_TRANSFORM_INDEX
-
-#define TEXT_INDENT_INDEX 25
-#define TEXT_INDENT_SHIFT 3
-#define TEXT_INDENT_MASK 0xf8
-static inline css_error set_text_indent(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[TEXT_INDENT_INDEX];
-
- /* 5bits: uuuut : units | type */
- *bits = (*bits & ~TEXT_INDENT_MASK) |
- (((type & 0x1) | (unit << 1)) << TEXT_INDENT_SHIFT);
-
- style->i.text_indent = length;
-
- return CSS_OK;
-}
-#undef TEXT_INDENT_MASK
-#undef TEXT_INDENT_SHIFT
-#undef TEXT_INDENT_INDEX
-
-#define WHITE_SPACE_INDEX 25
-#define WHITE_SPACE_SHIFT 0
-#define WHITE_SPACE_MASK 0x7
-static inline css_error set_white_space(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[WHITE_SPACE_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~WHITE_SPACE_MASK) |
- ((type & 0x7) << WHITE_SPACE_SHIFT);
-
- return CSS_OK;
-}
-#undef WHITE_SPACE_MASK
-#undef WHITE_SPACE_SHIFT
-#undef WHITE_SPACE_INDEX
-
-#define BACKGROUND_POSITION_INDEX 27
-#define BACKGROUND_POSITION_SHIFT 7
-#define BACKGROUND_POSITION_MASK 0x80
-#define BACKGROUND_POSITION_INDEX1 26
-#define BACKGROUND_POSITION_SHIFT1 0
-static inline css_error set_background_position(
- css_computed_style *style, uint8_t type,
- css_fixed hlength, css_unit hunit,
- css_fixed vlength, css_unit vunit)
-{
- uint8_t *bits;
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
-
- /* 1 bit: type */
- *bits = (*bits & ~BACKGROUND_POSITION_MASK) |
- ((type & 0x1) << BACKGROUND_POSITION_SHIFT);
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX1];
-
- /* 8bits: hhhhvvvv : hunit | vunit */
- *bits = (((hunit << 4) | vunit) << BACKGROUND_POSITION_SHIFT1);
-
- style->i.background_position[0] = hlength;
- style->i.background_position[1] = vlength;
-
- return CSS_OK;
-}
-#undef BACKGROUND_POSITION_SHIFT1
-#undef BACKGROUND_POSITION_INDEX1
-#undef BACKGROUND_POSITION_MASK
-#undef BACKGROUND_POSITION_SHIFT
-#undef BACKGROUND_POSITION_INDEX
-
-#define DISPLAY_INDEX 27
-#define DISPLAY_SHIFT 2
-#define DISPLAY_MASK 0x7c
-static inline css_error set_display(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[DISPLAY_INDEX];
-
- /* 5bits: type */
- *bits = (*bits & ~DISPLAY_MASK) |
- ((type & 0x1f) << DISPLAY_SHIFT);
-
- return CSS_OK;
-}
-#undef DISPLAY_MASK
-#undef DISPLAY_SHIFT
-#undef DISPLAY_INDEX
-
-#define FONT_VARIANT_INDEX 27
-#define FONT_VARIANT_SHIFT 0
-#define FONT_VARIANT_MASK 0x3
-static inline css_error set_font_variant(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_VARIANT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FONT_VARIANT_MASK) |
- ((type & 0x3) << FONT_VARIANT_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_VARIANT_MASK
-#undef FONT_VARIANT_SHIFT
-#undef FONT_VARIANT_INDEX
-
-#define TEXT_DECORATION_INDEX 28
-#define TEXT_DECORATION_SHIFT 3
-#define TEXT_DECORATION_MASK 0xf8
-static inline css_error set_text_decoration(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_DECORATION_INDEX];
-
- /* 5bits: type */
- *bits = (*bits & ~TEXT_DECORATION_MASK) |
- ((type & 0x1f) << TEXT_DECORATION_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_DECORATION_MASK
-#undef TEXT_DECORATION_SHIFT
-#undef TEXT_DECORATION_INDEX
-
-#define FONT_FAMILY_INDEX 28
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
-static inline css_error set_font_family(
- css_computed_style *style, uint8_t type,
- lwc_string **names)
-{
- uint8_t *bits = &style->i.bits[FONT_FAMILY_INDEX];
- lwc_string **oldnames = style->font_family;
- lwc_string **s;
-
- /* 3bits: type */
- *bits = (*bits & ~FONT_FAMILY_MASK) |
- ((type & 0x7) << FONT_FAMILY_SHIFT);
-
- for (s = names; s != NULL && *s != NULL; s++)
- *s = lwc_string_ref(*s);
-
- style->font_family = names;
-
- /* Free existing families */
- if (oldnames != NULL) {
- for (s = oldnames; *s != NULL; s++)
- lwc_string_unref(*s);
-
- if (oldnames != names)
- free(oldnames);
- }
-
- return CSS_OK;
-}
-#undef FONT_FAMILY_MASK
-#undef FONT_FAMILY_SHIFT
-#undef FONT_FAMILY_INDEX
-
-#define BORDER_TOP_STYLE_INDEX 29
-#define BORDER_TOP_STYLE_SHIFT 4
-#define BORDER_TOP_STYLE_MASK 0xf0
-static inline css_error set_border_top_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_TOP_STYLE_MASK) |
- ((type & 0xf) << BORDER_TOP_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_TOP_STYLE_MASK
-#undef BORDER_TOP_STYLE_SHIFT
-#undef BORDER_TOP_STYLE_INDEX
-
-#define BORDER_RIGHT_STYLE_INDEX 29
-#define BORDER_RIGHT_STYLE_SHIFT 0
-#define BORDER_RIGHT_STYLE_MASK 0xf
-static inline css_error set_border_right_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) |
- ((type & 0xf) << BORDER_RIGHT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_RIGHT_STYLE_MASK
-#undef BORDER_RIGHT_STYLE_SHIFT
-#undef BORDER_RIGHT_STYLE_INDEX
-
-#define BORDER_BOTTOM_STYLE_INDEX 30
-#define BORDER_BOTTOM_STYLE_SHIFT 4
-#define BORDER_BOTTOM_STYLE_MASK 0xf0
-static inline css_error set_border_bottom_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) |
- ((type & 0xf) << BORDER_BOTTOM_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_BOTTOM_STYLE_MASK
-#undef BORDER_BOTTOM_STYLE_SHIFT
-#undef BORDER_BOTTOM_STYLE_INDEX
-
-#define BORDER_LEFT_STYLE_INDEX 30
-#define BORDER_LEFT_STYLE_SHIFT 0
-#define BORDER_LEFT_STYLE_MASK 0xf
-static inline css_error set_border_left_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) |
- ((type & 0xf) << BORDER_LEFT_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef BORDER_LEFT_STYLE_MASK
-#undef BORDER_LEFT_STYLE_SHIFT
-#undef BORDER_LEFT_STYLE_INDEX
-
-#define FONT_WEIGHT_INDEX 31
-#define FONT_WEIGHT_SHIFT 4
-#define FONT_WEIGHT_MASK 0xf0
-static inline css_error set_font_weight(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FONT_WEIGHT_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~FONT_WEIGHT_MASK) |
- ((type & 0xf) << FONT_WEIGHT_SHIFT);
-
- return CSS_OK;
-}
-#undef FONT_WEIGHT_MASK
-#undef FONT_WEIGHT_SHIFT
-#undef FONT_WEIGHT_INDEX
-
-#define LIST_STYLE_TYPE_INDEX 31
-#define LIST_STYLE_TYPE_SHIFT 0
-#define LIST_STYLE_TYPE_MASK 0xf
-static inline css_error set_list_style_type(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~LIST_STYLE_TYPE_MASK) |
- ((type & 0xf) << LIST_STYLE_TYPE_SHIFT);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_TYPE_MASK
-#undef LIST_STYLE_TYPE_SHIFT
-#undef LIST_STYLE_TYPE_INDEX
-
-#define OUTLINE_STYLE_INDEX 32
-#define OUTLINE_STYLE_SHIFT 4
-#define OUTLINE_STYLE_MASK 0xf0
-static inline css_error set_outline_style(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~OUTLINE_STYLE_MASK) |
- ((type & 0xf) << OUTLINE_STYLE_SHIFT);
-
- return CSS_OK;
-}
-#undef OUTLINE_STYLE_MASK
-#undef OUTLINE_STYLE_SHIFT
-#undef OUTLINE_STYLE_INDEX
-
-#define TABLE_LAYOUT_INDEX 32
-#define TABLE_LAYOUT_SHIFT 2
-#define TABLE_LAYOUT_MASK 0xc
-static inline css_error set_table_layout(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~TABLE_LAYOUT_MASK) |
- ((type & 0x3) << TABLE_LAYOUT_SHIFT);
-
- return CSS_OK;
-}
-#undef TABLE_LAYOUT_MASK
-#undef TABLE_LAYOUT_SHIFT
-#undef TABLE_LAYOUT_INDEX
-
-#define UNICODE_BIDI_INDEX 32
-#define UNICODE_BIDI_SHIFT 0
-#define UNICODE_BIDI_MASK 0x3
-static inline css_error set_unicode_bidi(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[UNICODE_BIDI_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~UNICODE_BIDI_MASK) |
- ((type & 0x3) << UNICODE_BIDI_SHIFT);
-
- return CSS_OK;
-}
-#undef UNICODE_BIDI_MASK
-#undef UNICODE_BIDI_SHIFT
-#undef UNICODE_BIDI_INDEX
-
-#define VISIBILITY_INDEX 33
-#define VISIBILITY_SHIFT 6
-#define VISIBILITY_MASK 0xc0
-static inline css_error set_visibility(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[VISIBILITY_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~VISIBILITY_MASK) |
- ((type & 0x3) << VISIBILITY_SHIFT);
-
- return CSS_OK;
-}
-#undef VISIBILITY_MASK
-#undef VISIBILITY_SHIFT
-#undef VISIBILITY_INDEX
-
-#define LIST_STYLE_POSITION_INDEX 33
-#define LIST_STYLE_POSITION_SHIFT 4
-#define LIST_STYLE_POSITION_MASK 0x30
-static inline css_error set_list_style_position(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~LIST_STYLE_POSITION_MASK) |
- ((type & 0x3) << LIST_STYLE_POSITION_SHIFT);
-
- return CSS_OK;
-}
-#undef LIST_STYLE_POSITION_MASK
-#undef LIST_STYLE_POSITION_SHIFT
-#undef LIST_STYLE_POSITION_INDEX
-
-#define TEXT_ALIGN_INDEX 33
-#define TEXT_ALIGN_SHIFT 0
-#define TEXT_ALIGN_MASK 0xf
-static inline uint8_t set_text_align(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[TEXT_ALIGN_INDEX];
-
- /* 4bits: type */
- *bits = (*bits & ~TEXT_ALIGN_MASK) |
- ((type & 0xf) << TEXT_ALIGN_SHIFT);
-
- return CSS_OK;
-}
-#undef TEXT_ALIGN_MASK
-#undef TEXT_ALIGN_SHIFT
-#undef TEXT_ALIGN_INDEX
-
-#define PAGE_BREAK_AFTER_INDEX 0
-#define PAGE_BREAK_AFTER_SHIFT 0
-#define PAGE_BREAK_AFTER_MASK 0x7
-static inline css_error set_page_break_after(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_AFTER_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) |
- ((type & 0x7) << PAGE_BREAK_AFTER_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_AFTER_INDEX
-#undef PAGE_BREAK_AFTER_SHIFT
-#undef PAGE_BREAK_AFTER_MASK
-
-#define PAGE_BREAK_BEFORE_INDEX 0
-#define PAGE_BREAK_BEFORE_SHIFT 3
-#define PAGE_BREAK_BEFORE_MASK 0x38
-static inline css_error set_page_break_before(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_BEFORE_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) |
- ((type & 0x7) << PAGE_BREAK_BEFORE_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_BEFORE_INDEX
-#undef PAGE_BREAK_BEFORE_SHIFT
-#undef PAGE_BREAK_BEFORE_MASK
-
-#define PAGE_BREAK_INSIDE_INDEX 0
-#define PAGE_BREAK_INSIDE_SHIFT 6
-#define PAGE_BREAK_INSIDE_MASK 0xc0
-static inline css_error set_page_break_inside(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_PAGE_BREAK_INSIDE_AUTO) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) |
- ((type & 0x3) << PAGE_BREAK_INSIDE_SHIFT);
-
- return CSS_OK;
-}
-#undef PAGE_BREAK_INSIDE_INDEX
-#undef PAGE_BREAK_INSIDE_SHIFT
-#undef PAGE_BREAK_INSIDE_MASK
-
-#define ORPHANS_INDEX 1
-#define ORPHANS_SHIFT 0
-#define ORPHANS_MASK 0x1
-static inline css_error set_orphans(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_ORPHANS_SET && count == 2) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[ORPHANS_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT);
-
- style->page->orphans = count;
-
- return CSS_OK;
-}
-#undef ORPHANS_INDEX
-#undef ORPHANS_SHIFT
-#undef ORPHANS_MASK
-
-#define WIDOWS_INDEX 1
-#define WIDOWS_SHIFT 1
-#define WIDOWS_MASK 0x2
-static inline css_error set_widows(
- css_computed_style *style, uint8_t type, int32_t count)
-{
- uint8_t *bits;
-
- if (style->page == NULL) {
- if (type == CSS_WIDOWS_SET && count == 2) {
- return CSS_OK;
- }
- }
-
- ENSURE_PAGE;
-
- bits = &style->page->bits[WIDOWS_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT);
-
- style->page->widows = count;
-
- return CSS_OK;
-}
-#undef WIDOWS_INDEX
-#undef WIDOWS_SHIFT
-#undef WIDOWS_MASK
-
-#define ALIGN_CONTENT_INDEX_A 34
-#define ALIGN_CONTENT_SHIFT_A 0
-#define ALIGN_CONTENT_MASK_A 0x3
-#define ALIGN_CONTENT_INDEX_B 35
-#define ALIGN_CONTENT_SHIFT_B 1
-#define ALIGN_CONTENT_MASK_B 0x2
-static inline css_error set_align_content(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits_a = &style->i.bits[ALIGN_CONTENT_INDEX_A];
- uint8_t *bits_b = &style->i.bits[ALIGN_CONTENT_INDEX_B];
-
- /* type is 3bits: assigning the least significant two */
- *bits_a = (*bits_a & ~ALIGN_CONTENT_MASK_A) |
- ((type & 0x3) << ALIGN_CONTENT_SHIFT_A);
-
- /* type is 3bits: assigning the most significant one */
- *bits_b = (*bits_b & ~ALIGN_CONTENT_MASK_B) |
- (((type & 0x4) >> 2) << ALIGN_CONTENT_SHIFT_B);
-
- return CSS_OK;
-}
-#undef ALIGN_CONTENT_MASK_A
-#undef ALIGN_CONTENT_SHIFT_A
-#undef ALIGN_CONTENT_INDEX_A
-#undef ALIGN_CONTENT_MASK_B
-#undef ALIGN_CONTENT_SHIFT_B
-#undef ALIGN_CONTENT_INDEX_B
-
-#define FLEX_WRAP_INDEX 19
-#define FLEX_WRAP_SHIFT 0
-#define FLEX_WRAP_MASK 0x3
-static inline css_error set_flex_wrap(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLEX_WRAP_INDEX];
-
- /* 2bits: type */
- *bits = (*bits & ~FLEX_WRAP_MASK) |
- ((type & 0x3) << FLEX_WRAP_SHIFT);
-
- return CSS_OK;
-}
-#undef FLEX_WRAP_MASK
-#undef FLEX_WRAP_SHIFT
-#undef FLEX_WRAP_INDEX
-
-#define FLEX_BASIS_INDEX 35
-#define FLEX_BASIS_SHIFT 2
-#define FLEX_BASIS_MASK 0xfc
-static inline css_error set_flex_basis(
- css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
-{
- uint8_t *bits = &style->i.bits[FLEX_BASIS_INDEX];
-
- /* 6bits: uuuutt : units | type */
- *bits = (*bits & ~FLEX_BASIS_MASK) |
- (((type & 0x3) | (unit << 2)) << FLEX_BASIS_SHIFT);
-
- style->i.flex_basis = length;
-
- return CSS_OK;
-}
-
-#undef FLEX_BASIS_MASK
-#undef FLEX_BASIS_SHIFT
-#undef FLEX_BASIS_INDEX
-
-#define FLEX_SHRINK_INDEX 20
-#define FLEX_SHRINK_SHIFT 1
-#define FLEX_SHRINK_MASK 0x2
-static inline css_error set_flex_shrink(
- css_computed_style *style, uint8_t type,
- css_fixed number)
-{
- uint8_t *bits = &style->i.bits[FLEX_SHRINK_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~FLEX_SHRINK_MASK) |
- ((type & 0x1) << FLEX_SHRINK_SHIFT);
-
- style->i.flex_shrink = number;
-
- return CSS_OK;
-}
-
-#undef FLEX_SHRINK_MASK
-#undef FLEX_SHRINK_SHIFT
-#undef FLEX_SHRINK_INDEX
-
-#define FLEX_GROW_INDEX 20
-#define FLEX_GROW_SHIFT 0
-#define FLEX_GROW_MASK 0x1
-static inline css_error set_flex_grow(
- css_computed_style *style, uint8_t type,
- css_fixed number)
-{
- uint8_t *bits = &style->i.bits[FLEX_GROW_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~FLEX_GROW_MASK) |
- ((type & 0x1) << FLEX_GROW_SHIFT);
-
- style->i.flex_grow = number;
-
- return CSS_OK;
-}
-
-#undef FLEX_GROW_MASK
-#undef FLEX_GROW_SHIFT
-#undef FLEX_GROW_INDEX
-
-#define FLEX_DIRECTION_INDEX 36
-#define FLEX_DIRECTION_SHIFT 5
-#define FLEX_DIRECTION_MASK 0xe0
-static inline css_error set_flex_direction(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~FLEX_DIRECTION_MASK) |
- ((type & 0x7) << FLEX_DIRECTION_SHIFT);
-
- return CSS_OK;
-}
-#undef FLEX_DIRECTION_MASK
-#undef FLEX_DIRECTION_SHIFT
-#undef FLEX_DIRECTION_INDEX
-
-#define JUSTIFY_CONTENT_INDEX_A 35
-#define JUSTIFY_CONTENT_SHIFT_A 0
-#define JUSTIFY_CONTENT_MASK_A 0x1
-#define JUSTIFY_CONTENT_INDEX_B 36
-#define JUSTIFY_CONTENT_SHIFT_B 0
-#define JUSTIFY_CONTENT_MASK_B 0x3
-static inline css_error set_justify_content(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits_a = &style->i.bits[JUSTIFY_CONTENT_INDEX_A];
- uint8_t *bits_b = &style->i.bits[JUSTIFY_CONTENT_INDEX_B];
-
- /* type is 3bits: assigning the least significant one */
- *bits_a = (*bits_a & ~JUSTIFY_CONTENT_MASK_A) |
- ((type & 0x1) << JUSTIFY_CONTENT_SHIFT_A);
-
- /* type is 3bits: assigning the most significant two */
- *bits_b = (*bits_b & ~JUSTIFY_CONTENT_MASK_B) |
- (((type & 0x6) >> 1) << JUSTIFY_CONTENT_SHIFT_B);
-
- return CSS_OK;
-}
-#undef JUSTIFY_CONTENT_MASK_A
-#undef JUSTIFY_CONTENT_SHIFT_A
-#undef JUSTIFY_CONTENT_INDEX_A
-#undef JUSTIFY_CONTENT_MASK_B
-#undef JUSTIFY_CONTENT_SHIFT_B
-#undef JUSTIFY_CONTENT_INDEX_B
-
-#define ORDER_INDEX 37
-#define ORDER_SHIFT 1
-#define ORDER_MASK 0x2
-static inline css_error set_order(
- css_computed_style *style, uint8_t type,
- int32_t number)
-{
- uint8_t *bits = &style->i.bits[ORDER_INDEX];
-
- /* 1bit: type */
- *bits = (*bits & ~ORDER_MASK) |
- ((type & 0x1) << ORDER_SHIFT);
-
- style->i.order = number;
-
- return CSS_OK;
-}
-
-#undef ORDER_MASK
-#undef ORDER_SHIFT
-#undef ORDER_INDEX
-
-#define ALIGN_ITEMS_INDEX 37
-#define ALIGN_ITEMS_SHIFT 5
-#define ALIGN_ITEMS_MASK 0xe0
-static inline css_error set_align_items(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~ALIGN_ITEMS_MASK) |
- ((type & 0x7) << ALIGN_ITEMS_SHIFT);
-
- return CSS_OK;
-}
-#undef ALIGN_ITEMS_MASK
-#undef ALIGN_ITEMS_SHIFT
-#undef ALIGN_ITEMS_INDEX
-
-#define ALIGN_SELF_INDEX 37
-#define ALIGN_SELF_SHIFT 2
-#define ALIGN_SELF_MASK 0x1c
-static inline css_error set_align_self(
- css_computed_style *style, uint8_t type)
-{
- uint8_t *bits = &style->i.bits[ALIGN_SELF_INDEX];
-
- /* 3bits: type */
- *bits = (*bits & ~ALIGN_SELF_MASK) |
- ((type & 0x7) << ALIGN_SELF_SHIFT);
-
- return CSS_OK;
-}
-#undef ALIGN_SELF_MASK
-#undef ALIGN_SELF_SHIFT
-#undef ALIGN_SELF_INDEX
-
-#endif
diff --git a/src/select/select_config.py b/src/select/select_config.py
index 86d815d..468e8dc 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -3,7 +3,10 @@
#
http://www.opensource.org/licenses/mit-license.php
# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
-# Configuration of CSS values
+# Configuration of CSS values.
+# The tuples in this set will be unpacked as arguments to the CSSValue
+# class.
+# Args: see docstring for class CSSValue in select_generator.py.
values = {
('length', 'css_fixed', 4, '0',
'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
@@ -16,7 +19,10 @@ values = {
('content_item', 'css_computed_content_item*')
}
-# Configuration of properties
+# Configuration of property groups.
+# The tuples in these sets will be unpacked as arguments to the
+# CSSproperty class.
+# Args: see docstring for class CSSProperty in select_generator.py.
style = {
# Style group, only opcode
('align_content', 3),
@@ -68,17 +74,17 @@ style = {
('border_right_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
('border_bottom_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
('border_left_width', 3, 'length',
'CSS_BORDER_WIDTH_WIDTH'),
- ('top', 2, 'length', 'CSS_TOP_SET', None, None,
('get',)),
- ('right', 2, 'length', 'CSS_RIGHT_SET', None, None,
('get',)),
- ('bottom', 2, 'length', 'CSS_BOTTOM_SET', None, None,
('get',)),
- ('left', 2, 'length', 'CSS_LEFT_SET', None, None,
('get',)),
+ ('top', 2, 'length', 'CSS_TOP_SET', None, None,
'get'),
+ ('right', 2, 'length', 'CSS_RIGHT_SET', None, None,
'get'),
+ ('bottom', 2, 'length', 'CSS_BOTTOM_SET', None, None,
'get'),
+ ('left', 2, 'length', 'CSS_LEFT_SET', None, None,
'get'),
('color', 1, 'color'),
('flex_basis', 2, 'length', 'CSS_FLEX_BASIS_SET'),
('flex_grow', 1, 'fixed', 'CSS_FLEX_GROW_SET'),
('flex_shrink', 1, 'fixed', 'CSS_FLEX_SHRINK_SET'),
('font_size', 4, 'length', 'CSS_FONT_SIZE_DIMENSION'),
('height', 2, 'length', 'CSS_HEIGHT_SET'),
- ('line_height', 2, 'length', None, None, None, ('get',)),
+ ('line_height', 2, 'length', None, None, None, 'get'),
('list_style_image', 1, 'string'),
('margin_top', 2, 'length', 'CSS_MARGIN_SET'),
('margin_right', 2, 'length', 'CSS_MARGIN_SET'),
@@ -112,9 +118,9 @@ page = {
('page_break_after', 3, None, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
('page_break_before', 3, None, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
('page_break_inside', 2, None, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
- ('widows', 1, (('integer', '2 << CSS_RADIX_POINT'),),
None,
+ ('widows', 1, (('integer', '2'),), None,
'CSS_WIDOWS_SET'),
- ('orphans', 1, (('integer', '2 << CSS_RADIX_POINT'),),
None,
+ ('orphans', 1, (('integer', '2'),), None,
'CSS_ORPHANS_SET')
}
@@ -160,7 +166,7 @@ uncommon = {
'with a blank entry'),
('content', 2, 'content_item', 'CSS_CONTENT_NORMAL',
'CSS_CONTENT_NORMAL',
'Encode content as an array of content items, terminated with '
- 'a blank entry.')
+ 'a blank entry.', 'set')
}
groups = [
diff --git a/src/select/select_config.pyc b/src/select/select_config.pyc
new file mode 100644
index 0000000..fabcdce
Binary files /dev/null and b/src/select/select_config.pyc differ
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 75d2e3b..d215f2b 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -5,12 +5,13 @@
import math
import string
+import os
from select_config import values, groups
from assets import assets
from overrides import overrides
def get_tuple(from_var):
- 'Accepts tuples, strings and None; returns a tuple.'
+ """Convert tuples, strings and None into tuple."""
if type(from_var) is tuple:
return from_var
elif type(from_var) is str:
@@ -22,14 +23,18 @@ def get_tuple(from_var):
'received: ' + type(from_var).__name__)
def shift_star(value_type, prop_name):
- '''Shifts the asterisks from a pointer type to its name.
- i.e. `lwc_string** str_array` would become `lwc_string **str_array`'''
+ """Shift the asterisks from a pointer type to its name.
+
+ Example: `lwc_string** str_array` would become
+ `lwc_string **str_array`
+ """
star_i = value_type.find('*')
v_type = value_type if star_i is -1 else value_type[:star_i]
v_name = prop_name if star_i is -1 else value_type[star_i:] + prop_name
return (v_type, v_name)
class Text:
+ """Class for building strings for output files."""
def __init__(self):
self._lines = []
self._comment = False
@@ -39,22 +44,37 @@ class Text:
name_width = 31
bits_width = 16
- def indent(self, value, absolute=False):
- if absolute:
- self._indent = value
- else:
- self._indent += value
+ def indent(self, value):
+ """Increase or decrease indent by <value>.
+
+ Args:
+ value <int>: positive or negative value to be added to
+ indentation.
+ """
+ self._indent += value
def comment(self):
+ """Toggle C-style comment in the output text."""
comm = self._comment
self._comment = False
self.append(' */' if comm else '/*')
self._comment = not comm
def escape_newline(self):
+ """Toggle escape of newline character."""
self._esc_nl = not self._esc_nl
def append(self, text=None, pre_formatted=False):
+ """Append text to file builder.
+
+ Args:
+ text:
+ <str> add contents, breaking lines and adding comment
+ markers or newline escapes as needed.
+ <list> recursively call this method for list items.
+ <falsey value> add a new line.
+ pre_formatted: just add text without preprocessing.
+ """
if not text:
self._lines.append('{}{}{}'.format(
'\t' * self._indent,
@@ -105,23 +125,40 @@ class Text:
self.indent(-2)
def table_line(self):
+ """Add a sum line for the tables in computed.h"""
self.append('{0:{n}}{0:{b}}{0}'.format(
'---', n=self.name_width, b=self.bits_width))
def table_header(self):
+ """Add a header line for the tables in
computed.h"""
self.append('{:{n}}{:{b}}{}'.format(
'Property', 'Size (bits)', 'Size (bytes)',
n=self.name_width, b=self.bits_width))
self.table_line()
def result_line(self):
+ """Add a result line for the tables in
computed.h"""
self.append(' ' * self.name_width + '=' * (self.bits_width + 3))
def to_string(self):
+ """Output contents of file builder as a string."""
return '\n'.join(self._lines)
class CSSValue:
- 'Values to be associated with properties.'
+ """Values to be associated with properties.
+
+ Args:
+ name <str>: value name (required).
+ css_type <str>: C type of value (required).
+ size <int>: value size, in bytes (default: None, for pointers).
+ defaults <str>: default value (default: 'NULL', for pointers).
+ The fields below are only needed if the value stores data in the
+ array of bits (currently only css_unit uses it).
+ bits_name <str>: name of bits value (default: None).
+ bits_type <str>: C type of bits value (default: None).
+ bits_size <int>: value size, in bits (default: None).
+ bits_defaults <str>: default value (default: '0').
+ """
def __init__(self, name, css_type, size=None, defaults='NULL',
bits_name=None, bits_type=None,
bits_size=None, bits_defaults='0'):
@@ -139,9 +176,38 @@ class CSSValue:
@property
def is_ptr(self):
+ """Return True if value is a pointer; False
otherwise."""
return ((self.type, self.name) != shift_star(self.type, self.name))
class CSSProperty:
+ """Class for CSS properties.
+
+ Args:
+ name <str>: property name (required).
+ type_size <int>: opcode size, in bits (required).
+ values <tuple or str>: property values (default: None).
+ To set one value, using the value's defaults:
+ 'value_name'
+ To set multiple values, using the values' defaults:
+ (('value_name',), ('value_name',))
+ To override the default of one or multiple values:
+ (('value_name', 'default'),)
+ (('value_name', 'default'), ('value_name',
'default'))
+ condition <str>: condition (opcode value) to get property
+ values in propget.h (default: None).
+ defaults <str>: default opcode (default: None)
+ comments <str>: comments for properties that are stored in
+ "struct css_computed_{group}", instead of
+ "struct css_computed_{group}_i (default: None)
+ NOTE: passing this argument will result in the property being
+ stored in "struct css_computed_{group}"!
+ overrides <tuple | str>: files for which this property shouldn't
+ autogenerate content; instead, read entry from from overrides.py
+ Possible values:
+ 'get': overrides output to autogenerated_propget.h
+ 'set': overrides output to autogenerated_propset.h
+ ('get', 'set'): overrides output to both files.
+ """
def __init__(self, name, type_size, values=None, condition=None,
defaults=None, comments=None, override=None):
self.name = name
@@ -154,6 +220,7 @@ class CSSProperty:
self.__mask = None
def make_values(self, vals):
+ """Make list of values for this property."""
if vals is None:
return []
elif type(vals) is str:
@@ -179,19 +246,23 @@ class CSSProperty:
@property
def bits_size(self):
+ """Size of this property in the bits array."""
return self.type_size + sum([ v.bits['size'] for v in self.values
if v.bits is not None ])
@property
def bytes_size(self):
+ """Size of this property's values, in bytes (excluding
pointers)."""
return sum([ v.size for v in self.values if v.size is not None ])
@property
def ptr_size(self):
+ """Number of values of this property that are
pointers."""
return sum([ 1 for v in self.values if v.size is None ])
@property
def size_line(self):
+ """String for computed.h with the sizes of this
property."""
name = '{:{width}}'.format(self.name, width=Text.name_width)
type_size = '{:>3}'.format(str(self.type_size))
extra_size = sum([ v.bits['size'] for v in self.values
@@ -212,12 +283,14 @@ class CSSProperty:
@property
def mask(self):
+ """Getter for the bitwise mask of this property in the bits
array."""
if self.__mask is None:
raise NameError('Attribute `mask` not set yet!')
return '0x{:x}'.format(self.__mask).lower()
@mask.setter
def mask(self, val):
+ """Setter for the bitwise mask of this property in the bits
array."""
if type(val) is not int:
raise TypeError('Value of `mask` must be an integer!')
if val < 0:
@@ -226,6 +299,7 @@ class CSSProperty:
@property
def def_undefs(self):
+ """Return defines and undefs for propget.h and
propset.h."""
defines = [
'#define {}_INDEX {}'.format(self.name.upper(), self.index),
'#define {}_SHIFT {}'.format(self.name.upper(), self.shift),
@@ -239,6 +313,11 @@ class CSSProperty:
return (defines, undefs)
def get_param_values(self, pointer=False):
+ """Make parameters for functions in propget.h and propset.h.
+
+ Args:
+ pointer <bool>: add a star before value name.
+ """
vals = []
for v in self.values:
vt, vn = shift_star(v.type, v.name)
@@ -257,6 +336,7 @@ class CSSProperty:
return vals
def get_bits(self):
+ """Make vars for the bitwise operations in propget.h and
propset.h."""
bits = [
{ 'letter': v.suffix[1] if v.suffix else v.bits['name'][0],
'name': v.bits['name'] + v.suffix,
@@ -280,6 +360,7 @@ class CSSProperty:
return (type_mask, shift_list, comment)
class Bin:
+ """The storage unit for the bits array of
properties."""
def __init__(self, first_object):
self.contents = [ first_object ]
@@ -291,6 +372,11 @@ class Bin:
self.contents.append(obj)
class CSSGroup:
+ """Group of CSS properties (i.e. style, page, uncommon).
+
+ Args:
+ config <tuple>: imported from select_config.py.
+ """
def __init__(self, config):
self.name = config['name']
self.props = [ CSSProperty(*x) for x in config['props'] ]
@@ -298,25 +384,28 @@ class CSSGroup:
@property
def bits_size(self):
+ """Sum of all property bits in the bits array."""
return sum([ p.bits_size for p in self.props ])
@property
def bytes_size(self):
+ """Sum of all property value bytes (excluded
pointers)."""
return sum([ p.bytes_size for p in self.props ])
@property
def ptr_size(self):
+ """Sum of all property pointers."""
return sum([ p.ptr_size for p in self.props ])
@property
def bits_array(self):
- '''Implements a `best fit first` heuristics for the bin packing of
- property bits in the bits array'''
+ """Implement a `best fit first` heuristics for the bin packing
+ of property bits in the bits array."""
if self.__bits_array is not None:
return self.__bits_array
- bin_size = 32
+ bin_size = 32 # We're using uint32_t as concrete bins.
self.__bits_array = []
props = sorted(self.props, key=(lambda x: x.bits_size), reverse=True)
@@ -324,10 +413,11 @@ class CSSGroup:
for b in self.__bits_array:
if b.size + p.bits_size <= bin_size:
b.push(p)
- p.shift = 32 - sum([ x.bits_size for x in b.contents ])
+ p.shift = (bin_size -
+ sum([ x.bits_size for x in b.contents ]))
break
else:
- p.shift = 32 - p.bits_size
+ p.shift = bin_size - p.bits_size
self.__bits_array.append(Bin(p))
p.mask = (sum([ 2 ** x for x in range(p.bits_size) ]) *
@@ -341,12 +431,14 @@ class CSSGroup:
return self.__bits_array
def get_idot_grp(self):
+ """Make parameters for accessing bits and values in this
group."""
i_dot = '' if self.name is 'page' else 'i.'
grp = '' if self.name is 'style' else
'->{}{}'.format(
'' if self.name is 'page' else i_dot, self.name)
return (i_dot, grp)
def make_computed_h(self):
+ """Output this group's text for the computed.h
file."""
t = Text()
t.append()
@@ -357,11 +449,13 @@ class CSSGroup:
t.comment()
commented = []
t.table_header()
+
for prop in sorted(self.props, key=(lambda x: x.name)):
if prop.comments is None:
t.append(prop.size_line)
else:
commented.extend(( '', prop.comments, '', prop.size_line
))
+
t.append(commented)
t.append()
t.table_line()
@@ -396,10 +490,14 @@ class CSSGroup:
t.append('uint32_t bits[' + str(len(self.bits_array)) + '];')
t.append()
t.append(self.make_value_declaration(for_commented=False))
+
if self.name is 'style':
t.append()
- t.append('css_computed_uncommon *uncommon;')
+ for g in css_groups:
+ if g.name is not 'style' and g.name is not 'page':
+ t.append('css_computed_{0} *{0};'.format(g.name))
t.append('void *aural;')
+
t.indent(-1)
t.append('}}{};'.format(
' css_computed_' + self.name if typedef else ''))
@@ -414,8 +512,10 @@ class CSSGroup:
t.append()
t.append(self.make_value_declaration(for_commented=True))
t.append()
+
if self.name is 'style':
t.append('css_computed_page *page;')
+
t.append('struct css_computed_' + self.name + ' *next;')
t.append('uint32_t count;')
t.append('uint32_t bin;')
@@ -426,6 +526,11 @@ class CSSGroup:
return t.to_string()
def make_propset_h(self):
+ """Output this group's property functions for the propset.h
file.
+
+ If group is not `style`, will also output the defaults
+ and the ENSURE_{group} texts.
+ """
t = Text()
i_dot, grp = self.get_idot_grp()
@@ -433,11 +538,14 @@ class CSSGroup:
t.append('static const css_computed_{0} default_{0} = {{'.format(
self.name))
t.indent(1)
+
if self.name is not 'page':
t.append('.i = {')
t.indent(1)
+
t.append('.bits = {')
t.indent(1)
+
bits_ops = []
for b in self.bits_array:
or_ops = []
@@ -445,6 +553,7 @@ class CSSGroup:
or_ops.append('({} << {})'.format(p.defaults,
str(p.shift))
if p.shift else p.defaults)
bits_ops.append(' | '.join(or_ops))
+
t.append(',\n'.join(bits_ops).split('\n'))
t.indent(-1)
t.append('},')
@@ -487,6 +596,7 @@ class CSSGroup:
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
+ t.append()
t.append(defines)
if p.name in overrides['set']:
@@ -502,6 +612,7 @@ class CSSGroup:
p.name, params))
t.append('{')
t.indent(1)
+
t.append('uint32_t *bits;')
t.append()
@@ -598,17 +709,18 @@ class CSSGroup:
t.indent(-1)
t.append('}')
t.append(undefs)
- t.append()
return t.to_string()
def make_propget_h(self):
+ """Output this group's property functions for the propget.h
file."""
t = Text()
i_dot, grp = self.get_idot_grp()
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
+ t.append()
t.append(defines)
if p.name in overrides['get']:
@@ -675,11 +787,17 @@ class CSSGroup:
t.indent(-1)
t.append('}')
t.append(undefs)
- t.append()
return t.to_string()
def make_value_declaration(self, for_commented, defaults=False):
+ """Output declarations of values for this group's properties.
+
+ Args:
+ for_commented: only parse values that have a `comment` field
+ defaults: outputs default value assignments.
+ """
+
r = []
for p in sorted(self.props, key=(lambda x: x.name)):
if bool(p.comments) == for_commented:
@@ -693,6 +811,7 @@ class CSSGroup:
return r
def make_text(self, filename):
+ """Return this group's text for the given
file."""
if filename == 'computed.h':
return self.make_computed_h()
elif filename == 'propset.h':
@@ -703,10 +822,11 @@ class CSSGroup:
raise ValueError()
css_groups = [ CSSGroup(g) for g in groups ]
+dir_path = os.path.dirname(os.path.realpath(__file__))
for k, v in assets.items():
# Key is filename string (e.g. "computed.h") without autogenerated_ prefix
body = '\n'.join([ g.make_text(k) for g in css_groups ])
text = '\n'.join([ v['header'], body, v['footer'] ])
- with open('autogenerated_' + k, 'w') as file_k:
+ with open(os.path.join(dir_path, 'autogenerated_') + k, 'w') as
file_k:
file_k.write(text)
--
Cascading Style Sheets library