about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-11-15 21:03:19 +0100
committerbptato <nincsnevem662@gmail.com>2021-11-15 21:03:19 +0100
commitd3d9139dd6aa535ed1d7f2c78accd6ac5fa89b3e (patch)
tree3f21c217de6f8d616d6d455c5f7da2511bff0664 /src/layout
parent9b95435ae6a859f5da69d2fc473099df5102e243 (diff)
downloadchawan-d3d9139dd6aa535ed1d7f2c78accd6ac5fa89b3e.tar.gz
Abstract away FlexibleCell, fix pageUp/pageDown
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 7b82cdf9..17cce41c 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -84,11 +84,9 @@ proc processInlineBox(parent: CSSBox, str: string): CSSBox =
   rowbox.setup(ibox.cssvalues, ibox.bcontext.nodes)
   var r: Rune
   while i < str.len:
-    fastRuneAt(str, i, r)
-    if rowbox.width + r.width() > ibox.width:
-      inlineWrap(ibox, rowi, fromx, rowbox)
-    if r != Rune(0x00A0) and #NBSP
-        r.isWhitespace():
+    case str[i]
+    of ' ', '\n', '\t':
+      inc i
       let wsr = ibox.cssvalues[PROPERTY_WHITESPACE].whitespace
       if ibox.context.whitespace:
         if ibox.context.ws_initial:
@@ -114,6 +112,10 @@ proc processInlineBox(parent: CSSBox, str: string): CSSBox =
         ibox.context.whitespace = false
     else:
       ibox.context.whitespace = false
+      fastRuneAt(str, i, r)
+      if rowbox.width + r.width() > ibox.width:
+        inlineWrap(ibox, rowi, fromx, rowbox)
+
     rowbox.width += r.width()
     rowbox.runes.add(r)
   if rowbox.runes.len > 0: