summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-05-15 16:36:00 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-05-15 16:36:00 +0200
commitfed5c6bde9ae32bddfdce2f235e5adc484effad0 (patch)
tree0511000e339c53b68a12a0a75e6a46f5fd8c8539 /source
parentafa0a2b4b0508fb6b095c30a6e27afd0c5c21c64 (diff)
downloadmupdf-fed5c6bde9ae32bddfdce2f235e5adc484effad0.tar.xz
epub: Use flag bits for white-space enum.
Diffstat (limited to 'source')
-rw-r--r--source/html/html-layout.c36
1 files changed, 3 insertions, 33 deletions
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'))