From b1a6a8600a8940a8980fe6d88421a18e2eb73875 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 11 Apr 2022 00:38:23 +0200 Subject: [PATCH] LibWeb: Honor "display:block" on IMG elements Previously we forced all image elements to be inline-level. Now they can participate in block layout if they prefer. :^) --- Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 17fdca1b91..440b92f8e2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -80,7 +80,11 @@ void HTMLImageElement::parse_attribute(FlyString const& name, String const& valu RefPtr HTMLImageElement::create_layout_node(NonnullRefPtr style) { - return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); + auto display = style->display(); + auto layout_node = adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); + if (display.is_block_outside()) + layout_node->set_inline(false); + return layout_node; } Gfx::Bitmap const* HTMLImageElement::bitmap() const