Changeset 276745 in webkit


Ignore:
Timestamp:
Apr 28, 2021 6:00:26 PM (15 months ago)
Author:
commit-queue@webkit.org
Message:

[aspect-ratio] Treat border/padding correctly for box-sizing: border-box
https://bugs.webkit.org/show_bug.cgi?id=225015

Patch by Rob Buis <rbuis@igalia.com> on 2021-04-28
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Import WPT test for this.

  • web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035-expected.xht: Added.
  • web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035.html: Added.

Source/WebCore:

When computing logical height in aspect-ratio case, to compute the automatic
minimum size [1] for min-height: auto, the padding was always subtracted,
however it should only be subtracted in the box-sizing: content-box case.

Test: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035.html

[1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalHeight const):

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r276728 r276745  
     12021-04-28  Rob Buis  <rbuis@igalia.com>
     2
     3        [aspect-ratio] Treat border/padding correctly for box-sizing: border-box
     4        https://bugs.webkit.org/show_bug.cgi?id=225015
     5
     6        Reviewed by Darin Adler.
     7
     8        Import WPT test for this.
     9
     10        * web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035-expected.xht: Added.
     11        * web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035.html: Added.
     12
    1132021-04-28  Ziran Sun  <zsun@igalia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r276744 r276745  
     12021-04-28  Rob Buis  <rbuis@igalia.com>
     2
     3        [aspect-ratio] Treat border/padding correctly for box-sizing: border-box
     4        https://bugs.webkit.org/show_bug.cgi?id=225015
     5
     6        Reviewed by Darin Adler.
     7
     8        When computing logical height in aspect-ratio case, to compute the automatic
     9        minimum size [1] for min-height: auto, the padding was always subtracted,
     10        however it should only be subtracted in the box-sizing: content-box case.
     11
     12        Test: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035.html
     13
     14        [1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum
     15
     16        * rendering/RenderBox.cpp:
     17        (WebCore::RenderBox::computeLogicalHeight const):
     18
    1192021-04-28  Devin Rousso  <drousso@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r276718 r276745  
    29432943            Optional<LayoutUnit> intrinsicHeight;
    29442944            if (computedValues.m_extent != LayoutUnit::max())
    2945                 intrinsicHeight = computedValues.m_extent - borderAndPaddingLogicalHeight();
    2946             if (shouldComputeLogicalHeightFromAspectRatio())
     2945                intrinsicHeight = computedValues.m_extent;
     2946            if (shouldComputeLogicalHeightFromAspectRatio()) {
     2947                if (intrinsicHeight && style().boxSizingForAspectRatio() == BoxSizing::ContentBox)
     2948                    *intrinsicHeight -= borderAndPaddingLogicalHeight();
    29472949                heightResult = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalWidth());
    2948             else
     2950            } else {
     2951                if (intrinsicHeight)
     2952                    *intrinsicHeight -= borderAndPaddingLogicalHeight();
    29492953                heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);
     2954            }
    29502955            heightResult = constrainLogicalHeightByMinMax(heightResult, intrinsicHeight);
    29512956        } else {
Note: See TracChangeset for help on using the changeset viewer.