Skip to content

Commit

Permalink
correct width and heigth calculation regarding to scrollbars (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed May 16, 2024
1 parent 94684a9 commit da8a450
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ public int getCalculatedHeight(final boolean includeBorder, final boolean includ
if (includeBorder) {
height += getBorderVertical();
}
else if (isScrollable(false, true) && !(element instanceof HtmlBody)) {
else if (isScrollable(true, true) && !(element instanceof HtmlBody)) {
height -= 17;
}

Expand Down Expand Up @@ -1460,7 +1460,7 @@ public int getCalculatedWidth(final boolean includeBorder, final boolean include
if (includeBorder) {
width += getBorderHorizontal();
}
else if (isScrollable(true, true) && !(element instanceof HtmlBody)) {
else if (isScrollable(false, true) && !(element instanceof HtmlBody)) {
width -= 17;
}

Expand Down Expand Up @@ -1896,9 +1896,9 @@ private boolean isScrollable(final boolean horizontal, final boolean ignoreSize)

String overflow;
if (horizontal) {
overflow = getStyleAttribute(Definition.OVERFLOW_Y_, false);
overflow = getStyleAttribute(Definition.OVERFLOW_X_, false);
if (StringUtils.isEmpty(overflow)) {
overflow = getStyleAttribute(Definition.OVERFLOW_Y, false);
overflow = getStyleAttribute(Definition.OVERFLOW_X, false);
}
// fall back to default
if (StringUtils.isEmpty(overflow)) {
Expand All @@ -1908,9 +1908,9 @@ private boolean isScrollable(final boolean horizontal, final boolean ignoreSize)
&& (ignoreSize || getContentWidth() > getCalculatedWidth());
}
else {
overflow = getStyleAttribute(Definition.OVERFLOW_X_, false);
overflow = getStyleAttribute(Definition.OVERFLOW_Y_, false);
if (StringUtils.isEmpty(overflow)) {
overflow = getStyleAttribute(Definition.OVERFLOW_X, false);
overflow = getStyleAttribute(Definition.OVERFLOW_Y, false);
}
// fall back to default
if (StringUtils.isEmpty(overflow)) {
Expand Down

0 comments on commit da8a450

Please sign in to comment.