diff options
author | Andreas Kling <kling@serenityos.org> | 2020-11-29 21:27:01 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-29 21:27:41 +0100 |
commit | d0636291fea68531aa74c7713ddb71ce3345be64 (patch) | |
tree | d2ca28bb72d3f82f0735fde369e62681e07eefb2 /Libraries | |
parent | eea7cabdbc59d8b5b6aa37a7414b6c20a06bf8d8 (diff) | |
download | serenity-d0636291fea68531aa74c7713ddb71ce3345be64.zip |
LibWeb: Resolve percentage width/height of inline-block boxes
Percentage lengths cannot be to_px()'ed directly, we have to resolve
them against a reference (the containing block) first.
Fixes #4248.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index d06f82aec6..e482fde305 100644 --- a/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -176,7 +176,7 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_ auto width = min(max(result.preferred_minimum_width, available_width), result.preferred_width); inline_block.set_width(width); } else { - inline_block.set_width(inline_block.style().width().to_px(inline_block)); + inline_block.set_width(inline_block.style().width().resolved(CSS::Length::make_px(0), containing_block, containing_block.width()).to_px(inline_block)); } layout_inside(inline_block, layout_mode); @@ -184,7 +184,7 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_ if (inline_block.style().height().is_undefined_or_auto()) { // FIXME: (10.6.6) If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. } else { - inline_block.set_height(inline_block.style().height().to_px(inline_block)); + inline_block.set_height(inline_block.style().height().resolved(CSS::Length::make_px(0), containing_block, containing_block.height()).to_px(inline_block)); } return; } |