Skip to content

Commit f3b2fc0

Browse files
committed
fixed: incorrect floated block position
1 parent 24e622e commit f3b2fc0

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/render_block.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,16 +569,20 @@ std::shared_ptr<litehtml::render_item> litehtml::render_item_block::init()
569569
}
570570

571571
bool has_block_level = false;
572-
bool has_inlines = false;
572+
bool has_inlines = false;
573+
bool has_floats = false;
573574
for (const auto& el : m_children)
574575
{
575-
if(el->src_el()->is_block_box())
576-
{
577-
has_block_level = true;
578-
} else if(el->src_el()->is_inline_box())
579-
{
580-
has_inlines = true;
581-
}
576+
if(!el->src_el()->is_float())
577+
{
578+
if (el->src_el()->is_block_box())
579+
{
580+
has_block_level = true;
581+
} else if (el->src_el()->is_inline_box())
582+
{
583+
has_inlines = true;
584+
}
585+
}
582586
if(has_block_level && has_inlines)
583587
break;
584588
}

test/render/test24.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div style="position: relative; width: 300px">
2+
<span style="display: inline; background-color: green">lorem</span>
3+
<div style="background-color: red; float: right">ipsum</div>
4+
</div>

test/render/test24.htm.png

219 Bytes
Loading

0 commit comments

Comments
 (0)