summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-11-04 17:01:19 +0100
committerTor Andersson <tor.andersson@artifex.com>2014-12-03 12:25:51 +0100
commitb8f932bba1ca5003700a8c6465e6b67bffb5ea38 (patch)
tree9318071f04cface48dddae738b87eb8d1e233458 /source
parent59a3ca3072abebde69c11d5070c0bc42773f0f44 (diff)
downloadmupdf-b8f932bba1ca5003700a8c6465e6b67bffb5ea38.tar.xz
html: Parse white-space property.
Diffstat (limited to 'source')
-rw-r--r--source/html/css-apply.c55
-rw-r--r--source/html/css-parse.c1
2 files changed, 37 insertions, 19 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c
index 4f58154a..0e451ce0 100644
--- a/source/html/css-apply.c
+++ b/source/html/css-apply.c
@@ -699,24 +699,6 @@ get_style_property_string(struct style *node, const char *name, const char *init
return value->data;
}
-int
-get_style_property_display(struct style *node)
-{
- struct value *value = get_style_property(node, "display");
- if (value)
- {
- if (!strcmp(value->data, "none"))
- return DIS_NONE;
- if (!strcmp(value->data, "inline"))
- return DIS_INLINE;
- if (!strcmp(value->data, "block"))
- return DIS_BLOCK;
- if (!strcmp(value->data, "list-item"))
- return DIS_LIST_ITEM;
- }
- return DIS_INLINE;
-}
-
static struct number
make_number(float v, int u)
{
@@ -785,6 +767,39 @@ from_number(struct number number, float em, float width)
}
}
+int
+get_style_property_display(struct style *node)
+{
+ struct value *value = get_style_property(node, "display");
+ if (value)
+ {
+ if (!strcmp(value->data, "none"))
+ return DIS_NONE;
+ if (!strcmp(value->data, "inline"))
+ return DIS_INLINE;
+ if (!strcmp(value->data, "block"))
+ return DIS_BLOCK;
+ if (!strcmp(value->data, "list-item"))
+ return DIS_LIST_ITEM;
+ }
+ return DIS_INLINE;
+}
+
+int
+get_style_property_white_space(struct style *node)
+{
+ struct value *value = get_style_property(node, "white-space");
+ if (value)
+ {
+ if (!strcmp(value->data, "normal")) return WS_NORMAL;
+ if (!strcmp(value->data, "pre")) return WS_PRE;
+ if (!strcmp(value->data, "nowrap")) return WS_NOWRAP;
+ if (!strcmp(value->data, "pre-wrap")) return WS_PRE_WRAP;
+ if (!strcmp(value->data, "pre-line")) return WS_PRE_LINE;
+ }
+ return WS_NORMAL;
+}
+
void
compute_style(struct computed_style *style, struct style *node)
{
@@ -793,8 +808,12 @@ compute_style(struct computed_style *style, struct style *node)
memset(style, 0, sizeof *style);
style->text_align = TA_LEFT;
+ style->vertical_align = 0;
+ style->white_space = WS_NORMAL;
style->font_size = make_number(1, N_SCALE);
+ style->white_space = get_style_property_white_space(node);
+
value = get_style_property(node, "text-align");
if (value)
{
diff --git a/source/html/css-parse.c b/source/html/css-parse.c
index 066eb0f7..28176d14 100644
--- a/source/html/css-parse.c
+++ b/source/html/css-parse.c
@@ -1,4 +1,3 @@
-#include "mupdf/fitz.h"
#include "mupdf/html.h"
struct lexbuf