|
|
@@ -266,6 +266,9 @@ this.docHelper = this.docHelper || (() => {
|
|
|
}
|
|
|
|
|
|
function getSize(imageElement) {
|
|
|
+ const boxSizing = imageElement.style.getPropertyValue("box-sizing");
|
|
|
+ const boxSizingImportant = imageElement.style.getPropertyPriority("box-sizing");
|
|
|
+ imageElement.style.setProperty("box-sizing", "border-box", "important");
|
|
|
const computedStyle = getComputedStyle(imageElement);
|
|
|
const paddingLeft = getWidth("padding-left", computedStyle);
|
|
|
const paddingRight = getWidth("padding-right", computedStyle);
|
|
|
@@ -273,6 +276,11 @@ this.docHelper = this.docHelper || (() => {
|
|
|
const paddingBottom = getWidth("padding-bottom", computedStyle);
|
|
|
const width = imageElement.clientWidth;
|
|
|
const height = imageElement.clientHeight;
|
|
|
+ if (boxSizing) {
|
|
|
+ imageElement.style.setProperty("box-sizing", boxSizing, boxSizingImportant);
|
|
|
+ } else {
|
|
|
+ imageElement.style.removeProperty("box-sizing");
|
|
|
+ }
|
|
|
if (width >= 0 && height >= 0 && paddingLeft >= 0 && paddingRight >= 0 && paddingTop >= 0 && paddingBottom >= 0) {
|
|
|
return {
|
|
|
width: (paddingLeft || paddingRight) && (width - paddingLeft - paddingRight) + "px",
|