fixes #7548 - Scroll bar because auto height adjustment doesn't take <0.5 values into account (#7549)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
pull/7745/head
Lars Artmann 2023-03-15 09:55:11 +01:00 committed by GitHub
parent ec4228ab6a
commit ae0ed4176b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -341,14 +341,15 @@ function keepParentInformedAboutDimensionChanges() {
} }
const mainElementStyles = getComputedStyle(mainElement); const mainElementStyles = getComputedStyle(mainElement);
const contentHeight = // Use, .height as that gives more accurate value in floating point. Also, do a ceil on the total sum so that whatever happens there is enough iframe size to avoid scroll.
mainElement.offsetHeight + const contentHeight = Math.ceil(
parseInt(mainElementStyles.marginTop) + parseFloat(mainElementStyles.height) +
parseInt(mainElementStyles.marginBottom); parseFloat(mainElementStyles.marginTop) +
const contentWidth = parseFloat(mainElementStyles.marginBottom));
mainElement.offsetWidth + const contentWidth = Math.ceil(
parseInt(mainElementStyles.marginLeft) + parseFloat(mainElementStyles.width) +
parseInt(mainElementStyles.marginRight); parseFloat(mainElementStyles.marginLeft) +
parseFloat(mainElementStyles.marginRight));
// During first render let iframe tell parent that how much is the expected height to avoid scroll. // During first render let iframe tell parent that how much is the expected height to avoid scroll.
// Parent would set the same value as the height of iframe which would prevent scroll. // Parent would set the same value as the height of iframe which would prevent scroll.