소스 검색

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.
Sergey Bugaev 5 년 전
부모
커밋
756bdb2a42
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Libraries/LibHTML/Layout/LayoutBlock.cpp

+ 1 - 1
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();