diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2008-03-05 08:09:06 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2008-03-05 08:09:06 +0000 |
commit | f7be887580a9dc7645df1e04f676a0dd4af48938 (patch) | |
tree | e02ebf58b906209ecbcacdd3d13367168cc34667 /render/box_construct.c | |
parent | f5b638b8de92da4930040a40459fa9e5335ef65d (diff) | |
download | netsurf-f7be887580a9dc7645df1e04f676a0dd4af48938.tar.gz netsurf-f7be887580a9dc7645df1e04f676a0dd4af48938.tar.bz2 |
Centered tables are a special case.
svn path=/trunk/netsurf/; revision=3880
Diffstat (limited to 'render/box_construct.c')
-rw-r--r-- | render/box_construct.c | 16 |
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 || |