Title: [294996] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
Revision
294996
Author
za...@apple.com
Date
2022-05-28 06:21:48 -0700 (Sat, 28 May 2022)

Log Message

Use flex-basis when shrinking flex items
https://bugs.webkit.org/show_bug.cgi?id=241046

Reviewed by Antti Koivisto.

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

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

Modified Paths

Diff

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


--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:06:19 UTC (rev 294995)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:21:48 UTC (rev 294996)
@@ -226,8 +226,9 @@
         // don't participate in content flexing.
         for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
             auto& flexItem = logicalFlexItemList[index];
-            auto baseSize = flexItem.rect.width();
-            if (auto shrinkValue = flexItem.layoutBox->style().flexShrink()) {
+            auto& style = flexItem.layoutBox->style();
+            auto baseSize = style.flexBasis().isFixed() ? LayoutUnit { style.flexBasis().value() } : flexItem.rect.width();
+            if (auto shrinkValue = style.flexShrink()) {
                 auto flexShrink = shrinkValue * baseSize;
                 shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem, { } });
                 totalShrink += flexShrink;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to