mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:18:12 +00:00
LibWeb: Fix off-by-one in initial containing block overflow calculation
We're using the outermost right and bottom child edges to determine the width and height of the ICB. However, since these edges are *within* the respective child's rectangle, we have to add 1 when turning them into width and height values. This fixes an issue where scrolling a document would shrink its viewport rect by 1 pixel (on both axes) on every scroll step.
This commit is contained in:
parent
79f2e8ae2a
commit
877ddaa016
1 changed files with 2 additions and 1 deletions
|
@ -589,7 +589,8 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m
|
|||
if (bottom_edge >= viewport_rect.height() || right_edge >= viewport_rect.width()) {
|
||||
auto& overflow_data = icb.ensure_overflow_data();
|
||||
overflow_data.scrollable_overflow_rect = viewport_rect.to_type<float>();
|
||||
overflow_data.scrollable_overflow_rect.set_size(right_edge, bottom_edge);
|
||||
// NOTE: The edges are *within* the rectangle, so we add 1 to get the width and height.
|
||||
overflow_data.scrollable_overflow_rect.set_size(right_edge + 1, bottom_edge + 1);
|
||||
} else {
|
||||
icb.clear_overflow_data();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue