Title: [270049] trunk/Source/WebCore
Revision
270049
Author
[email protected]
Date
2020-11-19 13:37:08 -0800 (Thu, 19 Nov 2020)

Log Message

[LFC][Integration] Do not stretch the border box with the scrollbars
https://bugs.webkit.org/show_bug.cgi?id=219174

Reviewed by Antti Koivisto.

Scrollbars are placed "between" the border and the padding box and they never stretch the border box. They may shrink the padding box though.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270048 => 270049)


--- trunk/Source/WebCore/ChangeLog	2020-11-19 21:06:46 UTC (rev 270048)
+++ trunk/Source/WebCore/ChangeLog	2020-11-19 21:37:08 UTC (rev 270049)
@@ -1,3 +1,15 @@
+2020-11-19  Zalan Bujtas  <[email protected]>
+
+        [LFC][Integration] Do not stretch the border box with the scrollbars
+        https://bugs.webkit.org/show_bug.cgi?id=219174
+
+        Reviewed by Antti Koivisto.
+
+        Scrollbars are placed "between" the border and the padding box and they never stretch the border box. They may shrink the padding box though.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
+
 2020-11-19  Chris Dumez  <[email protected]>
 
         Regression(r267865) Geolocation API's error callback should be nullable

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (270048 => 270049)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-19 21:06:46 UTC (rev 270048)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-19 21:37:08 UTC (rev 270049)
@@ -128,9 +128,13 @@
     replacedBox.setContentSizeForIntegration({ replacedOrInlineBlock.contentWidth(), replacedOrInlineBlock.contentHeight() });
 
     auto& replacedBoxGeometry = m_layoutState.ensureGeometryForBox(replacedBox);
-    replacedBoxGeometry.setVerticalScrollbarWidth(replacedOrInlineBlock.verticalScrollbarWidth());
-    replacedBoxGeometry.setHorizontalScrollbarHeight(replacedOrInlineBlock.horizontalScrollbarHeight());
+    // Scrollbars are placed "between" the border and the padding box and they never stretch the border box. They may shrink the padding box though.
+    auto horizontalSpaceReservedForScrollbar = std::min(replacedOrInlineBlock.width() - replacedOrInlineBlock.paddingBoxWidth(), LayoutUnit(replacedOrInlineBlock.verticalScrollbarWidth()));
+    replacedBoxGeometry.setVerticalScrollbarWidth(horizontalSpaceReservedForScrollbar);
 
+    auto verticalSpaceReservedForScrollbar = std::min(replacedOrInlineBlock.height() - replacedOrInlineBlock.paddingBoxHeight(), LayoutUnit(replacedOrInlineBlock.horizontalScrollbarHeight()));
+    replacedBoxGeometry.setHorizontalScrollbarHeight(verticalSpaceReservedForScrollbar);
+
     auto baseline = replacedOrInlineBlock.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
     replacedBox.setBaseline(roundToInt(baseline));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to