Changeset 295081 in webkit


Ignore:
Timestamp:
May 31, 2022 10:27:39 PM (2 years ago)
Author:
Alan Bujtas
Message:

DOM order may not be sufficient when constructing the LogicalFlexItemList
https://bugs.webkit.org/show_bug.cgi?id=241166

Reviewed by Antti Koivisto.

We need to hold on to a reference to the layout box in case logical order != DOM order.

  • Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:

(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):

Canonical link: https://commits.webkit.org/251176@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp

    r295051 r295081  
    153153        FlexRect marginRect;
    154154        int logicalOrder { 0 };
     155        CheckedPtr<const ContainerBox> layoutBox;
    155156    };
    156157
     
    202203            previousLogicalOrder = flexItemOrder;
    203204
    204             flexItemList.append({ { logicalSize }, flexItemOrder });
     205            flexItemList.append({ { logicalSize }, flexItemOrder, downcast<ContainerBox>(flexItem) });
    205206        }
    206207    };
     
    218219
    219220    auto logicalFlexItemList = FlexLayout::LogicalFlexItems(flexItemList.size());
    220     auto* layoutBox = root().firstInFlowChild();
    221     for (size_t index = 0; index < flexItemList.size(); ++index) {
    222         logicalFlexItemList[index] = { flexItemList[index].marginRect, downcast<ContainerBox>(layoutBox) };
    223         layoutBox = layoutBox->nextInFlowSibling();
    224     }
     221    for (size_t index = 0; index < flexItemList.size(); ++index)
     222        logicalFlexItemList[index] = { flexItemList[index].marginRect, flexItemList[index].layoutBox };
    225223    return logicalFlexItemList;
    226224}
Note: See TracChangeset for help on using the changeset viewer.