From 756bdb2a42b4af38ea23d2d66147e52c2d30dd7a Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Wed, 25 Sep 2019 11:56:16 +0300 Subject: [PATCH] LibHTML: Fix moving inline elements to unrelated block elements LayoutBlock::inline_wrapper() is supposed to return an inline wrapper, a special anonymous block element intended to wrap inline children of a block element that also has block children. Add a check for whether the existing block child element is anonymous (refers to a DOM node), and if it's not create a new anonymous wrapper. --- Libraries/LibHTML/Layout/LayoutBlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibHTML/Layout/LayoutBlock.cpp b/Libraries/LibHTML/Layout/LayoutBlock.cpp index abbf5e7e25..eed6101479 100644 --- a/Libraries/LibHTML/Layout/LayoutBlock.cpp +++ b/Libraries/LibHTML/Layout/LayoutBlock.cpp @@ -12,7 +12,7 @@ LayoutBlock::~LayoutBlock() LayoutNode& LayoutBlock::inline_wrapper() { - if (!last_child() || !last_child()->is_block()) { + if (!last_child() || !last_child()->is_block() || last_child()->node() != nullptr) { append_child(adopt(*new LayoutBlock(nullptr, {}))); } return *last_child();