summaryrefslogtreecommitdiff
path: root/include/libcss/computed.h
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-06 19:34:23 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-06 19:34:23 +0000
commit716572fc56ab2da651ce036a19b556106f8bc453 (patch)
tree513a40f26ba85ffd38fc8acfd895c663c28ae404 /include/libcss/computed.h
parent37329b9a60636a419e4b0cd3fa24c89fe0d00e3b (diff)
downloadlibcss-716572fc56ab2da651ce036a19b556106f8bc453.tar.gz
libcss-716572fc56ab2da651ce036a19b556106f8bc453.tar.bz2
More accessors
svn path=/trunk/libcss/; revision=6383
Diffstat (limited to 'include/libcss/computed.h')
-rw-r--r--include/libcss/computed.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index f89d434..b2a8c0d 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -1655,4 +1655,43 @@ static inline uint8_t css_computed_white_space(
#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 css_computed_background_position(
+ const css_computed_style *style,
+ css_fixed *hlength, css_unit *hunit,
+ css_fixed *vlength, css_unit *vunit)
+{
+ uint8_t bits = style->bits[BACKGROUND_POSITION_INDEX];
+ bits &= BACKGROUND_POSITION_MASK;
+ bits >>= BACKGROUND_POSITION_SHIFT;
+
+ /* 1bit: type */
+ if (bits == CSS_BACKGROUND_POSITION_SET) {
+ uint8_t bits1 = style->bits[BACKGROUND_POSITION_INDEX1];
+ bits1 &= BACKGROUND_POSITION_MASK1;
+ bits1 >>= BACKGROUND_POSITION_SHIFT1;
+
+ /* 8bits: hhhhvvvv : hunit | vunit */
+ *hlength = style->background_position[0];
+ *hunit = bits1 >> 4;
+
+ *vlength = style->background_position[1];
+ *hunit = 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
+
+
#endif