Title: [271223] trunk
Revision
271223
Author
[email protected]
Date
2021-01-06 22:11:14 -0800 (Wed, 06 Jan 2021)

Log Message

Fix aspect ratio handling in RenderBox::computeLogicalWidthInFragment
https://bugs.webkit.org/show_bug.cgi?id=220138

Patch by Rob Buis <[email protected]> on 2021-01-06
Reviewed by Simon Fraser.

Source/WebCore:

The existing code does not respect min/max-height in the logical height
calculation, the computeLogicalWidthFromAspectRatio helper does, so use
it.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInFragment const):

LayoutTests:

Enable some tests that pass now.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271222 => 271223)


--- trunk/LayoutTests/ChangeLog	2021-01-07 02:56:16 UTC (rev 271222)
+++ trunk/LayoutTests/ChangeLog	2021-01-07 06:11:14 UTC (rev 271223)
@@ -1,3 +1,14 @@
+2021-01-06  Rob Buis  <[email protected]>
+
+        Fix aspect ratio handling in RenderBox::computeLogicalWidthInFragment
+        https://bugs.webkit.org/show_bug.cgi?id=220138
+
+        Reviewed by Simon Fraser.
+
+        Enable some tests that pass now.
+
+        * TestExpectations:
+
 2021-01-06  Aditya Keerthi  <[email protected]>
 
         [macOS] Text inside form controls is off center on burton.com

Modified: trunk/LayoutTests/TestExpectations (271222 => 271223)


--- trunk/LayoutTests/TestExpectations	2021-01-07 02:56:16 UTC (rev 271222)
+++ trunk/LayoutTests/TestExpectations	2021-01-07 06:11:14 UTC (rev 271223)
@@ -4437,7 +4437,6 @@
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-021.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-023.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-024.html [ ImageOnlyFailure ]
-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-025.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-026.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-027.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-028.html [ ImageOnlyFailure ]
@@ -4448,7 +4447,6 @@
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-009.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-011.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-012.html [ ImageOnlyFailure ]
-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-013.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-014.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-015.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-016.html [ ImageOnlyFailure ]
@@ -4457,7 +4455,6 @@
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-019.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-021.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-022.html [ ImageOnlyFailure ]
-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-024.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-001.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-002.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-004.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (271222 => 271223)


--- trunk/Source/WebCore/ChangeLog	2021-01-07 02:56:16 UTC (rev 271222)
+++ trunk/Source/WebCore/ChangeLog	2021-01-07 06:11:14 UTC (rev 271223)
@@ -1,3 +1,17 @@
+2021-01-06  Rob Buis  <[email protected]>
+
+        Fix aspect ratio handling in RenderBox::computeLogicalWidthInFragment
+        https://bugs.webkit.org/show_bug.cgi?id=220138
+
+        Reviewed by Simon Fraser.
+
+        The existing code does not respect min/max-height in the logical height
+        calculation, the computeLogicalWidthFromAspectRatio helper does, so use
+        it.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalWidthInFragment const):
+
 2021-01-06  Fujii Hironori  <[email protected]>
 
         [GTK][CMake] Add a build switch USE_OPENGL_OR_ES to be able to disable OpenGL and ES

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (271222 => 271223)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-07 02:56:16 UTC (rev 271222)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-07 06:11:14 UTC (rev 271223)
@@ -2499,14 +2499,9 @@
     if (hasPerpendicularContainingBlock)
         containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
 
-    Optional<LayoutUnit> logicalHeight;
-    if (style().hasAspectRatio() && style().logicalWidth().isAuto() && (style().logicalHeight().isFixed() || style().logicalHeight().isPercentOrCalculated()))
-        logicalHeight = computeLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight(), { });
-
     // Width calculations
-    if (logicalHeight) {
-        LayoutUnit logicalWidth = inlineSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), style().logicalAspectRatio(), style().boxSizing(), *logicalHeight);
-        computedValues.m_extent = constrainLogicalWidthInFragmentByMinMax(logicalWidth, containerWidthInInlineDirection, cb, fragment);
+    if (shouldComputeLogicalWidthFromAspectRatio() && style().logicalWidth().isAuto()) {
+        computedValues.m_extent = computeLogicalWidthFromAspectRatio(fragment);
     } else if (treatAsReplaced) {
         computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to