mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 18:05:08 +00:00
LibWeb: Rework the layout engine to use relative offsets
The box tree and line boxes now all store a relative offset from their containing block, instead of an absolute (document-relative) position. This removes a huge pain point from the layout system which was having to adjust offsets recursively when something moved. It also makes some layout logic significantly simpler. Every box can still find its absolute position by walking its chain of containing blocks and accumulating the translation from the root. This is currently what we do both for rendering and hit testing.
This commit is contained in:
parent
e836f09094
commit
656b01eb0f
21 changed files with 183 additions and 119 deletions
|
@ -59,7 +59,7 @@ void LayoutWidget::did_set_rect()
|
|||
|
||||
void LayoutWidget::update_widget()
|
||||
{
|
||||
auto adjusted_widget_position = rect().location().to_int_point();
|
||||
auto adjusted_widget_position = absolute_rect().location().to_int_point();
|
||||
auto& page_view = static_cast<const PageView&>(document().frame()->page().client());
|
||||
adjusted_widget_position.move_by(-page_view.horizontal_scrollbar().value(), -page_view.vertical_scrollbar().value());
|
||||
widget().move_to(adjusted_widget_position);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue