summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-03-05 08:09:06 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-03-05 08:09:06 +0000
commitf7be887580a9dc7645df1e04f676a0dd4af48938 (patch)
treee02ebf58b906209ecbcacdd3d13367168cc34667
parentf5b638b8de92da4930040a40459fa9e5335ef65d (diff)
downloadnetsurf-f7be887580a9dc7645df1e04f676a0dd4af48938.tar.gz
netsurf-f7be887580a9dc7645df1e04f676a0dd4af48938.tar.bz2
Centered tables are a special case.
svn path=/trunk/netsurf/; revision=3880
-rw-r--r--render/box_construct.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index 2cb264afd..5a3f90599 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1199,6 +1199,21 @@ struct css_style * box_get_style(struct content *c,
markup_track->align = ALIGN_NONE;
}
}
+ /* Centered tables are a special case. The align attribute only
+ * affects the current element (table) and overrides any existing
+ * HTML alignment rule. Tables aligned to left or right are floated
+ * by the default CSS file. */
+ if (!author->margin[LEFT] && !author->margin[RIGHT] &&
+ strcmp((const char *) n->name, "table") == 0) {
+ if ((s = (char *) xmlGetProp(n,
+ (const xmlChar *) "align"))) {
+ if (strcasecmp(s, "center") == 0) {
+ style->margin[LEFT].margin = CSS_MARGIN_AUTO;
+ style->margin[RIGHT].margin = CSS_MARGIN_AUTO;
+ }
+ xmlFree(s);
+ }
+ }
box_solve_display(style, !n->parent);
@@ -1215,7 +1230,6 @@ struct css_style * box_get_style(struct content *c,
else if (strcmp((const char *) n->name, "div") == 0 ||
strcmp((const char *) n->name, "col") == 0 ||
strcmp((const char *) n->name, "colgroup") == 0 ||
- strcmp((const char *) n->name, "table") == 0 ||
strcmp((const char *) n->name, "tbody") == 0 ||
strcmp((const char *) n->name, "td") == 0 ||
strcmp((const char *) n->name, "tfoot") == 0 ||