Skip to content

Truly independent web browser

LibWeb: Add test for left floats lying outside the BFC root

Andreas Kling2c3fa9abe674
diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/left-floats-outside-bfc-root-push-later-floats.txt b/Tests/LibWeb/Layout/expected/block-and-inline/left-floats-outside-bfc-root-push-later-floats.txt
new file mode 100644
index 00000000000..653dd21bab2
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/block-and-inline/left-floats-outside-bfc-root-push-later-floats.txt
@@ -0,0 +1,21 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: not-inline
+ BlockContainer <div> at [0,0] [0+0+0 300 0+0+500] [0+0+0 0 0+0+0] children: not-inline
+ BlockContainer <(anonymous)> at [0,0] [0+0+0 300 0+0+0] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <div> at [-300,0] [-300+0+0 900 0+0+-300] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <div.float> at [-300,0] floating [0+0+0 300 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ TextNode <#text> (not painted)
+ BlockContainer <div.float> at [-300,0] floating [0+0+0 300 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ TextNode <#text> (not painted)
+ BlockContainer <div.float> at [-300,0] floating [0+0+0 300 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> at [0,0] [0+0+0 300 0+0+0] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> at [0,0] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x50] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.txt b/Tests/LibWeb/Layout/expected/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.txt
new file mode 100644
index 00000000000..d47113e3bbb
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.txt
@@ -0,0 +1,14 @@
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: not-inline
+ BlockContainer <div> at [0,0] [0+0+0 300 0+0+500] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+ BlockContainer <div> at [0,0] floating [0+0+0 0 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ TextNode <#text> (not painted)
+ BlockContainer <div> at [0,0] floating [0+0+0 400 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
+ TextNode <#text> (not painted)
+ BlockContainer <(anonymous)> at [0,0] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: inline
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x50] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/left-floats-outside-bfc-root-push-later-floats.html b/Tests/LibWeb/Layout/input/block-and-inline/left-floats-outside-bfc-root-push-later-floats.html
new file mode 100644
index 00000000000..5d856233b49
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/left-floats-outside-bfc-root-push-later-floats.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ }
+ .float {
+ float: left;
+ width: 300px;
+ height: 50px;
+ }
+</style>
+<div style="width: 300px">
+ <div style="width: 900px; margin-left: -300px">
+ <div class="float"></div>
+ <div class="float"></div>
+ <div class="float"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.html b/Tests/LibWeb/Layout/input/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.html
new file mode 100644
index 00000000000..50aac7170a3
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/zero-width-left-float-does-not-push-later-floats-down.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<style>
+ body {
+ margin: 0;
+ }
+</style>
+<div style="width: 300px">
+ <div style="float: left; width: 0; height: 50px"></div>
+ <div style="float: left; width: 400px; height: 50px"></div>
+</div>