⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276135 in webkit


Ignore:
Timestamp:
Apr 16, 2021, 6:35:08 AM (5 years ago)
Author:
Alan Bujtas
Message:

[IFC] Incorrect box height when scrollbar takes padding box space
https://bugs.webkit.org/show_bug.cgi?id=224546
<rdar://problem/76666402>

Reviewed by Antti Koivisto.

Source/WebCore:

This patch fixes the case when a non-overlay scrollbar can't be accomodated in the padding/content box area (e.g <div style="height: 10px; overflow: scroll">...)
In the legacy render tree the non-overlay scrollbar size is already taken into account when calling RenderBox::contentWidth/Height (paddingBoxHeight/Width), so
we just have to check how much space they actully take (currently maximum of 15px).

Test: fast/inline-block/non-overlay-scrollbar-incorrect-padding.html

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):

LayoutTests:

  • fast/inline-block/non-overlay-scrollbar-incorrect-padding-expected.txt: Added.
  • fast/inline-block/non-overlay-scrollbar-incorrect-padding.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276134 r276135  
     12021-04-16  Zalan Bujtas  <zalan@apple.com>
     2
     3        [IFC] Incorrect box height when scrollbar takes padding box space
     4        https://bugs.webkit.org/show_bug.cgi?id=224546
     5        <rdar://problem/76666402>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/inline-block/non-overlay-scrollbar-incorrect-padding-expected.txt: Added.
     10        * fast/inline-block/non-overlay-scrollbar-incorrect-padding.html: Added.
     11
    1122021-04-16  Diego Pino Garcia  <dpino@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r276133 r276135  
     12021-04-16  Zalan Bujtas  <zalan@apple.com>
     2
     3        [IFC] Incorrect box height when scrollbar takes padding box space
     4        https://bugs.webkit.org/show_bug.cgi?id=224546
     5        <rdar://problem/76666402>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This patch fixes the case when a non-overlay scrollbar can't be accomodated in the padding/content box area (e.g <div style="height: 10px; overflow: scroll">...)
     10        In the legacy render tree the non-overlay scrollbar size is already taken into account when calling RenderBox::contentWidth/Height (paddingBoxHeight/Width), so
     11        we just have to check how much space they actully take (currently maximum of 15px).
     12
     13        Test: fast/inline-block/non-overlay-scrollbar-incorrect-padding.html
     14
     15        * layout/integration/LayoutIntegrationLineLayout.cpp:
     16        (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
     17
    1182021-04-16  Ryosuke Niwa  <rniwa@webkit.org>
    219
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r275214 r276135  
    146146    // Always use the physical size here for inline level boxes (this is where the logical vs. physical coords flip happens).
    147147    auto& replacedBoxGeometry = m_layoutState.ensureGeometryForBox(replacedBox);
    148     // Scrollbars are placed "between" the border and the padding box and they never stretch the border box. They may shrink the padding box though.
    149     auto horizontalSpaceReservedForScrollbar = std::min(replacedOrInlineBlock.width() - replacedOrInlineBlock.paddingBoxWidth(), LayoutUnit(replacedOrInlineBlock.verticalScrollbarWidth()));
     148
     149    // Scrollbars eat into the padding box area. They never stretch the border box but they may shrink the padding box.
     150    // In legacy render tree, RenderBox::contentWidth/contentHeight values are adjusted to accomodate the scrollbar width/height.
     151    // e.g. <div style="width: 10px; overflow: scroll;">content</div>, RenderBox::contentWidth() won't be returning the value of 10px but instead 0px (10px - 15px).
     152    auto horizontalSpaceReservedForScrollbar = replacedOrInlineBlock.paddingBoxRectIncludingScrollbar().width() - replacedOrInlineBlock.paddingBoxWidth();
    150153    replacedBoxGeometry.setHorizontalSpaceForScrollbar(horizontalSpaceReservedForScrollbar);
    151154
    152     auto verticalSpaceReservedForScrollbar = std::min(replacedOrInlineBlock.height() - replacedOrInlineBlock.paddingBoxHeight(), LayoutUnit(replacedOrInlineBlock.horizontalScrollbarHeight()));
     155    auto verticalSpaceReservedForScrollbar = replacedOrInlineBlock.paddingBoxRectIncludingScrollbar().height() - replacedOrInlineBlock.paddingBoxHeight();
    153156    replacedBoxGeometry.setVerticalSpaceForScrollbar(verticalSpaceReservedForScrollbar);
    154157
Note: See TracChangeset for help on using the changeset viewer.