summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-08-23 07:55:37 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-08-23 07:55:37 +0000
commit4f62d5af8c93e063bf0d9a9f0eaeffb3c451f56f (patch)
tree90d9b5844ca10916142a03b333d7b9a8994318f1
parent758b01f92c0d8e1cdd966a5127e267efd0fe6391 (diff)
downloadlibcss-4f62d5af8c93e063bf0d9a9f0eaeffb3c451f56f.tar.gz
libcss-4f62d5af8c93e063bf0d9a9f0eaeffb3c451f56f.tar.bz2
Somewhat nasty text-align magic for the benefit of HTML tables.
svn path=/trunk/libcss/; revision=9405
-rw-r--r--include/libcss/properties.h17
-rw-r--r--src/select/properties.c11
2 files changed, 20 insertions, 8 deletions
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index 7ec277a..91d1dab 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -506,14 +506,15 @@ enum css_table_layout_e {
enum css_text_align_e {
CSS_TEXT_ALIGN_INHERIT = 0x0,
- CSS_TEXT_ALIGN_LEFT = 0x1,
- CSS_TEXT_ALIGN_RIGHT = 0x2,
- CSS_TEXT_ALIGN_CENTER = 0x3,
- CSS_TEXT_ALIGN_JUSTIFY = 0x4,
- CSS_TEXT_ALIGN_DEFAULT = 0x5,
- CSS_TEXT_ALIGN_LIBCSS_LEFT = 0x6,
- CSS_TEXT_ALIGN_LIBCSS_CENTER = 0x7,
- CSS_TEXT_ALIGN_LIBCSS_RIGHT = 0x8
+ CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC = 0x1,
+ CSS_TEXT_ALIGN_LEFT = 0x2,
+ CSS_TEXT_ALIGN_RIGHT = 0x3,
+ CSS_TEXT_ALIGN_CENTER = 0x4,
+ CSS_TEXT_ALIGN_JUSTIFY = 0x5,
+ CSS_TEXT_ALIGN_DEFAULT = 0x6,
+ CSS_TEXT_ALIGN_LIBCSS_LEFT = 0x7,
+ CSS_TEXT_ALIGN_LIBCSS_CENTER = 0x8,
+ CSS_TEXT_ALIGN_LIBCSS_RIGHT = 0x9
};
enum css_text_decoration_e {
diff --git a/src/select/properties.c b/src/select/properties.c
index 9ca9d9f..3974f1e 100644
--- a/src/select/properties.c
+++ b/src/select/properties.c
@@ -4678,6 +4678,17 @@ css_error compose_text_align(const css_computed_style *parent,
if (type == CSS_TEXT_ALIGN_INHERIT) {
type = get_text_align(parent);
+ } else if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) {
+ /* This is purely for the benefit of HTML tables */
+ type = get_text_align(parent);
+
+ /* If the parent's text-align is a magical one,
+ * then reset to the default value. Otherwise,
+ * inherit as normal. */
+ if (type == CSS_TEXT_ALIGN_LIBCSS_LEFT ||
+ type == CSS_TEXT_ALIGN_LIBCSS_CENTER ||
+ type == CSS_TEXT_ALIGN_LIBCSS_RIGHT)
+ type = CSS_TEXT_ALIGN_DEFAULT;
}
return set_text_align(result, type);