Changeset 269717 in webkit


Ignore:
Timestamp:
Nov 11, 2020 10:24:45 PM (21 months ago)
Author:
commit-queue@webkit.org
Message:

[css-grid] Percentage height on replaced item with scrollbar
https://bugs.webkit.org/show_bug.cgi?id=191462

Patch by Ziran Sun <Ziran Sun> on 2020-11-11
Reviewed by Manuel Rego Casasnovas.

This CL is to subtract scrollbar in computeReplacedLogicalHeightUsing().
In RenderBox::computeReplacedLogicalHeightUsing() we should also subtract
scrollbarLogicalHeight() when calculating stretchHeight. Without this subtraction,
it caused issues to resolve the percentage heights on grid item replaced children,
if the grid item has a scrollbar.

It ports the changes from the following patch at Chromium:
https://bugs.chromium.org/p/chromium/issues/detail?id=837141
Test files were already ported in WPT at
https://github.com/web-platform-tests/wpt/commit/538eedafb15733c6113b44998170a6bbdae7518b

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeReplacedLogicalHeightUsing const):

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/TestExpectations

    r269712 r269717  
    11871187webkit.org/b/216145 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-no-aspect-ratio-stretch-10.html [ ImageOnlyFailure ]
    11881188webkit.org/b/191461 imported/w3c/web-platform-tests/css/css-grid/grid-items/percentage-size-subitems-001.html [ ImageOnlyFailure ]
    1189 webkit.org/b/191462 imported/w3c/web-platform-tests/css/css-grid/grid-items/percentage-size-replaced-subitems-001.html [ ImageOnlyFailure ]
    11901189webkit.org/b/191463 imported/w3c/web-platform-tests/css/css-grid/grid-items/explicitly-sized-grid-item-as-table.html [ ImageOnlyFailure ]
    11911190webkit.org/b/191627 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-001.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r269716 r269717  
     12020-11-11  Ziran Sun  <zsun@igalia.com>
     2
     3        [css-grid] Percentage height on replaced item with scrollbar
     4        https://bugs.webkit.org/show_bug.cgi?id=191462
     5       
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        This CL is to subtract scrollbar in computeReplacedLogicalHeightUsing().
     9        In RenderBox::computeReplacedLogicalHeightUsing() we should also subtract
     10        scrollbarLogicalHeight() when calculating stretchHeight. Without this subtraction,
     11        it caused issues to resolve the percentage heights on grid item replaced children,
     12        if the grid item has a scrollbar.
     13       
     14        It ports the changes from the following patch at Chromium:
     15        https://bugs.chromium.org/p/chromium/issues/detail?id=837141
     16        Test files were already ported in WPT at
     17        https://github.com/web-platform-tests/wpt/commit/538eedafb15733c6113b44998170a6bbdae7518b
     18       
     19        * rendering/RenderBox.cpp:
     20        (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
     21
    1222020-11-11  Said Abou-Hallawa  <said@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r269693 r269717  
    31923192                container = container->containingBlock();
    31933193            }
     3194            bool hasPerpendicularContainingBlock = container->isHorizontalWritingMode() != isHorizontalWritingMode();
    31943195            Optional<LayoutUnit> stretchedHeight;
    31953196            if (is<RenderBlock>(container)) {
     
    31983199                if (block->isFlexItem())
    31993200                    stretchedHeight = downcast<RenderFlexibleBox>(block->parent())->childLogicalHeightForPercentageResolution(*block);
    3200                 else if (block->isGridItem() && block->hasOverridingLogicalHeight())
    3201                     stretchedHeight = block->overridingLogicalHeight() - block->borderAndPaddingLogicalHeight();
     3201                else if (block->isGridItem() && block->hasOverridingLogicalHeight() && !hasPerpendicularContainingBlock)
     3202                    stretchedHeight = block->overridingContentLogicalHeight();
    32023203            }
    32033204
     
    32233224                availableHeight = stretchedHeight.value();
    32243225            else {
    3225                 availableHeight = containingBlockLogicalHeightForContent(IncludeMarginBorderPadding);
     3226                availableHeight = hasPerpendicularContainingBlock ? containingBlockLogicalWidthForContent() : containingBlockLogicalHeightForContent(IncludeMarginBorderPadding);
    32263227                // It is necessary to use the border-box to match WinIE's broken
    32273228                // box model.  This is essential for sizing inside
Note: See TracChangeset for help on using the changeset viewer.