Index: Source/web/PageScaleConstraintsSet.cpp |
diff --git a/Source/web/PageScaleConstraintsSet.cpp b/Source/web/PageScaleConstraintsSet.cpp |
index ebb42ad6bf2d33161e95de6df182eb7cc6157da9..113517d557b0ac4c2f8c4c8e8b1ca9d7e95869d7 100644 |
--- a/Source/web/PageScaleConstraintsSet.cpp |
+++ b/Source/web/PageScaleConstraintsSet.cpp |
@@ -150,6 +150,12 @@ IntSize PageScaleConstraintsSet::mainFrameSize(int contentWidthIncludingScrollba |
&& m_userAgentConstraints.minimumScale < finalConstraints().minimumScale |
&& contentWidthIncludingScrollbar |
&& m_viewSize.width()) { |
+ |
+ // Special case where the contents are exactly as wide as the viewport to prevent an off-by-one due |
+ // to floating point imprecision in the aspect ratio height calculation. |
+ if (contentWidthIncludingScrollbar == m_viewSize.width()) |
+ return m_viewSize; |
+ |
return expandedIntSize(FloatSize( |
contentWidthIncludingScrollbar, |
computeHeightByAspectRatio(contentWidthIncludingScrollbar, m_viewSize))); |