1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

LibWeb: Resolve auto margins on abspos elements in more cases

Specifically, we now handle cases where all three of `left`, `width`
and `right` are non-`auto`.
This commit is contained in:
Andreas Kling 2023-06-13 16:25:11 +02:00
parent f7dc2742a9
commit 41da9a4231
3 changed files with 64 additions and 10 deletions

View file

@ -0,0 +1,6 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x18 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x0 children: not-inline
BlockContainer <div#foo> at (350,1) content-size 100x100 positioned [BFC] children: not-inline
BlockContainer <div#bar> at (699,101) content-size 100x100 positioned [BFC] children: not-inline
BlockContainer <div#baz> at (1,201) content-size 100x100 positioned [BFC] children: not-inline

View file

@ -0,0 +1,31 @@
<!DOCTYPE html><style>
* {
border: 1px solid black;
}
div {
height: 100px;
width: 100px;
position: absolute;
height: 100px;
}
#foo {
margin: auto;
left: 0px;
right: 0px;
top: 0px;
}
#bar {
margin-left: auto;
margin-right: 0px;
left: 0px;
right: 0px;
top: 100px;
}
#baz {
margin-left: 0px;
margin-right: auto;
left: 0px;
right: 0px;
top: 200px;
}
</style><div id=foo></div><div id=bar></div><div id=baz></div>