summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-09-10 17:49:30 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-09-10 17:49:30 +0100
commitbae45a3a08fb41d86725c51512c761a40ba305a2 (patch)
tree438d7eebe305fec141ba8f7bf57dbfe9b1cd17dd /src
parentbc9c80c2dbf21d805f5372aea3df14d310a1512c (diff)
downloadlibcss-bae45a3a08fb41d86725c51512c761a40ba305a2.tar.gz
libcss-bae45a3a08fb41d86725c51512c761a40ba305a2.tar.bz2
Add computed style accessor for writing-mode and and writing-mode to the property handler table.
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/properties.c1
-rw-r--r--src/select/computed.c21
-rw-r--r--src/select/properties/properties.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index e8ca3ce..c4e939a 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -140,6 +140,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_widows,
css__parse_width,
css__parse_word_spacing,
+ css__parse_writing_mode,
css__parse_z_index
};
diff --git a/src/select/computed.c b/src/select/computed.c
index 9f21d4a..059c76f 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -479,6 +479,27 @@ uint8_t css_computed_word_spacing(
#undef CSS_WORD_SPACING_SHIFT
#undef CSS_WORD_SPACING_INDEX
+#define CSS_WRITING_MODE_INDEX 4
+#define CSS_WRITING_MODE_SHIFT 1
+#define CSS_WRITING_MODE_MASK 0x6
+uint8_t css_computed_writing_mode(
+ const css_computed_style *style)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[CSS_WRITING_MODE_INDEX];
+ bits &= CSS_WRITING_MODE_MASK;
+ bits >>= CSS_WRITING_MODE_SHIFT;
+
+ /* 2bits: type */
+ return bits;
+ }
+
+ return CSS_WRITING_MODE_HORIZONTAL_TB;
+}
+#undef CSS_WRITING_MODE_MASK
+#undef CSS_WRITING_MODE_SHIFT
+#undef CSS_WRITING_MODE_INDEX
+
#define CSS_COUNTER_INCREMENT_INDEX 3
#define CSS_COUNTER_INCREMENT_SHIFT 1
#define CSS_COUNTER_INCREMENT_MASK 0x2
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index d0bb648..63cdb17 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -131,6 +131,7 @@ PROPERTY_FUNCS(white_space);
PROPERTY_FUNCS(widows);
PROPERTY_FUNCS(width);
PROPERTY_FUNCS(word_spacing);
+PROPERTY_FUNCS(writing_mode);
PROPERTY_FUNCS(z_index);
#undef PROPERTY_FUNCS