Title: [284548] trunk
Revision
284548
Author
commit-qu...@webkit.org
Date
2021-10-20 10:35:18 -0700 (Wed, 20 Oct 2021)

Log Message

Fix percentages on orthogonal replaced children
https://bugs.webkit.org/show_bug.cgi?id=46496

Patch by Rob Buis <rb...@igalia.com> on 2021-10-20
Reviewed by Darin Adler.

Source/WebCore:

Modify computeReplacedLogicalWidthUsing to make it aware of the orthogonal flow case
when dealing with calc/percentages.

This patch also removes an outdated comment from computeReplacedLogicalHeightUsing.

Test: imported/w3c/web-platform-tests/wpt/css/css-writing-modes/sizing-percentages-replaced-orthogonal-001.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing const):

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284547 => 284548)


--- trunk/LayoutTests/ChangeLog	2021-10-20 17:30:32 UTC (rev 284547)
+++ trunk/LayoutTests/ChangeLog	2021-10-20 17:35:18 UTC (rev 284548)
@@ -1,3 +1,12 @@
+2021-10-20  Rob Buis  <rb...@igalia.com>
+
+        Fix percentages on orthogonal replaced children
+        https://bugs.webkit.org/show_bug.cgi?id=46496
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations:
+
 2021-10-20  Ayumi Kojima  <ayumi_koj...@apple.com>
 
         [ iOS ] imported/w3c/web-platform-tests/html/canvas/element/manual tests, fast/canvas/canvas-createPattern-video-modify.html and media/video-canvas-createPattern.html are failing.

Modified: trunk/LayoutTests/TestExpectations (284547 => 284548)


--- trunk/LayoutTests/TestExpectations	2021-10-20 17:30:32 UTC (rev 284547)
+++ trunk/LayoutTests/TestExpectations	2021-10-20 17:35:18 UTC (rev 284548)
@@ -4104,7 +4104,6 @@
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/sizing-orthogonal-percentage-margin-006.html [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/sizing-orthogonal-percentage-margin-007.html [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/sizing-orthogonal-percentage-margin-008.html [ ImageOnlyFailure ]
-webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/sizing-percentages-replaced-orthogonal-001.html [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/table-cell-001.html [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/table-cell-002.html [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/table-column-order-002.xht [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (284547 => 284548)


--- trunk/Source/WebCore/ChangeLog	2021-10-20 17:30:32 UTC (rev 284547)
+++ trunk/Source/WebCore/ChangeLog	2021-10-20 17:35:18 UTC (rev 284548)
@@ -1,3 +1,21 @@
+2021-10-20  Rob Buis  <rb...@igalia.com>
+
+        Fix percentages on orthogonal replaced children
+        https://bugs.webkit.org/show_bug.cgi?id=46496
+
+        Reviewed by Darin Adler.
+
+        Modify computeReplacedLogicalWidthUsing to make it aware of the orthogonal flow case
+        when dealing with calc/percentages.
+
+        This patch also removes an outdated comment from computeReplacedLogicalHeightUsing.
+
+        Test: imported/w3c/web-platform-tests/wpt/css/css-writing-modes/sizing-percentages-replaced-orthogonal-001.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
+
 2021-10-20  Ross Kirsling  <ross.kirsl...@sony.com>
 
         Mac CMake build should not need to include iOS headers

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (284547 => 284548)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-10-20 17:30:32 UTC (rev 284547)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-10-20 17:35:18 UTC (rev 284548)
@@ -3325,17 +3325,20 @@
     case LengthType::FillAvailable:
     case LengthType::Percent:
     case LengthType::Calculated: {
-        // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
-        // containing block's block-flow.
-        // https://bugs.webkit.org/show_bug.cgi?id=46496
-        const LayoutUnit cw = isOutOfFlowPositioned() ? containingBlockLogicalWidthForPositioned(downcast<RenderBoxModelObject>(*container())) : containingBlockLogicalWidthForContent();
+        LayoutUnit containerWidth;
+        if (isOutOfFlowPositioned())
+            containerWidth = containingBlockLogicalWidthForPositioned(downcast<RenderBoxModelObject>(*container()));
+        else if (isHorizontalWritingMode() == containingBlock()->isHorizontalWritingMode())
+            containerWidth = containingBlockLogicalWidthForContent();
+        else
+            containerWidth = perpendicularContainingBlockLogicalHeight();
         Length containerLogicalWidth = containingBlock()->style().logicalWidth();
         // FIXME: Handle cases when containing block width is calculated or viewport percent.
         // https://bugs.webkit.org/show_bug.cgi?id=91071
         if (logicalWidth.isIntrinsic())
-            return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
-        if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalculated())))
-            return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, cw), logicalWidth.type());
+            return computeIntrinsicLogicalWidthUsing(logicalWidth, containerWidth, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
+        if (containerWidth > 0 || (!containerWidth && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalculated())))
+            return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, containerWidth), logicalWidth.type());
         return 0_lu;
     }
     case LengthType::Intrinsic:
@@ -3472,9 +3475,6 @@
             return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, newContentHeight));
         }
         
-        // FIXME: availableLogicalHeight() is wrong if the replaced element's block-flow is perpendicular to the
-        // containing block's block-flow.
-        // https://bugs.webkit.org/show_bug.cgi?id=46496
         LayoutUnit availableHeight;
         if (isOutOfFlowPositioned())
             availableHeight = containingBlockLogicalHeightForPositioned(downcast<RenderBoxModelObject>(*container));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to