From fed5c6bde9ae32bddfdce2f235e5adc484effad0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 15 May 2015 16:36:00 +0200 Subject: epub: Use flag bits for white-space enum. --- source/html/html-layout.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'source/html') diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 52171ef8..cfc5da4f 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -99,44 +99,14 @@ static void generate_text(fz_context *ctx, fz_html *box, const char *text) { fz_html *flow; - int collapse; /* collapse sequences of white space */ - int bsp; /* allow breaks at white space */ - int bnl; /* force breaks at newline characters */ + int collapse = box->style.white_space & WS_COLLAPSE; + int bsp = box->style.white_space & WS_ALLOW_BREAK_SPACE; + int bnl = box->style.white_space & WS_FORCE_BREAK_NEWLINE; flow = box; while (flow->type != BOX_FLOW) flow = flow->up; - switch (box->style.white_space) - { - default: - case WS_NORMAL: - collapse = 1; - bsp = 1; - bnl = 0; - break; - case WS_PRE: - collapse = 0; - bsp = 0; - bnl = 1; - break; - case WS_NOWRAP: - collapse = 1; - bsp = 0; - bnl = 0; - break; - case WS_PRE_WRAP: - collapse = 0; - bsp = 1; - bnl = 1; - break; - case WS_PRE_LINE: - collapse = 1; - bsp = 1; - bnl = 1; - break; - } - while (*text) { if (bnl && (*text == '\n' || *text == '\r')) -- cgit v1.2.3