summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-10-06 17:11:21 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-06 17:15:28 +0200
commit2baad565ca74b21e3bab10479caa7d50b912bf0d (patch)
tree84e5270d58e468a594b3e80727b1aa61c405dbf0 /Userland/Libraries/LibWeb/Layout
parentf190e394b3ba227028baed06ab5c89f1b193e0f4 (diff)
downloadserenity-2baad565ca74b21e3bab10479caa7d50b912bf0d.zip
LibWeb: Remove bogus verify_cast when dimensioning inline-blocks
There's no need to make the assumption that any inline-block box will be represented by a BlockContainer. Nothing we do with the box here requires that specific type anyway.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index e174d2fdbe..296637de72 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -122,12 +122,10 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l
return;
}
- if (box.is_inline_block()) {
- auto const& inline_block = verify_cast<BlockContainer>(box);
-
- auto& width_value = inline_block.computed_values().width();
+ if (box.display().is_flow_root_inside()) {
+ auto const& width_value = box.computed_values().width();
if (width_value.is_auto()) {
- auto result = calculate_shrink_to_fit_widths(inline_block);
+ auto result = calculate_shrink_to_fit_widths(box);
auto available_width = m_available_space->width.to_px()
- box_state.margin_left
@@ -144,18 +142,18 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l
// NOTE: We can't resolve percentages yet. We'll have to wait until after inner layout.
} else {
auto container_width = CSS::Length::make_px(m_available_space->width.to_px());
- box_state.set_content_width(width_value.resolved(box, container_width).to_px(inline_block));
+ box_state.set_content_width(width_value.resolved(box, container_width).to_px(box));
}
}
- auto independent_formatting_context = layout_inside(inline_block, layout_mode, box_state.available_inner_space_or_constraints_from(*m_available_space));
+ auto independent_formatting_context = layout_inside(box, layout_mode, box_state.available_inner_space_or_constraints_from(*m_available_space));
- auto& height_value = inline_block.computed_values().height();
+ auto const& height_value = box.computed_values().height();
if (height_value.is_auto()) {
// FIXME: (10.6.6) If 'height' is 'auto', the height depends on the element's descendants per 10.6.7.
- parent().compute_height(inline_block, AvailableSpace(AvailableSize::make_indefinite(), AvailableSize::make_indefinite()));
+ parent().compute_height(box, AvailableSpace(AvailableSize::make_indefinite(), AvailableSize::make_indefinite()));
} else {
auto container_height = CSS::Length::make_px(m_containing_block_state.content_height());
- box_state.set_content_height(height_value.resolved(box, container_height).to_px(inline_block));
+ box_state.set_content_height(height_value.resolved(box, container_height).to_px(box));
}
if (independent_formatting_context)