aboutsummaryrefslogtreecommitdiffstats
path: root/src/render_image.cpp
diff options
context:
space:
mode:
authorYuri Kobets <[email protected]>2024-01-31 03:48:44 +0300
committerGitHub <[email protected]>2024-01-31 03:48:44 +0300
commit6ca1ab0419e770e6d35a1ef690238773a1dafcee (patch)
tree16df635edd594dc1d1b9d0044993e2ae4d0e0200 /src/render_image.cpp
parent8c320007878795fe629de7fe1eaef9328ac9c719 (diff)
parentd85ebec101e77825e5708e58df0e2508ec4fd389 (diff)
Merge pull request #285 from litehtml/flex_layoutHEADv0.9dev
Flex layout
Diffstat (limited to 'src/render_image.cpp')
-rw-r--r--src/render_image.cpp17
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())