summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp13
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineLevelIterator.h1
3 files changed, 11 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index 6fa30bbf02..228d3b3285 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -75,14 +75,6 @@ void InlineFormattingContext::run(Box const&, LayoutMode layout_mode)
generate_line_boxes(layout_mode);
- containing_block().for_each_child([&](auto& child) {
- VERIFY(child.is_inline());
- if (is<Box>(child) && child.is_absolutely_positioned()) {
- parent().add_absolutely_positioned_box(static_cast<Box&>(child));
- return;
- }
- });
-
float min_line_height = containing_block().line_height();
float max_line_width = 0;
float content_height = 0;
@@ -201,6 +193,11 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
line_builder.append_box(box, item.border_start + item.padding_start, item.padding_end + item.border_end);
break;
}
+ case InlineLevelIterator::Item::Type::AbsolutelyPositionedElement:
+ if (is<Box>(*item.node))
+ parent().add_absolutely_positioned_box(static_cast<Layout::Box const&>(*item.node));
+ break;
+
case InlineLevelIterator::Item::Type::Text: {
auto& text_node = verify_cast<Layout::TextNode>(*item.node);
line_builder.break_if_needed(layout_mode, item.border_box_width(), item.should_force_break);
diff --git a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp
index 51d022eea9..0088530355 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp
@@ -155,8 +155,12 @@ Optional<InlineLevelIterator::Item> InlineLevelIterator::next(float available_wi
}
if (m_current_node->is_absolutely_positioned()) {
+ auto& node = *m_current_node;
skip_to_next();
- return next(available_width);
+ return Item {
+ .type = Item::Type::AbsolutelyPositionedElement,
+ .node = &node,
+ };
}
if (is<Layout::BreakNode>(*m_current_node)) {
diff --git a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.h b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.h
index bfc29421c7..c4b6271293 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.h
+++ b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.h
@@ -26,6 +26,7 @@ public:
Text,
Element,
ForcedBreak,
+ AbsolutelyPositionedElement,
};
Type type {};
Layout::Node const* node { nullptr };