diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-11-18 16:09:40 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-12-03 12:25:52 +0100 |
commit | f18636e80edab0dadd07917ea26ec4c18102b99a (patch) | |
tree | 36bc9ef859f6d1de33b18da7e9a2f35be0fa62e6 /source/html | |
parent | d88d131bae7d516b1b8ad9c94706d0813bbb1497 (diff) | |
download | mupdf-f18636e80edab0dadd07917ea26ec4c18102b99a.tar.xz |
html: Cleanups.
Diffstat (limited to 'source/html')
-rw-r--r-- | source/html/css-apply.c | 27 | ||||
-rw-r--r-- | source/html/layout.c | 5 |
2 files changed, 22 insertions, 10 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c index eecb8111..67814440 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -984,7 +984,7 @@ default_computed_style(struct computed_style *style) { memset(style, 0, sizeof *style); style->text_align = TA_LEFT; - style->vertical_align = 0; + style->vertical_align = VA_BASELINE; style->white_space = WS_NORMAL; style->font_size = make_number(1, N_SCALE); } @@ -1017,10 +1017,16 @@ compute_style(html_document *doc, struct computed_style *style, struct style *no value = get_style_property(node, "vertical-align"); if (value) { - if (!strcmp(value->data, "super")) - style->vertical_align = 1; + if (!strcmp(value->data, "baseline")) + style->vertical_align = VA_BASELINE; if (!strcmp(value->data, "sub")) - style->vertical_align = -1; + style->vertical_align = VA_SUB; + if (!strcmp(value->data, "super")) + style->vertical_align = VA_SUPER; + if (!strcmp(value->data, "top")) + style->vertical_align = VA_TOP; + if (!strcmp(value->data, "bottom")) + style->vertical_align = VA_BOTTOM; } value = get_style_property(node, "font-size"); @@ -1042,6 +1048,17 @@ compute_style(html_document *doc, struct computed_style *style, struct style *no style->font_size = make_number(1, N_SCALE); } + value = get_style_property(node, "border-style"); + if (value) + { + if (!strcmp(value->data, "none")) + style->border_style = BS_NONE; + if (!strcmp(value->data, "hidden")) + style->border_style = BS_NONE; + if (!strcmp(value->data, "solid")) + style->border_style = BS_SOLID; + } + style->line_height = number_from_property(node, "line-height", 1.2, N_SCALE); style->text_indent = number_from_property(node, "text-indent", 0, N_NUMBER); @@ -1065,8 +1082,6 @@ compute_style(html_document *doc, struct computed_style *style, struct style *no style->background_color = color_from_property(node, "background-color", transparent); style->border_color = color_from_property(node, "border-color", style->color); - style->border_style = !strcmp(get_style_property_string(node, "border-style", "none"), "solid"); - { const char *font_family = get_style_property_string(node, "font-family", "serif"); const char *font_variant = get_style_property_string(node, "font-variant", "normal"); diff --git a/source/html/layout.c b/source/html/layout.c index b5a22557..001e15e4 100644 --- a/source/html/layout.c +++ b/source/html/layout.c @@ -1,9 +1,6 @@ #include "mupdf/html.h" -#define L LEFT -#define R RIGHT -#define T TOP -#define B BOTTOM +enum { T, R, B, L }; static const char *default_css = "html,address,blockquote,body,dd,div,dl,dt,h1,h2,h3,h4,h5,h6,ol,p,ul,center,hr,pre{display:block}" |