summaryrefslogtreecommitdiff
path: root/src/select/computed.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-01-10 15:59:06 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2014-01-10 15:59:06 +0000
commit4600e9ac013226a63e0dd68a47cde9b75cd3c452 (patch)
tree698a6850aefa9b831b2951cc6f00d6e65821e69b /src/select/computed.c
parent7a74cd0bca6c300b9cc3cd2880c8b8822307b293 (diff)
downloadlibcss-4600e9ac013226a63e0dd68a47cde9b75cd3c452.tar.gz
libcss-4600e9ac013226a63e0dd68a47cde9b75cd3c452.tar.bz2
Remove 9.7 handling from get_display. Delete get_display_static. Remove duplication in css_computed_display.
Diffstat (limited to 'src/select/computed.c')
-rw-r--r--src/select/computed.c50
1 files changed, 20 insertions, 30 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)