|
|
@@ -305,12 +305,27 @@ this.docHelper = this.docHelper || (() => {
|
|
|
|
|
|
function getSize(win, imageElement) {
|
|
|
const computedStyle = win.getComputedStyle(imageElement);
|
|
|
+ let boxSizingEffective = false;
|
|
|
+ const boxSizingValue = imageElement.style.getPropertyValue("box-sizing");
|
|
|
+ const boxSizingPriority = imageElement.style.getPropertyPriority("box-sizing");
|
|
|
+ const clientWidth = imageElement.clientWidth;
|
|
|
+ if (computedStyle.getPropertyValue("box-sizing") == "content-box") {
|
|
|
+ imageElement.style.setProperty("box-sizing", "border-box", "important");
|
|
|
+ } else {
|
|
|
+ imageElement.style.setProperty("box-sizing", "content-box", "important");
|
|
|
+ }
|
|
|
+ boxSizingEffective = imageElement.clientWidth != clientWidth;
|
|
|
+ if (boxSizingValue) {
|
|
|
+ imageElement.style.setProperty("box-sizing", boxSizingValue, boxSizingPriority);
|
|
|
+ } else {
|
|
|
+ imageElement.style.removeProperty("box-sizing");
|
|
|
+ }
|
|
|
let paddingLeft, paddingRight, paddingTop, paddingBottom, borderLeft, borderRight, borderTop, borderBottom;
|
|
|
paddingLeft = getWidth("padding-left", computedStyle);
|
|
|
paddingRight = getWidth("padding-right", computedStyle);
|
|
|
paddingTop = getWidth("padding-top", computedStyle);
|
|
|
paddingBottom = getWidth("padding-bottom", computedStyle);
|
|
|
- if (computedStyle.getPropertyValue("box-sizing") == "content-box") {
|
|
|
+ if (boxSizingEffective && computedStyle.getPropertyValue("box-sizing") == "content-box") {
|
|
|
borderLeft = getWidth("border-left-width", computedStyle);
|
|
|
borderRight = getWidth("border-right-width", computedStyle);
|
|
|
borderTop = getWidth("border-top-width", computedStyle);
|