Files
rust_browser/tests/external/wpt/fixtures/wpt-css-css2-floats-clear-adjoining-float-nested-forced-clearance-002-test.html
Zachary D. Rowitsch 16abbd78e7 Bulk-import 2899 WPT CSS reftests and add import tooling
Add scripts/import_wpt_reftests.py to sparse-clone the upstream WPT repo
and bulk-import qualifying CSS reftests (no JS, no external resources) as
known_fail entries. 23 tests already pass and are promoted. The import
script is idempotent and exposed via `just import-wpt`. CI now prints the
WPT summary (pass=36 known_fail=2877 skip=1) on every run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:15:27 -05:00

76 lines
2.2 KiB
HTML

<!DOCTYPE html>
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<style>
#container {
width: 100px;
background: green;
}
#left {
float: left;
width: 25px;
height: 10px;
}
#right {
float: right;
width: 25px;
height: 20px;
}
#clears-left {
clear: left;
}
#zero {
margin-bottom: 40px;
margin-top: -20px;
}
#nested-float {
float: left;
width: 25px;
height: 20px;
}
#new-formatting-context {
overflow: hidden;
width: 60px;
height: 80px;
margin-top: -30px;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div id=container>
<div id=left></div>
<div id=right></div>
<div>
<div id=clears-left>
<div>
<div id=zero></div>
<div id=nested-float></div>
<!--
The margins up to this new formatting context are chosen to hit an
edge condition. At this point there are two possible margins:
- (adjoining) {-30px, 40px} => 10px
- (non-adjoining) {-20px, 40px} => 20px
The logic for placing this new formatting context however shouldn't
check these margins, as there is an ancestor ("clears-left") which
has clearance past adjoining floats ("left", and "right").
And "nested-float" should get placed at "10px".
However if we didn't have this logic the following would occur.
1. We'd try and place the formatting context using the "adjoining"
margins.
2. The new formatting context doesn't "fit" on the same edge as the
floats, so it would trigger a retry using with a new position
calculated using the "non-adjoining" margins.
3. During the next pass, it still doesn't think the margins have
been separated yet as the parent is still using the position
calculated by the forced clearance from above.
4. It will trigger a retry again (and if an implementation does this
in a loop, will timeout).
-->
<div id=new-formatting-context></div>
</div>
</div>
</div>
</div>