diff options
author | Andreas Kling <kling@serenityos.org> | 2023-04-29 20:18:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-30 05:52:19 +0200 |
commit | 5236819f58b1ace2197d099c0d15bddd6a541cb4 (patch) | |
tree | a9749cc7883547642945ed94faf30248024b772e /Userland/Libraries/LibWeb | |
parent | f7e034d4b257a22b898252d62652587601fa7f99 (diff) | |
download | serenity-5236819f58b1ace2197d099c0d15bddd6a541cb4.zip |
LibWeb: Resolve horizontal auto margins for images with `display: block`
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index fdd5df089e..af4d568d8e 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -210,6 +210,11 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const& }; auto input_width = [&] { + if (is<ReplacedBox>(box)) { + // NOTE: Replaced elements had their width calculated independently above. + // We use that width as the input here to ensure that margins get resolved. + return CSS::Length::make_px(box_state.content_width()); + } if (is<TableWrapper>(box)) return CSS::Length::make_px(compute_width_for_table_wrapper(box, available_space)); if (should_treat_width_as_auto(box, available_space)) |