diff options
Diffstat (limited to 'src/render_image.cpp')
-rw-r--r-- | src/render_image.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/render_image.cpp b/src/render_image.cpp index 63e622d7..1ff4574b 100644 --- a/src/render_image.cpp +++ b/src/render_image.cpp @@ -5,6 +5,7 @@ int litehtml::render_item_image::_render(int x, int y, const containing_block_context &containing_block_size, formatting_context* fmt_ctx, bool second_pass) { int parent_width = containing_block_size.width; + containing_block_context self_size = calculate_containing_block_context(containing_block_size); calc_outlines(parent_width); @@ -60,10 +61,10 @@ int litehtml::render_item_image::_render(int x, int y, const containing_block_co } } else if(!src_el()->css().get_height().is_predefined() && src_el()->css().get_width().is_predefined()) { - if (!get_predefined_height(m_pos.height, containing_block_size.height)) - { - m_pos.height = (int)src_el()->css().get_height().val(); - } + if(self_size.height.type != containing_block_context::cbc_value_type_auto && self_size.height > 0) + { + m_pos.height = self_size.height; + } // check for max-height if(!src_el()->css().get_max_height().is_predefined()) @@ -107,10 +108,10 @@ int litehtml::render_item_image::_render(int x, int y, const containing_block_co { m_pos.width = (int) src_el()->css().get_width().calc_percent(parent_width); m_pos.height = 0; - if (!get_predefined_height(m_pos.height, containing_block_size.height)) - { - m_pos.height = (int)src_el()->css().get_height().val(); - } + if(self_size.height.type != containing_block_context::cbc_value_type_auto && self_size.height > 0) + { + m_pos.height = self_size.height; + } // check for max-height if(!src_el()->css().get_max_height().is_predefined()) |