Changeset 294233 in webkit


Ignore:
Timestamp:
May 16, 2022 8:08:11 AM (2 years ago)
Author:
Alan Bujtas
Message:

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

Reviewed by Antti Koivisto.

With "flex-direction: row-reverse" the main axis progression is from visual right to left (with default writing mode and all that).

  • layout/formattingContexts/flex/FlexFormattingContext.cpp:

(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r294231 r294233  
     12022-05-16  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][FFC] Add "flex-direction: row-reverse" basic visual/logical conversion
     4        https://bugs.webkit.org/show_bug.cgi?id=240432
     5
     6        Reviewed by Antti Koivisto.
     7
     8        With "flex-direction: row-reverse" the main axis progression is from visual right to left (with default writing mode and all that).
     9
     10        * layout/formattingContexts/flex/FlexFormattingContext.cpp:
     11        (WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
     12
    1132022-05-16  Alan Bujtas  <zalan@apple.com>
    214
  • trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp

    r294231 r294233  
    130130    Vector<FlexItemLogicalBox> logicalFlexItemList;
    131131
    132     auto logicalLeft = LayoutUnit { };
    133     auto logicalTop = LayoutUnit { };
    134132
    135133    auto convertVisualToLogical = [&] {
     
    137135        auto direction = root().style().flexDirection();
    138136
    139         logicalLeft = constraints.horizontal().logicalLeft;
    140         logicalTop = constraints.logicalTop();
    141 
    142137        for (auto& flexItem : childrenOfType<ContainerBox>(root())) {
    143138            auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
     
    146141            switch (direction) {
    147142            case FlexDirection::Row:
     143            case FlexDirection::RowReverse:
    148144                logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
    149145                break;
     
    151147                logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
    152148                break;
    153             case FlexDirection::RowReverse:
    154149            case FlexDirection::ColumnReverse:
    155150                ASSERT_NOT_IMPLEMENTED_YET();
     
    163158    };
    164159    convertVisualToLogical();
     160
     161    auto logicalLeft = LayoutUnit { };
     162    auto logicalTop = LayoutUnit { };
    165163
    166164    for (auto& logicalFlexItem : logicalFlexItemList) {
     
    178176            switch (direction) {
    179177            case FlexDirection::Row:
    180                 topLeft = logicalFlexItem.rect.topLeft();
    181                 break;
    182             case FlexDirection::Column:
    183                 topLeft = logicalFlexItem.rect.topLeft().transposedPoint();
     178                topLeft = { constraints.horizontal().logicalLeft + logicalFlexItem.rect.left(), constraints.logicalTop() + logicalFlexItem.rect.top() };
    184179                break;
    185180            case FlexDirection::RowReverse:
     181                topLeft = { constraints.horizontal().logicalRight() - logicalFlexItem.rect.right(), constraints.logicalTop() + logicalFlexItem.rect.top() };
     182                break;
     183            case FlexDirection::Column: {
     184                auto flippedTopLeft = logicalFlexItem.rect.topLeft().transposedPoint();
     185                topLeft = { constraints.horizontal().logicalLeft + flippedTopLeft.x(), constraints.logicalTop() + flippedTopLeft.y() };
     186                break;
     187            }
    186188            case FlexDirection::ColumnReverse:
    187189                ASSERT_NOT_IMPLEMENTED_YET();
Note: See TracChangeset for help on using the changeset viewer.