Title: [294231] trunk/Source/WebCore
Revision
294231
Author
za...@apple.com
Date
2022-05-16 06:16:41 -0700 (Mon, 16 May 2022)

Log Message

[LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
https://bugs.webkit.org/show_bug.cgi?id=240430

Reviewed by Antti Koivisto.

With "flex-direction: column" the main axis progression is based on the margin box height.

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (294230 => 294231)


--- trunk/Source/WebCore/ChangeLog	2022-05-16 12:54:14 UTC (rev 294230)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 13:16:41 UTC (rev 294231)
@@ -1,3 +1,15 @@
+2022-05-16  Alan Bujtas  <za...@apple.com>
+
+        [LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
+        https://bugs.webkit.org/show_bug.cgi?id=240430
+
+        Reviewed by Antti Koivisto.
+
+        With "flex-direction: column" the main axis progression is based on the margin box height.
+
+        * layout/formattingContexts/flex/FlexFormattingContext.cpp:
+        (WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
 2022-05-15  Philippe Normand  <ph...@igalia.com>
 
         REGRESSION(r294104): [GStreamer] getUserMedia broken

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294230 => 294231)


--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 12:54:14 UTC (rev 294230)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 13:16:41 UTC (rev 294231)
@@ -134,12 +134,31 @@
 
     auto convertVisualToLogical = [&] {
         // FIXME: Convert visual (row/column) direction to logical.
+        auto direction = root().style().flexDirection();
+
         logicalLeft = constraints.horizontal().logicalLeft;
         logicalTop = constraints.logicalTop();
-    
+
         for (auto& flexItem : childrenOfType<ContainerBox>(root())) {
             auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
-            logicalFlexItemList.append({ { LayoutSize { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() } }, flexItem });
+            auto logicalSize = LayoutSize { };
+
+            switch (direction) {
+            case FlexDirection::Row:
+                logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
+                break;
+            case FlexDirection::Column:
+                logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
+                break;
+            case FlexDirection::RowReverse:
+            case FlexDirection::ColumnReverse:
+                ASSERT_NOT_IMPLEMENTED_YET();
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+                break;
+            }
+            logicalFlexItemList.append({ { logicalSize }, flexItem });
         }
     };
     convertVisualToLogical();
@@ -151,9 +170,27 @@
 
     auto convertLogicalToVisual = [&] {
         // FIXME: Convert logical coordinates to visual.
+        auto direction = root().style().flexDirection();
         for (auto& logicalFlexItem : logicalFlexItemList) {
             auto& flexItemGeometry = formattingState.boxGeometry(logicalFlexItem.flexItem);
-            flexItemGeometry.setLogicalTopLeft(logicalFlexItem.rect.topLeft());
+            auto topLeft = LayoutPoint { };
+
+            switch (direction) {
+            case FlexDirection::Row:
+                topLeft = logicalFlexItem.rect.topLeft();
+                break;
+            case FlexDirection::Column:
+                topLeft = logicalFlexItem.rect.topLeft().transposedPoint();
+                break;
+            case FlexDirection::RowReverse:
+            case FlexDirection::ColumnReverse:
+                ASSERT_NOT_IMPLEMENTED_YET();
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+                break;
+            }
+            flexItemGeometry.setLogicalTopLeft(topLeft);
         }
     };
     convertLogicalToVisual();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to