File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -33,18 +33,33 @@ void litehtml::el_image::parse_styles(bool is_reparse)
33
33
if (!m_css_height.val ())
34
34
{
35
35
m_css_height.fromString (get_attr (L" height" , L" auto" ), L" auto" );
36
- if (m_css_height.is_predefined ())
37
- {
38
- m_css_height.set_value ((float ) sz.height , css_units_px);
39
- }
40
36
}
41
37
if (!m_css_width.val ())
42
38
{
43
39
m_css_width.fromString (get_attr (L" width" , L" auto" ), L" auto" );
44
- if (m_css_width.is_predefined ())
40
+ }
41
+ if (m_css_height.is_predefined () && m_css_width.is_predefined ())
42
+ {
43
+ m_css_height.set_value ((float ) sz.height , css_units_px);
44
+ m_css_width.set_value ((float ) sz.width , css_units_px);
45
+ } else if (!m_css_height.is_predefined () && m_css_width.is_predefined ())
46
+ {
47
+ if (sz.height )
48
+ {
49
+ m_css_width.set_value ((float ) m_css_height.val () * (float )sz.width / (float )sz.height , css_units_px);
50
+ } else
45
51
{
46
52
m_css_width.set_value ((float ) sz.width , css_units_px);
47
53
}
54
+ } else if (m_css_height.is_predefined () && !m_css_width.is_predefined ())
55
+ {
56
+ if (sz.width )
57
+ {
58
+ m_css_height.set_value ((float ) m_css_width.val () * (float ) sz.height / (float )sz.width , css_units_px);
59
+ } else
60
+ {
61
+ m_css_height.set_value ((float ) sz.height , css_units_px);
62
+ }
48
63
}
49
64
}
50
65
You can’t perform that action at this time.
0 commit comments