Title: [272360] trunk
Revision
272360
Author
commit-qu...@webkit.org
Date
2021-02-03 23:59:45 -0800 (Wed, 03 Feb 2021)

Log Message

Handle aspect-ratio: auto m/n for replaced elements
https://bugs.webkit.org/show_bug.cgi?id=221323

Patch by Rob Buis <rb...@igalia.com> on 2021-02-03
Reviewed by Simon Fraser.

Source/WebCore:

In the aspect-ratio: auto m/n case, replaced elements with natural aspect ratio
should use that aspect-ratio instead of the provided aspect ratio [1].

[1] https://drafts.csswg.org/css-sizing-4/#ratios

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

LayoutTests:

replaced-element-030.html now passes.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272359 => 272360)


--- trunk/LayoutTests/ChangeLog	2021-02-04 06:00:10 UTC (rev 272359)
+++ trunk/LayoutTests/ChangeLog	2021-02-04 07:59:45 UTC (rev 272360)
@@ -1,3 +1,14 @@
+2021-02-03  Rob Buis  <rb...@igalia.com>
+
+        Handle aspect-ratio: auto m/n for replaced elements
+        https://bugs.webkit.org/show_bug.cgi?id=221323
+
+        Reviewed by Simon Fraser.
+
+        replaced-element-030.html now passes.
+
+        * TestExpectations:
+
 2021-02-03  Peng Liu  <peng.l...@apple.com>
 
         [MSE] Move the call to didParseInitializationDataCallback() from the beginning of a cluster to the end of "tracks" element

Modified: trunk/LayoutTests/TestExpectations (272359 => 272360)


--- trunk/LayoutTests/TestExpectations	2021-02-04 06:00:10 UTC (rev 272359)
+++ trunk/LayoutTests/TestExpectations	2021-02-04 07:59:45 UTC (rev 272360)
@@ -4448,7 +4448,6 @@
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-008.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-010.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-011.html [ ImageOnlyFailure ]
-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-030.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/table-element-001.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (272359 => 272360)


--- trunk/Source/WebCore/ChangeLog	2021-02-04 06:00:10 UTC (rev 272359)
+++ trunk/Source/WebCore/ChangeLog	2021-02-04 07:59:45 UTC (rev 272360)
@@ -1,3 +1,18 @@
+2021-02-03  Rob Buis  <rb...@igalia.com>
+
+        Handle aspect-ratio: auto m/n for replaced elements
+        https://bugs.webkit.org/show_bug.cgi?id=221323
+
+        Reviewed by Simon Fraser.
+
+        In the aspect-ratio: auto m/n case, replaced elements with natural aspect ratio
+        should use that aspect-ratio instead of the provided aspect ratio [1].
+
+        [1] https://drafts.csswg.org/css-sizing-4/#ratios
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalWidthInFragment const):
+
 2021-02-03  Peng Liu  <peng.l...@apple.com>
 
         [MSE] Move the call to didParseInitializationDataCallback() from the beginning of a cluster to the end of "tracks" element

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (272359 => 272360)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-02-04 06:00:10 UTC (rev 272359)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-02-04 07:59:45 UTC (rev 272360)
@@ -2548,10 +2548,10 @@
         containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
 
     // Width calculations
-    if (shouldComputeLogicalWidthFromAspectRatio() && style().logicalWidth().isAuto()) {
+    if (treatAsReplaced) {
+        computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
+    } else if (shouldComputeLogicalWidthFromAspectRatio() && style().logicalWidth().isAuto()) {
         computedValues.m_extent = computeLogicalWidthFromAspectRatio(fragment);
-    } else if (treatAsReplaced) {
-        computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
     } else {
         LayoutUnit preferredWidth = computeLogicalWidthInFragmentUsing(MainOrPreferredSize, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb, fragment);
         computedValues.m_extent = constrainLogicalWidthInFragmentByMinMax(preferredWidth, containerWidthInInlineDirection, cb, fragment);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to