summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/select/computed.c50
-rw-r--r--src/select/properties/display.c4
-rw-r--r--src/select/propget.h40
3 files changed, 22 insertions, 72 deletions
diff --git a/src/select/computed.c b/src/select/computed.c
index 6f0d979..ba6f92f 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -861,55 +861,45 @@ uint8_t css_computed_background_position(const css_computed_style *style,
return get_background_position(style, hlength, hunit, vlength, vunit);
}
-#define CSS_DISPLAY_INDEX 27
-#define CSS_DISPLAY_SHIFT 2
-#define CSS_DISPLAY_MASK 0x7c
-uint8_t css_computed_display(
- const css_computed_style *style, bool root)
+uint8_t css_computed_display(const css_computed_style *style,
+ bool root)
{
- uint8_t position;
- uint8_t bits = style->bits[CSS_DISPLAY_INDEX];
- bits &= CSS_DISPLAY_MASK;
- bits >>= CSS_DISPLAY_SHIFT;
+ uint8_t position = css_computed_position(style);
+ uint8_t display = get_display(style);
/* Return computed display as per $9.7 */
- position = css_computed_position(style);
- /* 5bits: type */
- if (bits == CSS_DISPLAY_NONE)
- return bits; /* 1. */
+ if (display == CSS_DISPLAY_NONE)
+ return display; /* 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) {
+ if (display == 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) {
+ } else if (display == CSS_DISPLAY_INLINE ||
+ display == CSS_DISPLAY_RUN_IN ||
+ display == CSS_DISPLAY_TABLE_ROW_GROUP ||
+ display == CSS_DISPLAY_TABLE_COLUMN ||
+ display == CSS_DISPLAY_TABLE_COLUMN_GROUP ||
+ display == CSS_DISPLAY_TABLE_HEADER_GROUP ||
+ display == CSS_DISPLAY_TABLE_FOOTER_GROUP ||
+ display == CSS_DISPLAY_TABLE_ROW ||
+ display == CSS_DISPLAY_TABLE_CELL ||
+ display == CSS_DISPLAY_TABLE_CAPTION ||
+ display == CSS_DISPLAY_INLINE_BLOCK) {
return CSS_DISPLAY_BLOCK;
}
}
/* 5. */
- return bits;
+ return display;
}
-#undef CSS_DISPLAY_MASK
-#undef CSS_DISPLAY_SHIFT
-#undef CSS_DISPLAY_INDEX
uint8_t css_computed_display_static(const css_computed_style *style)
{
- return get_display_static(style);
+ return get_display(style);
}
uint8_t css_computed_font_variant(const css_computed_style *style)
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 02f5e1e..e5e7711 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -97,10 +97,10 @@ css_error css__compose_display(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- uint8_t type = get_display_static(child);
+ uint8_t type = get_display(child);
if (type == CSS_DISPLAY_INHERIT) {
- type = get_display_static(parent);
+ type = get_display(parent);
}
return set_display(result, type);
diff --git a/src/select/propget.h b/src/select/propget.h
index 0f32e8c..b2cf16b 100644
--- a/src/select/propget.h
+++ b/src/select/propget.h
@@ -1453,46 +1453,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];