diff options
Diffstat (limited to 'src/select/propget.h')
-rw-r--r-- | src/select/propget.h | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/src/select/propget.h b/src/select/propget.h index 16b8fc2..7fff136 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -184,6 +184,8 @@ static inline uint8_t get_writing_mode( uint8_t bits = style->uncommon->bits[WRITING_MODE_INDEX]; bits &= WRITING_MODE_MASK; bits >>= WRITING_MODE_SHIFT; + + /* 2bits: type */ return bits; } @@ -601,6 +603,16 @@ static inline uint8_t get_top( return (bits & 0x3); } +static inline uint8_t get_top_bits( + const css_computed_style *style) +{ + uint8_t bits = style->bits[TOP_INDEX]; + bits &= TOP_MASK; + bits >>= TOP_SHIFT; + + /* 6bits: uuuutt : units | type */ + return bits; +} #undef TOP_MASK #undef TOP_SHIFT #undef TOP_INDEX @@ -624,6 +636,16 @@ static inline uint8_t get_right( return (bits & 0x3); } +static inline uint8_t get_right_bits( + const css_computed_style *style) +{ + uint8_t bits = style->bits[RIGHT_INDEX]; + bits &= RIGHT_MASK; + bits >>= RIGHT_SHIFT; + + /* 6bits: uuuutt : units | type */ + return bits; +} #undef RIGHT_MASK #undef RIGHT_SHIFT #undef RIGHT_INDEX @@ -647,6 +669,16 @@ static inline uint8_t get_bottom( return (bits & 0x3); } +static inline uint8_t get_bottom_bits( + const css_computed_style *style) +{ + uint8_t bits = style->bits[BOTTOM_INDEX]; + bits &= BOTTOM_MASK; + bits >>= BOTTOM_SHIFT; + + /* 6bits: uuuutt : units | type */ + return bits; +} #undef BOTTOM_MASK #undef BOTTOM_SHIFT #undef BOTTOM_INDEX @@ -670,6 +702,16 @@ static inline uint8_t get_left( return (bits & 0x3); } +static inline uint8_t get_left_bits( + const css_computed_style *style) +{ + uint8_t bits = style->bits[LEFT_INDEX]; + bits &= LEFT_MASK; + bits >>= LEFT_SHIFT; + + /* 6bits: uuuutt : units | type */ + return bits; +} #undef LEFT_MASK #undef LEFT_SHIFT #undef LEFT_INDEX @@ -1451,46 +1493,6 @@ static inline uint8_t get_background_position( #define DISPLAY_SHIFT 2 #define DISPLAY_MASK 0x7c static inline uint8_t get_display( - const css_computed_style *style, bool root) -{ - uint8_t position; - uint8_t bits = style->bits[DISPLAY_INDEX]; - bits &= DISPLAY_MASK; - bits >>= DISPLAY_SHIFT; - - /* Return computed display as per $9.7 */ - position = css_computed_position(style); - - /* 5bits: type */ - if (bits == CSS_DISPLAY_NONE) - return bits; /* 1. */ - - if ((position == CSS_POSITION_ABSOLUTE || - position == CSS_POSITION_FIXED) /* 2. */ || - css_computed_float(style) != CSS_FLOAT_NONE /* 3. */ || - root /* 4. */) { - if (bits == CSS_DISPLAY_INLINE_TABLE) { - return CSS_DISPLAY_TABLE; - } else if (bits == CSS_DISPLAY_INLINE || - bits == CSS_DISPLAY_RUN_IN || - bits == CSS_DISPLAY_TABLE_ROW_GROUP || - bits == CSS_DISPLAY_TABLE_COLUMN || - bits == CSS_DISPLAY_TABLE_COLUMN_GROUP || - bits == CSS_DISPLAY_TABLE_HEADER_GROUP || - bits == CSS_DISPLAY_TABLE_FOOTER_GROUP || - bits == CSS_DISPLAY_TABLE_ROW || - bits == CSS_DISPLAY_TABLE_CELL || - bits == CSS_DISPLAY_TABLE_CAPTION || - bits == CSS_DISPLAY_INLINE_BLOCK) { - return CSS_DISPLAY_BLOCK; - } - } - - /* 5. */ - return bits; -} - -static inline uint8_t get_display_static( const css_computed_style *style) { uint8_t bits = style->bits[DISPLAY_INDEX]; @@ -1500,7 +1502,6 @@ static inline uint8_t get_display_static( /* 5bits: type */ return bits; } - #undef DISPLAY_MASK #undef DISPLAY_SHIFT #undef DISPLAY_INDEX @@ -1831,20 +1832,20 @@ static inline uint8_t get_page_break_inside( #define ORPHANS_MASK 0x1 static inline uint8_t get_orphans( const css_computed_style *style, - css_fixed *count) + int32_t *orphans) { if (style->page != NULL) { uint8_t bits = style->page->bits[ORPHANS_INDEX]; bits &= ORPHANS_MASK; bits >>= ORPHANS_SHIFT; - *count = style->page->orphans; + *orphans = style->page->orphans; /* 1bit: type */ return bits; } - *count = INTTOFIX(2); + *orphans = 2; return CSS_ORPHANS_SET; } #undef ORPHANS_MASK @@ -1856,20 +1857,20 @@ static inline uint8_t get_orphans( #define WIDOWS_MASK 0x2 static inline uint8_t get_widows( const css_computed_style *style, - css_fixed *count) + int32_t *widows) { if (style->page != NULL) { uint8_t bits = style->page->bits[WIDOWS_INDEX]; bits &= WIDOWS_MASK; bits >>= WIDOWS_SHIFT; - *count = style->page->orphans; + *widows = style->page->widows; /* 1bit: type */ return bits; } - *count = INTTOFIX(2); + *widows = 2; return CSS_WIDOWS_SET; } #undef WIDOWS_MASK |