Truly independent web browser
LibWeb: Honor orphans and widows when lines break across columns
Aliaksandr Kalenik65df7f2a9fa5
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs b/Libraries/LibWeb/Rust/src/css/computed_value_views.rsindex ef374db4c0d..62039824217 100644--- a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs+++ b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs@@ -446,6 +446,10 @@ scalar_accessors! {border_bottom_color: u32 => border_bottom.color,border_left_color: u32 => border_left.color,}+ inherited_text: {+ orphans: u64 => orphans,+ widows: u64 => widows,+ }inherited_box: {writing_mode: u8 => writing_mode,direction: u8 => direction,diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rsindex 471918e3539..b05ec5623a5 100644--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs@@ -268,6 +268,7 @@ pub(crate) struct BlockFormattingContext<'pass> {broken_child_token: RefCell<Option<std::rc::Rc<fragmentation::BlockBreakToken>>>,unbreakable_line_roots: RefCell<HashSet<Node>>,fragmentation_suppression_depth: Cell<usize>,+ break_before_child_is_avoided: Cell<Option<Node>>,}impl<'pass> BlockFormattingContext<'pass> {@@ -332,6 +333,7 @@ impl<'pass> BlockFormattingContext<'pass> {broken_child_token: RefCell::new(None),unbreakable_line_roots: RefCell::new(HashSet::default()),fragmentation_suppression_depth: Cell::new(0),+ break_before_child_is_avoided: Cell::new(None),}}@@ -2846,6 +2848,8 @@ impl<'pass> BlockFormattingContext<'pass> {self.discard_block_start_margin_of_next_child.set(true);}state.fragmentainer_had_content_before_child = self.fragmentainer_has_content.get();+ self.break_before_child_is_avoided+ .set(self.break_between_is_avoided(state, child).then_some(child));FragmentationStep::LayOut}@@ -3090,6 +3094,7 @@ impl<'pass> BlockFormattingContext<'pass> {block_size: fragmentainer.block_size,resume,fragmentainer_had_content: self.fragmentainer_has_content.get(),+ break_before_is_avoided: self.break_before_child_is_avoided.get() == Some(line_root),})}diff --git a/Libraries/LibWeb/Rust/src/layout/fragmentation.rs b/Libraries/LibWeb/Rust/src/layout/fragmentation.rsindex c64ceac3a7d..a0afaaaaea7 100644--- a/Libraries/LibWeb/Rust/src/layout/fragmentation.rs+++ b/Libraries/LibWeb/Rust/src/layout/fragmentation.rs@@ -140,6 +140,7 @@ pub(crate) struct LineRootFragmentation {pub(crate) block_size: Option<CssPixels>,pub(crate) resume: Option<LinePosition>,pub(crate) fragmentainer_had_content: bool,+ pub(crate) break_before_is_avoided: bool,}#[derive(Clone, Debug, Default)]diff --git a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rsindex be0a6ed9adb..e62bf2ccdd3 100644--- a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs@@ -1838,7 +1838,7 @@ impl<'context> InlineFormattingContext<'context> {}).map(|block_size| FragmentainerLineLimit {block_size,- widows: 1,+ widows: self.style(self.containing_block).widows().max(1) as usize,checked_line_count: 0,lines_past_end: 0,minimum_line_block_size: None,@@ -2196,7 +2196,8 @@ impl<'context> InlineFormattingContext<'context> {&& !self.line_data().line_boxes.iter().any(|line| line.has_block_level_box);let dropped_atomic_inlines = if breakable {lines_are_fragmented = true;- let (dropped_atomic_inlines, next_line_start) = self.keep_lines_of_fragmentainer(fragmentation);+ let (dropped_atomic_inlines, next_line_start) =+ self.keep_lines_of_fragmentainer(fragmentation, stopped_at_line_limit);kept_lines_end = next_line_start;dropped_atomic_inlines} else {@@ -2438,6 +2439,7 @@ impl<'context> InlineFormattingContext<'context> {fn keep_lines_of_fragmentainer(&self,fragmentation: fragmentation::LineRootFragmentation,+ stopped_at_line_limit: bool,) -> (Vec<Node>, Option<fragmentation::LinePosition>) {let line_count = self.line_data().line_boxes.len();let is_first_fragment = fragmentation.resume.is_none();@@ -2470,6 +2472,31 @@ impl<'context> InlineFormattingContext<'context> {self.parent.note_line_for_fragmentation(block_end - block_start, block_end, true);}+ if stop < line_count {+ let content_line_count = self+ .line_data()+ .line_boxes+ .iter()+ .rposition(|line| !line.is_empty())+ .map_or(0, |index| index + 1);+ let style = self.style(self.containing_block);+ // https://drafts.csswg.org/css-break-3/#widows-orphans+ let orphans = style.orphans().max(1) as usize;+ let widows = style.widows().max(1) as usize;+ if stop < orphans {+ if is_first_fragment+ && fragmentation.fragmentainer_had_content+ && !fragmentation.break_before_is_avoided+ {+ self.parent.request_early_break_before(self.containing_block);+ }+ } else if !stopped_at_line_limit && content_line_count.saturating_sub(stop) < widows {+ let stop_keeping_widows = content_line_count.saturating_sub(widows);+ if stop_keeping_widows >= orphans {+ stop = stop_keeping_widows;+ }+ }+ }*self.inline_boxes_continued_in_next_fragment.borrow_mut() = {let data = self.line_data();diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-break/float-in-inline-widows-orphans-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-break/float-in-inline-widows-orphans-crash.htmlnew file mode 100644index 00000000000..be8645ddfa1--- /dev/null+++ b/Tests/LibWeb/Crash/wpt-import/css/css-break/float-in-inline-widows-orphans-crash.html@@ -0,0 +1,10 @@+<!DOCTYPE html>+<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1486252">+<div style="columns:10em; orphans:2; widows:2; height:20px; column-fill:auto; line-height:20px; background:yellow;">+ <div style="float:left; width:100%; height:30px; background:cyan;"></div>+ <br>+ <div style="float:left; contain:size; width:1px; height:10px; background:hotpink;"></div>+ <div style="float:left; width:10px; height:10px; background:blue;"></div>+ allworkandnoplaymakesjackadullstableboy+</div>diff --git a/Tests/LibWeb/Ref/expected/multicol-orphans-widows-ref.html b/Tests/LibWeb/Ref/expected/multicol-orphans-widows-ref.htmlnew file mode 100644index 00000000000..21b86730149--- /dev/null+++ b/Tests/LibWeb/Ref/expected/multicol-orphans-widows-ref.html@@ -0,0 +1,25 @@+<!DOCTYPE html>+<style>+body { margin: 0; }+.container { position: relative; height: 60px; width: 220px; margin-bottom: 10px; }+.line { position: absolute; width: 20px; height: 20px; background: green; }+.block { position: absolute; left: 0; top: 0; width: 100px; height: 40px; background: blue; }+</style>+<div class="container">+ <div class="line" style="left: 0; top: 0"></div>+ <div class="line" style="left: 0; top: 20px"></div>+ <div class="line" style="left: 120px; top: 0"></div>+ <div class="line" style="left: 120px; top: 20px"></div>+</div>+<div class="container">+ <div class="block"></div>+ <div class="line" style="left: 120px; top: 0"></div>+ <div class="line" style="left: 120px; top: 20px"></div>+ <div class="line" style="left: 120px; top: 40px"></div>+</div>+<div class="container">+ <div class="block"></div>+ <div class="line" style="left: 0; top: 40px"></div>+ <div class="line" style="left: 120px; top: 0"></div>+ <div class="line" style="left: 120px; top: 20px"></div>+</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-001-ref.htmlnew file mode 100644index 00000000000..4f822f8fd67--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-001-ref.html@@ -0,0 +1,38 @@+<!DOCTYPE html>++ <meta charset="UTF-8">++ <title>CSS Reftest Reference</title>++ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">++ <!--+ Date created: November 7th 2020+ Last modified: November 17th 2020+ -->++ <style>+ div+ {+ border: orange solid 4px;+ font-size: 20px;+ line-height: 1.3; /* computes to 26px */+ height: 104px; /* Therefore, exactly 4 line boxes */+ margin-bottom: 1em;+ padding: 0.5em; /* computes to 10px */+ width: 490px;++ columns: 3 auto;+ column-fill: auto;+ column-gap: 1em; /* computes to 20px */+ column-rule: blue solid 4px;++ widows: 1;+ }+ </style>++ <p>Test passes if the digits inside both orange-bordered rectangles are <strong>distributed identically</strong>.++ <div>1<br>2<br>3<br>4<br>5<br>6<br>7<br><br>8<br>9</div>++ <div>1<br>2<br>3<br>4<br>5<br>6<br>7<br><br>8<br>9</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-orphans-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-orphans-001-ref.htmlnew file mode 100644index 00000000000..06108ac800c--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-break/reference/widows-orphans-001-ref.html@@ -0,0 +1,17 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Fragmentation level 3 Test Reference File</title>+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">+<style>+div {+ position: absolute;+ columns: 2;+ column-fill: balance-all;+ column-gap: 0;+}+</style>+<body>+ <p>Test passes if there are 4 “X” characters <strong>arranged in a 2 by 2 square</strong> below.++ <div>X<br>X<br>X<br>X</div>+</body>diff --git a/Tests/LibWeb/Ref/input/multicol-orphans-widows.html b/Tests/LibWeb/Ref/input/multicol-orphans-widows.htmlnew file mode 100644index 00000000000..a1caea3ac2c--- /dev/null+++ b/Tests/LibWeb/Ref/input/multicol-orphans-widows.html@@ -0,0 +1,23 @@+<!DOCTYPE html>+<link rel="match" href="../expected/multicol-orphans-widows-ref.html">+<style>+@font-face {+ font-family: Ahem;+ src: url("../data/fonts/Ahem.ttf");+}+body { margin: 0; }+.multicol { columns: 2; column-gap: 20px; column-fill: auto; height: 60px; width: 220px; margin-bottom: 10px; font: 20px/20px Ahem; color: green; }+.multicol p { margin: 0; }+.block { height: 40px; background: blue; overflow: hidden; }+</style>+<div class="multicol">+ <p>X<br>X<br>X<br>X</p>+</div>+<div class="multicol">+ <div class="block"></div>+ <p>X<br>X<br>X</p>+</div>+<div class="multicol" style="orphans: 1; widows: 1">+ <div class="block"></div>+ <p>X<br>X<br>X</p>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-001.htmlnew file mode 100644index 00000000000..e059690d88d--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-001.html@@ -0,0 +1,82 @@+<!DOCTYPE html>++ <meta charset="UTF-8">++ <title>CSS Fragmentation level 3 Test: 'widows' and content distribution in columns</title>++ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">+ <link rel="help" href="https://www.w3.org/TR/css-break-3/#widows-orphans">+ <link rel="match" href="../../../../expected/wpt-import/css/css-break/reference/widows-001-ref.html">++ <!--+ Date created: November 7th 2020+ Last modified: November 17th 2020+ -->++ <!--++ Bug 1562420: Implement orphans and widows for individual columns of a multicolumn element+ https://bugzilla.mozilla.org/show_bug.cgi?id=1562420++ Bug 137367: Implement orphans and widows+ https://bugzilla.mozilla.org/show_bug.cgi?id=137367++ -->++ <meta name="assert" content="When column boxes are filled sequentially, their content should be adjusted and fragmented in accordance with the 'widows' declaration. In the test, since the 3rd column box was going to get only 1 line box, then a class B break point is allowed and should occur before the last line box of the 2nd column box and after the next-to-last line box of the 2nd column box so that there is a minimum of 2 line boxes at the top of the 3rd column box.">++ <!--++ Breaking at a class B break point is allowed only if (...)+ the number of line boxes between the break and the end+ of the box is the value of widows or more.+ 4.4 Unforced Breaks+ https://www.w3.org/TR/css-break-3/#unforced-breaks++ -->++ <style>+ div+ {+ border: orange solid 4px;+ font-size: 20px;+ line-height: 1.3; /* computes to 26px */+ height: 104px; /* Therefore, exactly 4 line boxes */+ margin-bottom: 1em;+ padding: 0.5em; /* computes to 10px */+ width: 490px;++ columns: 3 auto;+ column-fill: auto;+ column-gap: 1em;+ column-rule: blue solid 4px;+ }++ div#test+ {+ widows: 2; /* widows' initial value is 2 */++ /*+ "The widows property specifies the minimum number of line boxes of a+ block container that must be left in a fragment <em>after</em> a+ column break."++ coming from+ CSS Fragmentation Module Level 3, section 3.3 Breaks Between Lines: orphans, widows+ https://www.w3.org/TR/css-break-3/#widows-orphans+ */+ }++ div#reference+ {+ widows: 1;+ }+ </style>++ <p>Test passes if the digits inside both orange-bordered rectangles are <strong>distributed identically</strong>.++ <div id="test">1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9</div>++ <div id="reference">1<br>2<br>3<br>4<br>5<br>6<br>7<br><br>8<br>9</div>++ <!-- Same as div#test except 1 extra br here ^ -->diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-001.htmlnew file mode 100644index 00000000000..01fd491e550--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-001.html@@ -0,0 +1,31 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Fragmentation level 3 Test: widows and block level boxes</title>+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">+<link rel="help" href="https://drafts.csswg.org/css-break/#widows-orphans">+<link rel="match" href="../../../../expected/wpt-import/css/css-break/reference/widows-orphans-001-ref.html">+<meta name="assert" content="The widows property has no effect on block container boxes that contains only block-level boxes.">+<style>+div p { margin: 0; }++div {+ columns: 2;+ column-gap: 0;+ position: absolute; /* shrinkwrap. Using an explicit width in 'ch' with a monospace font would be fine as well if all UAs supported 'ch', but some don't. */+ column-fill: balance-all; /* to make sure it balances as well on paged media */++ widows: 4;+}++/* If the property applied to block container boxes that contain block-level boxes,+ it would force the two two-line paragraphs to stick together.*/++</style>+<body>+ <p>Test passes if there are 4 “X” characters <strong>arranged in a 2 by 2 square</strong> below.++ <div>+ <p>X<br>X+ <p>X<br>X+ </div>+</body>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-003.htmlnew file mode 100644index 00000000000..ba7a1371951--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-003.html@@ -0,0 +1,31 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Fragmentation level 3 Test: orphans and block level boxes</title>+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">+<link rel="help" href="https://drafts.csswg.org/css-break/#widows-orphans">+<link rel="match" href="../../../../expected/wpt-import/css/css-break/reference/widows-orphans-001-ref.html">+<meta name="assert" content="The orphans property has no effect on block container boxes that contains only block-level boxes.">+<style>+div p { margin: 0; }++div {+ columns: 2;+ column-gap: 0;+ position: absolute; /* shrinkwrap. Using an explicit width in 'ch' with a monospace font would be fine as well if all UAs supported 'ch', but some don't. */+ column-fill: balance-all; /* to make sure it balances as well on paged media */++ orphans: 4;+}++/* If the property applied to block container boxes that contain block-level boxes,+ it would force the two two-line paragraphs to stick together.*/++</style>+<body>+ <p>Test passes if there are 4 “X” characters <strong>arranged in a 2 by 2 square</strong> below.++ <div>+ <p>X<br>X+ <p>X<br>X+ </div>+</body>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-006.htmlnew file mode 100644index 00000000000..e8aef816efb--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-break/widows-orphans-006.html@@ -0,0 +1,22 @@+<!DOCTYPE html>+<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">+<link rel="help" href="https://www.w3.org/TR/css-break-3/#widows-orphans">+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1153517">+<link rel="match" href="../../../../expected/wpt-import/css/css-break/../reference/ref-filled-green-100px-square.xht">+<style>+ #mc > div { display:inline-block; width:100%; height:20px; }+ #mc > div.red { background:red; }+</style>+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>+<div id="mc" style="overflow:hidden; columns:1; column-fill:auto; width:100px; height:100px; orphans:1; widows:1; line-height:0; background:green;">+ <div></div>+ <div class="red"></div>+ <div class="red"></div>+ <div class="red"></div>+ <div class="red"></div>+ <div class="red"></div>+</div>+<script>+ document.body.offsetTop,+ mc.style.widows = 5;+</script>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/balance-orphans-widows-000.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/balance-orphans-widows-000.htmlnew file mode 100644index 00000000000..b4ad2731651--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-multicol/balance-orphans-widows-000.html@@ -0,0 +1,37 @@+<!DOCTYPE html>+<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">+<link rel="help" href="https://www.w3.org/TR/css-multicol-1/#filling-columns">+<link rel="help" href="https://www.w3.org/TR/css-break-3/#widows-orphans">+<link rel="match" href="../../../../expected/wpt-import/css/css-multicol/../reference/ref-filled-green-100px-square.xht">+<style>+ .multicol {+ columns: 2;+ orphans: 4;+ widows: 4;+ width: 100px;+ column-gap: 80px;+ column-rule: 80px solid green;+ line-height: 0;+ background: red;+ }+ span {+ display: inline-block;+ width: 100%;+ height: 10px;+ background: green;+ }+ span.tall {+ height: 40px;+ }+</style>+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>+<div class="multicol">+ <span></span><br>+ <span></span><br>+ <span class="tall"></span><br>+ <span class="tall"></span><br>+ <span class="tall"></span><br>+ <span class="tall"></span><br>+ <span></span><br>+ <span></span><br>+</div>diff --git a/Tests/LibWeb/Text/expected/multicol-widows-trailing-break.txt b/Tests/LibWeb/Text/expected/multicol-widows-trailing-break.txtnew file mode 100644index 00000000000..7952fa6cfee--- /dev/null+++ b/Tests/LibWeb/Text/expected/multicol-widows-trailing-break.txt@@ -0,0 +1,2 @@+br: 200,0+pre: 200,0diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-break/widows-orphans-005.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-break/widows-orphans-005.txtnew file mode 100644index 00000000000..8878e5224da--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-break/widows-orphans-005.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass [data-offset-x] 1+Pass [data-offset-x] 2+Pass [data-offset-x] 3+Pass [data-offset-x] 4\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/multicol-widows-trailing-break.html b/Tests/LibWeb/Text/input/multicol-widows-trailing-break.htmlnew file mode 100644index 00000000000..4ae91be9d5d--- /dev/null+++ b/Tests/LibWeb/Text/input/multicol-widows-trailing-break.html@@ -0,0 +1,27 @@+<!DOCTYPE html>+<script src="include.js"></script>+<style>+ @font-face { font-family: Ahem; src: url(../../Ref/data/fonts/Ahem.ttf); }+ body { margin: 0; }+ .mc { columns: 2; column-gap: 0; column-fill: auto; height: 100px; width: 400px; font: 20px/20px Ahem; }+ p, pre { margin: 0; font: inherit; }+</style>+<div class="mc" id="br"><p style="widows: 3">l1<br>l2<br>l3<br><span id="br-line">l4</span><br>l5<br>l6<br></p></div>+<div class="mc" id="pre"><pre>p1+p2+p3+p4+<span id="pre-line">p5</span>+p6+</pre></div>+<script>+ asyncTest(async done => {+ await document.fonts.load("20px Ahem");+ for (const id of ["br", "pre"]) {+ const origin = document.getElementById(id).getBoundingClientRect();+ const rect = document.getElementById(`${id}-line`).getBoundingClientRect();+ println(`${id}: ${rect.x - origin.x},${rect.y - origin.y}`);+ }+ done();+ });+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-break/widows-orphans-005.html b/Tests/LibWeb/Text/input/wpt-import/css/css-break/widows-orphans-005.htmlnew file mode 100644index 00000000000..1d7d0c5ae65--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-break/widows-orphans-005.html@@ -0,0 +1,45 @@+<!DOCTYPE html>+<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">+<link rel="help" href="https://drafts.csswg.org/css-break/#widows-orphans">+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1022348">+<meta name="assert" content="Here's a multicol container with four lines, and a widows requirement of 2. We cannot honor that requirement, because the third line alone is too tall to fit in a column.">+<style>+ .multicol {+ position: relative;+ columns: 3;+ column-fill: auto;+ column-gap: 10px;+ width: 320px;+ height: 200px;+ orphans: 1;+ widows: 2;+ column-rule: 1px dotted;+ line-height: 20px;+ }+ .ibk {+ display: inline-block;+ width: 70px;+ }+</style>+<p>+ There should be three columns below. In the first column there should be a+ black rectangle and a yellow rectangle. In the second column there should be a+ cyan rectangle. In the third column there should be a hotpink rectangle.</p>+<div class="multicol">+ <div class="ibk" style="height:50px; background:black;" data-offset-x="0"></div><br>+ <div class="ibk" style="height:50px; background:yellow;" data-offset-x="0"></div><br>+ <div class="ibk" style="height:285px;" data-offset-x="110">+ <!-- The implementations differ here. Gecko lets the inline-block overflow+ the column, while Blink slices the inline-block and puts what doesn't+ fit in the second column into the third. Blink has a bug, but that's+ not the bug we want to test here. -->+ <div style="height:100px; background:cyan;"></div>+ </div><br>+ <div class="ibk" style="height:10px; background:hotpink;" data-offset-x="220"></div><br>+</div>+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../resources/check-layout-th.js"></script>+<script>+ checkLayout("[data-offset-x]");+</script>