Truly independent web browser
LibWeb: Let only boxes with a block size count as column content
Aliaksandr Kalenik6813ffec76a0
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rsindex fcc198b9014..fce0d9cffaa 100644--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs@@ -2809,7 +2809,9 @@ impl<'pass> BlockFormattingContext<'pass> {}}state.has_in_flow_content = true;- self.fragmentainer_has_content.set(true);+ if border_box_block_size > CssPixels::default() {+ self.fragmentainer_has_content.set(true);+ }state.previous_in_flow_child_forces_break_after =fragmentation::is_forced_column_break(self.style(child).break_after());FragmentationStep::LayOutdiff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-break-001-ref.xht b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-break-001-ref.xhtnew file mode 100644index 00000000000..3280937d9f8--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-break-001-ref.xht@@ -0,0 +1,30 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <title>CSS Reftest Reference</title>+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2013-09-14 -->+ <meta name="flags" content="ahem image" />+ <link rel="stylesheet" type="text/css" href="../../fonts/ahem.css" />+ <style type="text/css"><![CDATA[+ div+ {+ background-color: yellow;+ margin-bottom: 0.5em;+ font: 1.25em/1 Ahem;+ height: 3em;+ width: 10em;+ }++ img {vertical-align: top;}+ ]]></style>+ </head>+ <body>++ <p>Test passes if the 2 horizontal bars are <strong>identical</strong>.</p>++ <div><img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /></div>++ <div><img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /></div>++ </body>+</html>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-zero-height-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-zero-height-002-ref.htmlnew file mode 100644index 00000000000..f9c296ecbc2--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/multicol-zero-height-002-ref.html@@ -0,0 +1,18 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Multi-column Reference: Test an unbreakble block element in a zero height multi-column container</title>+<link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">+<link rel="stylesheet" href="../../fonts/ahem.css">++<style>+.child {+ font: 100px/1 Ahem;+ color: green;+ inline-size: 100px;+ outline: 3px solid green;+}+</style>++<p>There shouldn't be a green strip in the second column.</p>+<div class="child">X</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/overflow-unsplittable-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/overflow-unsplittable-001-ref.htmlnew file mode 100644index 00000000000..d245912be88--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-multicol/overflow-unsplittable-001-ref.html@@ -0,0 +1,4 @@+<!DOCTYPE html>+<div style="overflow:scroll; width:50px; background:green;">+ <div style="height:200px;"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-break-001.xht b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-break-001.xhtnew file mode 100644index 00000000000..3f743595564--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-break-001.xht@@ -0,0 +1,54 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <title>CSS Multi-column Layout Test: break-before: column (basic)</title>+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2013-09-14 -->+ <link rel="help" href="http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside" title="5.1. 'break-before', 'break-after', 'break-inside'" />+ <link rel="match" href="../../../../expected/wpt-import/css/css-multicol/multicol-break-001-ref.xht" />+ <meta name="flags" content="ahem image" />+ <meta name="assert" content="This test checks that basic support of 'break-before: column'." />+ <link rel="stylesheet" type="text/css" href="../../fonts/ahem.css" />+ <style type="text/css"><![CDATA[+ div#test, div#reference+ {+ background-color: yellow;+ margin-bottom: 0.5em;+ font: 1.25em/1 Ahem;+ height: 3em;+ width: 10em;+ }++ div#test+ {+ column-fill: auto;+ column-gap: 0;+ column-width: 2em;++ /*++ N == 5;++ W == 2em;++ */+ }++ div#test > div {break-before: column;}++ img {vertical-align: top;}+ ]]></style>+ </head>+ <body>++ <p>Test passes if the 2 horizontal bars are <strong>identical</strong>.</p>++ <div id="test">+ <div>A</div>+ <div>B</div>+ <div>C</div>+ </div>++ <div id="reference"><img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /> <img src="support/black20x20.png" alt="Image download support must be enabled" /></div>++ </body>+</html>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-fill-balance-041.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-fill-balance-041.htmlnew file mode 100644index 00000000000..96c6b76c028--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-fill-balance-041.html@@ -0,0 +1,14 @@+<!DOCTYPE html>+<title>Column balancing, more forced breaks than columns</title>+<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">+<link rel="help" href="https://www.w3.org/TR/2024/CR-css-multicol-1-20240516/#pagination-and-overflow-outside-multicol">+<link rel="help" href="https://issues.chromium.org/issues/385595003">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/../reference/ref-filled-green-100px-square.xht">+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>+<div style="columns:2; width:100px; height:100px; gap:0; background:red;">+ <div style="background:green;">+ <div style="break-before:column; height:20px;"></div>+ <div style="break-before:column; height:40px;"></div>+ <div style="break-before:column; height:100px; background:white;"></div>+ </div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-zero-height-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-zero-height-002.htmlnew file mode 100644index 00000000000..94ff067c3a8--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/multicol-zero-height-002.html@@ -0,0 +1,30 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Multi-column Test: Test an unbreakble block element in a zero height multi-column container</title>+<link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1754598">+<link rel="stylesheet" href="../../fonts/ahem.css">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/multicol-zero-height-002-ref.html">+<meta name="assert" content="This test verifies that the unbreakable block element with definite block-size doesn't ask for an extra continuation in the second column.">++<style>+.multicol {+ column-width: 100px;+ inline-size: 300px;+ block-size: 0;+}++.child {+ font: 100px/1 Ahem;+ color: green;+ inline-size: 100px;+ block-size: 100px; /* The define block-size is required to reproduce the bug.*/+ outline: 3px solid green;+}+</style>++<p>There shouldn't be a green strip in the second column.</p>+<div class="multicol">+ <div class="child">X</div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-001.htmlnew file mode 100644index 00000000000..f594cddeca1--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-001.html@@ -0,0 +1,11 @@+<!DOCTYPE html>+<title>+ Test that a scrollable container isn't split across multiple columns.+</title>+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/overflow-unsplittable-001-ref.html">+<div style="columns:2; column-gap:0; width:100px; height:100px;">+ <div style="overflow:scroll; width:50px; background:green;">+ <div style="height:200px;"></div>+ </div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-002.htmlnew file mode 100644index 00000000000..513897ddc4f--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-002.html@@ -0,0 +1,12 @@+<!DOCTYPE html>+<title>+ Test that a scrollable container isn't split across multiple columns.+</title>+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/../reference/ref-filled-green-100px-square-only.html">+<p>Test passes if there is a filled green square.</p>+<div style="columns:2; column-gap:0; width:200px; height:50px;">+ <div style="overflow:auto; width:100px; background:green;">+ <div style="height:100px;"></div>+ </div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-003.htmlnew file mode 100644index 00000000000..51b3e200070--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/overflow-unsplittable-003.html@@ -0,0 +1,12 @@+<!DOCTYPE html>+<title>+ Test that a scrollable container isn't split across multiple columns.+</title>+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/../reference/ref-filled-green-100px-square-only.html">+<p>Test passes if there is a filled green square.</p>+<div style="columns:2; column-gap:0; width:200px; height:50px;">+ <div style="overflow:hidden; width:100px; background:green;">+ <div style="height:100px;"></div>+ </div>+</div>