about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/css/layout.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index 471c7364..3cc65578 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -1628,9 +1628,9 @@ proc addImage(ictx: var InlineContext; state: var InlineState;
     else:
       if osize.h > 0:
         atom.size.w = osize.w div osize.h * atom.size.h
-  elif not hasHeight:
+  elif not hasHeight and osize.w != 0:
     atom.size.h = osize.h div osize.w * atom.size.w
-  elif not hasWidth:
+  elif not hasWidth and osize.h != 0:
     atom.size.w = osize.w div osize.h * atom.size.h
   let iastate = InlineAtomState(
     vertalign: state.box.computed{"vertical-align"},