summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/html.h6
-rw-r--r--source/html/css-apply.c27
-rw-r--r--source/html/layout.c5
3 files changed, 25 insertions, 13 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h
index 8da4534c..27b9faad 100644
--- a/include/mupdf/html.h
+++ b/include/mupdf/html.h
@@ -99,10 +99,10 @@ struct property *fz_parse_css_properties(fz_context *ctx, const char *source);
enum { DIS_NONE, DIS_BLOCK, DIS_INLINE, DIS_LIST_ITEM };
enum { POS_STATIC, POS_RELATIVE, POS_ABSOLUTE, POS_FIXED };
-enum { TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY };
enum { WS_NORMAL, WS_PRE, WS_NOWRAP, WS_PRE_WRAP, WS_PRE_LINE };
-
-enum { TOP, RIGHT, BOTTOM, LEFT };
+enum { TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY };
+enum { VA_BASELINE, VA_SUB, VA_SUPER, VA_TOP, VA_BOTTOM };
+enum { BS_NONE, BS_SOLID };
enum { N_NUMBER='p', N_SCALE='m', N_PERCENT='%' };
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}"