about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-25 21:42:48 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-25 21:42:48 +0100
commit041219b67de28fd7d18daa6b17f85d625108d8f3 (patch)
treec112526cfc43a9e38a9136aa9c35da40dda0a305 /src/layout
parente87109683acf7c11462dd53684c076a6f7724a63 (diff)
downloadchawan-041219b67de28fd7d18daa6b17f85d625108d8f3.tar.gz
Fix an anonymous table bug
...by flushing anonymous tables *before* inline layout is
set (therefore avoiding placing them inside inline boxes.)
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 813400b4..45662888 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1444,13 +1444,19 @@ proc generateBlockBox(styledNode: StyledNode, viewport: Viewport, marker = none(
 
   ctx.generateInnerBlockBox()
 
+  # Flush anonymous tables here, to avoid setting inline layout with tables.
+  ctx.flushTableRow()
+  ctx.flushTable()
+  # (flush here, because why not)
+  ctx.flushInherit()
+
   # Avoid unnecessary anonymous block boxes. This also helps set our layout to
   # inline even if no inner anonymous block was generated.
   if box.children.len == 0:
     box.children = ctx.blockgroup.boxes
     box.inlinelayout = true
     ctx.blockgroup.boxes.setLen(0)
-  ctx.flush()
+  ctx.blockgroup.flush()
   return box
 
 proc generateTableCellBox(styledNode: StyledNode, viewport: Viewport, parent: var InnerBlockContext): TableCellBoxBuilder =