Skip to content

Commit 98e690a

Browse files
committed
1 parent 5cf0658 commit 98e690a

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

litehtml/element.cpp

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void litehtml::element::draw( uint_ptr hdc, int x, int y, const position* clip )
181181

182182
draw_background(hdc, x, y, clip);
183183

184-
if(m_overflow == overflow_hidden)
184+
if(m_overflow > overflow_visible)
185185
{
186186
m_doc->container()->set_clip(pos, true, true);
187187
}
@@ -218,7 +218,7 @@ void litehtml::element::draw( uint_ptr hdc, int x, int y, const position* clip )
218218
el->draw(hdc, pos.left(), pos.top(), clip);
219219
}
220220

221-
if(m_overflow == overflow_hidden)
221+
if(m_overflow > overflow_visible)
222222
{
223223
m_doc->container()->del_clip();
224224
}
@@ -442,6 +442,16 @@ int litehtml::element::render( int x, int y, int max_width )
442442
m_margins.top = m_doc->cvt_units(m_css_margins.top, m_font_size);
443443
m_margins.bottom = m_doc->cvt_units(m_css_margins.bottom, m_font_size);
444444

445+
// reset auto margins
446+
if(m_css_margins.left.is_predefined())
447+
{
448+
m_margins.left = 0;
449+
}
450+
if(m_css_margins.right.is_predefined())
451+
{
452+
m_margins.right = 0;
453+
}
454+
445455
m_pos.move_to(x, y);
446456

447457
m_pos.x += content_margins_left();
@@ -2157,6 +2167,17 @@ int litehtml::element::place_element( element* el, int max_width )
21572167
case display_inline_block:
21582168
ret_width = el->render(line_left, line_top, line_right);
21592169
break;
2170+
case display_block:
2171+
if(el->is_replaced() || el->is_floats_holder())
2172+
{
2173+
el->m_pos.width = el->m_css_width.calc_percent(line_right - line_left);
2174+
el->m_pos.height = el->m_css_height.calc_percent(0);
2175+
if(el->m_pos.width || el->m_pos.height)
2176+
{
2177+
el->calc_outlines(line_right - line_left);
2178+
}
2179+
}
2180+
break;
21602181
case display_inline_text:
21612182
{
21622183
litehtml::size sz;
@@ -2228,7 +2249,7 @@ int litehtml::element::place_element( element* el, int max_width )
22282249
case display_table_cell:
22292250
case display_table_caption:
22302251
case display_table_row:
2231-
if(el->is_replaced())
2252+
if(el->is_replaced() || el->is_floats_holder())
22322253
{
22332254
ret_width = el->render(line_left, line_top, line_right - line_left);
22342255
} else
@@ -2448,3 +2469,8 @@ litehtml::position litehtml::element::get_placement()
24482469
}
24492470
return pos;
24502471
}
2472+
2473+
void litehtml::element::reset_size()
2474+
{
2475+
2476+
}

litehtml/element.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ namespace litehtml
184184
virtual void draw_content(uint_ptr hdc, const litehtml::position& pos);
185185
virtual void init();
186186
virtual void get_inline_boxes(position::vector& boxes);
187+
virtual void reset_size();
187188

188189
private:
189190
bool select_one(const tstring& selector);

0 commit comments

Comments
 (0)