Title: [274467] trunk
Revision
274467
Author
commit-qu...@webkit.org
Date
2021-03-15 23:55:48 -0700 (Mon, 15 Mar 2021)

Log Message

Fix table-element-001.html
https://bugs.webkit.org/show_bug.cgi?id=223063

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

Source/WebCore:

The aspect-ratio property should not apply to table boxes [1].
Tables themselves should respect the property.

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

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight const):
(WebCore::RenderBox::shouldIgnoreAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
* rendering/RenderBox.h:

LayoutTests:

Enable test that passes now.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274466 => 274467)


--- trunk/LayoutTests/ChangeLog	2021-03-16 05:55:19 UTC (rev 274466)
+++ trunk/LayoutTests/ChangeLog	2021-03-16 06:55:48 UTC (rev 274467)
@@ -1,3 +1,14 @@
+2021-03-15  Rob Buis  <rb...@igalia.com>
+
+        Fix table-element-001.html
+        https://bugs.webkit.org/show_bug.cgi?id=223063
+
+        Reviewed by Simon Fraser.
+
+        Enable test that passes now.
+
+        * TestExpectations:
+
 2021-03-15  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] WebPageProxy's EditorState may be stale until the next remote layer tree commit

Modified: trunk/LayoutTests/TestExpectations (274466 => 274467)


--- trunk/LayoutTests/TestExpectations	2021-03-16 05:55:19 UTC (rev 274466)
+++ trunk/LayoutTests/TestExpectations	2021-03-16 06:55:48 UTC (rev 274467)
@@ -4552,7 +4552,6 @@
 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-025.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-026.html [ ImageOnlyFailure ]
-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/table-element-001.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-001.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-002.html [ ImageOnlyFailure ]
 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-003.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (274466 => 274467)


--- trunk/Source/WebCore/ChangeLog	2021-03-16 05:55:19 UTC (rev 274466)
+++ trunk/Source/WebCore/ChangeLog	2021-03-16 06:55:48 UTC (rev 274467)
@@ -1,3 +1,22 @@
+2021-03-15  Rob Buis  <rb...@igalia.com>
+
+        Fix table-element-001.html
+        https://bugs.webkit.org/show_bug.cgi?id=223063
+
+        Reviewed by Simon Fraser.
+
+        The aspect-ratio property should not apply to table boxes [1].
+        Tables themselves should respect the property.
+
+        [1] https://drafts.csswg.org/css-sizing-4/#aspect-ratio
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeight const):
+        (WebCore::RenderBox::shouldIgnoreAspectRatio const):
+        (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
+        (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
+        * rendering/RenderBox.h:
+
 2021-03-15  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: Grid overlay does not adjust for element inside iframes

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (274466 => 274467)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-16 05:55:19 UTC (rev 274466)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-16 06:55:48 UTC (rev 274467)
@@ -2910,6 +2910,8 @@
 
         // For tables, calculate margins only.
         if (isTable()) {
+            if (shouldComputeLogicalHeightFromAspectRatio())
+                computedValues.m_extent = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalWidth());
             if (hasPerpendicularContainingBlock) {
                 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb.style(), &style());
                 computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), computedValues.m_extent,
@@ -5098,9 +5100,14 @@
     point.move(rect.x(), rect.y());
 }
 
+bool RenderBox::shouldIgnoreAspectRatio() const
+{
+    return !style().hasAspectRatio() || isTablePart();
+}
+
 bool RenderBox::shouldComputeLogicalHeightFromAspectRatio() const
 {
-    if (!style().hasAspectRatio())
+    if (shouldIgnoreAspectRatio())
         return false;
 
     if (shouldComputeLogicalWidthFromAspectRatioAndInsets())
@@ -5112,7 +5119,7 @@
 
 bool RenderBox::shouldComputeLogicalWidthFromAspectRatio() const
 {
-    if (!style().hasAspectRatio())
+    if (shouldIgnoreAspectRatio())
         return false;
 
     auto isResolvablePercentageHeight = [this] () {

Modified: trunk/Source/WebCore/rendering/RenderBox.h (274466 => 274467)


--- trunk/Source/WebCore/rendering/RenderBox.h	2021-03-16 05:55:19 UTC (rev 274466)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2021-03-16 06:55:48 UTC (rev 274467)
@@ -701,6 +701,7 @@
 
     void incrementVisuallyNonEmptyPixelCountIfNeeded(const IntSize&);
 
+    bool shouldIgnoreAspectRatio() const;
     bool shouldComputeLogicalWidthFromAspectRatio() const;
     bool shouldComputeLogicalWidthFromAspectRatioAndInsets() const;
     LayoutUnit computeLogicalWidthFromAspectRatio(RenderFragmentContainer* = nullptr) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to