[csswg-drafts] [css2][css-flow] Can a BFC root overlap floats that are 0px tall or wide? (#9172)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css2][css-flow] Can a BFC root overlap floats that are 0px tall or wide? ==
While implementing floats in Servo, I have noticed this WPT, which Gecko/Webkit/Blink pass but seems against the spec: https://wpt.fyi/results/css/CSS2/floats/zero-width-floats.html

This testcase is more complete and easier to see what's going on:
```html
<!DOCTYPE html>
<div style="margin-left:50px; width:100px;">
  <div style="float:left; width:0px; height:50px; outline:solid red"></div>
  <div style="float:right; width:0px; height:50px; outline:solid red;"></div>
  <div style="float:left; clear:both; width:25px; height:0px; outline:solid green"></div>
  <div style="float:right; clear:both; width:25px; height:0px; outline:solid green;"></div>
  <div style="float:left; width:0px; height:50px; outline:solid blue"></div>
  <div style="float:right; width:0px; height:50px; outline:solid blue;"></div>
  <div style="overflow:hidden; width:200px; margin:0 -50px; height:150px; background:cyan;"></div>
</div>
```

| Gecko, WebKit | Blink | Spec |
| - | - | - |
| ![](https://github.com/w3c/csswg-drafts/assets/7477678/e7993bc6-f47f-4ed3-8e0c-6de2748f6772) | ![](https://github.com/w3c/csswg-drafts/assets/7477678/076f7458-cce0-47f2-91cb-707d9628756d) | ![](https://github.com/w3c/csswg-drafts/assets/7477678/42ada657-57d6-4647-9245-b36c989a385c) |

Basically, Gecko and WebKit allow the BFC root to overlap floats whose width or height is 0px. Blink only allows it when the width is 0px.

I don't see any exception for 0px sizes in the spec: https://drafts.csswg.org/css2/#floats

> The border box of a table, a block-level replaced element, or an element in the normal flow that establishes a new [block formatting context](https://drafts.csswg.org/css2/#block-formatting) (such as an element with [`overflow`](https://drafts.csswg.org/css2/#propdef-overflow) other than [`visible`](https://drafts.csswg.org/css2/#valdef-overflow-visible)) must not overlap the margin box of any floats in the same block formatting context as the element itself.

TBH I don't think this exception makes much sense, so it would be good to know if such thing is required by compat or if browsers are willing to drop it.

Cc @mstensho and @bfgeek for https://chromium-review.googlesource.com/c/chromium/src/+/919065

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9172 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 8 August 2023 18:59:45 UTC