summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/html.h17
-rw-r--r--source/html/css-apply.c26
2 files changed, 10 insertions, 33 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h
index 613ab65c..9a42043d 100644
--- a/include/mupdf/html.h
+++ b/include/mupdf/html.h
@@ -114,22 +114,15 @@ struct color
struct computed_style
{
- int position;
- struct number top, right, bottom, left;
+ struct number font_size;
struct number margin[4];
struct number padding[4];
- struct number border_width[4];
- int border_style;
- struct color border_color;
- struct color color;
- struct color background_color;
+ struct number text_indent;
+ int text_align;
+ int vertical_align;
+ struct number line_height;
const char *font_family;
int bold, italic, smallcaps;
- struct number font_size;
- struct number line_height;
- int vertical_align;
- int text_align;
- struct number text_indent;
};
void apply_styles(fz_context *ctx, struct style *style, struct rule *rule, fz_xml *node);
diff --git a/source/html/css-apply.c b/source/html/css-apply.c
index 8526f7b9..4f58154a 100644
--- a/source/html/css-apply.c
+++ b/source/html/css-apply.c
@@ -792,23 +792,9 @@ compute_style(struct computed_style *style, struct style *node)
memset(style, 0, sizeof *style);
- style->position = POS_STATIC;
style->text_align = TA_LEFT;
style->font_size = make_number(1, N_SCALE);
- value = get_style_property(node, "position");
- if (value)
- {
- if (!strcmp(value->data, "static"))
- style->position = POS_STATIC;
- if (!strcmp(value->data, "relative"))
- style->position = POS_RELATIVE;
- if (!strcmp(value->data, "absolute"))
- style->position = POS_ABSOLUTE;
- if (!strcmp(value->data, "fixed"))
- style->position = POS_FIXED;
- }
-
value = get_style_property(node, "text-align");
if (value)
{
@@ -890,16 +876,14 @@ void
print_style(struct computed_style *style)
{
printf("style {\n");
- printf("\tposition = %d;\n", style->position);
- printf("\ttext-align = %d;\n", style->text_align);
- printf("\tfont-family = %s;\n", style->font_family);
- printf("\tfont-weight = %s;\n", style->bold ? "bold" : "normal");
- printf("\tfont-style = %s;\n", style->italic ? "italic" : "normal");
- printf("\tfont-variant = %s;\n", style->smallcaps ? "small-caps" : "normal");
-
printf("\tfont-size = %g%c;\n", style->font_size.value, style->font_size.unit);
+ printf("\tfont = %s", style->font_family);
+ printf(" %s", style->bold ? "bold" : "normal");
+ printf(" %s", style->italic ? "italic" : "normal");
+ printf(" %s;\n", style->smallcaps ? "small-caps" : "normal");
printf("\tline-height = %g%c;\n", style->line_height.value, style->line_height.unit);
printf("\ttext-indent = %g%c;\n", style->text_indent.value, style->text_indent.unit);
+ printf("\ttext-align = %d;\n", style->text_align);
printf("\tvertical-align = %d;\n", style->vertical_align);
printf("\tmargin = %g%c %g%c %g%c %g%c;\n",
style->margin[0].value, style->margin[0].unit,