Dynamic styles
Where do the old/new content width/height come from?
TL;DR
TL;DR
If itâs the root view transition then itâs the snapshot containing block width/height.
Otherwise itâs probably the width/height of the elementâs border box, unless youâre using box-sizing: content-box; because youâre a hipster.
TS;WM
TS;WM
Let (
oldContentWidth,ÂoldContentHeight) be (capturedElementâs old width,ÂcapturedElementâs old height) ifÂcapturedElementâs old box properties isnull, otherwiseÂcapturedElementâs old box propertiesâs content boxâs size.
if (capturedElement === document.documentElement) {
capturedElement.old.width = snapshotContainingBlock.width;
capturedElement.old.height = snapshotContainingBlock.height;
} else {
capturedElement.old.width = capturedElement.old.borderBox.width;
capturedElement.old.height = capturedElement.old.borderBox.height;
}
if (capturedElement.old.boxProperties === null) {
oldContentWidth = capturedElement.old.width;
oldContentHeight = capturedElement.old.height;
} else {
oldContentWidth = capturedElement.old.contentBox.width;
oldContentHeight = capturedElement.old.contentBox.height;
}
Let (
newContentWidth,ÂnewContentHeight) be (width,Âheight) if new box properties isnull, otherwiseÂcapturedElementâs new box propertiesâs content boxâs size.
if (capturedElement.new.boxSizing === 'content-box') {
width = capturedElement.new.contentBox.width;
height = capturedElement.new.contentBox.height;
} else {
width = capturedElement.new.borderBox.width;
height = capturedElement.new.borderBox.height;
}
if (capturedElement.new.boxProperties === null) {
newContentWidth = width;
newContentHeight = height;
} else {
newContentWidth = capturedElement.new.contentBox.width;
newContentHeight = capturedElement.new.contentBox.height;
}