LibWeb: Allow negative margins to influence inline offset after float

In 89ba00304c, the box' X position was
capped at 0 to prevent negative X positions to act as if there were
intruding floats on the left side. Instead, we need to check whether the
left side float intrusion we are going to calculate matters at all -
because if there's no matching float box, the intrusion is always going
to be 0 and we don't need to take the box' X position into account.

Fixes the floating publication images on https://lexfridman.com/.
This commit is contained in:
Jelle Raaijmakers
2025-07-28 00:01:37 +02:00
committed by Andreas Kling
parent 06ffe532c2
commit ab3e9799d5
Notes: github-actions[bot] 2025-07-28 10:13:04 +00:00
4 changed files with 50 additions and 9 deletions

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<style>
#a {
margin-left: -100px;
}
#b {
background-color: red;
float: left;
height: 200px;
width: 200px;
}
</style>
<!-- The text should be positioned to the right of the red square -->
<div id="a"><div id="b"></div>foo bar baz