forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Use static position for abspos box axes with auto insets
When both insets in a given axis are auto, we should use the static position for absolutely positioned elements. By doing this correctly, we exposed a bunch of other small bugs which had to be fixed to compensate for new test failures. Those fixes are included here as well: - Don't apply margins twice. - Compute the static position containing block chain correctly. This makes https://brave.com/ look much better. :^)
- Loading branch information
1 parent
ee3dd79
commit f6fbb64
Showing
5 changed files
with
54 additions
and
10 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Tests/LibWeb/Layout/expected/abspos-with-static-position-in-one-axis.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline | ||
BlockContainer <html> at (0,0) content-size 800x33 [BFC] children: not-inline | ||
BlockContainer <body> at (8,8) content-size 784x17 children: not-inline | ||
BlockContainer <div> at (8,8) content-size 784x17 children: inline | ||
frag 0 from TextNode start: 0, length: 13, rect: [8,8 100.203125x17] baseline: 13.296875 | ||
"hello friends" | ||
TextNode <#text> | ||
ImageBox <img> at (50,25) content-size 100x100 positioned children: not-inline | ||
|
||
ViewportPaintable (Viewport<#document>) [0,0 800x600] | ||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x33] overflow: [0,0 800x125] | ||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17] overflow: [8,8 784x117] | ||
PaintableWithLines (BlockContainer<DIV>) [8,8 784x17] | ||
TextPaintable (TextNode<#text>) | ||
ImagePaintable (ImageBox<IMG>) [50,25 100x100] |
10 changes: 10 additions & 0 deletions
10
Tests/LibWeb/Layout/input/abspos-with-static-position-in-one-axis.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!doctype html><style> | ||
* { outline: 1px solid black; } | ||
img { | ||
position: absolute; | ||
width: 100px; | ||
height: 100px; | ||
background: green; | ||
left: 50px; | ||
} | ||
</style><div>hello friends</div><img> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters