Gildas 7 лет назад
Родитель
Сommit
8be6bd3f58
1 измененных файлов с 2 добавлено и 4 удалено
  1. 2 4
      lib/single-file/util/doc-helper.js

+ 2 - 4
lib/single-file/util/doc-helper.js

@@ -306,9 +306,7 @@ this.docHelper = this.docHelper || (() => {
 	function getSize(win, imageElement) {
 		let pxWidth = imageElement.naturalWidth;
 		let pxHeight = imageElement.naturalHeight;
-		if (pxWidth > 0 && pxHeight > 0) {
-			return { pxWidth, pxHeight };
-		} else {
+		if (!pxWidth && !pxHeight) {
 			const computedStyle = win.getComputedStyle(imageElement);
 			let removeBorderWidth = false;
 			if (computedStyle.getPropertyValue("box-sizing") == "content-box") {
@@ -338,8 +336,8 @@ this.docHelper = this.docHelper || (() => {
 			}
 			pxWidth = Math.max(0, imageElement.clientWidth - paddingLeft - paddingRight - borderLeft - borderRight);
 			pxHeight = Math.max(0, imageElement.clientHeight - paddingTop - paddingBottom - borderTop - borderBottom);
-			return { pxWidth, pxHeight };
 		}
+		return { pxWidth, pxHeight };
 	}
 
 	function getWidth(styleName, computedStyle) {