about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-02-07 19:27:16 +0100
committerbptato <nincsnevem662@gmail.com>2025-02-07 20:18:47 +0100
commitd57ef74a78ba32e8187d74c1975e7a4181af36c0 (patch)
treef29a16e1d0c7e600f438862bc37f925acfc3eb45 /test
parentebdb900ebc843e93dec4846e2f2434bf18ad8613 (diff)
downloadchawan-d57ef74a78ba32e8187d74c1975e7a4181af36c0.tar.gz
layout: unify BlockBox and InlineBox, refactor building
* normalize flow baseline computation
* fix various margin collapsing bugs
* eliminate inlineStack
* eliminate push*
* derive BlockBox and InlineBox from CSSBox

This removes a pointer from BlockBox, and adds a pointer to both
BlockBox and InlineBox (type field).  A net loss, but it makes the code
more manageable.
Plus, inline groups now need one less allocation, so overall it's not
that bad.
Diffstat (limited to 'test')
-rw-r--r--test/layout/flex-perc-width-constrains-intrinsic-min-width.expected2
-rw-r--r--test/layout/inline-backgrounds.color.expected2
-rw-r--r--test/layout/inline-margin-collapses-over-empty-boxes.expected16
-rw-r--r--test/layout/inline-margin-collapses-over-empty-boxes.html43
-rw-r--r--test/layout/margin-does-not-collapse-through-padding.color.expected18
-rw-r--r--test/layout/margin-does-not-collapse-through-padding.html26
-rw-r--r--test/layout/table-caption-correct-order.expected3
-rw-r--r--test/layout/table-caption-correct-order.html2
-rw-r--r--test/layout/tabs.color.expected2
9 files changed, 111 insertions, 3 deletions
diff --git a/test/layout/flex-perc-width-constrains-intrinsic-min-width.expected b/test/layout/flex-perc-width-constrains-intrinsic-min-width.expected
index 159d7848..15bc70e4 100644
--- a/test/layout/flex-perc-width-constrains-intrinsic-min-width.expected
+++ b/test/layout/flex-perc-width-constrains-intrinsic-min-width.expected
@@ -1,6 +1,6 @@
 testtest
 testtest
 testtest
-    test 
+    test
 
     test test test test
diff --git a/test/layout/inline-backgrounds.color.expected b/test/layout/inline-backgrounds.color.expected
index 52e82d6d..3f140fda 100644
--- a/test/layout/inline-backgrounds.color.expected
+++ b/test/layout/inline-backgrounds.color.expected
@@ -16,7 +16,7 @@ but
 
 
                            test test test test thing
-final stage 
+final stage
 
 
                                     testing
diff --git a/test/layout/inline-margin-collapses-over-empty-boxes.expected b/test/layout/inline-margin-collapses-over-empty-boxes.expected
new file mode 100644
index 00000000..1cd5da05
--- /dev/null
+++ b/test/layout/inline-margin-collapses-over-empty-boxes.expected
@@ -0,0 +1,16 @@
+test1
+test2
+test3 
+test4
+test5
+
+test6
+test7
+test8
+
+test9 
+testa
+testb
+
+
+testd
diff --git a/test/layout/inline-margin-collapses-over-empty-boxes.html b/test/layout/inline-margin-collapses-over-empty-boxes.html
new file mode 100644
index 00000000..859b3f87
--- /dev/null
+++ b/test/layout/inline-margin-collapses-over-empty-boxes.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<span>
+test1
+<div>
+test2
+</div>
+test3
+</span>
+
+<br>
+
+<span>
+test4
+<div style="margin-bottom: 1em">
+test5
+</div>
+<div style="margin-top: 1em">
+test6
+</div>
+</span>
+
+<span>
+test7
+<div style="margin-bottom: 1em">
+test8
+</div>
+<div style="margin-top: 1em">
+</div>
+test9
+</span>
+
+<br>
+<span>
+testa
+<div style="margin-bottom: 1em">
+testb
+</div>
+<div style="margin-top: 1em; margin-bottom: 2em">
+</div>
+</span>
+<div style="margin-top: 2em">
+testd
+</div>
diff --git a/test/layout/margin-does-not-collapse-through-padding.color.expected b/test/layout/margin-does-not-collapse-through-padding.color.expected
new file mode 100644
index 00000000..4469e4ac
--- /dev/null
+++ b/test/layout/margin-does-not-collapse-through-padding.color.expected
@@ -0,0 +1,18 @@
+test
+
+test 
+test 
+     
+     
+test
+test 
+     
+     
+test
+     
+     
+test 
+     
+what
+
+test
diff --git a/test/layout/margin-does-not-collapse-through-padding.html b/test/layout/margin-does-not-collapse-through-padding.html
new file mode 100644
index 00000000..257b1ca5
--- /dev/null
+++ b/test/layout/margin-does-not-collapse-through-padding.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+test
+<div style="width: 5ch; padding-bottom: 1em; margin-top: 1em; background: red">
+<div style="display: flow-root; margin-top: 1em">
+test
+<div style="margin-bottom: 1em; background: blue">test</div>
+</div>
+</div>
+test
+<div style="width: 5ch; padding-bottom: 1em; background: red">
+<div style="margin-bottom: 1em; background: blue">test</div>
+</div>
+test
+</div>
+<div style="background: green; padding-top: 1em; width: 5ch">
+<div style="margin-top: 1em">
+test
+</div>
+</div>
+<div style="background: green; width: 5ch"><br></div>
+<div style="background: rgba(200 0 0); height: 1em; width: 4ch; margin-top: -1em"></div>
+<div>
+what
+</div>
+<div style="margin-top: 1em; height: 0px"></div>
+<div style="margin-top: 1em">test</div>
diff --git a/test/layout/table-caption-correct-order.expected b/test/layout/table-caption-correct-order.expected
new file mode 100644
index 00000000..f04f1aef
--- /dev/null
+++ b/test/layout/table-caption-correct-order.expected
@@ -0,0 +1,3 @@
+test
+    caption
+test
diff --git a/test/layout/table-caption-correct-order.html b/test/layout/table-caption-correct-order.html
new file mode 100644
index 00000000..f8ba5b84
--- /dev/null
+++ b/test/layout/table-caption-correct-order.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<span>test<div style="display: table-caption; background: red">caption</div><br><span>test</span></span>
diff --git a/test/layout/tabs.color.expected b/test/layout/tabs.color.expected
index accba20f..c0375438 100644
--- a/test/layout/tabs.color.expected
+++ b/test/layout/tabs.color.expected
@@ -4,7 +4,7 @@
 x       y                                                                       
 ^ The above rows should be aligned, and dump mode should output spaces.         
 
-Without bgcolor: 
+Without bgcolor:
 
 x	y
 x    	y