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