Changeset 294231 in webkit


Ignore:
Timestamp:
May 16, 2022 6:16:41 AM (2 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r294229 r294231  
     12022-05-16  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=240430
     5
     6        Reviewed by Antti Koivisto.
     7
     8        With "flex-direction: column" the main axis progression is based on the margin box height.
     9
     10        * layout/formattingContexts/flex/FlexFormattingContext.cpp:
     11        (WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
     12
    1132022-05-15  Philippe Normand  <philn@igalia.com>
    214
  • trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp

    r294217 r294231  
    135135    auto convertVisualToLogical = [&] {
    136136        // FIXME: Convert visual (row/column) direction to logical.
     137        auto direction = root().style().flexDirection();
     138
    137139        logicalLeft = constraints.horizontal().logicalLeft;
    138140        logicalTop = constraints.logicalTop();
    139    
     141
    140142        for (auto& flexItem : childrenOfType<ContainerBox>(root())) {
    141143            auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
    142             logicalFlexItemList.append({ { LayoutSize { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() } }, flexItem });
     144            auto logicalSize = LayoutSize { };
     145
     146            switch (direction) {
     147            case FlexDirection::Row:
     148                logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
     149                break;
     150            case FlexDirection::Column:
     151                logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
     152                break;
     153            case FlexDirection::RowReverse:
     154            case FlexDirection::ColumnReverse:
     155                ASSERT_NOT_IMPLEMENTED_YET();
     156                break;
     157            default:
     158                ASSERT_NOT_REACHED();
     159                break;
     160            }
     161            logicalFlexItemList.append({ { logicalSize }, flexItem });
    143162        }
    144163    };
     
    152171    auto convertLogicalToVisual = [&] {
    153172        // FIXME: Convert logical coordinates to visual.
     173        auto direction = root().style().flexDirection();
    154174        for (auto& logicalFlexItem : logicalFlexItemList) {
    155175            auto& flexItemGeometry = formattingState.boxGeometry(logicalFlexItem.flexItem);
    156             flexItemGeometry.setLogicalTopLeft(logicalFlexItem.rect.topLeft());
     176            auto topLeft = LayoutPoint { };
     177
     178            switch (direction) {
     179            case FlexDirection::Row:
     180                topLeft = logicalFlexItem.rect.topLeft();
     181                break;
     182            case FlexDirection::Column:
     183                topLeft = logicalFlexItem.rect.topLeft().transposedPoint();
     184                break;
     185            case FlexDirection::RowReverse:
     186            case FlexDirection::ColumnReverse:
     187                ASSERT_NOT_IMPLEMENTED_YET();
     188                break;
     189            default:
     190                ASSERT_NOT_REACHED();
     191                break;
     192            }
     193            flexItemGeometry.setLogicalTopLeft(topLeft);
    157194        }
    158195    };
Note: See TracChangeset for help on using the changeset viewer.