1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:07:34 +00:00

LibWeb: Start implementing proper layout of replaced elements

LayoutReplaced now has intrinsic width, height and ratio. Only some of
the values may be present. The layout algorithm takes the various
configurations into account per the CSS specification.

This is still pretty immature but at least we're moving forward. :^)
This commit is contained in:
Andreas Kling 2020-06-05 19:13:27 +02:00
parent 7fcf61be35
commit 4d5ecf6e32
10 changed files with 215 additions and 22 deletions

View file

@ -26,8 +26,9 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Frame.h>
#include <LibWeb/PageView.h>
#include <LibWeb/Layout/LayoutDocument.h>
#include <LibWeb/Layout/LayoutWidget.h>
#include <LibWeb/PageView.h>
namespace Web {
@ -87,10 +88,8 @@ void Frame::did_scroll(Badge<PageView>)
return;
if (!m_document->layout_node())
return;
m_document->layout_node()->for_each_in_subtree([&](LayoutNode& layout_node) {
if (layout_node.is_widget()) {
layout_node.layout(LayoutNode::LayoutMode::Default);
}
m_document->layout_node()->for_each_in_subtree_of_type<LayoutWidget>([&](auto& layout_widget) {
layout_widget.update_widget();
return IterationDecision::Continue;
});
}