Changeset 294755 in webkit
- Timestamp:
- May 24, 2022 12:12:38 PM (2 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
r294638 r294755 207 207 void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints) 208 208 { 209 auto& formattingState = this->formattingState(); 209 210 auto logicalFlexItemList = convertFlexItemsToLogicalSpace(); 210 211 … … 214 215 for (auto& logicalFlexItem : logicalFlexItemList) { 215 216 totalGrowth += logicalFlexItem.layoutBox->style().flexGrow(); 216 // FIXME: Use min/max here. 217 totalFixedSpace += logicalFlexItem.rect.width(); 217 totalFixedSpace += formattingState.intrinsicWidthConstraintsForBox(*logicalFlexItem.layoutBox)->minimum; 218 218 } 219 219 … … 238 238 // rest of the flex items in the flex container when positive free space is distributed. 239 239 ASSERT(availableSpace.has_value()); 240 logicalFlexItem.rect.setWidth(LayoutUnit { *availableSpace * grow / totalGrowth }); 240 // FIXME: This is still slighly incorrect. 241 logicalFlexItem.rect.setWidth(LayoutUnit { formattingState.intrinsicWidthConstraintsForBox(*logicalFlexItem.layoutBox)->minimum + (flexibleSpace * grow / totalGrowth) }); 241 242 // FIXME: constrain logical width on min width. 242 243 }; -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
r294638 r294755 35 35 #include "HitTestResult.h" 36 36 #include "LayoutBoxGeometry.h" 37 #include "LayoutChildIterator.h" 37 38 #include "RenderFlexibleBox.h" 38 39 … … 76 77 void FlexLayout::updateFormattingRootGeometryAndInvalidate() 77 78 { 78 auto& flexBoxRenderer = this->flexBoxRenderer(); 79 auto updateGeometry = [&](auto& root) { 80 auto& flexBoxRenderer = this->flexBoxRenderer(); 79 81 80 auto updateGeometry = [&](auto& root) {81 82 auto isLeftToRightInlineDirection = flexBoxRenderer.style().isLeftToRightDirection(); 82 83 auto writingMode = flexBoxRenderer.style().writingMode(); … … 88 89 root.setVerticalMargin({ }); 89 90 }; 90 return updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox())); 91 updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox())); 92 93 for (auto& flexItem : Layout::childrenOfType<Layout::Box>(rootLayoutBox())) 94 m_flexFormattingState.clearIntrinsicWidthConstraints(flexItem); 91 95 } 92 96 93 void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem )97 void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem, LayoutUnit minimumContentSize, LayoutUnit maximumContentSize) 94 98 { 95 auto& boxGeometry = m_layoutState.ensureGeometryForBox(m_boxTree.layoutBoxForRenderer(flexItem)); 99 auto& layoutBox = m_boxTree.layoutBoxForRenderer(flexItem); 100 auto& boxGeometry = m_layoutState.ensureGeometryForBox(layoutBox); 96 101 97 102 boxGeometry.setContentBoxWidth(flexItem.contentWidth()); … … 101 106 boxGeometry.setBorder({ { flexItem.borderLeft(), flexItem.borderRight() }, { flexItem.borderTop(), flexItem.borderBottom() } }); 102 107 boxGeometry.setPadding(Layout::Edges { { flexItem.paddingLeft(), flexItem.paddingRight() }, { flexItem.paddingTop(), flexItem.paddingBottom() } }); 108 109 // FIXME: We may need to differentiate preferred and min/max content size. 110 m_flexFormattingState.setIntrinsicWidthConstraintsForBox(layoutBox, { minimumContentSize, maximumContentSize }); 103 111 } 104 112 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
r294193 r294755 52 52 53 53 void updateFormattingRootGeometryAndInvalidate(); 54 void updateFlexItemDimensions(const RenderBlock& );54 void updateFlexItemDimensions(const RenderBlock& flexItem, LayoutUnit minimumContentSize, LayoutUnit maximumContentSize); 55 55 void updateStyle(const RenderBlock&, const RenderStyle& oldStyle); 56 56 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r294744 r294755 2357 2357 for (auto& flexItem : childrenOfType<RenderBlock>(*this)) { 2358 2358 flexItem.layoutIfNeeded(); 2359 m_flexLayout->updateFlexItemDimensions(flexItem); 2359 auto minMaxContentSize = computeFlexItemMinMaxSizes(flexItem); 2360 m_flexLayout->updateFlexItemDimensions(flexItem, minMaxContentSize.first, minMaxContentSize.second); 2360 2361 } 2361 2362 m_flexLayout->layout();
Note: See TracChangeset
for help on using the changeset viewer.