mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Don't allow resolved width of abspos elements to become negative
We have to clamp the resulting width to 0 when solving for it.
This commit is contained in:
parent
8f311c61af
commit
3f6f3966b9
Notes:
sideshowbarker
2024-07-17 06:00:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3f6f3966b9
@ -0,0 +1,4 @@
|
||||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x0 children: not-inline
|
||||
BlockContainer <body.outer> at (8,8) content-size 0x0 positioned children: not-inline
|
||||
BlockContainer <div.inner> at (9,9) content-size 0x0 positioned children: not-inline
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html><html><head><style>
|
||||
.outer {
|
||||
position: absolute;
|
||||
}
|
||||
.inner {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style></head><body class="outer"><div class="inner">
|
@ -515,7 +515,7 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
||||
};
|
||||
|
||||
auto solve_for_width = [&] {
|
||||
return CSS::Length::make_px(width_of_containing_block - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - padding_right - border_right - margin_right.to_px(box) - right.to_px(box));
|
||||
return CSS::Length::make_px(max(CSSPixels(0), width_of_containing_block - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - padding_right - border_right - margin_right.to_px(box) - right.to_px(box)));
|
||||
};
|
||||
|
||||
auto solve_for_right = [&] {
|
||||
|
Loading…
Reference in New Issue
Block a user