Title: [286952] trunk
Revision
286952
Author
svil...@igalia.com
Date
2021-12-13 09:19:12 -0800 (Mon, 13 Dec 2021)

Log Message

[css-writing-modes] Use the correct margins in computeInlinePreferredLogicalWidths in orthogonal flows
https://bugs.webkit.org/show_bug.cgi?id=233562
<rdar://problem/86105904>

Reviewed by Rob Buis.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html: Added.
* web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html: Added.

Source/WebCore:

In order to compute the preferred logical width of an inline element we must compute the preferred widths of
its children. More precisely we should compute the intrinsic size of the children in the inline direction of the
inline element. For parallel flows this means indeed computing the preferred logical width. Translated to
the margins, we should compute the margin-start and margin-end of each child.

However for orthogonal writing modes we should not use the margin-start & margin-end but margin-after and
margin-before. That's why in order to support orthogonal flows we should replace marginStart() usage by
marginStartUsing(parentStyle) (same for marginEnd).

Test: imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):

LayoutTests:

* TestExpectations: Unksipped a flexbox test that is now passing.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286951 => 286952)


--- trunk/LayoutTests/ChangeLog	2021-12-13 17:04:02 UTC (rev 286951)
+++ trunk/LayoutTests/ChangeLog	2021-12-13 17:19:12 UTC (rev 286952)
@@ -1,3 +1,13 @@
+2021-12-13  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-writing-modes] Use the correct margins in computeInlinePreferredLogicalWidths in orthogonal flows
+        https://bugs.webkit.org/show_bug.cgi?id=233562
+        <rdar://problem/86105904>
+
+        Reviewed by Rob Buis.
+
+        * TestExpectations: Unksipped a flexbox test that is now passing.
+
 2021-12-13  Antti Koivisto  <an...@apple.com>
 
         [CSS Cascade Layers] Unflake and fix web-platform-tests/css/css-cascade/layer-statement-before-import.html

Modified: trunk/LayoutTests/TestExpectations (286951 => 286952)


--- trunk/LayoutTests/TestExpectations	2021-12-13 17:04:02 UTC (rev 286951)
+++ trunk/LayoutTests/TestExpectations	2021-12-13 17:19:12 UTC (rev 286952)
@@ -4247,9 +4247,6 @@
 # SVGs as flex items.
 webkit.org/b/221474 imported/w3c/web-platform-tests/css/css-flexbox/svg-root-as-flex-item-002.html [ ImageOnlyFailure ]
 
-# The test works fine but the expected result fails due to a missing layout.
-webkit.org/b/221468 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-horiz-002.xhtml [ ImageOnlyFailure ]
-
 # align baseline in flexbox.
 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/baseline-synthesis-001.html [ ImageOnlyFailure ]
 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-baseline-horiz-001a.xhtml [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286951 => 286952)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-13 17:04:02 UTC (rev 286951)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-13 17:19:12 UTC (rev 286952)
@@ -1,3 +1,14 @@
+2021-12-13  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-writing-modes] Use the correct margins in computeInlinePreferredLogicalWidths in orthogonal flows
+        https://bugs.webkit.org/show_bug.cgi?id=233562
+        <rdar://problem/86105904>
+
+        Reviewed by Rob Buis.
+
+        * web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html: Added.
+        * web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html: Added.
+
 2021-12-13  Antti Koivisto  <an...@apple.com>
 
         [CSS Cascade Layers] Unflake and fix web-platform-tests/css/css-cascade/layer-statement-before-import.html

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html (0 => 286952)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html	2021-12-13 17:19:12 UTC (rev 286952)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<link rel="author" title="Sergio Villar Senin" href=""
+<link rel="help" href=""
+  title="3.1 Block Flow Direction: the writing-mode property">
+<style>
+.container {
+  border: 1px dashed blue;
+  height: 200px;
+  width: 560px;
+  box-sizing: content-box;
+}
+.container > div {
+  float: left;
+  width: 40px;
+  margin:       10px 20px 30px 40px;
+  border-width: 20px 30px 40px 50px;
+  padding:      30px 40px 50px 60px;
+  border-style: dotted;
+}
+.container > div:nth-child(1) { background: yellow; }
+.container > div:nth-child(2) { background: purple; }
+
+</style>
+
+<div class="container">
+  <div></div>
+  <div style="writing-mode: vertical-lr;"></div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html (0 => 286952)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html	2021-12-13 17:19:12 UTC (rev 286952)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<link rel="author" title="Sergio Villar Senin" href=""
+<link rel="help" href=""
+  title="3.1 Block Flow Direction: the writing-mode property">
+<link rel="match" href=""
+ <style>
+.container {
+  border: 1px dashed blue;
+  height: 200px;
+  display: inline-block;
+}
+.container > div {
+  float: left;
+  width: 40px;
+  margin:       10px 20px 30px 40px;
+  border-width: 20px 30px 40px 50px;
+  padding:      30px 40px 50px 60px;
+  border-style: dotted;
+}
+.container > div:nth-child(1) { background: yellow; }
+.container > div:nth-child(2) { background: purple; }
+
+</style>
+
+<div class="container">
+  <div></div>
+  <div style="writing-mode: vertical-lr;"></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (286951 => 286952)


--- trunk/Source/WebCore/ChangeLog	2021-12-13 17:04:02 UTC (rev 286951)
+++ trunk/Source/WebCore/ChangeLog	2021-12-13 17:19:12 UTC (rev 286952)
@@ -1,3 +1,25 @@
+2021-12-13  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-writing-modes] Use the correct margins in computeInlinePreferredLogicalWidths in orthogonal flows
+        https://bugs.webkit.org/show_bug.cgi?id=233562
+        <rdar://problem/86105904>
+
+        Reviewed by Rob Buis.
+
+        In order to compute the preferred logical width of an inline element we must compute the preferred widths of
+        its children. More precisely we should compute the intrinsic size of the children in the inline direction of the
+        inline element. For parallel flows this means indeed computing the preferred logical width. Translated to
+        the margins, we should compute the margin-start and margin-end of each child.
+
+        However for orthogonal writing modes we should not use the margin-start & margin-end but margin-after and
+        margin-before. That's why in order to support orthogonal flows we should replace marginStart() usage by
+        marginStartUsing(parentStyle) (same for marginEnd).
+
+        Test: imported/w3c/web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
+
 2021-12-13  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Non-bidi content with RTL inline base direction may need visual reordering

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (286951 => 286952)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-12-13 17:04:02 UTC (rev 286951)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-12-13 17:19:12 UTC (rev 286952)
@@ -4339,8 +4339,8 @@
                     if (!child->isFloating())
                         lastText = nullptr;
                     LayoutUnit margins;
-                    Length startMargin = childStyle.marginStart();
-                    Length endMargin = childStyle.marginEnd();
+                    Length startMargin = childStyle.marginStartUsing(&style());
+                    Length endMargin = childStyle.marginEndUsing(&style());
                     if (startMargin.isFixed())
                         margins += LayoutUnit::fromFloatCeil(startMargin.value());
                     if (endMargin.isFixed())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to