summaryrefslogtreecommitdiff
path: root/source/html/css-apply.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-10-22 21:20:42 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-12-03 12:25:51 +0100
commitd79203b42621257aed8e4c02e4e6c95ec82d9243 (patch)
tree4ebd4fc7a39f55ad1a4ec7cad157f0d9a90a64e3 /source/html/css-apply.c
parent9890cc2bd3c6b81ebaf5f7ce236117dc08c03cee (diff)
downloadmupdf-d79203b42621257aed8e4c02e4e6c95ec82d9243.tar.xz
html: Don't compute full styles during box generation.
Apply the style sheet rules and save the raw properties in each box. Only resolve the 'display' property that is needed for box generation.
Diffstat (limited to 'source/html/css-apply.c')
-rw-r--r--source/html/css-apply.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c
index 53a46f50..1a93e3e4 100644
--- a/source/html/css-apply.c
+++ b/source/html/css-apply.c
@@ -699,6 +699,24 @@ 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 NONE;
+ if (!strcmp(value->data, "inline"))
+ return INLINE;
+ if (!strcmp(value->data, "block"))
+ return BLOCK;
+ if (!strcmp(value->data, "list-item"))
+ return LIST_ITEM;
+ }
+ return INLINE;
+}
+
static float
compute_number(struct value *value, float em, float hundred, float scale, float initial)
{
@@ -751,24 +769,10 @@ compute_style(struct computed_style *style, struct style *node)
memset(style, 0, sizeof *style);
- style->display = INLINE;
style->position = STATIC;
style->text_align = LEFT;
style->font_size = 12;
- value = get_style_property(node, "display");
- if (value)
- {
- if (!strcmp(value->data, "none"))
- style->display = NONE;
- if (!strcmp(value->data, "inline"))
- style->display = INLINE;
- if (!strcmp(value->data, "block"))
- style->display = BLOCK;
- if (!strcmp(value->data, "list-item"))
- style->display = LIST_ITEM;
- }
-
value = get_style_property(node, "position");
if (value)
{
@@ -871,7 +875,6 @@ void
print_style(struct computed_style *style)
{
printf("style {\n");
- printf("\tdisplay = %d;\n", style->display);
printf("\tposition = %d;\n", style->position);
printf("\ttext-align = %d;\n", style->text_align);
printf("\tfont-family = %s;\n", style->font_family);